Re: Extending a lease when dhcp server is offline (similar to lastleaseextend)
Roy Marples
Wed Sep 02 10:42:58 2020
Hi Matthew
On 01/09/2020 23:47, Matthew Clarkson wrote:
Hi Roy,
I switched to testing with master, latest commit is https://roy.marples.name/cgit/dhcpcd.git/commit/?id=c628d4a2a7474f72b99dce03571732667fc0c7b1.
I am still seeing the server offer a different ip address once it comes back online. The dhcpcd output looks like this:
root@RCFA-0001p:~# dhcpcd --lastleaseextend --nobackground --timeout 10 br0
dhcpcd-9.1.4 starting
no such user dhcpcd
DUID 00:01:00:01:26:3d:a6:3e:00:02:d9:1f:ff:ff
br0: IAID d9:1f:ff:ff
br0: rebinding lease of 192.168.10.24
br0: leased 192.168.10.24 for 471 seconds
br0: adding route to 192.168.10.0/24
br0: adding default route via 192.168.10.1
br0: failed to renew DHCP, rebinding
br0: DHCP lease expired, extending lease
br0: soliciting a DHCP lease
br0: offered 192.168.10.25 from 192.168.10.2
br0: probing address 192.168.10.25/24
br0: leased 192.168.10.25 for 600 seconds
br0: changing route to 192.168.10.0/24
br0: changing default route via 192.168.10.1
Thanks.
I don't see this as a dhcpcd problem.
From the servers perspective your lease has expired - for example it might have
handed 192.168.10.24 to another host.
I think ISC DHCP server keeps records of who had what ip address after expiry
and only re-uses these once the pool of available addresses is exhausted and
then oldest first. In this situation you would still get 192.168.10.24 if it's
still available.
dnsmasq on the other hand i think purges the record when it expires so it will
hand it out quite happily to another host.
What you are really asking for is to request an infinite lease time where your
address is guaranteed by the server never to change.
You can do this by setting `leasetime 4294967295` in dhcpcd.conf which
represents infinity in DHCP terms.
I've comitted a patch to allow `leasetime -1` which is easier to comprehend as
infinity.
https://roy.marples.name/cgit/dhcpcd.git/commit/?id=2d3b623273de0dd2ce30e79af12953aa6f0f8a25
However, most servers will reject this request and give you real leasetime which
will expire at some point.
Another option is to use INFORM to inform the DHCP server of your IP address
rather than lease it.
Roy
Archive administrator: postmaster@marples.name