Cisco Routing & Switching

DHCP Relay and giaddr

In large networks, DHCP Servers are located on remote subnets, sometimes far from where the clients requesting the ip are located. In these cases, relays agents are needed to carry the DHCP Discover packets sourced from clients to the data center where the big DHCP servers reside.

Using our topology, we are going to set up R9 as remote DHCP server and R4 as relay agent.

For this purpose, we will define two pools, one for each subnet.

R9(config)#ip dhcp excluded-address 85.0.47.4
R9(config)#ip dhcp pool LAN-47
R9(dhcp-config)#network 85.0.47.0 255.255.255.0
R9(dhcp-config)#default-router 85.0.47.4
R9(dhcp-config)#dns-server 85.0.47.4

R9(config)#ip dhcp excluded-address 85.0.145.1 85.0.145.4
R9(config)#ip dhcp pool LAN-145
R9(dhcp-config)#network 85.0.145.0 255.255.255.0
R9(dhcp-config)#default-router 85.0.145.4
R9(dhcp-config)#dns-server 85.0.145.4

 R5 and R7 will request for an ip address on its fa0/0 and fa0/1 interfaces respectively. We must enable the broadcast forwarding option on both interfaces of R4.

R4(config)#int fa0/0
R4(config-if)#ip helper-address 85.0.146.9
R4(config-if)#int fa0/1
R4(config-if)#ip helper-address 85.0.146.9

 Now the question is, how can R9 know which ip should assign from what pool. As we already know, a router choosse an ip from a pool depending the interface is receiving the request, but now, the situation is different. R9 has no way to discern what the remote subnet is. This is why the giaddr was designed for. This address is added by the router acting as relay agent, adding its own ip address of the facing interface to the client. Therefore, this address is essencial.

Output from R9 when R5 is requesting an ip:

R9#deb ip dhcp server packet
R9#deb ip dhcp server event
*Mar  1 00:19:50.455: DHCPD: Sending notification of DISCOVER:
*Mar  1 00:19:50.459:   DHCPD: htype 1 chaddr c208.1998.0000
*Mar  1 00:19:50.459:   DHCPD: circuit id 03880000
*Mar  1 00:19:50.463: DHCPD: DHCPDISCOVER received from client 0063.6973.636f.2d63.3230.382e.3139.3938.2e30.3030.302d.4661.302f.30
through relay 85.0.145.4.
*Mar  1 00:19:50.467: DHCPD: Seeing if there is an internally specified pool class:
*Mar  1 00:19:50.467:   DHCPD: htype 1 chaddr c208.1998.0000
*Mar  1 00:19:50.471:   DHCPD: circuit id 03880000
*Mar  1 00:19:50.471: DHCPD: Allocate an address without class information (85.0.145.0)
R9#
*Mar  1 00:19:52.475: DHCPD: Adding binding to radix tree (85.0.145.5)
*Mar  1 00:19:52.479: DHCPD: Adding binding to hash tree
*Mar  1 00:19:52.479: DHCPD: assigned IP address 85.0.145.5 to client 0063.6973.636f.2d63.3230.382e.3139.3938.2e30.3030.302d.4661.302f.30.
*Mar  1 00:19:52.483: DHCPD: Sending DHCPOFFER to client 0063.6973.636f.2d63.3230.382e.3139.3938.2e30.3030.302d.4661.302f.30 (85.0.145.5).
*Mar  1 00:19:52.487: DHCPD: unicasting BOOTREPLY for client c208.1998.0000 to relay 85.0.145.4.

Same output for R7 request:

*Mar  1 00:52:40.955: DHCPD: Sending notification of DISCOVER:
*Mar  1 00:52:40.955:   DHCPD: htype 1 chaddr c200.13cc.0001
*Mar  1 00:52:40.959:   DHCPD: circuit id 03880000
*Mar  1 00:52:40.959: DHCPD: DHCPDISCOVER received from client 0063.6973.636f.2d63.3230.302e.3133.6363.2e30.3030.312d.4661.302f.31
through relay 85.0.47.4.
*Mar  1 00:52:40.963: DHCPD: Seeing if there is an internally specified pool class:
*Mar  1 00:52:40.967:   DHCPD: htype 1 chaddr c200.13cc.0001
*Mar  1 00:52:40.967:   DHCPD: circuit id 03880000
*Mar  1 00:52:40.967: DHCPD: Sending DHCPOFFER to client 0063.6973.636f.2d63.3230.302e.3133.6363.2e30.3030.312d.4661.302f.31 (85.0.47.5).
*Mar  1 00:52:40.971: DHCPD: unicasting BOOTREPLY for client c200.13cc.0001 to relay 85.0.47.4.
*Mar  1 00:52:44.315: DHCPD: Sending notification of DISCOVER:
*Mar  1 00:52:44.319:   DHCPD: htype 1 chaddr c200.13cc.0001
*Mar  1 00:52:44.319:   DHCPD: circuit id 03880000
*Mar  1 00:52:44.323: DHCPD: DHCPDISCOVER received from client 0063.6973.636f.2d63.3230.302e.3133.6363.2e30.3030.312d.4661.302f.31
through relay 85.0.47.4.
*Mar  1 00:52:44.327: DHCPD: Seeing if there is an internally specified pool class:
*Mar  1 00:52:44.327:   DHCPD: htype 1 chaddr c200.13cc.0001
*Mar  1 00:52:44.331:   DHCPD: circuit id 03880000
*Mar  1 00:52:44.331: DHCPD: Sending DHCPOFFER to client 0063.6973.636f.2d63.3230.302e.3133.6363.2e30.3030.312d.4661.302f.31 (85.0.47.5).

Check the bindings:

R9#sh ip dhcp bind
Bindings from all pools not associated with VRF:
IP address          Client-ID/              Lease expiration        Type
                    Hardware address/
                    User name
85.0.47.3           0063.6973.636f.2d63.    Mar 01 2002 12:54 AM    Automatic
                    3230.302e.3133.6363.
                    2e30.3030.312d.4661.
                    302f.31
85.0.145.7          0063.6973.636f.2d63.    Mar 01 2002 12:53 AM    Automatic
                    3230.382e.3139.3938.
                    2e30.3030.302d.4661.
                    302f.30

 

If you notice problems with the giaddr not added by the relay router, make sure the DHCP service is running in the router, in other case it will not work.

Related Posts

No Comments

Leave a Reply