Cisco 交换机 EtherChannel 配置端口聚合

作者: xiaozhu 发布时间: 2022-10-15 浏览: 2550 次 编辑

EtherChannel 配置端口聚合

1. 能够将多个物理端口绑定为一个逻辑端口,能充分利用现有端口来增加带宽。

2. Cisco交换机最多允许绑定8个端口。

如果是100Mbps端口,汇聚后可达800Mbit/s

如果是1000Mbps端口,汇聚后可达8Gbit/s

3. 绑定后的端口默认继承原来物理接口的配置模式。

4. Cisco的交换机不仅可以支持第二层Eherchannel,还可以支持第三层Etherchannel。

5. 一个Etherchannel内所有的端口都必须具有相同的速率和双工模式。LACP只能是全双工。

6、二层接口和三层接口的区别:

二层接口不能配置IP地址,不能宣告进路由协议,只能对二层以太网帧进行转发。

三层接口可以配置IP地址,可运行路由协议,能接收IP包并且转发。

7、EtherChannel的模式:

可以直接将物理端口绑定,也可以让两台交换机之间通过协议进行协商,来形成channel通道。

On:强行起etherchannel

Sw1(config)#int range f0/8 ,f0/9

Sw1(config-if-range)#channel-group 1 mode on

(将这两个接口绑定为一组并指定on模式组号本地有效)

Sw1(config)#interface port-channel 1

Sw1(config-if)#switchport mode trunk

( 指定接口模式为trunk,如不指定,会自动继承物理接口的模式)

Sw1#show etherchannel summary

(可以看到绑定了多少接口)

Sw1#Show interface etherchannel

Sw1(config)#no interface port-channel 1

(拆除etherchannel)

注意:强行起通道的话要在短期内在双方启用。否则可能环路。协商起链路则没有这问题,因为启用不起通道的话会down。

8、端口聚合协议--Port Aggregation Protocol (PAgP)

Cisco私有技术,该协议有两种模式:

auto:被动只收不发

Desirable:主动 会发也会收协商消息

Sw1(config)#int range f0/8 ,f0/9

Sw1(config-if-range)#channel-group 1 mode desible

Sw1(config)#int range f0/8 ,f0/9

Sw1(config-if-range)#channel-group 1 mode auto

Sw1(config)#interface port-channel 1

Sw1(config-if)#switchport mode trunk

Link Aggregation Control Protocol (LACP) 链路聚合控制协议

802.3ad,业界标准

Passvie相当于PAgP的auto

Active相当于PAgP的desirable 又发又收协商消息

Sw1(config)#int range f0/8 ,f0/9

Sw1(config-if-range)#channel-group 1 mode passive

Sw1(config)#int range f0/8 ,f0/9

Sw1(config-if-range)#channel-group 1 mode active

Sw1(config)#interface port-channel 1

Sw1(config-if)#switchport mode trunk

show etherchannel 1 summary

show etherchannel summary 查看所有的group

还有一种好的办法是先对每个接口封装trunk,再划入channel-group中,channel-group接口会自动继承trunk

注:channel-group接口会自动继承第一个物理接口的接口配置模式,或最先配置的接口模式。

配置三层channel

所谓三层的channel其实就是将多个三层接口绑定。只能在三层交换机上配置。

在3550这样的交换机上,所有接口默认都是二层接口。首先需要将交换机的的二层接口改为三层接口。可用以下命令实现:

3550(config)#interface gigabitethernet 0/1

3550(config-if)#no switchport

然后再绑定:

3550(config-if)#channel-group 1 mode desirable

3550(config-if)#exit

将另一个端口也绑进来

3550(config)#interface gigabitethernet 0/2

3550(config-if)#no switchport

3550(config-if)#channel-group 1 mode desirable

3550(config-if)#exit

给channel通道配上IP地址:

3550(config)#interface port-channel 1

3550(config-if)#ip address 100.1.1.1 255.255.255.0

当物理接口放进了逻辑接口,那物理接口的配置就忽略了,如ip地址。

配置etherchannel负载均衡

默认情况下是基于源MAC地址的负载均衡

port-channel load-balance [dst-mac|src-mac]

show etherchannel load-balance

3560可以基于源目IP来做负载均衡

Err-disable特性:

接口如果进入err-disable状态:有两种方法恢复

1、手动恢复

先shutdown、再no shutdown

2、自动恢复

errdisable recovery cause {all|arp-inspection|bpduguard|link-flap} 指定原因

errdisable recovery interval 30 指定自动恢复时间间隔

两台交换机之间是否形成EtherChannel也可以用协议自动协商。目前有两个协商协议:PAGP和LACP,前者是CISCO专有的协议,而LACP是公共的标准。

LACP协商的规律

ON active passive

ON √ × ×

active × √ √

passive × √ ×

PAGP协商的规律

ON Desirable auto

ON √ × ×

desirable × √ √

auto × √ ×

要想把接口配置为PAGP 的desirable 模式使用命令:“channel-group 1 mode desirable”;

要想把接口配置为PAGP 的auto 模式使用命令:“channel-group 1 mode auto”;

要想把接口配置为LACP 的active 模式使用命令:“channel-group 1 mode active”;

要想把接口配置为LACP 的passive 模式使用命令:“channel-group 1 mode passive”。

端口通道负载均衡 port-channel load-balance

sw1(config)#port-channel load-balance ?

dst-ip Dst IP Addr

dst-mac Dst Mac Addr

src-dst-ip Src XOR Dst IP Addr

src-dst-mac Src XOR Dst Mac Addr

src-ip Src IP Addr

src-mac Src Mac Addr

sw1#show etherchannel 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(SD) Fa0/0(s) Fa0/1(s)

sw1#show etherchannel load-balance

Po1 ---> Source XOR Destination IP address

备注:

1、以太网通道最多可以捆绑8条物理链路

2、捆绑遵循以下规则:

(1)相同VLAN

(2)端口中继模式

(3)相同speed和duplex