vlan acess端口的设置

vlan acess端口的设置

步骤
创建vlan2 vlan3
将端口0/0/1加入VLAN2
端口0/0/2加入VLAN2
将端口0/0/3加入VLAN3
端口0/0/4加入VLAN3
[Sw1]vlan batch 2 3
[sw1]interface e0/0/1
[sw1-Ethernet0/0/1]port link-type access
[sw1-Ethernet0/0/1]port default vlan 2
[sw1-Ethernet0/0/2]port lin1k-type access
[sw1-Ethernet0/0/2]port default vlan 2
[sw1-Ethernet0/0/3]port link-type access
[sw1-Ethernet0/0/3]port default vlan 3
[sw1-Ethernet0/0/4]port link-type access
[sw1-Ethernet0/0/4]port default vlan 4

实验结果:
PC机1能PING通PC机2
PC机2也能PING通PC机1
PC机3能PING通PC机4
PC机4能PING通PC机3
实验结果实现了不通VLAN不能PING通
同一VLAN可以ping通
完成了公司不同部门网络的隔离

还有一种方法是批量将端口加入vlan
先要创建group 1
把0/0/1 0/0/2加入group 1
并给group 1 配上vlan 2
把0/0/3 0/0/4 加入group 2
并给grop 2配上vlan 3
具体操作如下:
[Sw1]vlan batch 2 3
[sw1]port-group 1
[sw1-group-1]group-member e0/0/1 e0/0/2
[sw1-Ethernet0/0/1] Port link-type access
[sw1-Ethernet0/0/2] Port link-type access
[sw1-Ethernet0/0/1]port default vlan 2
[sw1-Ethernet0/0/2]port default vlan 2
[sw1]port-group 2
[sw1-group-2]group-member e0/0/3 e0/0/4
[sw1-Ethernet0/0/3]port default vlan 3
[sw1-Ethernet0/0/4]port default vlan 3

OK
得到的结果和上面的实验是一样的
实验结果:
PC机1能PING通PC机2
PC机2也能PING通PC机1
PC机3能PING通PC机4
PC机4能PING通PC机3
实验结果实现了不通VLAN不能PING通
同一VLAN可以ping通
完成了公司不同部门网络的隔离

猜你喜欢

转载自blog.51cto.com/13935936/2299002