Dynamic Host Configuration Protocol is a protocol used in networks to dynamically assigns an IP address and other network configuration parameters to each device on a network so they can communicate with other devices on network. A DHCP server enables computers to request an IP address and other networking parameters such as DNS, default gateway, etc. automatically from their ISP. In the absence of a DHCP server, an IP address on a computer or a network device must be assigned manually assigned, or else it will assign itself an APIPA address, due to which it will not be able to communicate outside its local subnet.
A router can be enabled to act as a DHCP server. Within a local area network, a DHCP server assigns an IP address to each device which is connected to the network.
DHCP uses the User Datagram Protocol (UDP) to communicate with network devices. It performs its task using two UDP port number 67(destination port of server) and 68(port used by client) which are the same as for the bootstrap protocol (BOOTP).
DHCP operations are divided into four phases such as server discovery, IP lease offer, IP lease request, and IP lease acknowledgement. DHCP uses DORA process for IP address assignment. DORA stands for discovery, offer, request and acknowledgement.
- DHCP discovery
DHCP client will broadcast a DHCPDISCOVER message on the network, using the specific subnet broadcast address or the destination address 255.255.255.255. A DHCP client may request its last known IP address if it remains connected to the same network and server may grant the request. An authoritative server denies this request, causing the client to send a new request and non-authoritative server just ignores the request.
- DHCP offer
When a DHCP server receives a DHCPDISCOVER message from a client it reserves an IP address for the client and offer a lease by sending a DHCPOFFER message back to client. This message contains the client-id (MAC address), the IP address that the server is offering, subnet mask, lease duration and the IP address of the DHCP server who is offering lease.
- DHCP request
When client receives DHCP offer, it replies back with a DHCPREQUEST message through broadcast, requesting for offered address. A client might receive DHCP offers from multiple servers, but it can accept only one of them. Based on server identification option in the request and broadcast message, all windows servers are informed whose offer has been accepted by client. When other DHCP servers receive this message, they withdraw their offers and return the offered IP address back to the pool of available addresses.
- DHCP acknowledgement
When DHCP server receives a DHCPREQUEST message from the client, the configuration process enters its final phase. In this phase, DHCP server sends a DHCPACK packet to the client which includes the lease duration and other network configuration parameters that the client has requested. At this point, the IP assignment process is completed.
Learn more about Networking Exam