跨交换机VLAN配置案例
作者:互联网
跨交换机VLAN配置案例
1实验目的目的
掌握VLAN的概念、创建VLAN的方法、把交换机端口划分到VLAN中、Trunk的配置与调试方法
2实验拓扑图
3实验步骤
- 在交换机S1,S2上创建VLAN,并把端口划分到相应的VLAN中
(1)配置交换机S1
S1(config)#vlan 2 //创建vlan
S1(config)#name VLAN2 //命名vlan
S1(config)#exit
S1(config)#vlan 3
S1(config)#name VLAN3
S1(config)#exit
S1(config)#interface fastEthernet0/1
S1(config-if)switchport mode access//设置端口类型为access
S1(config-if)switchport access vlan 2//把端口加入到vlan中
S1(config)#interface fastEthernet0/2
S1(config-if)switchport mode access
S1(config-if)switchport access vlan 3
(2)配置交换机S2
S1(config)#vlan 2
S1(config)#name VLAN2
S1(config)#exit
S1(config)#vlan 3
S1(config)#name VLAN3
S1(config)#exit
S1(config)#interface fastEthernet0/3
S1(config-if)switchport mode access
S1(config-if)switchport access vlan 3
S1(config)#interface fastEthernet0/4
S1(config-if)switchport mode access
S1(config-if)switchport access vlan 2
- 配置Trunk
(1)配置交换机S1
S1(config)#interface fastEthernet0/13
S1(config-if)# switchporttrunk encanpsulation dot1q
//配置端口封装类型
S1(config-if)#switchport mode trunk
//配置端口模式为trunk
S1(config-if)#switchport trunk native vlan 199
//在trunk链路上配置native vlan 默认native vlan为vlan1
S1(config-if)#switchport nonegotiate
//关闭dtp自动协商功能
S1(config-if-range)# switchport trunk allowed vlan 1-3
//trunk只允许VLAN1-VLAN3的数据包通过(默认是允许所有通过)
(2)配置交换机S2
S1(config)#interface fastEthernet0/13
S1(config-if)# switchporttrunk encanpsulation dot1q
S1(config-if)#switchport mode trunk
S1(config-if)#switchport trunk native vlan 199
S1(config-if)#switchport nonegotiate
S1(config-if-range)# switchport trunk allowed vlan 1-3
4实验调试
S1#show interfaces trunk//查看端口Trunk信息
S1#show interfaces fastEthernet 0/13 switchport//查看交换端口信息
标签:vlan,switchport,S1,VLAN,access,案例,交换机,trunk,config 来源: https://blog.csdn.net/weixin_45710567/article/details/110816225