不同交换机之间,相同VLAN间的pc通讯
要求:PCA和PCC属于VLAN10,PCB和PCD属于VLAN20
配置SW1:
Switch>en
Switch#config terminal
Switch#vlan10 //创建vlan10
Switch#vlan20 //创建vlan20
Switch(config)#interface f 0/1
Switch(config-if)#switchport access vlan 10 //将端口Ethernetf/0/1添加到Vlan10中
Switch(config)#interface f 0/2
Switch(config-if)#switchport access vlan 20 //将端口Ethernetf/0/1添加到Vlan20中
Switch(config)#interface f 0/24
Switch(config-if)switchport mode trunk //设置端口为Trunk链路类型
Switch(config-if)#switchport trunk allowed vlan all //运行所有vlan通过//
Switch#exit
Switch#save
配置SW2:
Switch>en
Switch#config terminal
Switch#vlan10 //创建vlan10
Switch#vlan20 //创建vlan20
Switch(config)#interface f 0/1
Switch(config-if)#switchport access vlan 10 //将端口Ethernetf/0/1添加到Vlan10中
Switch(config)#interface f 0/2
Switch(config-if)#switchport access vlan 20 //将端口Ethernetf/0/1添加到Vlan20中
Switch(config)#interface f 0/24
Switch(config-if)switchport mode trunk //设置端口为Trunk链路类型
Switch(config-if)#switchport trunk allowed vlan all //运行所有vlan通过//
Switch#exit
Switch#save
相关命令:
Switch#show vlan //查看交换机上的vlan信息
Switch#show int fastEthernet 0/1 //查看端口Ethernet1/0/1的信息
Switch(config-if)#switchport trunk allowed vlan all (运行所有vlan通过)
给每个PC添加IP 地址如图下面,验证,TRUNK跨交换机相同VLAN 间是可以进行通讯的
结果:pc A 可以ping通pcC但是不通pcD
结果:pc B 可以ping通pcD但是不通pcA