链路聚合(Port-Channel)
一、简介
1. PortGroup
Portgroup是配置层面上的一个物理端口组,配置到port group里面的物理端口才可以参加链路汇聚,并成为portchannel里的某个成员端口。在逻辑上,port group并不是一个端口,而是一个端口序列。加入port group中的物理端口满足某种条件时进行端口汇聚,形成一个port channel,这个port channel具备了逻辑端口的属性,才真正成为一个独立的逻辑端口。
2. 配置PortChannel注意事项
- 选择Port-Channel的端口,端口数目必须是2、4或者8
- 必须使用同一组中的端口,在交换机上的端口分成了多个组,Port-Channel的所有端口必须来自同一个组
- 使用连续的端口;Port-Channel上的端口必须连续,比如你可以用端口1、2、3、4组合成一个端口汇聚
- 在一组端口只产生一个Port-Channel
- 端口均为全双工模式
- 端口速率必须相同
- 端口的类型必须一样,比如必须为GE端口或者10GE端口
- 端口同为access 端口并且属于同一个vlan 或同为trunk 端口
二、CLI命令
1. 操作设置类
// 加入链路组1并开启
channel-group 1 mode on
// 通过此命令在交换机查看端口聚合可以使用的协议
channel-group 1 mode ?
active Enable LACP unconditionally #主动发送LACP报文
auto Enable PAgP only if a PAgP device is detected #被动发送PAgP报文
desirable Enable PAgP unconditionally #主动发送PAgP报文
on Enable Etherchannel only #手动设置,需要两边都设置成on
passive Enable LACP only if a LACP device is detected #被动接收LACP报文
//
2. 信息查看类
// 加入链路组1并开启
channel-group 1 mode on
// 通过此命令在交换机查看端口聚合可以使用的协议
channel-group 1 mode ?
active Enable LACP unconditionally #主动发送LACP报文
auto Enable PAgP only if a PAgP device is detected #被动发送PAgP报文
desirable Enable PAgP unconditionally #主动发送PAgP报文
on Enable Etherchannel only #手动设置,需要两边都设置成on
passive Enable LACP only if a LACP device is detected #被动接收LACP报文
//
三、具体实现
1. SWRoot
SWRoot>en
SWRoot#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SWRoot(config)#int range f0/23 - 24
SWRoot(config-if-range)#channel-group 1 mode on
SWRoot(config-if-range)#
Creating a port-channel interface Port-channel 1
%LINK-5-CHANGED: Interface Port-channel1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to up
SWRoot(config-if-range)#exit
SWRoot(config)#int port-channel 1
SWRoot(config-if)#sw tr en do
SWRoot(config-if)#sw mo tr
SWRoot(config-if)#exit
2. SWServer
SWServer>en
SWServer#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SWServer(config)#int range f0/23 - 24
SWServer(config-if-range)#sw mo tr
SWServer(config-if-range)#sw tr al vl al
SWServer(config-if-range)#channel-group 1 mode on
SWServer(config-if-range)#
Creating a port-channel interface Port-channel 1
%LINK-5-CHANGED: Interface Port-channel1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to up