DHCP client state if rebooted when local DHCPD server is offline?
dhcp1 at thehobsons.co.uk
Thu Aug 14 16:08:35 UTC 2014
terrygalant.lists at fastest.cc wrote:
> I understand that if my LAN's dhcpd server is up, when any client on the lan is rebooted, it'll pick up its lease & IP address.
> What happens on the client if it reboots when the LAN's dhcpd is stopped, NOT serving dhcp info/leases?
> Does the client come up in the last known state? With the last-used IP addresses? Or, instead, default or random IP address info?
It is very client/implementation specific.
In principle, IFF the client has an accurate clock, AND it can determine that it's on the same network, AND it still has an unexpired lease - then (and only then) can it continue to use it's leased address. If any of those conditions isn't met, then it shouldn't use any existing lease, and it should have no IPv4 address until it obtains a lease.
One common method used by clients is to do an ARP check of the default gateway. If you do an ARP request on the default gateway address, AND you get the same hardware address as you had before, then it's "quite likely" that you're on the same network. In theory it should be guaranteed since hardware addresses are supposed to be globally unique - but these days it's not so certain.
But this is implementation dependent, and some are less thorough than others. I've seen problems at work where wireless laptops (running Windows) have kept their IP address obtained from the staff member's home network and "just used it" on the office network (with same subnet, same default router IP, but different router hardware address).
Similarly, today I noticed (having accidentally created a problem with DHCP) a number of clients (iPhones and Android devices)on a WiFi network I manage use what I assume was their previous address on another network - I certainly saw a number of 192.168.1.nn addresses appear on a network using a completely different RFC1918 address block.
What a client is allowed to do, should getting an address by DHCP fail, is to assign itself a link local address in the 169.254/16 block https://en.wikipedia.org/wiki/Link-local_address
Combine this with ZeroConf https://en.wikipedia.org/wiki/Zero-configuration_networking and you can have a number of devices on an ad-hoc isolated network communicate with each other.
More information about the dhcp-users