Overview

Enable DHCP Relay Agent on Cisco routers (Cisco IOS). This allows a single DHCP server to support DHCP clients on multiple networks.

Network Diagram

Figure: DHCP Relay Agent Configuration Example [Cisco] Network Diagram
Figure: DHCP Relay Agent Configuration Example [Cisco] Network Diagram

Configuration Condition

  • Create the required DHCP pools on DHCP-Server. DNS Server and Domain Name are common. DNS Server “8.8.8.8” Domain Name “n-study.com”.
  • CL1/CL2/CL3 IP addresses are automatically configured with DHCP.
  • Allows R1 to forward DHCP messages from DHCP clients to DHCP-Server.

Initical Configuration

This is an excerpt of the initial configuration for R1/DHCP-Server; only the hostname is configured for CL1/CL2/CL3.

R1 Configuration Excerpt(Click)

hostname R1
!
interface Ethernet0/0
 ip address 192.168.1.1 255.255.255.0
 ip helper-address 192.168.4.100
!
interface Ethernet0/1
 ip address 192.168.2.1 255.255.255.0
!
interface Ethernet0/2
 ip address 192.168.3.1 255.255.255.0
!
interface Ethernet0/3
 ip address 192.168.4.1 255.255.255.0

DHCP-Server Configuration Excerpt(Click)

hostname DHCP-Server
!
interface Ethernet0/0
 ip address 192.168.4.100 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 192.168.4.1

Configuration and Verification

Step1:DHCP Server Configuration

Create the following DHCP pools so that DHCP-Server can distribute IP addresses to DHCP clients on 192.168.1.0/24, 192.168.2.0/24 and 192.168.3.0/24.

Pool nameNetwork addressDefault gateway
192.168.1.0192.168.1.0/24192.168.1.1
192.168.2.0192.168.2.0/24192.168.2.1
192.168.3.0192.168.3.0/24192.168.3.1

In addition, a DHCP pool is created to distribute DNS server IP address and domain name.

Pool nameNetwork addressDNS ServerDomain name
DNS_DOMAIN192.168.0.0/168.8.8.8n-study.com

DHCP-Server DHCP pool configuration

ip dhcp pool 192.168.1.0
 network 192.168.1.0 255.255.255.0
 default-router 192.168.1.1
!
ip dhcp pool 192.168.2.0
 network 192.168.2.0 255.255.255.0
 default-router 192.168.2.1
!
ip dhcp pool 192.168.3.0
 network 192.168.3.0 255.255.255.0
 default-router 192.168.3.1
!
ip dhcp pool DNS_DOMAIN
 network 192.168.0.0 255.255.0.0
 domain-name n-study.com
 dns-server 8.8.8.8

Step2:DHCP Client configuration

Ensure that the IP address of Ethernet0/0 on CL1/CL2/CL3 is automatically configured with DHCP.

CL1/CL2/CL3 DHCP Client

interface Ethernet0/0
 ip address dhcp

CL1/CL2/CL3 and DHCP-Server are not on the same network. Therefore, DHCP-Server cannot distribute TCP/IP configuration information to CL1/CL2/CL3.

Step3:R1 DHCP Relay Agent configuration

Configure R1 as a DHCP Relay Agent so that it can forward broadcast DHCP messages from CL1/CL2/CL3 to the DHCP-Server. On the interface to which CL1/CL2/CL3 are connected, use the ip helper-address command to specify the IP address of the forwarding DHCP-Server.

R1 DHCP Relay Agent configuration

interface Ethernet0/0
 ip helper-address 192.168.4.100
!
interface Ethernet0/1
 ip helper-address 192.168.4.100
!
interface Ethernet0/2
 ip helper-address 192.168.4.100

Step4:DHCP Verification

Verify the IP addresses of CL1/CL2/CL3.

DHCP Verification Client

CL1#show ip interface brief | include DHCP
Ethernet0/0                192.168.1.3     YES DHCP   up                    up
CL2#show ip interface brief | include DHCP
Ethernet0/0                192.168.2.2     YES DHCP   up                    up
CL3#show ip interface brief | include DHCP
Ethernet0/0                192.168.3.2     YES DHCP   up                    up

You can see that CL1/CL2/CL3 are obtaining their IP addresses with DHCP.

Also, verify the IP address assigned to the client on the DHCP-Server.

DHCP Verification Server

