This article gives a basic explanation of what DHCP is and how it works.
Table of Contents
What is DHCP?
The Dynamic Host Configuration Protocol (DHCP) runs on UDP ports 66 & 67 and allows for automatic IP configuration of many different parameters (called "Options") in addition to the requested IP address, including:
- Subnet Mask (Option 1 - e.g., 255.255.255.0)
- Router Address (Option 3 - e.g., 192.168.1.1)
- DNS Address (Option 6 - e.g., 22.214.171.124)
- Vendor Class Identifier (Option 43 - e.g., 'unifi' = 192.168.1.9 ##where unifi = controller)
DHCP is based on a client-server model. A Host running a DHCP client (e.g., laptop) forwards Layer-2 Broadcast frames with its Source MAC address in order for the DHCP server to reserve the offered IP address for the respective DHCP client.
- Discovery - DHCP host broadcasts to find local DHCP server
- Offer - DHCP server advertises address lease via unicast
- Request - DHCP host broadcasts requesting the address
- ACK - DHCP server reserves the address, sending acknowledgment
DHCP pools typically "lease" IP addresses, that is, temporarily reserve IP addresses, after which, the IP address may be re-used. A common DHCP lease time is 86400 seconds (or, 1 day).
|Not unlike a network handshake, the DHCP Offer is summarized in four steps where Client broadcasts and Server unicasts.|
Read our other introductory networking articles in the Intro to Networking section.