Dynamic Host Configuration protocol (DHCP) is an auto configuration protocol that runs in the application layer of the TCP/IP Protocol which automates network parameter assignment. The DHCP Relay Agent makes it possible for the DHCP servers and DHCP client’s broadcast messages to be sent and received while both the server and clients is on different segments of a network.
DHCP Servers and DHCP Clients
DHCP allows for a computer to be automatically configured without the system administrator. DHCP provides a computer or any network-aware device with an IP address and information such as subnet mask, default gateway, DNS server amongst others. When a DHCP client sends a broadcast message requesting the necessary information required for IP- based communication on the network, if a valid request the DHCP client assigns an IP address to the computer from a set of predetermined addresses referred to as scopes. The request is typically made during the booting process; the server also issues a lease which is the time for which the allocation is valid. The DHCP lease process occurs with four messages being sent.
In the four messages sequence begins with the DHCP client sending a DHCPDISCOVER message which requests an IP Address. The DHCP server/s responds with a DHCPOFFER which may be sent by one or several servers. The DHCPREQUEST message is then sent by the client to the server which responded initially, requesting a specific IP address. The DHCP server sends a DHCPACK acknowledging the message and assigning the IP address and lease to the client.
Relationship between DHCP and DHCP Relay Agents
When the DHCP Client sends DHCPDISCOVER a broadcast message, the DHCP server is able to receive it provided both server and client are on the same network or segment. Broadcast messages are unable to cross the router interface in order to deliver the message. One way to solve this problem is to configure a DHCP sever on each segment but this can be expensive especially for larger organizations. Another solution is to us a DHCP Relay on each segment configured with the address of DHCP server to which the message would be relayed. The DCHP Relay intercepts the message, and forwards it via a directed datagram to a specific DHCP server.
DHCP Relay Agents
The DHCP relay agent intercepts the broadcast sent by the client. The Hop field is then checked and the request is discarded if the value in the field is greater than 16, if not the field is incremented. The relay agent then places IP address of the router interface of the original request in the GIADDR field. The GIADDR field is used to identify subnet of the originating device in order to select the appropriate IP address from the scopes. It is then forwarded to the DHCP server; the server receives a non-zero value in the GIADDR and responds to the relay agent using the IP address in the field. The relay agent in turn sends the response to the client.