Search code examples
dhcp

Is it right to send out a discovery packet without releasing?


I'm writing a tiny DHCP client for a microcontroller in which I have no non-volatile memory (that I want to use). Therefore on a reset/reboot I will not be able to know what my previously acquired IP address was. If that reset/reboot was abrupt (which is possible) I may not be able to release the IP that was given to me. Therefore my only option is to send out another discovery packet and do the dance again.

Is this the correct thing to do, provided I can't save the IP and jump straight to the request phase later on?


Solution

  • What you describe is the correct behavior of a client without memory and it is according to the DHCP specification RFC 2131. So you are fine to go ahead with DHCPDISCOVER. Releasing an IP is necessary only if you want the DHCP server to forget your lease. Normally you would not want that and getting the same IP address as last time is ok.