I’m currently developing an Embedded device, which uses TCP-IP, and get’s it’s IP address with DHCP.
I saw in examples, that every now and then, I need to check if the lease has ended, but I didn’t find any reference about how often to check it, because there are implementation who check it once in 8 days, and implementation which check it every 24 hours.
so basically, in your implementations, How often do you check the DHCP lease ? what’s the standard regarding this issue ?
I’m currently developing an Embedded device, which uses TCP-IP, and get’s it’s IP address
Share
You actually have to check the “IP Lease time” field in the ACK of the DHCPREQUEST. The RFC specifies that this ACK message MUST contain the lease time. Some clients may also choose to propose a lease time in the DHCPDISCOVER or DHCPREQUEST message (depends on the implementation).
From the client perspective, at 50% of the lease duration (T1) the client has to send a DHCP Request to the server to ask for a renew of its lease time. When the client receives a DHCP ACK from the server, the client computes the lease expiration time as the sum of the time at which the client sent the DHCPREQUEST message and the duration of the lease in the DHCPACK message.
If no DHCPACK arrives before time by 87.5% of lease time (T2), the client sends (via broadcast) a DHCPREQUEST message to extend its lease.
If the lease expires before the client receives a DHCPACK (T3), the client MUST immediately stop any other network processing and requests network initialization parameters as if the client were uninitialized.
Hence you have to keep in mind T1, T2 and T3.