华为多VLAN的DHCP中继配置

2025-10-21 07:20:15

1、 ①、PC1、PC2、PC3、PC4、PC5设置动态获取IP地址。

②、Switch1、Switch2和Switch3作为接入交换机。Switch0作为汇聚交换机,可以不做Vlan其他非实验的Vlan配置。

③、在路由器Router旁路接入DHCP Server,作为DHCP服务器,分别为Vlan100、Vlan200、Vlan300提供IP地址的分发业务。路由器Router上配置DHCP中继。

④、如拓扑结构中所标示,为各个设备的管理地址。

华为多VLAN的DHCP中继配置

2、平台搭建:

①、按照拓扑结构图所示,摆放好设备,并使用直连线连接好各个设备。

②、开启所有的设备。

1、Router的配置清单:

[V200R003C00]

<Huawei> system-view

[Huawei]sysname Router

[Router]vlan batch 100 200 300 888 999

[Router]dhcp enable

[Router]interface Vlanif 100

[Router-Vlanif100]ip address 192.168.10.1 255.255.255.0

[Router-Vlanif100]dhcp select relay

[Router-Vlanif100]dhcp relay server-ip 192.168.88.254

[Router-Vlanif100]quit

[Router]interface Vlanif 200

[Router-Vlanif200]ip address 192.168.20.1 255.255.255.0

[Router-Vlanif200]dhcp select relay

[Router-Vlanif200]dhcp relay server-ip 192.168.88.254

[Router-Vlanif200]quit

[Router]interface Vlanif 300

[Router-Vlanif300]ip address 192.168.30.1 255.255.255.0

[Router-Vlanif300]dhcp select relay

[Router-Vlanif300]dhcp relay server-ip 192.168.88.254

[Router-Vlanif300]quit

[Router]interface Vlanif888

[Router-Vlanif888]ip address 192.168.88.253 255.255.255.0

[Router-Vlanif888]quit

[Router]interface Vlanif999

[Router-Vlanif999]description Management-vlan

[Router-Vlanif999]ip address 192.168.99.11 255.255.255.0

[Router-Vlanif999]quit

[Router]interface Ethernet0/0/0

[Router-Ethernet0/0/0]description To_DHCPServer

[Router-Ethernet0/0/0]port link-type trunk

[Router-Ethernet0/0/0]port trunk allow-pass vlan 2 to 4094

[Router-Ethernet0/0/0]quit

[Router]interface Ethernet0/0/1

[Router-Ethernet0/0/1]description To_Switch0

[Router-Ethernet0/0/1]port link-type trunk

[Router-Ethernet0/0/1]port trunk allow-pass vlan 2 to 4094

[Router-Ethernet0/0/1]quit

[Router]interface Ethernet0/0/3

[Router-Ethernet0/0/3]description To_Switch3

[Router-Ethernet0/0/3]port link-type trunk

[Router-Ethernet0/0/3]port trunk allow-pass vlan 2 to 4094

[Router-Ethernet0/0/3]quit

[Router]interface Ethernet0/0/8

[Router-Ethernet0/0/8]description To_Output

[Router-Ethernet0/0/8]quit

[Router]ip route-static 0.0.0.0 0.0.0.0 192.168.88.254

2、DHCP Server的配置清单:

[V200R003C00]

<Huawei> system-view

[Huawei]sysname DHCPServer

[DHCPServer]vlan batch 888 999

[DHCPServer]dhcp enable

[DHCPServer]ip pool ForVlan100

[DHCPServer-ip-pool-ForVlan100]network 192.168.10.0 mask 255.255.255.0

[DHCPServer-ip-pool-ForVlan100]excluded-ip-address 192.168.10.2 192.168.10.99

[DHCPServer-ip-pool-ForVlan100]excluded-ip-address 192.168.10.200 192.168.10.254

[DHCPServer-ip-pool-ForVlan100]dns-list 172.16.8.8

[DHCPServer-ip-pool-ForVlan100]gateway-list 192.168.10.1

[DHCPServer-ip-pool-ForVlan100]quit

[DHCPServer]ip pool ForVlan200

[DHCPServer-ip-pool-ForVlan200]network 192.168.20.0 mask 255.255.255.0

