DHCP Relay Agent

When a device is configured as a Dynamic Host Configuration Protocol (DHCP) client, it will send a broadcast packet to discover DHCP servers on the network. Routers do not forward broadcast packets by default, so if a DHCP server is in a different network than DHCP clients, it will not receive DHCP requests. Consider the following scenario:

DHCP Relay Agent

 

The workstation on the left is configured as a DHCP client. R2 on the right is configured as a DHCP server. The workstation sends a DHCP discover packet but receives no DHCP request since R1 doesn’t forward the packet to R2 (broadcast packets stay on the local subnet).

To rectify this, we can configure R1 to act as a DHCP relay agent and forward the DHCP requests to the configured DHCP server. This is done by issuing the ‘ip helper-address DHCP_SERVER_IP_ADDRESS’ command on its Gi0/0 interface. This command instructs the router to do the following:

  1. watch for DHCP messages on the interface
  2. when a DHCP packet arrives, set the packet’s source IP address to the IP address of Gi0/0
  3. change the destination IP address of the packet from 255.255.255.255 (the broadcast address) to the IP address of the DHCP server and send it to R2
  4. when the answer from the DHCP server is received, change the packet’s destination IP to 255.255.255.255 and send it out its Gi0/0 interface so that the workstation (which does not have an IP address yet) can receive the DHCP message.

 

Configure DHCP Relay Agents

To configure the interface Gi0/0 on R1 to forward DHCP packets, only a single command is needed:

R1(config-if)#ip helper-address 172.16.0.2

 

To make sure that the workstation indeed got its IP parameters, we can issue the ‘ipconfig’ command:

C:\>ipconfig

FastEthernet0 Connection:(default port)

Link-local IPv6 Address.........: FE80::2E0:B0FF:FEB3:73E
IP Address......................: 10.0.0.104
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 10.0.0.1

Download our Free CCNA Study Guide PDF for complete notes on all the CCNA 200-301 exam topics in one book.

We recommend the Cisco CCNA Gold Bootcamp as your main CCNA training course. It’s the highest rated Cisco course online with an average rating of 4.8 from over 30,000 public reviews and is the gold standard in CCNA training: