跨交换机划分vlan

拓扑图

如图所示,四台交换机的IP地址网段相同,划分vlan后,只有相同vlan的主机才能通信

因为是跨交换机的vlan划分,所以两台交换机都要配置相同的vlan

switch 1 配置内容

Switch>en

Switch#

Switch#conf t

Switch(config)# vlan 10

Switch(config-vlan)#exit

Switch(config)#vlan 20

扫描二维码关注公众号,回复: 1581549 查看本文章

Switch(config-vlan)#exit

Switch(config)#int f0/1

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 10

Switch(config-if)#exit

Switch(config)#int f0/2

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 20

Switch(config-if)#exit

switch 0与switch1的配置内容一致

划分好vlan后,还需要将两台交换机间的端口设置为trunk模式,不然无法传输除vlan1以外vlan的信息

使用switchport mode trunk来设置trunk模式

Switch(config)#int f0/24

Switch(config-if)#switchport mode trunk

Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up
Switch(config-if)#
Switch(config-if)#exit
 
设置结束后,用ping命令来测试网络连通性
pc1 ping  pc2

无法连通

pc1 ping pc3

可以通信

猜你喜欢

转载自www.cnblogs.com/knightysa/p/9177011.html