OpenWrt Not Providing Hostname

I currently have two device running OpenWRT. The first one is acting as a wireless AP. The second device is in client mode and connected to first devices wireless network. For some reason the client device is not providing it's hostname. All I see is in LUCI is a question mark. If I connect other non-openwrt devices (laptop and phone) to the AP, the hostnames shows up. I can't figure out why the OpenWRT install on the client device is not providing it's hostname.

Thanks in advance!

If the second OpenWrt box isn't a DHCP client of the first, you're not going to have an entry for it unless you add it yourself to either DNS or a MAC database of some sort.

/etc/ethers is one way to have it show up with "any" hostname you want on the machine that you enter the host's MAC address and hostname.

Thanks for the reply,

The second box has been configured to be in "client mode." Shouldn't it provide it's hostname to the first box when requesting an IP address?

Does it actually make a DHCP request or it is configured with a static address?

Hostnames, both reporting to using when suggested by a DHCP server are completely optional. There's good security reasons not to trust a client, though it is convenient when a benign client announces themselves in a way that is easily recognized by a human.

1 Like

The first box's dhcp server is set to dynamic assignment. I haven't configured any static IP addresses.

Have you removed the static LAN address configuration from the client mode openwrt device????

The client device is not configured with a static LAN. Another question that came to mind, all the client devices on the network will be controlled. I had orginally planned to reference them by there hostname, which was going to be a unique ID assigned to that device. Do you think it would be better to use their MAC addresses as UIDs? I'm thinking that might be more reliable.

You have to specify a hostname in the network config. It does not automatically use the system hostname.

/etc/config/network

config interface lan
   option proto dhcp
   option hostname 'OpenWrt-37cf'
   ...

You could use part of the MAC address as the hostname. It may be more logical to use the router's model number and / or physical location.

1 Like

That did it! Thanks a bunch! I did not realize the hostname had to be set on the LAN interface as well.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.