1.通过上面的拓扑图要求配置DHCP让PC1和PC2分别从不同DHCP上获取对应的IP地址;
2.配置命令如下:
DHCP中继:
<Huawei>system-view
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.20.254 24
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip address 192.168.10.254 24
[Huawei-GigabitEthernet0/0/2]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.1 24
[Huawei]dhcp enable
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]dhcp select relay
[Huawei-GigabitEthernet0/0/1]dhcp relay server-ip 192.168.2.2
[Huawei-GigabitEthernet0/0/1]dhcp select global
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]dhcp select relay
[Huawei-GigabitEthernet0/0/2]dhcp relay server-ip 192.168.1.2
[Huawei-GigabitEthernet0/0/2]dhcp select global
[Huawei]ip route-static 192.168.2.0 255.255.255.0 192.168.1.2
DHCP-1:
<Huawei>system-view
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.1.2 24
[Huawei-GigabitEthernet0/0/1]dhcp select global
[Huawei-GigabitEthernet0/0/1]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.2.1 24
[Huawei]dhcp enable
[Huawei]ip pool 1
[Huawei-ip-pool-1]network 192.168.10.0 mask 24
[Huawei-ip-pool-1]gateway-list 192.168.10.254
[Huawei-ip-pool-1]dns-list 6.6.6.6
<Huawei>system-view
[Huawei]ip route-static 192.168.10.0 255.255.255.0 192.168.1.1
[Huawei]ip route-static 192.168.20.0 255.255.255.0 192.168.1.1
DHCP-2:
<Huawei>system-view
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.2.2 24
[Huawei-GigabitEthernet0/0/0]dhcp select global
[Huawei]dhcp enable
[Huawei]ip pool 2
[Huawei-ip-pool-2]network 192.168.20.0 mask 24
[Huawei-ip-pool-2]gateway-list 192.168.20.254
[Huawei-ip-pool-2]dns-list 6.6.6.6
[Huawei]ip route-static 0.0.0.0 0.0.0.0 192.168.2.1
测试:
原文地址:http://blog.51cto.com/13562456/2069241