实验目的:
1. 实现同VLAN互通,不同VLAN不能通信
2.实现创建SVI,不同VLAN之间的通信
同VLAN互通,不同VLAN不能通信
[sw1]
#
vlan batch 10 20
#
interface Ethernet0/0/1
port link-type access
port default vlan 10
#
interface Ethernet0/0/2
port link-type access
port default vlan 10
#
interface Ethernet0/0/3
port link-type access
port default vlan 20
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
sw2同理
[RS-1]
#
vlan batch 10 20
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
结果:PC1,PC2,PC4,PC5可以互通;PC3,PC6可以互通
创建SVI,不同VLAN之间的通信
[RS-1]
#
interface Vlanif10
ip address 192.168.9.254 255.255.255.0
#
interface Vlanif20
ip address 192.168.10.254 255.255.255.0
结果:所有PC机都能够互通
注意:
想要删除设置错的vlan,要先删第二条,再删第一条
比如:
先用display this查看配置:
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 11 to 12
#
这里我配多了一个2,需要使用命令:undo port trunk allow-pass vlan 2 11 to 12
然后再undo port link-type