(华为)2个DHCP与一个中继搭配PC1与PC2获取不同网段IP地址

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了(华为)2个DHCP与一个中继搭配PC1与PC2获取不同网段IP地址相关的知识,希望对你有一定的参考价值。

技术分享图片
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
测试:
技术分享图片
技术分享图片

以上是关于(华为)2个DHCP与一个中继搭配PC1与PC2获取不同网段IP地址的主要内容,如果未能解决你的问题,请参考以下文章

华为MSTPVRRP与DHCP综合项目详解

为啥ensp请打开dhcp在哪打

DHCP实验演示(Huawei交换机设备配置)

华为三层交换机VRRP与DHCP综合实验详解

华为——综合排错

使三层交换机实现DHCP功能--华为