DHCP-Server#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.1.2         0063.6973.636f.2d61.    Nov 05 2022 04:49 AM    Automatic
                    6162.622e.6363.3030.
                    2e30.3230.302d.4574.
                    302f.30
192.168.2.2         0063.6973.636f.2d61.    Nov 05 2022 04:19 AM    Automatic
                    6162.622e.6363.3030.
                    2e30.3330.302d.4574.
                    302f.30
192.168.3.2         0063.6973.636f.2d61.    Nov 05 2022 04:19 AM    Automatic
                    6162.622e.6363.3030.
                    2e30.3430.302d.4574.
                    302f.30

Packet Capture

DHCP DISCOVER(CL1→R1)

DHCP DISCOVER(CL1→R1) Packet Capture Text(Click)

Frame 15: 334 bytes on wire (2672 bits), 334 bytes captured (2672 bits) on interface -, id 0
Ethernet II, Src: aa:bb:cc:00:02:00 (aa:bb:cc:00:02:00), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 0.0.0.0, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 68, Dst Port: 67
Dynamic Host Configuration Protocol (Discover)
    Message type: Boot Request (1)
    Hardware type: Ethernet (0x01)
    Hardware address length: 6
    Hops: 0
    Transaction ID: 0x00000b32
    Seconds elapsed: 0
    Bootp flags: 0x8000, Broadcast flag (Broadcast)
    Client IP address: 0.0.0.0
    Your (client) IP address: 0.0.0.0
    Next server IP address: 0.0.0.0
    Relay agent IP address: 0.0.0.0
    Client MAC address: aa:bb:cc:00:02:00 (aa:bb:cc:00:02:00)
    Client hardware address padding: 00000000000000000000
    Server host name not given
    Boot file name not given
    Magic cookie: DHCP
    Option: (53) DHCP Message Type (Discover)
    Option: (57) Maximum DHCP Message Size
    Option: (61) Client identifier
    Option: (12) Host Name
    Option: (55) Parameter Request List
    Option: (255) End

DHCP DISCOVER(R1→DHCP-Server)

DHCP DISCOVER(R1→DHCP-Server) Packet Capture Text(Click)

Frame 17: 334 bytes on wire (2672 bits), 334 bytes captured (2672 bits) on interface -, id 0
Ethernet II, Src: aa:bb:cc:00:01:30 (aa:bb:cc:00:01:30), Dst: aa:bb:cc:00:05:00 (aa:bb:cc:00:05:00)
Internet Protocol Version 4, Src: 192.168.1.1, Dst: 192.168.4.100
User Datagram Protocol, Src Port: 67, Dst Port: 67
Dynamic Host Configuration Protocol (Discover)
    Message type: Boot Request (1)
    Hardware type: Ethernet (0x01)
    Hardware address length: 6
    Hops: 1
    Transaction ID: 0x00000b32
    Seconds elapsed: 0
    Bootp flags: 0x8000, Broadcast flag (Broadcast)
    Client IP address: 0.0.0.0
    Your (client) IP address: 0.0.0.0
    Next server IP address: 0.0.0.0
    Relay agent IP address: 192.168.1.1
    Client MAC address: aa:bb:cc:00:02:00 (aa:bb:cc:00:02:00)
    Client hardware address padding: 00000000000000000000
    Server host name not given
    Boot file name not given
    Magic cookie: DHCP
    Option: (53) DHCP Message Type (Discover)
    Option: (57) Maximum DHCP Message Size
    Option: (61) Client identifier
    Option: (12) Host Name
    Option: (55) Parameter Request List
    Option: (255) End

DHCP OFFER(DHCP-Server→R1)

DHCP OFFER(DHCP-Server→R1) Packet Capture Text(Click)

Frame 20: 342 bytes on wire (2736 bits), 342 bytes captured (2736 bits) on interface -, id 0
Ethernet II, Src: aa:bb:cc:00:05:00 (aa:bb:cc:00:05:00), Dst: aa:bb:cc:00:01:30 (aa:bb:cc:00:01:30)
Internet Protocol Version 4, Src: 192.168.4.100, Dst: 192.168.1.1
User Datagram Protocol, Src Port: 67, Dst Port: 67
Dynamic Host Configuration Protocol (Offer)
    Message type: Boot Reply (2)
    Hardware type: Ethernet (0x01)
    Hardware address length: 6
    Hops: 0
    Transaction ID: 0x00000b32
    Seconds elapsed: 0
    Bootp flags: 0x8000, Broadcast flag (Broadcast)
    Client IP address: 0.0.0.0
    Your (client) IP address: 192.168.1.3
    Next server IP address: 0.0.0.0
    Relay agent IP address: 192.168.1.1
    Client MAC address: aa:bb:cc:00:02:00 (aa:bb:cc:00:02:00)
    Client hardware address padding: 00000000000000000000
    Server host name not given
    Boot file name not given
    Magic cookie: DHCP
    Option: (53) DHCP Message Type (Offer)
    Option: (54) DHCP Server Identifier (192.168.4.100)
    Option: (51) IP Address Lease Time
    Option: (58) Renewal Time Value
    Option: (59) Rebinding Time Value
    Option: (1) Subnet Mask (255.255.255.0)
    Option: (3) Router
    Option: (15) Domain Name
    Option: (6) Domain Name Server
    Option: (255) End
    Padding: 00

