5
Configuring DHCP relay agent
Introduction
The following example describes the basic procedure to configure an interface as a DHCP relay
agent. The DHCP relay agent enables clients to obtain IP addresses and configuration parameters
from a DHCP server on another subnet.
Network configuration
As shown in
, Switch A acts as the core switch and has two VLANs. Host A and Host B are in
VLAN 5 and VLAN 6, respectively. The DHCP server and the hosts run on different subnets and
Switch A is the gateway for these hosts. Configure the network to meet the following requirements:
•
The DHCP clients run on subnets 192.168.5.0/24 and 192.168.6.0/24, and the DHCP server IP
address is 192.168.7.100/24.
•
Switch A acts as the DHCP relay agent for clients, so these clients can obtain IP addresses in
subnets 192.168.5.0/24 and 192.168.6.0/24, and other network settings from the DHCP server.
Figure 2 Network diagram
Procedure
1.
Configure Switch B.
# Create VLAN 5 and VLAN 6, and then assign GigabitEthernet 1/0/2 and GigabitEthernet 1/0/3
to VLAN 5 and VLAN 6, respectively.
<SwitchB> system-view
[SwitchB] vlan 5
[SwitchB-vlan5] port gigabitEthernet 1/0/2
[SwitchB-vlan5] quit
[SwitchB] vlan 6
GE1/0/1
Switch B
GE1/0/2
GE1/0/3
DHCP server
Switch A
GE1/0/1
GE1/0/2
VLAN 5
Host A
VLAN 6
Host B