当交换机之间需要链路冗余的时候,由于有生成树的存在,导致无论多少条冗余,最终都只能有一条是可以通信的。
可以使用ethernet channel的手段将多个接口捆绑,作为一个接口和另外一个交换机相连,这样在逻辑上就没有环路,也就不需要生成树。并且多个链路都可以利用,不会浪费。
如图所示,Sw2的e0/2接口会被阻塞,最终导致只有e0/1接口的线路可以通信,下面试试链路捆绑
Sw1(config)#int range e0/1 -2
Sw1(config-if-range)#channel-group 1 mode on
===========================
Sw2(config)#int range e0/1 -2
Sw2(config-if-range)#channel-group 1 mode on
查看是否捆绑
Sw1#sh etherchannel summary
Flags: D - down P - bundled in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
R - Layer3 S - Layer2
U - in use N - not in use, no aggregation
f - failed to allocate aggregator
M - not in use, minimum links not met
m - not in use, port not aggregated due to minimum links not met
u - unsuitable for bundling
w - waiting to be aggregated
d - default port
A - formed by Auto LAG
Number of channel-groups in use: 1
Number of aggregators: 1
Group Port-channel Protocol Ports
------+-------------+-----------+-----------------------------------------------
1 Po1(SU) - Et0/1(P) Et0/2(P)
Sw2#sh int port-channel 1
Port-channel1 is up, line protocol is up (connected)
Hardware is EtherChannel, address is aabb.cc00.2010 (bia aabb.cc00.2010)
MTU 1500 bytes, BW 20000 Kbit/sec, DLY 1000 usec,
reliability 255/255, txload 1/255, rxload 1/255
负载均衡
多条线路捆绑了之后,流量可以选择不同的负载均衡方式
默认的行为:源目IP地址对(src-dst-ip)
Sw2(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