How to discard a DHCP request’s old IP address (and provide a new one)

dhcpdhcp-serverdnsmasq

I switched from a 192.168.0.0/24 network to 10.10.10.0/24. The addresses are provided by dnsmasq-dhcp.

The switch went fine for all devices but one – a printer (called PRINTER). This printer was assigned a fixed IP based on its name defined in /etc/hosts (via dhcp-host=PRINTER) and still does with the new ranges.

When it requests an IP address, the DHCP server states in its logs that

dnsmasq-dhcp:  not giving name PRINTER to the DHCP lease of 192.168.0.20 because the name exists in /etc/hosts with address 10.10.10.20

I do not understand this message: the name indeed exists in /etc/hosts, with now the new 10.10.10.20 address. While I guess that the DHCP query from the printer hints about the old IP address it used to have, why doesn't dnsmasq just ignore that and provide the new IP address?

Best Answer

Check if your printer name for old ip is here: /var/lib/misc/dnsmasq.leases and edit that file, you must stop dnsmask first

check the Lease times you setup when you configured dhcp, if you assigned too much time then it will take a while to "fix "itself