Page 1 of 1

No DHCP hostname provided for wlan0

Posted: Sun Sep 16, 2018 3:33 pm
by Shdwdrgn
I have a Pi3 with raspbian stretch installed. I noticed that when I plug into ethernet, the Pi's hostname is broadcast to DHCP on the local network allowing me to ping the system by name. However when I plug in a wifi dongle (which obtains DHCP from the same network server) no hostname is provided. Is there something that needs to be added to dhcpcd.conf so that the Pi's hostname is broadcast no matter how I connect to the local network?

Re: No DHCP hostname provided for wlan0

Posted: Sun Sep 16, 2018 4:36 pm
by HawaiianPi
Shdwdrgn wrote:
Sun Sep 16, 2018 3:33 pm
I have a Pi3 with raspbian stretch installed. ... However when I plug in a wifi dongle
Why would you need a WiFi dongle with the Pi3? And if you are using a WiFi dongle, it's likely wlan1 (since the built-in WiFi would be wlan0).

We'll need more details about your setup and what you are trying to accomplish to help.

Re: No DHCP hostname provided for wlan0

Posted: Sun Sep 16, 2018 5:29 pm
by DirkS
Is the hostname in the form of hostname.local by any chance? That name has nothing to do with DHCP. It's avahi (mDNS) that broadcasts the .local name / ip address.

Re: No DHCP hostname provided for wlan0

Posted: Sun Sep 16, 2018 5:40 pm
by Shdwdrgn
I'm using the internal wifi (renamed to ap0) as an access point via hostapd and dnsmasq, while the USB dongle and eth0 are meant to connect to available networks and provide a feed-through to the internet when possible. Wlan0 and eth0 do not have any special settings in dhcpcd.conf. The local network here at home also used dnsmasq on my firewall, so I can watch the logs and see all the information that is broadcast with a DHCP request is made.

And no, it wasn't avahi. I was just reading a little about that service this morning since it seemed to indicate this service would broadcast my hostname, however I get the feeling that is something that has to be set up across the whole network, and it seemed like a rabbit-hole that didn't lead to the solution I wanted, so I left it alone.

Ah I think I just figured out the problem though. There is a line in dhcpcd.conf to provide the hostname over DDNS. For some reason I thought "hostname" was supposed to be replaced by the actual hostname, but apparently the line should actually read "hostname <your_hostname>". After a restart it is broadcasting the name via dhcp and I can ping the Pi by name now. The rest of the setup is still working as expected so I think that solved my problem. Thanks for the replies.