how dhcp-server select a ip-address to client?
chris.p.buxton at gmail.com
Mon Mar 5 17:08:50 UTC 2012
On Mar 5, 2012, at 5:13 AM, Simon Hobson wrote:
> The key reasons a client will change it's address :
> 1) It requests a specific address.
> 2) It presents a different Client ID, presents a Client ID when one was not previously presented, or does not present a Client ID when one was previously presented.
> 3) It's previous address has been given to a different client.
> The Client ID/no Client ID issue comes into play when systems multiboot. Eg, a system may first request an address for a PXE client (typically not supplying a Client ID), and then boot an OS (eg Windows) which does supply a Client ID. In this case, the two clients are completely different as far as the server is concerned and will get separate leases which will be tracked separately.
According to my observations, while this is somewhat true, it is not entirely true. If the client supplies no client ID for one request, then supplies a client ID for a subsequent address (for the first time), dhcpd will reuse the same lease, based on the MAC address. However, if the client later goes back to requesting an address without supplying a client ID, this will be seen as a different client, and it will get a different address. This initial conversion from no-client-ID to with-client-ID seems to be a useful behavior for a PXE boot environment, where the initial bootup gets a lease, the system is imaged, and then it reboots into Windows and gets the same lease.
Also, the client ID by itself does not uniquely identify a host. If a client machine has two interfaces, such as wired and wireless, the two NICs are seen as different DHCP clients, even if the same client ID is supplied with each request. If this weren't the case, then trying to connect both interfaces at once would fail if one-lease-per-client were turned on. Therefore, I believe the effective unique identifier is a combination of the client ID, if any, and the MAC address.
More information about the dhcp-users