Do You Know What DHCP Is?
If it is first time you are learning DHCP, you can find an introduction is here!
Let’s Dive In DHCP!
DHCP is protocol using between DHCP Clients and DHCP Servers to provide automatic TCP/IP configuration to clients. There are some steps and message packets sending by clients and servers to complete a successful negotiation. Let’s review!
DHCP Discover
This is a broadcast packet sending by client to find a DHCP Server in environment. Source IP for this packet is 0.0.0.0. When a DHCP Server gets this message, processes it and find an available IP address from its IP pool. After that, server replies to client with a DHCP Offer packet.
DHCP Offer
This is a unicast packet sending by DHCP Server to client’s MAC address. This message includes IP address which is assigned by DHCP Server to client. If more than one DHCP Server replies to the client with a DHCP Offer packet, client selects the first replied server.
DHCP Request
After DHCP Offer receives by client, it responses with a DHCP Request message to show acceptance of offered IP address. This is a broadcast packet which includes offered IP address.
DHCP Acknowledge
End of the story, when DHCP Server recieves DHCP Request message from client, it confirms the offering of IP address and sends DHCP Ack packet to the client as unicast.
Other DHCP Messages
DHCP Nak
If the IP address trying to use by client is invalid, for instance it is used by a different client, DHCP Server sends a DHCP Nak packet to client. When client gets this message, it needs to start DHCP process again.
DHCP Decline
If the DHCP Server provided configuration parameters are invalid for DHCP Client, it sends a DHCP Decline message and starts the DHCP process again.
DHCP Release
This message is sent by client to DHCP Server to release client’s current IP address.
Does IP Address Lease For Lifetime?
When DHCP Server sends DHCP Ack packet to client, it starts counting a lease time. By default, most of operating systems configure lease time as 8 days. When lease time is reached to middle of it, DHCP Server sends a packet to client to verify its leased IP usage status. If client replies this packet, server extends the IP’s lease time, up to configured lease time. If server doesn’t get a reply from client and client doesn’t reach to server until the end of lease time, DHCP Server release this IP address and IP returns to IP Pool as an available IP.