vlan实验

配置图

如上图所示,为交换机的配置

复制区

sw1的配置:

[sw1]vlan batch 10 20 30       创建vlan
[sw1]int g0/0/1
[sw1-GigabitEthernet0/0/1]p l a        设置接口状态
[sw1-GigabitEthernet0/0/1]p d v 10    设置接口允许通过的vlan
[sw1-GigabitEthernet0/0/1]int g0/0/4   
[sw1-GigabitEthernet0/0/4]p l a
[sw1-GigabitEthernet0/0/4]p d v 30
[sw1-GigabitEthernet0/0/4]int g0/0/3
[sw1-GigabitEthernet0/0/3]p l a 
[sw1-GigabitEthernet0/0/3]p d v 20
[sw1-GigabitEthernet0/0/3]int g0/0/2
[sw1-GigabitEthernet0/0/2]p l t
[sw1-GigabitEthernet0/0/2]p t p v 30
[sw1-GigabitEthernet0/0/2]u p t a v 1      设置接口不允许通过vlan1
[sw1-GigabitEthernet0/0/2]p t a v 10 20 30

sw2的配置:

[sw 2]vlan batch 10 20 30
[sw 2]int g 0/0/2
[sw 2-GigabitEthernet0/0/2]p l t
[sw 2-GigabitEthernet0/0/2]p t p v 30
[sw 2-GigabitEthernet0/0/2]port trunk allow-pass vlan 30
[sw 2-GigabitEthernet0/0/2]undo port trunk allow-pass vlan 1
[sw 2-GigabitEthernet0/0/2]int g0/0/3
[sw 2-GigabitEthernet0/0/3]p l t
[sw 2-GigabitEthernet0/0/3]undo port trunk allow-pass vlan 1
[sw 2-GigabitEthernet0/0/3]port trunk allow-pass vlan 10 20 30
[sw 2-GigabitEthernet0/0/3]int g0/0/1
[sw 2-GigabitEthernet0/0/1]p l t
[sw 2-GigabitEthernet0/0/1]p t a v 10 20 30
[sw 2-GigabitEthernet0/0/1]p t p v 30
[sw 2-GigabitEthernet0/0/1]undo port trunk allow-pass vlan 1
 

sw3的配置:

[sw3]vlan 20
[sw3-vlan20]int g0/0/2
[sw3-GigabitEthernet0/0/2]p l a
[sw3-GigabitEthernet0/0/2]p d v 20
[sw3-GigabitEthernet0/0/2]int g0/0/1
[sw3-GigabitEthernet0/0/1]p l a
[sw3-GigabitEthernet0/0/1]p d v 20
 

sw4的配置:

[sw4]un in en
[sw4]vlan batch 10 20 30
[sw4]int g0/0/1
[sw4-GigabitEthernet0/0/1]p l h
[sw4-GigabitEthernet0/0/1]port hybrid pvid  vlan 30
[sw4-GigabitEthernet0/0/1]port hybrid untagged vlan 30
[sw4-GigabitEthernet0/0/1]undo port hybrid untagged vlan 1
[sw4-GigabitEthernet0/0/1]int g0/0/2
[sw4-GigabitEthernet0/0/2]p l h
[sw4-GigabitEthernet0/0/2]p h p v 10
[sw4-GigabitEthernet0/0/2]undo port hybrid untagged vlan 1
[sw4-GigabitEthernet0/0/2]port  hybrid untagged vlan 10
[sw4-GigabitEthernet0/0/2]int g 0/0/3
[sw4-GigabitEthernet0/0/3]p l h
[sw4-GigabitEthernet0/0/3]p h p v 20
[sw4-GigabitEthernet0/0/3]undo port hybrid untagged vlan 1
[sw4-GigabitEthernet0/0/3]port hybrid untagged vlan 20
[sw4-GigabitEthernet0/0/3]int g0/0/4
[sw4-GigabitEthernet0/0/4]p l h
[sw4-GigabitEthernet0/0/4]undo port hybrid untagged vlan 1
[sw4-GigabitEthernet0/0/4]port hybrid tagged vlan 10 20 30
 


保证pc5和pc6 互通:
[sw4]int g0/0/2
[sw4-GigabitEthernet0/0/2]port hybrid untagged vlan 20
[sw4-GigabitEthernet0/0/2]int g0/0/3
[sw4-GigabitEthernet0/0/3]port hybrid untagged vlan 10

要根据对应的数据流的方向,设置每个接口可以通过的vlan-id,是否需要标签。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值