How to Configure DHCP Relay Agent on Cisco Routers

DHCP clients transmit requests using broadcast messages, which routers do not forward. Consequently, if the DHCP server and clients reside on separate network segments connected by a router, clients will not receive IP configuration information from the DHCP server.

In this scenario, configure the router interface connected to the DHCP server as a DHCP relay agent. Use the following command in interface configuration mode to enable this functionality.

Router(config-if)#ip helper-address [ip-address-of-the-dhcp-server]

The 'ip helper-address' command instructs the interface to forward incoming DHCP messages to the specified DHCP server. Apply this command to all interfaces connected to local subnets containing DHCP clients.

Lab setup

  • Create a network that contains five subnets: 10.0.0.0/8, 20.0.0.0/8, 30.0.0.0/8, 40.0.0.0/8, and 50.0.0.0/8.
  • Add some hosts in each network except the fifth subnet. In the fifth subnet, add a DHCP Server.
  • To connect subnets, use three routers: Router0, Router1, and Router2.
  • Connect subnets 10.0.0.0/8 and 20.0.0.0/8 to Router1's FastEthernet 0/0 and FastEthernet0/1 interfaces, respectively.
  • Connect subnets 30.0.0.0/8 and 40.0.0.0/8 to Router2's FastEthernet 0/0 and FastEthernet0/1 interfaces, respectively.
  • Connect the serial 0/0/0 interface of Router1 to the serial 0/0/0 interface of Router0. Use the subnet 192.168.1.0/252 for the IP configuration on this connection.
  • Connect the serial 0/0/1 interface of Router2 to the serial 0/0/1 interface of Router0. Use the subnet 192.168.4.0/252 for the IP configuration on this connection.
  • Configure RIP routing between routers and test connectivity between subnets.

Practice lab

The following link provides a reference for this lab setup. It does not include configuration.

Packet Tracer LAB without configuration

Objective

  • Configure PCs in the first four subnets to obtain IP addresses from the DHCP server in the fifth subnet.
  • On the DHCP server, create four DHCP pools and assign one pool to each subnet.
  • Configure routers to act as DHCP relay agents.

Assigning IP configuration

The following commands assign an IP address to a router interface and enable the interface.

Command Description (used for)
Router>enableEnter Privilege Exec mode.
Router#configure terminalEnter Global configuration mode.
Router(config)#interface [interface name] [interface number]Enter interface configuration mode.
Router(config-if)#ip address [ip address] [subnet mask]Assign the IP address to the interface.
Router(config-if)#clock rate 64000Set the clock rate to 64000. (Use only if the interface is serial DCE)
Router(config-if)#bandwidth 64To set the bandwidth to 64 (Use only if the interface is serial DCE)
Router(config-if)#no shutdownEnable the interface.
Router(config-if)#exitExit interface configuration mode.

Router0 (Interface configuration)

Router>enable
Router#configure terminal
Router(config)#interface fastethernet 0/0
Router(config-if)#ip address 50.0.0.1 255.0.0.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface serial 0/0/0
Router(config-if)#ip address 192.168.1.2 255.255.255.252
Router(config-if)#clock rate 64000
Router(config-if)#bandwidth 64
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface serial 0/0/1
Router(config-if)#ip address 192.168.1.6 255.255.255.252
Router(config-if)#clock rate 64000
Router(config-if)#bandwidth 64
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#

Interface IP configuration on Router 0

Router1 (Interface configuration)

Router>enable
Router#configure terminal
Router(config)#interface fastethernet 0/0
Router(config-if)#ip address 10.0.0.1 255.0.0.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface fastethernet 0/1
Router(config-if)#ip address 20.0.0.1 255.0.0.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface serial 0/0/0
Router(config-if)#ip address 192.168.1.1 255.255.255.252
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#

Interface IP configuration on Router 1

Router2 (Interface configuration)

Router>enable
Router#configure terminal
Router(config)#interface fastethernet 0/0
Router(config-if)#ip address 30.0.0.1 255.0.0.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface fastethernet 0/1
Router(config-if)#ip address 40.0.0.1 255.0.0.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface serial 0/0/1
Router(config-if)#ip address 192.168.1.5 255.255.255.252
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#

Interface IP configuration on Router 2

Configuring RIP routing

Use the following commands to configure RIP routing on a router.

Command Description (Used for)
Router(config)#router ripEnable RIP routing, then enter routing configuration mode.
Router(config-router)#network [network]Add the local network to the list of networks that RIP will advertise.
Router(config-router)#version 2Use RIP version 2.
Router(config-router)#no auto-summarySupport classless subnets and disable auto-summary.
Router(config-router)#exit Exit routing configuration mode.

Router0 (RIP routing configuration)

Router>enable
Router#configure terminal
Router(config)#router rip
Router(config-router)#network 50.0.0.0
Router(config-router)#network 192.168.1.0
Router(config-router)#network 192.168.4.0
Router(config-router)#version 2
Router(config-router)#no auto-summary
Router(config-router)#exit
Router(config)#

RIP routing configuration on Router 0

Router1 (RIP routing configuration)

