"Active DHCP Leases" page shows "wrong" hostname

Hi. I have APs configured with subnets and VLANs, with their network interfaces configured as DHCP clients, and with the router configured with static leases. The problem is that the router "Active DHCP Leases" UI seems to show the "wrong" DNS hostname for the AP.

Details:

I have some APs configured with bridge and 802.1q devices, where the interface is configured as a DHCP client, sending along a hostname specific to that interface (a VLAN):

config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config interface 'lan'
	option device 'br-lan'
	option proto 'dhcp'
	option metric '10'

config interface 'lan1'
	option device 'br-lan1'
	option proto 'dhcp'
	option metric '11'
	option hostname 'livap11'

config interface 'lan2'
	option device 'br-lan2'
	option proto 'dhcp'
	option metric '12'
	option hostname 'livap12'

config interface 'lan3'
	option device 'br-lan3'
	option proto 'dhcp'
	option metric '13'
	option hostname 'livap13'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'lan1'
	list ports 'lan2'
	list ports 'wan'

config device
	option name 'br-lan1'
	option type 'bridge'
	list ports 'br-lan.3'

config device
	option name 'br-lan2'
	option type 'bridge'
	list ports 'br-lan.4'
	list ports 'lan3'
	list ports 'lan4'

config device
	option name 'br-lan3'
	option type 'bridge'
	list ports 'br-lan.5'

config device
	option name 'br-lan.3'
	option type '8021q'
	option ifname 'br-lan'
	option vid '3'

config device
	option name 'br-lan.4'
	option type '8021q'
	option ifname 'br-lan'
	option vid '4'

config device
	option name 'br-lan.5'
	option type '8021q'
	option ifname 'br-lan'
	option vid '5'

The router is configured with static leases for the AP's interfaces:

config dhcp 'lan'
	option interface 'lan'
	option leasetime '1h'
	option start '100'
	option limit '150'
	list dhcp_option 'option:domain-search,mydomain'
	list dhcp_option 'option:dns-server,192.168.10.1'
	list dhcp_option 'option:ntp-server,0.0.0.0'

config dhcp 'lan1'
	option interface 'lan1'
	option leasetime '1h'
	option start '100'
	option limit '150'
	list dhcp_option 'option:domain-search,mydomain'
	list dhcp_option 'option:dns-server,192.168.10.1'
	list dhcp_option 'option:ntp-server,0.0.0.0'

config dhcp 'lan2'
	option interface 'lan2'
	option leasetime '1h'
	option start '100'
	option limit '150'
	list dhcp_option 'option:domain-search,mydomain'
	list dhcp_option 'option:dns-server,192.168.10.1'
	list dhcp_option 'option:ntp-server,0.0.0.0'

config dhcp 'lan3'
	option interface 'lan3'
	option leasetime '1h'
	option start '100'
	option limit '150'
	list dhcp_option 'option:domain-search,mydomain'
	list dhcp_option 'option:dns-server,192.168.10.1'
	list dhcp_option 'option:ntp-server,0.0.0.0'

config host
	option mac 'AA:BB:CC:DD:EE:FF'
	option name 'livap'
	option dns '1'
	option ip '192.168.10.7'
	option leasetime '4h'

config host
	option mac 'AA:BB:CC:DD:EE:FF'
	option name 'livap11'
	option dns '1'
	option ip '192.168.11.7'
	option leasetime '4h'

config host
	option mac 'AA:BB:CC:DD:EE:FF'
	option name 'livap12'
	option dns '1'
	option ip '192.168.12.7'
	option leasetime '4h'

config host
	option mac 'AA:BB:CC:DD:EE:FF'
	option name 'livap13'
	option dns '1'
	option ip '192.168.13.7'
	option leasetime '4h'

This seems to be working; I can resolve names and addresses forwards and backwards for the different AP interfaces.

The problem I am trying to solve is that the router's "Active DHCP Leases" page shows the "wrong" hostname (the hostname supplied by the AP on that interface is correct, but the UI is showing the DNS name for a different interface on that AP, presumably getting confused by the same MAC address on all interfaces):

livap11 (livap13.mydomain)	192.168.11.7	AA:BB:CC:DD:EE:FF	3h 6m 15s

I have tried:

  • Changing the DHCP configuration to only assign a hostname for the "primary" IP address, and using DHCP domains to assign hostnames for the other IP addresses (hoping to associate the MAC address with only the "primary" IP address and hostname). This did not seem to work; the UI still shows the "wrong" DNS hostname.
  • Setting the MAC address of each bridge and VLAN device to a different unique value, and making the appropriate changes at the router. This seems to work, since there is no longer any "collisions" on the MAC address across subnets/VLANs.

Some questions:

  • How is the hostname getting displayed in the router "Active DHCP Leases" web UI? Is this provided by the router, or is this a client-side browser thing?
  • Is there a better way than changing all the MAC addresses everywhere? I have multiple APs (each with multiple devices and VLANs), so this would be error-prone

I thought maybe I could use the dnsmasq id feature (instead of MAC address), but there doesn't seem to be a UCI way to configure the dhcp host entry in this way (it seems to only support the mac address).

Thank you.

I'm not entirely sure, but I'm comfortably certain to bring it in here :).

You can completely disable DHCP and use IP addresses on all of your devices that stem from "elsewhere", either all manually configured on each device or having a DHCP server that isn't installed on your OpenWRT router. From that moment on, your Wifi UI will show only MAC addresses. That's what happens in the "Dumb AP" scenario. Then manually edit the "/etc/ethers" file on your AP and your Wifi UI will show the names assigned to a specific MAC address.

So coming from a completely different angle (not DHCP but Wifi configuration), this leads me to conclude:

There's a table/map in the system where one MAC address has one hostname. This has nothing to do with dynamic or static DHCP leases. You can only have one host name per MAC address, and you can't do anything about it.

It is wrong to have multiple addresses on a dumbAP to start with. Use one interface for management purposes and use protocol unmanaged (or none) to all other interfaces.

2 Likes

I think I will need to configure separate MAC addresses, or somehow configure dnsmasq to allocate by ID only (and not by MAC address). According to dnsmasq:

More than one --dhcp-host can be associated (by name, hardware address or UID) with a host. Which one is used (and therefore which address is allocated by DHCP and appears in the DNS) depends on the subnet on which the host last obtained a DHCP lease

I think what I am seeing is the different interfaces requesting their IP addresses and clobbering each other's DNS entry ("last one wins")

Why are you giving each interface on the AP an IP address? Or a hostname?

I didn't even realize it's dumb access points we're talking about here.

You should consider what trendy said. What's the exact scenario in which one access point has IP interfaces in multiple vlans?

Better set up a dedicated service/management vlan where each of your APs holds a single IP address and switch all other interfaces your APs have to "unmanaged".

1 Like

I do not think I said these were "dumb" APs; apologies for any misunderstanding. They also provide access ports for wired clients to be on an appropriate VLAN; hence the need for a trunk port to go upstream. But I think you are still suggesting that the APs do not need per-VLAN IP addresses of their own?

They don't. They obviously need at least one interface with an IP so you can reach the terminal and/or web interface, but (as @trendy says) all the other interfaces can be set up with protocol as unmanaged or none.

1 Like

Ah thank you (and @trendy too)! I set the other interfaces to unmanaged, removed their static DHCP leases, and everything still works (and the "wrong hostname" issue is also resolved).

I came from FreshTomato (a long time ago); their UI does not permit this kind of unmanaged interface, and I had carried over this configuration to my new APs.

Thanks again!

1 Like

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