1.背景
端口聚合将两个设备间多条物理链路捆绑在一起组成逻辑链路,一是可实现增加带宽;除了增加带宽外,二是端口聚合还可以在多条链路上均衡分配流量,起到负载分担的作用;三是当一条或多条链路故障时,只要还有链路正常,流量将转移到其它的链路上,从而起到冗余的作用,增强了网络的稳定性和安全性。主要作用为:
- 链路捆绑,增加带宽。
- 多条链路流量负载分担
- 冗余链路,保障稳定
1.1 端口聚合两种协议
PAgP(Port Aggregation Protocol )思科私有 :端口聚合协议。
LACP(Link Aggregation Control Protocol)是基于IEEE 802.3ad的国际标准,是一种实现链路动态聚合的协议,日常工作中使用较多。
1.2 PAgP协议
- On:通道成员不协商,手工指定的强制模式。
- Desirable:主动发送PAgP报文,积极的想和对端协商。
- Auto:被动发送PAgP报文,等待对端询问,就同意建立。
- Off:接口不配置Etherchannel。
1.3 LACP协议
- On:通道成员不协商,手工指定的强制模式。
- Active:主动发送PAgP报文,积极的想和对端协商。
- Passive:被动发送PAgP报文,等待对端询问,就同意建立。
- Off:接口不配置Etherchannel。
2.端口聚合配置
2.1 LACP二层配置
SW1配置:
Switch(config)#hostname SW1
SW1(config)##interface range e0/0-2
SW1(config-if-range)#shutdown
SW1(config-if-range)#channel-group 1 mode active
SW2配置:
Switch(config)#hostname SW2
SW2(config)##interface range e0/0-2
SW2(config-if-range)#shutdown
SW2(config-if-range)#channel-group 1 mode active
验证:
SW1#show 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) LACP Et0/0(P) Et0/1(P) Et0/2(P)
SW1#show ip interface br
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 unassigned YES unset up up
Ethernet0/1 unassigned YES unset up up
Ethernet0/2 unassigned YES unset up up
Ethernet0/3 unassigned YES unset up up
Port-channel1 unassigned YES unset up up
PC验证通信:
VPC3> ping 192.168.1.2
84 bytes from 192.168.1.2 icmp_seq=1 ttl=64 time=0.941 ms
84 bytes from 192.168.1.2 icmp_seq=2 ttl=64 time=1.324 ms
84 bytes from 192.168.1.2 icmp_seq=3 ttl=64 time=1.414 ms
84 bytes from 192.168.1.2 icmp_seq=4 ttl=64 time=1.350 ms
84 bytes from 192.168.1.2 icmp_seq=5 ttl=64 time=1.739 ms
2.2 LACP三层端口配置
SW1配置:
SW1(config)##interface range e0/0-2
SW1(config-if-range)#shutdown
SW1(config-if-range)#no switchport
SW1(config-if-range)#channel-group 1 mode active
SW1(config)#interface port-channel 1
SW1(config-if)#ip address 12.1.1.1 255.255.255.0
SW2配置:
SW2(config)##interface range e0/0-2
SW2(config-if-range)#shutdown
SW2(config-if-range)#no switchport
SW2(config-if-range)#channel-group 1 mode active
SW2(config)#interface port-channel 1
SW2(config-if)#ip address 12.1.1.2 255.255.255.0
验证:
SW1#show etherchannel su
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(RU) LACP Et0/0(P) Et0/1(P) Et0/2(P)
SW1#ping 12.1.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.1.2, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/3 ms