[DHCPServer-ip-pool-ForVlan200]excluded-ip-address 192.168.20.2 192.168.20.99

[DHCPServer-ip-pool-ForVlan200]excluded-ip-address 192.168.20.200 192.168.20.254

[DHCPServer-ip-pool-ForVlan200]dns-list 172.16.8.8

[DHCPServer-ip-pool-ForVlan200]gateway-list 192.168.20.1

[DHCPServer-ip-pool-ForVlan200]quit

[DHCPServer]ip pool ForVlan300

[DHCPServer-ip-pool-ForVlan300]network 192.168.30.0 mask 255.255.255.0

[DHCPServer-ip-pool-ForVlan300]excluded-ip-address 192.168.30.2 192.168.30.99

[DHCPServer-ip-pool-ForVlan300]excluded-ip-address 192.168.30.200 192.168.30.254

[DHCPServer-ip-pool-ForVlan300]dns-list 172.16.8.8

[DHCPServer-ip-pool-ForVlan300]gateway-list 192.168.30.1

[DHCPServer-ip-pool-ForVlan300]quit

[DHCPServer]interface Vlanif888

[DHCPServer-Vlanif888]ip address 192.168.88.254 255.255.255.0 

[DHCPServer-Vlanif888]dhcp select global

[DHCPServer-Vlanif888]quit

[DHCPServer]interface Vlanif999

[DHCPServer-Vlanif999]description Management-vlan

[DHCPServer-Vlanif999]ip address 192.168.99.254 255.255.255.0

[DHCPServer-Vlanif999]quit

[DHCPServer]interface Ethernet0/0/0

[DHCPServer-Ethernet0/0/0]description To_Router

[DHCPServer-Ethernet0/0/0]port link-type trunk

[DHCPServer-Ethernet0/0/0]port trunk allow-pass vlan 2 to 4094

[DHCPServer-Ethernet0/0/0]quit

[DHCPServer]ip route-static 0.0.0.0 0.0.0.0 192.168.88.253

3、Switch0的配置清单:

<Huawei> system-view

[Huawei]sysname Switch0

[Switch0]vlan batch 100 200 999

[Switch0-Vlanif999]description Management-vlan

[Switch0-Vlanif999]ip address 192.168.99.21 255.255.255.0

[Switch0-Vlanif999]quit

[Switch0]interface GigabitEthernet0/0/21

[Switch0-GigabitEthernet0/0/21]description To_Switch1

[Switch0-GigabitEthernet0/0/21]port link-type trunk

[Switch0-GigabitEthernet0/0/21]port trunk allow-pass vlan 2 to 4094

[Switch0-GigabitEthernet0/0/21]quit

[Switch0]interface GigabitEthernet0/0/22

[Switch0-GigabitEthernet0/0/22]description To_Switch2

[Switch0-GigabitEthernet0/0/22]port link-type trunk

[Switch0-GigabitEthernet0/0/22]port trunk allow-pass vlan 2 to 4094

[Switch0-GigabitEthernet0/0/22]quit

[Switch0]interface GigabitEthernet0/0/24

[Switch0-GigabitEthernet0/0/24]description To_Router

[Switch0-GigabitEthernet0/0/24]port link-type trunk

[Switch0-GigabitEthernet0/0/24]port trunk allow-pass vlan 2 to 4094

[Switch0-GigabitEthernet0/0/24]quit

[Switch0]ip route-static 0.0.0.0 0.0.0.0 192.168.99.11

4、Switch1的配置清单:

<Huawei> system-view

[Huawei]sysname Switch1

[Switch1]vlan batch 100 999

[Switch1]interface Vlanif999

[Switch1-Vlanif999]description Management-vlan

[Switch1-Vlanif999]ip address 192.168.99.31 255.255.255.0

[Switch1-Vlanif999]quit

[Switch1]port-group 123

[Switch1-port-group-123]group-member GigabitEthernet 0/0/1 to g0/0/16

[Switch1-port-group-123]port link-type access

[Switch1-port-group-123]port default vlan 100

[Switch1-port-group-123]quit

[Switch1]undo port-group 123

[Switch1]interface GigabitEthernet0/0/24

[Switch1-GigabitEthernet0/0/24]description To_Switch0

