A-A+

CISCO设备之端口聚合详解

2015年11月26日 站长资讯 暂无评论

所谓端口聚合,指的是把两个或多个物理端口捆绑成一个逻辑链路,两设备多个端口两两相连,从而增加链路带宽,可起到负载均衡的作用,而且多条线路间还能形成冗余备份。比方说,两个千M端口聚合后带宽就有2G,如果其中一个端口down了或线路出问题了并不影响网络的正常运行,只是带宽变成了1G而已,增加了网络的可靠性。

端口聚合分手动和自动协商两种方式:

  1. SW0(config)#interface range gigabitEthernet0/1-2            //进入端口G0/1与G0/2  
  2. SW0(config-if-range)#channel-group 1 mode ?                 //查看端口聚合模式  
  3.  active      Enable LACP unconditionally                    //主动发送LACPDU报文  
  4.  auto        Enable PAgP only if aPAgP device is detected   //相当于passive(PAgP)  
  5.  desirable   Enable PAgP unconditionally                    //相当于active(PAgP)   
  6.  on          Enable Etherchannel only             //手动方式(两端都on,配置后会使用PAgP)  
  7.  passive    Enable LACP only if a LACP device is detected   //被动接收LACPDU报文  
  8. SW0(config-if-range)#channel-group 1 modea ctive  

on不属于任何一个协议,但配置后会使用PagP协议,两端都需on;如果服务不支持任何协商协议,推荐此模式。

PAgP(Port Aggregation Protocol):CISCO私有协议,有auto和desirable模式。PAgP 可以用来自动创建快速EtherChannel 链路。在使用PAgP配置EtherChannel链路时,PAgP数据包就会在启用了EtherChannel的端口之间发送,以协商建立起这条通道。在PAgP识别出匹配的以太网链路之后,它就会将这些链路放入一个EtherChannel组中。而生成树会将EtherChannel看成是一个单独的桥接端口。

PAgP 数据包每30秒发送一次。PAgP 会通过这些数据包来查看两端的配置是否一致,并以此管理交换机两端添加链路及链路失效问题。

LACP(Link aggregation Control Protocol):基于IEEE802.3ad标准,是一种实现链路动态聚合的协议。LACP协议通过LACPDU(Link AggregationControl Protocol Data Unit,链路聚合控制协议数据单元)与对端交互信息。启用端口的LACP协议后,该端口将通过发送LACPDU向对端通告自己的系统优先级、MAC地址、端口优先级、端口号和操作Key;对端接收到这些信息后,将这些信息与其它端口所保存的信息比较以选择能够聚合的端口,从而双方可以对端口加入或退出某个动态聚合组达成一致。

操作Key是在端口聚合时,LACP协议根据端口的配置(即速率、双工、基本配置、管理Key)生成的一个配置组合。

动态聚合端口在启用LACP协议后,其管理Key缺省为零。静态聚合端口在启用LACP后,端口的管理Key与聚合组ID相同。

对于动态聚合组而言,同组成员一定有相同的操作Key,而手工和静态聚合组中,处于Active的端口具有相同的操作Key。

工作模式:

Active:主动模式,该模式下端口会主动向对端发送LACPDU报文,进行LACP协议的计算。
passive:被动模式,该模式下端口不会主动发送LACPDU报文,在接收到对端发送的LACP报文后,该端口进入协议计算状态。

实验拓扑图如下:

因部分命令在真机上操作,所以下面会看G口和F口,不用管它,当成一种口就OK了。

1)SW0 port-channel配置

SW0(config)#interface port-channel 1

SW0(config-if)#description port-channel

SW0(config-if)#switchport mode trunk

2) SW0物理接口捆绑

  1. SW0(config)#interfacerange gigabitEthernet 0/1-2  
  2. SW0(config-if-range)#channel-protocol lacp          //如果配置on,则可省略此条命令,PagP的话改之即可  
  3. SW0(config-if-range)#channel-group 1 mode ?  
  4.  active       Enable LACP unconditionally  
  5.  auto        EnablePAgP only if a PAgP device is detected  
  6.  desirable    Enable PAgP unconditionally  
  7.  on         Enable Etherchannelonly  
  8.  passive     EnableLACP only if a LACP device is detected  
  9. SW0(config-if-range)#channel-group 1 mode active  
  10.   
  11. SW0(config-if-range)#  

在SW1上做相同的配置即可完成聚合,配置完成后检查下配置结果:

a.show etherchannelsummary //查看聚合信息

可看到f0/1与f0/2已聚合成功,SU表示etherchannel正常(还需注意Ports都应为P,D的话就有问题了),如果是SD,你则需检查下配置了是否有误了。

b.show etherchannel port-channel //查看通道包含的接口

c.show etherchannel protocol //查看通道使用的协议

d.show etherchannel load-balance //查看负载均衡分配方案

默认基于MAC地址负载均衡,可配置基于IP方式。

  1. e:show interfaces port-channel                       //查看通道接口状况(机人只有一台物理机,所以状态都是down,PT无此命令)  
  2. SW0#show interfaces port-channel 1  
  3. Port-channel1 isdown, line protocol is down (notconnect)  
  4.  Hardware is EtherChannel, address is 0000.0000.0000 (bia 0000.0000.0000)  
  5.  Description: port-channel  
  6.   MTU1500 bytes, BW 10000 Kbit, DLY 1000 usec,  
  7.     reliability 255/255, txload 1/255, rxload 1/255  
  8.  Encapsulation ARPA, loopback not set  
  9.  Keepalive set (10 sec)  
  10.  Auto-duplex, Auto-speed, link type is auto, media type is unknown  
  11.  input flow-control is off, output flow-control is unsupported  
  12.   ARPtype: ARPA, ARP Timeout 04:00:00  
  13.  Last input never, output never, output hang never  
  14.  Last clearing of "show interface" counters never   
  15.  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0  
  16.  Queueing strategy: fifo  
  17.  Output queue: 0/40 (size/max)  
  18.   5minute input rate 0 bits/sec, 0 packets/sec  
  19.   5minute output rate 0 bits/sec, 0 packets/sec  
  20.     0 packets input, 0 bytes, 0 no buffer  
  21.     Received 0 broadcasts (0 multicasts)  
  22.     0 runts, 0 giants, 0 throttles  
  23.     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored  
  24.     0 watchdog, 0 multicast, 0 pause input  
  25.     0 input packets with dribble condition detected  
  26.     0 packets output, 0 bytes, 0 underruns  
  27.     0 output errors, 0 collisions, 1 interface resets  
  28.     0 babbles, 0 late collision, 0 deferred  
  29.      0 lost carrier, 0 no carrier, 0 PAUSE output  
  30.     0 output buffer failures, 0 output buffers swapped out  
标签:

给我留言