Router>enable
Router#configure terminal
Router(config)#router rip
Router(config-router)#network 10.0.0.0
Router(config-router)#network 20.0.0.0
Router(config-router)#network 192.168.1.0
Router(config-router)#version 2
Router(config-router)#no auto-summary
Router(config-router)#exit
Router(config)#

RIP routing configuration on Router 1

Router2 (RIP routing configuration)

Router>enable
Router#configure terminal
Router(config)#router rip
Router(config-router)#network 30.0.0.0
Router(config-router)#network 40.0.0.0
Router(config-router)#network 192.168.1.4
Router(config-router)#version 2
Router(config-router)#no auto-summary
Router(config-router)#exit
Router(config)#

RIP routing configuration on Router 2

Assigning a static IP to the DHCP server

A DHCP server requires a static IP configuration. To assign a static IP address, select Server, then Config, and choose the interface connected to Router0's FastEthernet 0/0. In the IP configuration section, select Static and set the IP address.

Static IP configuration on the DHCP server

Because the server connects to the network through Router0's FastEthernet 0/0 interface, use this interface's IP address as the server's default gateway. To configure the default gateway, select the Settings button in the left pane, choose Static in the IP configuration section of the right pane, and enter the default gateway IP address.

Default gateway IP on dhcp server

Enabling and configuring the DHCP service on the server

To enable the DHCP service on the server, select Server, then Services. In the left pane, select DHCP, and in the right pane, choose the 'On' option. This action enables the DHCP service. The DHCP service uses DHCP pools to allocate IP addresses. A DHCP pool is a collection of IP configurations assigned by the DHCP server to a specific subnet. Create one pool for each subnet; for four subnets, configure four pools.

Entries for the first pool

Entries for the first pool

Entries for the second pool

Entries for the second pool

Entries for the third pool

Entries for the third pool

Entries for the fourth pool

Entries for the fourth pool

The following image shows the configuration for all the pools.

configuration for all pools

Configuring DHCP clients

To configure a device as a DHCP client, select the DHCP option in its IP configuration. For example, select PC, then Desktop, then IP Configuration, and choose the DHCP option.

Configuring DHCP clients

Configure all PCs as DHCP clients by following the steps outlined above.

Configuring DHCP relay agents

Configure the DHCP relay agent only on interfaces connected to local subnets. In this network, four interfaces are directly connected to local subnets, as listed below.

Router Interface Connected to the local subnet
Router1 Fa0/0 10.0.0.0/8
Router1 Fa0/1 20.0.0.0/8
Router2 Fa0/0 30.0.0.0/8
Router2 Fa0/1 40.0.0.0/8

The 'ip helper-address' command designates an interface as a DHCP relay agent. This command requires the DHCP server’s IP address as an argument. Execute this command on interfaces connected to local subnets.

Router1
Router(config)#interface fastethernet 0/0
Router(config-if)#ip helper-address 50.0.0.10
Router(config-if)#exit
Router(config)#interface fastethernet 0/1
Router(config-if)#ip helper-address 50.0.0.10
Router(config-if)#exit
Router(config)#

Configuring DHCP relay agents on Router 0

Router2
Router(config)#interface fastethernet 0/0
Router(config-if)#ip helper-address 50.0.0.10
Router(config-if)#exit
Router(config)#interface fastethernet 0/1
Router(config-if)#ip helper-address 50.0.0.10
Router(config-if)#exit
Router(config)#

Configuring DHCP relay agents on Router 1

Verifying DHCP relay agent configuration

Verify the DHCP relay agent configuration by checking the PCs' IP configurations. To do so, select PC, then Desktop, and then IP Configuration. The PC should receive an IP address from its assigned pool.

Verifying DHCP relay agent configuration

Alternatively, use the 'ipconfig' command to view the IP configuration.

Verifying DHCP relay agent configuration

Configured practice lab

The following link provides the lab configuration above.

Packet Tracer LAB with configuration

This tutorial is part of the tutorial series "DHCP (Dynamic Host Configuration Protocol) basic concepts, configurations, functions, and options explained". Other parts of this series are the following.
Chapter 1  What DHCP is and Types of DHCP Explained
Chapter 2  How DHCP works explained with examples
Chapter 3  DHCP Configuration Parameters and Settings Explained
Chapter 4  How to Configure DHCP Server on Cisco Switches
Chapter 5  Configure DHCP Server for multiple VLANs on the Switch
Chapter 6  How to Configure DHCP Server on Cisco Routers
Chapter 7  How DHCP Relay Agents work Explained
Chapter 8  How to Configure DHCP Relay Agent on Cisco Routers
Chapter 9  How DHCP Snooping works Explained
Chapter 10  Configure DHCP Snooping on Cisco Switches

Conclusion

The 'ip helper-address' command enables the forwarding of DHCP requests across routers, facilitating the deployment of DHCP servers and clients throughout the network. This tutorial demonstrated how to use this command to configure DHCP relay agents when DHCP clients and servers are located on different subnets separated by routers.

ComputerNetworkingNotes CCNA Study Guide How to Configure DHCP Relay Agent on Cisco Routers

We do not accept any kind of Guest Post. Except Guest post submission, for any other query (such as adverting opportunity, product advertisement, feedback, suggestion, error reporting and technical issue) or simply just say to hello mail us ComputerNetworkingNotes@gmail.com