TomK tomkcpr at mdevsys.com
Tue Mar 5 06:05:48 UTC 2019

On 3/4/2019 9:34 AM, Simon Hobson wrote:
> TomK <tomkcpr at mdevsys.com> wrote:
>> Is there a way to force remote DHCPD servers to assign a different IP to a client with the same MAC everytime dhclient -v is called?
> ...
>> I've a unique scenario where I would like to also check the local DNS to determine if any offline hosts are already assigned to an IP and need to cycle through a few to determine that.
> What you are seeing is correct behaviour and is required by the RFCs covering DHCP.
> It is explicitly required that the server should try and lease the same IP to a client - even if it's been off the network for a while. So unless the address has been reused in the meantime, your device could come back even years later and get the same address.
> As Sten says, you can use a different client-id each time and then the device will be considered a different one each time.
> This because the MAC address (hardware-address) is only used as the database key if there is no client-id provided by the client (the default on Linux clients). If there is a client-id then this will be used as the database key. So setting this and changing the value on each invocation will achieve what you want.
>> Currently the DHCPD server servers the same IP or one of two IP's regardless of how many times dhclient -v is called.
> As an aside, it's good that you provided this explanation. The question has been asked a few times over the years, and usually it's some variation of "manglement tell me that we must change customers' IPs regularly to stop then running servers at home". The usual response is along the lines of "look for another job now before your customers are peed off and leave, and your employer goes bust" !
> _______________________________________________
> dhcp-users mailing list
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users


Thanks Simon and Sten.  This was a great reply.  I'll dig into changing 
the client-id.

As an aside, should mention that I did end up writing a script that 
defaults to using nmap if dhcpd fails to provide an IP.  Subsequently I 
do DNS lookups using the IP's retrieved to ensure none of the IP's 
belong to hosts that could just be offline.

So far it works amazingly at always assigning a unique IP from ranges 
but couldn't help wondering if there isn't a community solution or even 
a better way using dhcpd.

Tom K.

Living on earth is expensive, but it includes a free trip around the sun.

More information about the dhcp-users mailing list