DHCP OFFER(R1→CL1)

DHCP OFFER(R1→CL1) Packet Capture Text(Click)

Frame 17: 342 bytes on wire (2736 bits), 342 bytes captured (2736 bits) on interface -, id 0
Ethernet II, Src: aa:bb:cc:00:01:00 (aa:bb:cc:00:01:00), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 192.168.1.1, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 67, Dst Port: 68
Dynamic Host Configuration Protocol (Offer)
    Message type: Boot Reply (2)
    Hardware type: Ethernet (0x01)
    Hardware address length: 6
    Hops: 0
    Transaction ID: 0x00000b32
    Seconds elapsed: 0
    Bootp flags: 0x8000, Broadcast flag (Broadcast)
    Client IP address: 0.0.0.0
    Your (client) IP address: 192.168.1.3
    Next server IP address: 0.0.0.0
    Relay agent IP address: 192.168.1.1
    Client MAC address: aa:bb:cc:00:02:00 (aa:bb:cc:00:02:00)
    Client hardware address padding: 00000000000000000000
    Server host name not given
    Boot file name not given
    Magic cookie: DHCP
    Option: (53) DHCP Message Type (Offer)
    Option: (54) DHCP Server Identifier (192.168.4.100)
    Option: (51) IP Address Lease Time
    Option: (58) Renewal Time Value
    Option: (59) Rebinding Time Value
    Option: (1) Subnet Mask (255.255.255.0)
    Option: (3) Router
    Option: (15) Domain Name
    Option: (6) Domain Name Server
    Option: (255) End
    Padding: 00

DHCP REQUEST(CL1→R1)

DHCP REQUEST(CL1→R1) Packet Capture Text(Click)

Frame 18: 346 bytes on wire (2768 bits), 346 bytes captured (2768 bits) on interface -, id 0
Ethernet II, Src: aa:bb:cc:00:02:00 (aa:bb:cc:00:02:00), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 0.0.0.0, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 68, Dst Port: 67
Dynamic Host Configuration Protocol (Request)
    Message type: Boot Request (1)
    Hardware type: Ethernet (0x01)
    Hardware address length: 6
    Hops: 0
    Transaction ID: 0x00000b32
    Seconds elapsed: 0
    Bootp flags: 0x8000, Broadcast flag (Broadcast)
    Client IP address: 0.0.0.0
    Your (client) IP address: 0.0.0.0
    Next server IP address: 0.0.0.0
    Relay agent IP address: 0.0.0.0
    Client MAC address: aa:bb:cc:00:02:00 (aa:bb:cc:00:02:00)
    Client hardware address padding: 00000000000000000000
    Server host name not given
    Boot file name not given
    Magic cookie: DHCP
    Option: (53) DHCP Message Type (Request)
    Option: (57) Maximum DHCP Message Size
    Option: (61) Client identifier
    Option: (54) DHCP Server Identifier (192.168.4.100)
    Option: (50) Requested IP Address (192.168.1.3)
    Option: (12) Host Name
    Option: (55) Parameter Request List
    Option: (255) End

DHCP REQUEST(R1→DHCP-Server)

DHCP REQUEST(R1→DHCP-Server) Packet Capture Text(Click)

