Dhcp.leases missing IPs for devices with multiple IPs

I have 4 devices that have 2 IPs due to multiple VLANs (3 WAPs, 1 Server). I assign static IPs to dnsmasq using the following dhcp config:

config host                    
     option name 'wap'     
     option mac 'XX:XX:XX:XX:XX:XX' 
     option ip '10.10.1.100'       
     option dns '1'            
     option leasetime '7d'      
                               
config host                      
     option name 'wap-guest'
     option mac 'XX:XX:XX:XX:XX:XX' 
     option ip '10.10.5.100'       
     option dns '1'                     
     option leasetime '7d' 

However the dhcp.leases file seems to choose randomly which entry to show. Is there anyway to force both entries to display in the dhcp.leases file? Or if that is not possible at least make it consistent which one is displayed?

Even if you have several VLANs, I guess each device (except the router) is only connected to one VLAN at the same time. When each device does a DHCP request, the assigned address is stored on dhcp.leases, so only the last address assigned to each MAC address remains.

If a device is connected to several VLANs, then it will have several different Interfaces, each one with a different MAC address.

2 Likes

Change a bit the mac address of the host in the guest vlan and configure it accordingly to the dhcp config.

My server is connected to 2 VLANS (main VLAN and work VLAN), my Unifi Access Points are connected to 3 (main, IoT, Guest. although only main and Guest need IPs assigned)

That's not true. Linux (even OpenWRT itself) uses the same device MAC for the physical interface and tagged VLAN interfaces.

Potentially an option for my server, but not really an option for my Unifi Access Points

I have the same equipment and I have just given up hope on that. If it wasn't for the guest vlan to need an extra dhcp it wouldn't be such a problem.

What doesn't work for you? DHCP assignment works fine for me, its just the logging to dhcp.leases and displaying it on the status page that is wonky. It seem to be just a really annoying display issue though.

Yes, exactly the same display issue.

Well, for now i've set the DHCP lease time to 14 days for the VLANs that I don't care as much about, and 1 day for the main network. That way at least the majority of the time the dhcp.leases file will consistently show the IPs from the main lan.

1 Like