VLAN(Vlan Local Area Network,虚拟局域网)技术,可以从逻辑上将一个大的网络划分为若干个小的虚拟局域网,VLAN技术不仅能够控制广播,还可以增强网络的安全性。VLAN工作在O
.
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>enSW1#conf tEnter configuration commands, one per line. End with CNTL/Z.SW1(config)#no ip routing #关闭路由SW1(config)#vlan 10,20 #创建vlan10,vlan20SW1(config-vlan)#exSW1(config)#int f1/0SW1(config-if)#sw mo accSW1(config-if)#sw acc vlan 10 #将接口加入vlan10SW1(config-if)#exSW1(config)#int f1/1SW1(config-if)#sw mo accSW1(config-if)#sw acc vlan 20 #将接口加入vlan20SW1(config-if)#exSW1(config)#int f1/2SW1(config-if)#sw mo trSW1(config-if)#sw tr en dot1q #该接口封装协议dot1qSW1(config-if)#exSW1(config)#int f1/3SW1(config-if)#sw mo trSW1(config-if)#sw tr en dot1q #该接口封装协议dot1qSW1(config-if)#exSW1(config)#int rang f1/2 - 3SW1(config-if-range)#channel-group 1 mode on #建立以太网通道Creating a port-channel interface Port-channel1SW1(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 Po1SW1(config-if-range)#endSW1#*Mar 1 00:07:41.195: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to upSW1#*Mar 1 00:07:42.655: %SYS-5-CONFIG_I: Configured from console by consoleSW1#show etherchannel 1 summary #查看以太网通道Flags: D - down P - in port-channel I - stand-alone s - suspended R - Layer3 S - Layer2 U - in useGroup Port-channel Ports-----+------------+-----------------------------------------------------------1 Po1(SU) Fa1/2(P) Fa1/3(P)
SW2配置
SW2>enSW2#conf tEnter configuration commands, one per line. End with CNTL/Z.SW2(config)#no ip routing #关闭路由SW2(config)#vlan 10,20 #创建vlan10,vlan20SW2(config-vlan)#exSW2(config)#int f1/0SW2(config-if)#sw mo accSW2(config-if)#sw acc vlan 10 #将接口加入vlan10SW2(config-if)#exSW2(config)#int f1/1SW2(config-if)#sw mo accSW2(config-if)#sw acc vlan 20 #将接口加入vlan20SW2(config-if)#exSW2(config)#int f1/2SW2(config-if)#sw mo tr*Mar 1 00:09:15.299: %DTP-5-TRUNKPORTON: Port Fa1/2 has become dot1q trunkSW2(config-if)#sw tr en dot1q #该接口封装协议dot1qSW2(config-if)#exSW2(config)#int f1/3SW2(config-if)#sw mo tr*Mar 1 00:09:31.679: %DTP-5-TRUNKPORTON: Port Fa1/3 has become dot1q trunkSW2(config-if)#sw tr en dot1q #该接口封装协议dot1qSW2(config-if)#exSW2(config)#channelSW2(config)#int rang f1/2 - 3SW2(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 Po1SW2(config-if-range)#endSW2#*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 consoleSW2#show etherchannel 1 summary #查看以太网通道Flags: D - down P - in port-channel I - stand-alone s - suspended R - Layer3 S - Layer2 U - in useGroup Port-channel Ports-----+------------+-----------------------------------------------------------1 Po1(SU) Fa1/2(P) Fa1/3(P)