华为交换机划分VLAN实现主机自动分配IP地址并互相访问设计与实现

时间:2024-02-25 10:32:46

拓扑图

配置方法

Switches1(S5700)配置

The device is running!

 

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

[Huawei]undo info enable

Info: Information center is disabled.

[Huawei]dhcp enable

Info: The operation may take a few seconds. Please wait for a moment.done.

[Huawei]vlan batch 10 to 40

Info: This operation may take a few seconds. Please wait for a moment...done.

[Huawei]interface GigabitEthernet 0/0/1

[Huawei-GigabitEthernet0/0/1]port link-type trunk

[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20

[Huawei-GigabitEthernet0/0/1]quit

[Huawei]interface GigabitEthernet 0/0/2

[Huawei-GigabitEthernet0/0/2]port link-type trunk

[Huawei-GigabitEthernet0/0/2]port trunk allow-pass vlan 30 40

[Huawei-GigabitEthernet0/0/2]quit

[Huawei]int vlan 10

[Huawei-Vlanif10]ip address 192.168.10.254 24

[Huawei-Vlanif10]quit

[Huawei]int vlan 20

[Huawei-Vlanif20]ip address 192.168.20.254 24

[Huawei-Vlanif20]quit

[Huawei]int vlan 30

[Huawei-Vlanif30]ip address 192.168.30.254 24

[Huawei-Vlanif30]quit

[Huawei]int vlan 40

[Huawei-Vlanif40]ip address 192.168.40.254 24

[Huawei-Vlanif40]quit

[Huawei]ip pool 10

Info:It\'s successful to create an IP address pool.

[Huawei-ip-pool-10]network 192.168.10.0 mask 24

[Huawei-ip-pool-10]gateway-list 192.168.10.254

[Huawei-ip-pool-10]dns-list 8.8.8.8

[Huawei-ip-pool-10]quit

[Huawei]int vlan 10

[Huawei-Vlanif10]dhcp select global

[Huawei-Vlanif10]quit

[Huawei]ip pool 20

Info:It\'s successful to create an IP address pool.

[Huawei-ip-pool-20]network 192.168.20.0 mask 24

[Huawei-ip-pool-20]gateway-list 192.168.20.254

[Huawei-ip-pool-20]dns-list 8.8.8.8

[Huawei-ip-pool-20]quit

[Huawei]int vlan 20

[Huawei-Vlanif20]dhcp select global

[Huawei-Vlanif20]quit

[Huawei]ip pool 30

Info:It\'s successful to create an IP address pool.

[Huawei-ip-pool-30]network 192.168.30.0 mask 24

[Huawei-ip-pool-30]gateway-list 192.168.30.254

[Huawei-ip-pool-30]dns-list 8.8.8.8

[Huawei-ip-pool-30]quit

[Huawei]int vlan 30

[Huawei-Vlanif30]dhcp select global

[Huawei-Vlanif30]quit

[Huawei]ip pool 40

Info:It\'s successful to create an IP address pool.

[Huawei-ip-pool-40]network 192.168.40.0 mask 24

[Huawei-ip-pool-40]gateway-list 192.168.40.254

[Huawei-ip-pool-40]dns-list 8.8.8.8

[Huawei-ip-pool-40]quit

[Huawei]int vlan 40

[Huawei-Vlanif40]dhcp select global

[Huawei-Vlanif40]quit

[Huawei]

Switches2(S3700)配置

The device is running!

 

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

[Huawei]undo info enable

Info: Information center is disabled.

[Huawei]vlan batch 10 20

Info: This operation may take a few seconds. Please wait for a moment...done.

[Huawei]interface Ethernet 0/0/1

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

[Huawei-Ethernet0/0/1]port trunk allow-pass vlan 10 20

[Huawei-Ethernet0/0/1]quit

[Huawei]interface Ethernet 0/0/2

[Huawei-Ethernet0/0/2]port link-type access

[Huawei-Ethernet0/0/2]port default vlan 10

[Huawei-Ethernet0/0/2]quit

[Huawei]interface Ethernet 0/0/3

[Huawei-Ethernet0/0/3]port link-type access

[Huawei-Ethernet0/0/3]port default vlan 10

[Huawei-Ethernet0/0/3]quit

[Huawei]interface Ethernet 0/0/4

[Huawei-Ethernet0/0/4]port link-type access

[Huawei-Ethernet0/0/4]port default vlan 20

[Huawei-Ethernet0/0/4]quit

[Huawei]interface Ethernet 0/0/5

[Huawei-Ethernet0/0/5]port link-type access

[Huawei-Ethernet0/0/5]port default vlan 20

[Huawei-Ethernet0/0/5]quit

[Huawei]

Switches3(S3700)配置

The device is running!

 

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

[Huawei]undo info enable

Info: Information center is disabled.

[Huawei]vlan batch 30 40

Info: This operation may take a few seconds. Please wait for a moment...done.

[Huawei]interface Ethernet 0/0/1

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

[Huawei-Ethernet0/0/1]port trunk allow-pass vlan 30 40

[Huawei-Ethernet0/0/1]quit

[Huawei]interface Ethernet 0/0/2

[Huawei-Ethernet0/0/2]port link-type access

[Huawei-Ethernet0/0/2]port default vlan 30

[Huawei-Ethernet0/0/2]quit

[Huawei]interface Ethernet 0/0/3

[Huawei-Ethernet0/0/3]port link-type access

[Huawei-Ethernet0/0/3]port default vlan 30

[Huawei-Ethernet0/0/3]quit

[Huawei]interface Ethernet 0/0/4

[Huawei-Ethernet0/0/4]port link-type access

[Huawei-Ethernet0/0/4]port default vlan 40

[Huawei-Ethernet0/0/4]quit

[Huawei]interface Ethernet 0/0/5

[Huawei-Ethernet0/0/5]port link-type access

[Huawei-Ethernet0/0/5]port default vlan 40

[Huawei-Ethernet0/0/5]quit

[Huawei]

效果图