12台pc机在192.168.168.1.0/24 ,在同一网段不用配置网关,每台pc机以他的序列号作为它的IP地址最后一位
lsw1配置
- vlan batch 10
- interface GigabitEthernet0/0/1
- port link-type trunk
- port trunk allow-pass vlan 10
- #
- interface GigabitEthernet0/0/2
- port link-type access
- port default vlan 10
- #
- interface GigabitEthernet0/0/3
- port link-type access
- port default vlan 10
lsw2配置
- vlan batch 20
- interface GigabitEthernet0/0/1
- port link-type trunk
- port trunk allow-pass vlan 20
- #
- interface GigabitEthernet0/0/2
- port link-type access
- port default vlan 20
- #
- interface GigabitEthernet0/0/3
- port link-type access
- port default vlan 20
lsw3配置
- vlan batch 30
- interface GigabitEthernet0/0/1
- port link-type trunk
- port trunk allow-pass vlan 30
- #
- interface GigabitEthernet0/0/2
- port link-type access
- port default vlan 30
- #
- interface GigabitEthernet0/0/3
- port link-type access
- port default vlan 30
lsw4配置
- vlan batch 10
- interface GigabitEthernet0/0/1
- port link-type trunk
- port trunk allow-pass vlan 10
- #
- interface GigabitEthernet0/0/2
- port link-type access
- port default vlan 10
- #
- interface GigabitEthernet0/0/3
- port link-type access
- port default vlan 10
lsw5配置
- vlan batch 20
- interface GigabitEthernet0/0/1
- port link-type trunk
- port trunk allow-pass vlan 20
- #
- interface GigabitEthernet0/0/2
- port link-type access
- port default vlan 20
- #
- interface GigabitEthernet0/0/3
- port link-type access
- port default vlan 20
lsw6配置
- vlan batch 30
- interface GigabitEthernet0/0/1
- port link-type trunk
- port trunk allow-pass vlan 30
- #
- interface GigabitEthernet0/0/2
- port link-type access
- port default vlan 30
- #
- interface GigabitEthernet0/0/3
- port link-type access
- port default vlan 30
lsw7配置
- <Huawei>
- <Huawei>sys
- [Huawei]sysn
- [Huawei]sysname lsw7
- [lsw7]vlan batch 10 20 30
- [lsw7]int g0/0/1
- [lsw7-GigabitEthernet0/0/1]port link-type trunk
- [lsw7-GigabitEthernet0/0/1]port trunk allow-pass vlan 10
- [lsw7-GigabitEthernet0/0/1]int g0/0/2
- [lsw7-GigabitEthernet0/0/2]port link-type trunk
- [lsw7-GigabitEthernet0/0/2]port trunk allow-pass vlan 20
- [lsw7-GigabitEthernet0/0/2]int g0/0/3
- [lsw7-GigabitEthernet0/0/3]port link-type trunk
- [lsw7-GigabitEthernet0/0/3]port trunk allow-pass vlan 30
- [lsw7-GigabitEthernet0/0/3]q
- [lsw7]int Eth-Trunk 1
- [lsw7-Eth-Trunk1]t
- [lsw7-Eth-Trunk1]trunkport g 0/0/4 to 0/0/9
- [lsw7-Eth-Trunk1]port link-type trunk
- [lsw7-Eth-Trunk1]port trunk allow-pass vlan all
lsw8配置
- <Huawei>
- <Huawei>sys
- [Huawei]sysn
- [Huawei]sysname lsw8
- [lsw8]vlan batch 10 20 30
- [lsw8]int g0/0/1
- [lsw8-GigabitEthernet0/0/1]port link-type trunk
- [lsw8-GigabitEthernet0/0/1]port trunk allow-pass vlan 10
- [lsw8-GigabitEthernet0/0/1]int g0/0/2
- [lsw8-GigabitEthernet0/0/2]port link-type trunk
- [lsw8-GigabitEthernet0/0/2]port trunk allow-pass vlan 20
- [lsw8-GigabitEthernet0/0/2]int g0/0/3
- [lsw8-GigabitEthernet0/0/3]port link-type trunk
- [lsw8-GigabitEthernet0/0/3]port trunk allow-pass vlan 30
- [lsw8-GigabitEthernet0/0/3]q
- [lsw8]int Eth-Trunk 1
- [lsw8-Eth-Trunk1]t
- [lsw8-Eth-Trunk1]trunkport g 0/0/4 to 0/0/9
- [lsw8-Eth-Trunk1]port link-type trunk
- [lsw8-Eth-Trunk1]port trunk allow-pass vlan all
验证实验效果
发现相同vlan能通信,不同vlan不能通信