After reboot and without any DHCP leases, Hostnames won't resolve

Hi there,

My setup is:

mikrotik hex-lite as router (192.168.1.1)
ubiquiti unifi6 ap (also running Openwrt, IP via DHCP reservation)
Fritzbox 7412 (for VOIP, IP via DHCP reservation)

The situation I have: If I reboot my router, at first, there won't be any DHCP leases (not even the reserved ones, even though all devices keep running). My guess is that this is totally expected, since the devices remember their DHCP lease time and only refresh if that time comes to an end.

However, the problem I have is that without DHCP leases, the hostnames won't resolve to their IPs. So I cannot ping fritz.lan after a reboot and it takes several hours until ping is possible.

Is that also expected? If yes, what is a common workaround? As a quickfix I just created a hosts entry (Luci --> Hostnames). However, this does not help with devices which are "dynamic" (smartphones) and thus do not have a DHCP reservation.

Best,
Julian

that is correct, a reboot, or any other kind of activity where the client notices it's been offline (like going into flight mode), needs to happen, to trigger a DHCP renewal.

this shouldn't however be the case, the DHCP is renewed after a reboot.

A quick and dirty would be to have a short(er) DHCP lease time, the clients would have to renew their IPs more often, and notice/get any changes sooner.

who resolves the fritz.lan name ?

3 Likes

The dhcp lease file is stored in /tmp which is lost after a reboot. That is why you won't see the leases or be able to resolve the hostnames which depend on dhcp.
As @frollic suggested a shorter leasetime will trigger a dhcp renewal more often, it happens at half of the lease-time. The other solution is to manually enter the hostnames as you did already.

1 Like

Thank you both!!! I think there is no perfect solution (for me at least).

Well, at least you confirmed my guesses. I am not too happy with the situation in general though, since I do not like to configure both DHCP reservations and hostnames.

And I intentionally set the DHCP lease time quite high to have some time fixing DHCP if it might fail one day.

who resolves the fritz.lan name ?

The openwrt router (192.168.1).

I can understand your frustration, however the router is generally not expected to reboot very often. You could move the dhcp leases file to the permanent storage space, but then you are risking to wear out the flash.

1 Like

This is what I did now. I chose a cheap USB drive, so I can live with it failing. Thank you!

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