DHCP

Dynamic Host Configuration Protocol (DHCP) is used to dynamically manage and assign IP addresses to hosts on a network.

  1. When a new machine joins the nework, it sends out a DHCP request.
  2. Assuming there is a DHCP server on the network, it responds with the IP configuration for the new machine.
  3. This new IP address is reserved to prevent accidental assignment to other devices while still in use.

On servers, static DHCP reservations are used. Basically an IP is assigned to a new host joining the network, and is kept reserved for this host in case it joins back later. So essentially, we are reserving a dynamically assigned IP address for a particular host, making sure that this host will always get assigned that reserved IP address when it rejoins.

Clients and servers

When a device connects to a network, a DHCP client on the device sends a request to the DHCP server. The server assigns an IP, subnet mask and default gateway to the device.

Working

  • Client sends a DHCP Discover packet as a broadcast at 255.255.255.255
  • DHCP server responds with a DHCP Offer
  • Client sends a DHCP Request to take up offer
  • Server sends DHCP Acknowledgement