Frame 21: 346 bytes on wire (2768 bits), 346 bytes captured (2768 bits) on interface -, id 0
Ethernet II, Src: aa:bb:cc:00:01:30 (aa:bb:cc:00:01:30), Dst: aa:bb:cc:00:05:00 (aa:bb:cc:00:05:00)
Internet Protocol Version 4, Src: 192.168.1.1, Dst: 192.168.4.100
User Datagram Protocol, Src Port: 67, Dst Port: 67
Dynamic Host Configuration Protocol (Request)
    Message type: Boot Request (1)
    Hardware type: Ethernet (0x01)
    Hardware address length: 6
    Hops: 1
    Transaction ID: 0x00000b32
    Seconds elapsed: 0
    Bootp flags: 0x8000, Broadcast flag (Broadcast)
    Client IP address: 0.0.0.0
    Your (client) IP address: 0.0.0.0
    Next server IP address: 0.0.0.0
    Relay agent IP address: 192.168.1.1
    Client MAC address: aa:bb:cc:00:02:00 (aa:bb:cc:00:02:00)
    Client hardware address padding: 00000000000000000000
    Server host name not given
    Boot file name not given
    Magic cookie: DHCP
    Option: (53) DHCP Message Type (Request)
    Option: (57) Maximum DHCP Message Size
    Option: (61) Client identifier
    Option: (54) DHCP Server Identifier (192.168.4.100)
    Option: (50) Requested IP Address (192.168.1.3)
    Option: (12) Host Name
    Option: (55) Parameter Request List
    Option: (255) End

DHCP ACK(DHCP-Server→R1)

DHCP ACK(DHCP-Server→R1) Packet Capture Text(Click)

Frame 22: 342 bytes on wire (2736 bits), 342 bytes captured (2736 bits) on interface -, id 0
Ethernet II, Src: aa:bb:cc:00:05:00 (aa:bb:cc:00:05:00), Dst: aa:bb:cc:00:01:30 (aa:bb:cc:00:01:30)
Internet Protocol Version 4, Src: 192.168.4.100, Dst: 192.168.1.1
User Datagram Protocol, Src Port: 67, Dst Port: 67
Dynamic Host Configuration Protocol (ACK)
    Message type: Boot Reply (2)
    Hardware type: Ethernet (0x01)
    Hardware address length: 6
    Hops: 0
    Transaction ID: 0x00000b32
    Seconds elapsed: 0
    Bootp flags: 0x8000, Broadcast flag (Broadcast)
    Client IP address: 0.0.0.0
    Your (client) IP address: 192.168.1.3
    Next server IP address: 0.0.0.0
    Relay agent IP address: 192.168.1.1
    Client MAC address: aa:bb:cc:00:02:00 (aa:bb:cc:00:02:00)
    Client hardware address padding: 00000000000000000000
    Server host name not given
    Boot file name not given
    Magic cookie: DHCP
    Option: (53) DHCP Message Type (ACK)
    Option: (54) DHCP Server Identifier (192.168.4.100)
    Option: (51) IP Address Lease Time
    Option: (58) Renewal Time Value
    Option: (59) Rebinding Time Value
    Option: (1) Subnet Mask (255.255.255.0)
    Option: (3) Router
    Option: (15) Domain Name
    Option: (6) Domain Name Server
    Option: (255) End
    Padding: 00

DHCP ACK(R1→CL1)

DHCP ACK(R1→CL1) Packet Capture Text(Click)

Frame 19: 342 bytes on wire (2736 bits), 342 bytes captured (2736 bits) on interface -, id 0
Ethernet II, Src: aa:bb:cc:00:01:00 (aa:bb:cc:00:01:00), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 192.168.1.1, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 67, Dst Port: 68
Dynamic Host Configuration Protocol (ACK)
    Message type: Boot Reply (2)
    Hardware type: Ethernet (0x01)
    Hardware address length: 6
    Hops: 0
    Transaction ID: 0x00000b32
    Seconds elapsed: 0
    Bootp flags: 0x8000, Broadcast flag (Broadcast)
    Client IP address: 0.0.0.0
    Your (client) IP address: 192.168.1.3
    Next server IP address: 0.0.0.0
    Relay agent IP address: 192.168.1.1
    Client MAC address: aa:bb:cc:00:02:00 (aa:bb:cc:00:02:00)
    Client hardware address padding: 00000000000000000000
    Server host name not given
    Boot file name not given
    Magic cookie: DHCP
    Option: (53) DHCP Message Type (ACK)
    Option: (54) DHCP Server Identifier (192.168.4.100)
    Option: (51) IP Address Lease Time
    Option: (58) Renewal Time Value
    Option: (59) Rebinding Time Value
    Option: (1) Subnet Mask (255.255.255.0)
    Option: (3) Router
    Option: (15) Domain Name
    Option: (6) Domain Name Server
    Option: (255) End
    Padding: 00