1.access配置
vlan 10
vlan batch 30 40 //配置多个vlan
- 查看vlan配置
display vlan
- 配置LSW1 e0/0/2 access接口
interface e0/0/2
port link-type access
port default vlan 10
display vlan
发现e0/0/0接入vlan10里
同理配置其他交换机和接口
2.trunk配置
1.配置s1和s2 access
//LSW4:e0/0/2
vlan batch 10 20
interface e0/0/2
port link-type access
port default vlan 10
LSW4:e0/0/3
q
interface e0/0/3
port link-type access
port default vlan 20
//LSW5:e0/0/2
vlan batch 10 20
interface e0/0/2
port link-type access
port default vlan 10
LSW5:e0/0/3
q
interface e0/0/3
port link-type access
port default vlan 20
2.汇聚交换机配置trunk
需要在LSW4:e0/0/1 LSW5:e0/0/1 LSW3:e0/0/1、0/0/2都配置trunk
//LSW4:e0/0/1
interface e0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
//LSW5:e0/0/1
interface e0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
//LSW3:e0/0/1
interface g0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
//LSW3:e0/0/2
interface g0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
display vlan
vlan10 :pc6 ping pc 8
3.配置hybrid
//LSW6:e0/0/4
vlan batch 10 20 30
interface e0/0/4
port link-type hybrid
port hybrid pvid vlan 20
port hybrid untagged vlan 30 20
//LSW6:e0/0/3
interface e0/0/3
port link-type hybrid
port hybrid pvid vlan 10
port hybrid untagged vlan 30 10
//LSW6:e0/0/1
interface e0/0/1
port link-type hybrid
port hybrid pvid vlan 30
port hybrid untagged vlan 30 10 20
//LSW6:e0/0/2
interface e0/0/2
port link-type hybrid
port hybrid tagged vlan 30 10 20
display vlan
//LSW7:e0/0/3
vlan batch 10 20 30
interface e0/0/3
port link-type hybrid
port hybrid pvid vlan 20
port hybrid untagged vlan 30 20
//LSW7:e0/0/2
interface e0/0/2
port link-type hybrid
port hybrid pvid vlan 10
port hybrid untagged vlan 30 10
//LSW7:e0/0/1
interface e0/0/1
port link-type hybrid
port hybrid tagged vlan 30 10 20
display vlan
检验
- vlan20 : 192.168.1.1
- vlan10 : 192.168.1.2
- vlan30 : 192.168.1.1