CloudEngine 16800, 12800, 9800, 8800, 7800, 6800, and 5800 Series Switches Typical Configuration Examples (V100 and V200)
Example for Configuring a DHCP Relay Agent
Applicable Products and Versions
- This example applies to all models and all versions.
- For details about the mapping between software versions and switch models, see the Hardware Query Tool.
Networking Requirements
As shown in Figure 2-24, an enterprise uses a DHCP server to assign IP addresses to servers in the data center. The server at 10.20.20.0/24 is used as an example to describe how to configure a DHCP relay agent.
The enterprise client is on the network segment 10.20.20.0/24, and the DHCP server is on the network segment 10.10.10.0/24. The DHCP clients can obtain IP addresses from the DHCP server through SwitchA enabled with DHCP relay.
The uplink interface of SwitchA is 10GE1/0/2, the address of VLANIF 200 is 10.10.20.1/24, and the interface address of SwitchA connected to the peer device is 10.10.20.2/24.
The public address of the DHCP server is 10.10.10.1/24 and the interface address of the DHCP server connected to the peer device is 10.10.10.2/24.
Configuration Roadmap
The configuration roadmap is as follows:
- Create a DHCP server group on Switch A, and add a DHCP server to this group.
- Enable DHCP relay on VLANIF 100.
- Bind VLANIF 100 to the DHCP server group.
Procedure
- Add 10GE1/0/2 on SwitchA to VLAN 200.
<Huawei> system-view [~Huawei] sysname SwitchA [*Huawei] commit [~SwitchA] vlan batch 200 [*SwitchA] interface 10ge 1/0/2 [*SwitchA-10GE1/0/2] port link-type trunk [*SwitchA-10GE1/0/2] port trunk allow-pass vlan 200 [*SwitchA-10GE1/0/2] quit [*SwitchA] interface vlanif 200 [*SwitchA-Vlanif200] ip address 10.10.20.1 24 [*SwitchA-Vlanif200] quit [*SwitchA] commit
- Configure the DHCP relay function on SwitchA.
- Configure a default route on SwitchA.
[~SwitchA] ip route-static 0.0.0.0 0.0.0.0 10.10.20.2 [*SwitchA] commit
Example
# Run the display dhcp relay command on SwitchA to view the DHCP relay configuration on the interface.
[~SwitchA] display dhcp relay interface vlanif 100
DHCP relay agent running information of interface Vlanif100 :
Server group name : dhcpgroup1
Gateway address in use : 10.20.20.1
Configuration Files
Configuration file of SwitchA
#
sysname SwitchA
#
vlan batch 100 200
#
dhcp enable
#
dhcp relay server group dhcpgroup1
server 10.10.10.1 0
#
interface Vlanif100
ip address 10.20.20.1 255.255.255.0
dhcp select relay
dhcp relay binding server group dhcpgroup1
#
interface Vlanif200
ip address 10.10.20.1 255.255.255.0
#
interface 10GE1/0/1
port default vlan 100
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 200
#
ip route-static 0.0.0.0 0.0.0.0 10.10.20.2
#
return