多交换机间的VLAM通信
VLAN(Vlan Local Area Network,虚拟局域网)技术,可以从逻辑上将一个大的网络划分为若干个小的虚拟局域网,VLAN技术不仅能够控制广播,还可以增强网络的安全性。VLAN工作在OSI参考模型的数据链路层,一个VLAN就是一个交换网络,其中的所有用户都在同一个广播域中,各VLAN通过路由设备的连接实现通信。
VLAN的优势
给局域网的设计增加了灵活性,使管理员在划分工作组时,不再受限于用户所在的物理位置。具有灵活性和可扩展性等特点,还有以下好处:
- 控制广播
- 增强网络安全性
- 简化网络管理
VLAN种类
静态VLAN:基于端口的VLAN,是目前常见的实现方式
动态VLAN:基于MAC地址的动态VLAN
VLAN Trunk
trunk的作用:为了实现不同交换机上的相同VLAN之间的通信。
在交换网络中,有两种类型链路:接入链路和中继链路。
接入链路:通常属于一个VLAN,客户机与交换机之间的链路就是接入链路;
中继链路:可以承载多个VLAN,交换机与交换机之间的链路为中继链路实现承载多条VLAN通信;
EthernetChannel(以太网通道)
通过捆绑多条以太链路来进行提高带宽,并运行一种机制将多条物理链路捆绑成一条逻辑链路。
以太网通道遵循以下规则:
- 参与捆绑的端口必须属于同一个VLAN;
- 链路两端的端口必须一致,如交换机某端口为中继模式那么相邻交换机的那个端口也必须为中继模式;
- 所有参与捆绑的端口物理参数必须相同,应该有相同的速率和双工模式;
实验环境
GNS 3
实验拓扑图
配置命令
SW1配置
SW1>en SW1#conf t Enter configuration commands, one per line. End with CNTL/Z. SW1(config)#no ip routing #关闭路由 SW1(config)#vlan 10,20 #创建vlan10,vlan20 SW1(config-vlan)#ex SW1(config)#int f1/0 SW1(config-if)#sw mo acc SW1(config-if)#sw acc vlan 10 #将接口加入vlan10 SW1(config-if)#ex SW1(config)#int f1/1 SW1(config-if)#sw mo acc SW1(config-if)#sw acc vlan 20 #将接口加入vlan20 SW1(config-if)#ex SW1(config)#int f1/2 SW1(config-if)#sw mo tr SW1(config-if)#sw tr en dot1q #该接口封装协议dot1q SW1(config-if)#ex SW1(config)#int f1/3 SW1(config-if)#sw mo tr SW1(config-if)#sw tr en dot1q #该接口封装协议dot1q SW1(config-if)#ex SW1(config)#int rang f1/2 - 3 SW1(config-if-range)#channel-group 1 mode on #建立以太网通道 Creating a port-channel interface Port-channel1 SW1(config-if-range)# *Mar 1 00:07:38.235: %EC-5-BUNDLE: Interface Fa1/2 joined port-channel Po1 *Mar 1 00:07:38.295: %EC-5-BUNDLE: Interface Fa1/3 joined port-channel Po1 SW1(config-if-range)#end SW1# *Mar 1 00:07:41.195: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to up SW1# *Mar 1 00:07:42.655: %SYS-5-CONFIG_I: Configured from console by console SW1#show etherchannel 1 summary #查看以太网通道 Flags: D - down P - in port-channel I - stand-alone s - suspended R - Layer3 S - Layer2 U - in use Group Port-channel Ports -----+------------+----------------------------------------------------------- 1 Po1(SU) Fa1/2(P) Fa1/3(P)
SW2配置
SW2>en SW2#conf t Enter configuration commands, one per line. End with CNTL/Z. SW2(config)#no ip routing #关闭路由 SW2(config)#vlan 10,20 #创建vlan10,vlan20 SW2(config-vlan)#ex SW2(config)#int f1/0 SW2(config-if)#sw mo acc SW2(config-if)#sw acc vlan 10 #将接口加入vlan10 SW2(config-if)#ex SW2(config)#int f1/1 SW2(config-if)#sw mo acc SW2(config-if)#sw acc vlan 20 #将接口加入vlan20 SW2(config-if)#ex SW2(config)#int f1/2 SW2(config-if)#sw mo tr *Mar 1 00:09:15.299: %DTP-5-TRUNKPORTON: Port Fa1/2 has become dot1q trunk SW2(config-if)#sw tr en dot1q #该接口封装协议dot1q SW2(config-if)#ex SW2(config)#int f1/3 SW2(config-if)#sw mo tr *Mar 1 00:09:31.679: %DTP-5-TRUNKPORTON: Port Fa1/3 has become dot1q trunk SW2(config-if)#sw tr en dot1q #该接口封装协议dot1q SW2(config-if)#ex SW2(config)#channel SW2(config)#int rang f1/2 - 3 SW2(config-if-range)#channel-group 1 mode on #建立以太网通道 Creating a port-channel interface Port-channel1 *Mar 1 00:10:03.419: %EC-5-BUNDLE: Interface Fa1/2 joined port-channel Po1 *Mar 1 00:10:03.475: %EC-5-BUNDLE: Interface Fa1/3 joined port-channel Po1 SW2(config-if-range)#end SW2# *Mar 1 00:10:06.391: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to up *Mar 1 00:10:06.775: %SYS-5-CONFIG_I: Configured from console by console SW2#show etherchannel 1 summary #查看以太网通道 Flags: D - down P - in port-channel I - stand-alone s - suspended R - Layer3 S - Layer2 U - in use Group Port-channel Ports -----+------------+----------------------------------------------------------- 1 Po1(SU) Fa1/2(P) Fa1/3(P)
实验结果
原文地址:https://blog.51cto.com/10316297/2112022