DHCP stands for "dynamic host control protocol". It is the method for which machines on a local network automatically retrieve an IP address in order to identiy itself. It requires both a server and a client to work as-expected. This process includes 4 steps:
- A client that requires an IP address sends a UDP packet to the local network, asking if there are any DHCP servers on the network. This step is called
DHCPDiscover
1a) This request is then ignored by anything that isn't a DHCP server
- The DHCP Server responds with an IP address suggestion. It doesn't know where to send it back to, since the requester does not have an IP address yet it will respond using UDP to every machine on the network. This step is called
DHCPOffer
2a) Any machine that has not requested an IP via DHCPDiscover
will ignore this packet
2b) Interestingly, if there is more than one DHCP server, all DHCP servers will respond with their own DHCPOffer
s.
- The client that has requested via
DHCPDiscover
acknoledges the request, and tells the server (again, via UDP) that it will accept that address via theDHCPRequest
step
3a) Once again, any non-DHCP server will ignore the request.
3b) If there is more than one DHCP server, whichever packet is recieved by the client first is handled and others are disregarded. As a result, only the first DHCP server will recieve the relevant DHCPRequest
packet, and the other servers will ignore said request
- The server will respond with a
DHCPACK
packet, acknoledging the IP address utilization, but include including a date and time that the IP address lease will expire
4a) Becuase the server has no way of knowing when the client shuts down, it needs to include a date and time that the IP address will be available to the network once again. Otherwise, IP addresses would no longer ever be available and the pool would be quickly exhausted due to the lack of available addresses.