DHCP relay: ip helper-address

The problem

A DISCOVER is a broadcast, and routers don't forward broadcasts. Companies usually run one central DHCP server for many subnets, so the router on each LAN must pass the requests on.

The fix: a relay agent

Configure ip helper-address SERVER-IP on the router interface that faces the clients. The router then:

  1. Receives the DHCP broadcast on that interface.
  2. Sends it on as a unicast to the server, putting its own interface address (192.168.10.1) in the giaddr (gateway address) field.
  3. The server sees the giaddr and picks the pool whose network contains it: that is how one server serves many subnets.
  4. The server answers the relay, and the relay passes the answer to the client.

Here R2 is the server and R1 the relay. The server needs a route back to 192.168.10.0/24 to answer; this network already has one.

In NetLab

▶ R1
R1>enable
R1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#interface g0/0
R1(config-if)#ip helper-address 10.0.0.2
R1(config-if)#end
*Mar  1 00:00:29.000: %SYS-5-CONFIG_I: Configured from console by console
▶ PC1
NetLab Windows-style command prompt. Type help to see the commands.
C:\Users\student>ipconfig /renew

Windows IP Configuration


Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . : corp.local
   Link-local IPv6 Address . . . . . : fe80::11db:99de:fbce:36d1%12
   IPv4 Address. . . . . . . . . . . : 192.168.10.10
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.10.1
C:\Users\student>ipconfig /all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : PC1
   Primary Dns Suffix  . . . . . . . : 
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . : corp.local
   Description . . . . . . . . . . . : NetLab Gigabit Network Adapter
   Physical Address. . . . . . . . . : 00-1A-33-D5-62-B1
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::11db:99de:fbce:36d1%12(Preferred) 
   IPv4 Address. . . . . . . . . . . : 192.168.10.10(Preferred) 
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Monday, March 1, 1993 12:00:34 AM
   Lease Expires . . . . . . . . . . : Tuesday, March 2, 1993 12:00:34 AM
   Default Gateway . . . . . . . . . : 192.168.10.1
   DHCP Server . . . . . . . . . . . : 10.0.0.2
   DNS Servers . . . . . . . . . . . : 192.168.10.5
▶ R2
R2>enable
R2#show ip dhcp binding
Bindings from all pools not associated with VRF:
IP address          Client-ID/              Lease expiration        Type
                    Hardware address/
                    User name
192.168.10.10       0100.1a33.d562.b1       Mar 02 1993 12:00 AM    Automatic

PC1's DHCP Server is 10.0.0.2, a different subnet, and its gateway is R1. The helper address forwards more than DHCP: by default also TFTP, DNS, TACACS, NetBIOS and time (all UDP).

Common mistake: Putting ip helper-address on the interface towards the server instead of the one towards the clients. It goes where the broadcasts arrive.

HOME LABS COMMUNITY DASHBOARD