如图所示:
PC1的IP地址192.168.10.1,vlan 10 网关192.168.10.254
PC2的IP地址192.168.20.1,vlan 20 网关192.168.20.254
PC3的IP地址192.168.30.1,vlan 30 网关192.168.30.254
PC4的IP地址192.168.40.1,vlan 40 网关192.168.40.254
PC5的ip地址192.168.50.1,vlan 50 网关192.168.50.254
LSW5
<Huawei>undo terminal monitor #关闭提示信息
Info: Current terminal monitor is off.
<Huawei>sys #进入系统视图
[Huawei]vlan batch 10 20 30 #连续创建vlan 10 20 30
[Huawei]int vlan 10 #进入vlan 10
[Huawei-Vlanif10]ip add 192.168.10.254 24 #配置vlan 10的网关地址
[Huawei-Vlanif10]int vlanif 20 #进入vlan 20
[Huawei-Vlanif20]ip add 192.168.20.254 24 #配置vlan 20的网关地址
[Huawei-Vlanif20]int vlanif 30 #进入vlan 30
[Huawei-Vlanif30]ip add 192.168.30.254 24 #配置vlan 30的网关地址
[Huawei-Vlanif30]q #退出vlan 30的配置界面
[Huawei]int g0/0/2 #进入端口视图
[Huawei-GigabitEthernet0/0/2]port link-type access #将端口设置为access模式
[Huawei-GigabitEthernet0/0/2]port default vlan 10 #将端口加入到vlan 10
[Huawei-GigabitEthernet0/0/2]q #退出端口视图
[Huawei]int g0/0/3
[Huawei-GigabitEthernet0/0/3]port link-type access
[Huawei-GigabitEthernet0/0/3]port default vlan 20
[Huawei-GigabitEthernet0/0/3]q
[Huawei]int g0/0/4
[Huawei-GigabitEthernet0/0/4]port link-type access
[Huawei-GigabitEthernet0/0/4]port default vlan 30
[Huawei-GigabitEthernet0/0/4]q
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type trunk
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[Huawei-GigabitEthernet0/0/1]q
LSW4
<Huawei>undo terminal monitor
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan batch 10 20 30 40 50
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int vlanif 10
[Huawei-Vlanif10]ip add 192.168.10.254 24
[Huawei-Vlanif10]int vlanif 20
[Huawei-Vlanif20]ip add 192.168.20.254 24
[Huawei-Vlanif20]int vlanif 30
[Huawei-Vlanif30]ip add 192.168.30.254 24
[Huawei-Vlanif30]int vlanif 40
[Huawei-Vlanif40]ip add 192.168.40.254 24
[Huawei-Vlanif40]int vlanif 50
[Huawei-Vlanif50]ip add 192.168.50.254 24
[Huawei-Vlanif50]q
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type trunk
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[Huawei-GigabitEthernet0/0/1]q
[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type trunk
[Huawei-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[Huawei-GigabitEthernet0/0/2]q
LSW6
<Huawei>undo terminal monitor
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan batch 40 50
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int vlanif 40
[Huawei-Vlanif40]ip add 192.168.40.254 24
[Huawei-Vlanif40]int vlanif 50
[Huawei-Vlanif50]ip add 192.168.50.254 24
[Huawei-Vlanif50]q
[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type access
[Huawei-GigabitEthernet0/0/2]port default vlan 40
[Huawei-GigabitEthernet0/0/2]q
[Huawei]int g0/0/3
[Huawei-GigabitEthernet0/0/3]port link-type access
[Huawei-GigabitEthernet0/0/3]port default vlan 50
[Huawei-GigabitEthernet0/0/3]q
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type trunk
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[Huawei-GigabitEthernet0/0/1]q
验证:5台主机互通,用PC1 ping192.168.20.1/192.168.30.1/192.168.40.1/192.168.50.1
原文地址:http://blog.51cto.com/13721773/2113815