[Switch1-GigabitEthernet0/0/24]port link-type trunk

[Switch1-GigabitEthernet0/0/24]port trunk allow-pass vlan 2 to 4094

[Switch1-GigabitEthernet0/0/24]quit

[Switch1]ip route-static 0.0.0.0 0.0.0.0 192.168.99.11

5、Switch2的配置清单:

<Huawei> system-view

[Huawei]sysname Switch2

[Switch2]vlan batch 100 200 999

[Switch2]interface Vlanif999

[Switch2-Vlanif999]description Management-vlan

[Switch2-Vlanif999]ip address 192.168.99.32 255.255.255.0

[Switch2-Vlanif999]quit

[Switch2]port-group 123

[Switch2-port-group-123]group-member GigabitEthernet 0/0/1 to g0/0/8

[Switch2-port-group-123]port link-type access

[Switch2-port-group-123]port default vlan 100

[Switch2-port-group-123]quit

[Switch2]undo port-group 123

[Switch2]port-group 456

[Switch2-port-group-456]group-member GigabitEthernet 0/0/9 to g0/0/16

[Switch2-port-group-456]port link-type access

[Switch2-port-group-456]port default vlan 200

[Switch2-port-group-456]quit

[Switch2]undo port-group 456

[Switch2]interface GigabitEthernet0/0/24

[Switch2-GigabitEthernet0/0/24]description To_Switch0

[Switch2-GigabitEthernet0/0/24]port link-type trunk

[Switch2-GigabitEthernet0/0/24]port trunk allow-pass vlan 2 to 4094

[Switch2-GigabitEthernet0/0/24]quit

[Switch2]ip route-static 0.0.0.0 0.0.0.0 192.168.99.11

6、Switch3的配置清单:

<Huawei> system-view

[Huawei]sysname Switch3

[Switch3]vlan batch 200 300 999

[Switch3]interface Vlanif999

[Switch3-Vlanif999]description Management-vlan

[Switch3-Vlanif999]ip address 192.168.99.23 255.255.255.0

[Switch3-Vlanif999]quit

[Switch3]port-group 123

[Switch3-port-group-123]group-member GigabitEthernet 0/0/1 to g0/0/8

[Switch3-port-group-123]port link-type access

[Switch3-port-group-123]port default vlan 200

[Switch3-port-group-123]quit

[Switch3]undo port-group 123

[Switch3]port-group 456

[Switch3-port-group-456]group-member GigabitEthernet 0/0/9 to g0/0/16

[Switch3-port-group-456]port link-type access

[Switch3-port-group-456]port default vlan 300

[Switch3-port-group-456]quit

[Switch3]undo port-group 456

[Switch3]interface GigabitEthernet0/0/24

[Switch3-GigabitEthernet0/0/24]description To_Router

[Switch3-GigabitEthernet0/0/24]port link-type trunk

[Switch3-GigabitEthernet0/0/24]port trunk allow-pass vlan 2 to 4094

[Switch3-GigabitEthernet0/0/24]quit

[Switch3]ip route-static 0.0.0.0 0.0.0.0 192.168.99.11

1、检验PC1、PC2、PC3、PC4、PC5获取的IP地址信息

所有PC均正常从路由器Router上正确获取IP地址等参数。

华为多VLAN的DHCP中继配置

华为多VLAN的DHCP中继配置

华为多VLAN的DHCP中继配置

华为多VLAN的DHCP中继配置

华为多VLAN的DHCP中继配置

2、PC1到PC3、PC1到PC5、PC3到PC5的连通测试

所有的通讯测试均正常。

华为多VLAN的DHCP中继配置

华为多VLAN的DHCP中继配置

华为多VLAN的DHCP中继配置

3、PC1到Router、DHCPServer的连通测试(这里直接对Router、DHCPServer的管理地址进行测试)

华为多VLAN的DHCP中继配置

华为多VLAN的DHCP中继配置

4、PC1到Switch0、Switch1、Switch2、Switch3的连通测试

所有的通讯测试均正常。

华为多VLAN的DHCP中继配置

华为多VLAN的DHCP中继配置

华为多VLAN的DHCP中继配置

华为多VLAN的DHCP中继配置

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