DHCP Server
Overview
A DHCP server is a network server that automatically provides and assigns IP addresses, default gateways and other network parameters to client devices. It relies on the standard protocol known as Dynamic Host Configuration Protocol (DHCP) to respond to broadcast queries by clients.
Functionality
A DHCP server dynamically assigns an IP address and other network configuration parameters to each device on a network so they can communicate with other IP networks. DHCP is an enhancement of an older protocol called BOOTP. DHCP is more advanced, and DHCP servers can handle BOOTP client requests if any BOOTP clients remain on a network segment.
DHCP Operation
The operation of the DHCP protocol is based on the concept of a 'lease'. This is the amount of time that a DHCP client can use a particular IP configuration assigned by the DHCP server. The lease duration can vary depending on how long a user is likely to require the network connection at a particular location.
DHCP Lease Process
The DHCP lease process consists of four steps: IP lease request, IP lease offer, IP lease selection, and IP lease acknowledgement. These steps are also known as DORA for Discovery, Offer, Request, and Acknowledgement.
Discovery
The DHCP lease process begins with the DHCP client broadcasting a DHCPDISCOVER message on the network to discover available DHCP servers.
Offer
When a DHCP server receives the DHCPDISCOVER message from the client, it reserves an IP address for the client and sends a DHCPOFFER message back to the client. This message contains the offered IP address, subnet mask, lease duration, and additional configuration parameters.
Request
Upon receiving the DHCPOFFER, the client responds with a DHCPREQUEST message, indicating its acceptance of the offered parameters. This message is also broadcast on the network, allowing other DHCP servers to reclaim any IP addresses they may have offered to the client.
Acknowledgement
Finally, the DHCP server sends a DHCPACK message to the client, acknowledging the client's acceptance of the offered parameters. This message also includes the lease duration and any other configuration information that the client might have requested.
DHCP Message Format
Each DHCP message has a specific format, which includes several fields such as 'op' (message operation code), 'htype' (hardware address type), 'hlen' (hardware address length), 'hops' (hop count), 'xid' (transaction ID), 'secs' (seconds elapsed), 'flags', 'ciaddr' (client IP address), 'yiaddr' (your IP address), 'siaddr' (server IP address), 'giaddr' (gateway IP address), 'chaddr' (client hardware address), 'sname' (server name), 'file' (boot file name), and 'options' (options).
DHCP Options
The DHCP options field allows vendors to add custom parameters to extend the DHCP protocol. Some commonly used options include default gateway (option 3), DNS servers (option 6), domain name (option 15), and lease time (option 51).
DHCP Relay
A DHCP Relay Agent is a network device that helps DHCP clients obtain IP addresses from DHCP servers on a different network segment. The relay agent receives DHCP messages from the client and forwards them to the server, and vice versa.
DHCPv6
DHCP for IPv6 (DHCPv6) is a version of DHCP that supports IPv6 addresses. It includes several enhancements over the original DHCP protocol, such as the ability to carry more information in its 'options' field and support for rapid deployment of IP addresses.