(1)概念
链路聚合一般部署在核心结点,以便提升整个网络的数据吞吐量。
链路聚合能够提高链路带宽,增强网络可用性,支持负载分担。
手工负载分担模式下所有活动接口都参与数据的转发,分担负载流量。
LACP模式支持链路备份。
Eth-Trunk链路两端相连的物理接口的数量、速率、双工方式、流控方式必须一致。
(2)手工负载分担模式(Eth-Trunk)链路聚合配置(二层)
1 端口添加
SW1和SW2分别采用两种方法添加Eth-Trunk
SW1:
[sw1]vlan batch 2 to 3
[sw1]int g0/0/1
[sw1-GigabitEthernet0/0/1]port link-type access
[sw1-GigabitEthernet0/0/1]port default vlan 2
[sw1-GigabitEthernet0/0/1]int g0/0/2
[sw1-GigabitEthernet0/0/2]port link-type access
[sw1-GigabitEthernet0/0/2]port default vlan 3
[sw1-GigabitEthernet0/0/2]quit
[sw1]interface Eth-Trunk 1
[sw1-Eth-Trunk1]port link-type trunk
[sw1-Eth-Trunk1]port trunk allow-pass vlan 2 3
[sw1-Eth-Trunk1]trunkport GigabitEthernet 0/0/3
[sw1-Eth-Trunk1]trunkport GigabitEthernet 0/0/4
[sw1-Eth-Trunk1]trunkport GigabitEthernet 0/0/5
[sw1-Eth-Trunk1]trunkport GigabitEthernet 0/0/6
SW2:
vlan batch 2 to 3
interface GigabitEthernet0/0/1
port link-type access
port default vlan 2
interface GigabitEthernet0/0/2
port link-type access
port default vlan 3
interface Eth-Trunk 1
port link-type trunk
port trunk allow-pass vlan 2 to 3
interface GigabitEthernet0/0/3
eth-trunk 1
interface GigabitEthernet0/0/4
eth-trunk 1
interface GigabitEthernet0/0/5
eth-trunk 1
interface GigabitEthernet0/0/6
eth-trunk 1
PC1可以ping通PC3
PC>ping 192.168.2.2
Ping 192.168.2.2: 32 data bytes, Press Ctrl_C to break
From 192.168.2.2: bytes=32 seq=1 ttl=128 time=62 ms
From 192.168.2.2: bytes=32 seq=2 ttl=128 time=31 ms
From 192.168.2.2: bytes=32 seq=3 ttl=128 time=62 ms
From 192.168.2.2: bytes=32 seq=4 ttl=128 time=63 ms
From 192.168.2.2: bytes=32 seq=5 ttl=128 time=62 ms
--- 192.168.2.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 31/56/63 ms
PC2可以ping通PC4
PC>ping 192.168.3.2
Ping 192.168.3.2: 32 data bytes, Press Ctrl_C to break
From 192.168.3.2: bytes=32 seq=1 ttl=128 time=62 ms
From 192.168.3.2: bytes=32 seq=2 ttl=128 time=63 ms
From 192.168.3.2: bytes=32 seq=3 ttl=128 time=47 ms
From 192.168.3.2: bytes=32 seq=4 ttl=128 time=47 ms
From 192.168.3.2: bytes=32 seq=5 ttl=128 time=47 ms
--- 192.168.3.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 47/53/63 ms
2查看命令
[sw1]dis stp brief
MSTID Port Role STP State Protection
0 GigabitEthernet0/0/1 DESI FORWARDING NONE
0 GigabitEthernet0/0/2 DESI FORWARDING NONE
0 Eth-Trunk1 DESI FORWARDING NONE
[sw2]dis stp brief
MSTID Port Role STP State Protection
0 GigabitEthernet0/0/1 DESI FORWARDING NONE
0 GigabitEthernet0/0/2 DESI FORWARDING NONE
0 Eth-Trunk1 ROOT FORWARDING NONE
[sw1]dis int b
PHY: Physical
*down: administratively down
(l): loopback
(s): spoofing
(b): BFD down
(e): ETHOAM down
(dl): DLDP down
(d): Dampening Suppressed
InUti/OutUti: input utility/output utility
Interface PHY Protocol InUti OutUti inErrors outErrors
Eth-Trunk1 up up 0% 0% 0 0
GigabitEthernet0/0/3 up up 0% 0% 0 0
GigabitEthernet0/0/4 up up 0% 0% 0 0
GigabitEthernet0/0/5 up up 0% 0% 0 0
GigabitEthernet0/0/6 up up 0% 0% 0 0
... ...
[sw1]dis eth-trunk 1
Eth-Trunk1's state information is:
WorkingMode: NORMAL Hash arithmetic: According to SIP-XOR-DIP
Least Active-linknumber: 1 Max Bandwidth-affected-linknumber: 8
Operate status: up Number Of Up Port In Trunk: 4
-----------------------------------------------------------------
PortName Status Weight
GigabitEthernet0/0/3 Up 1
GigabitEthernet0/0/4 Up 1
GigabitEthernet0/0/5 Up 1
GigabitEthernet0/0/6 Up 1
3负载均衡
该设置为可选配置,非必须
[sw1]int Eth-Trunk 1
[sw1-Eth-Trunk1]load-balance ?
dst-ip According to destination IP hash arithmetic
dst-mac According to destination MAC hash arithmetic
src-dst-ip According to source/destination IP hash arithmetic
src-dst-mac According to source/destination MAC hash arithmetic
src-ip According to source IP hash arithmetic
src-mac According to source MAC hash arithmetic
根据实际需要选择模式
[sw1-Eth-Trunk1]load-balance src-mac
[sw1-Eth-Trunk1]dis eth-trunk 1
Eth-Trunk1's state information is:
WorkingMode: NORMAL Hash arithmetic: According to SA
Least Active-linknumber: 1 Max Bandwidth-affected-linknumber: 8
Operate status: up Number Of Up Port In Trunk: 4
-----------------------------------------------------------------
PortName Status Weight
GigabitEthernet0/0/3 Up 1
GigabitEthernet0/0/4 Up 1
GigabitEthernet0/0/5 Up 1
GigabitEthernet0/0/6 Up 1
(3)LACP模式的链路聚合配置
1端口添加
sw1、sw2:
[sw1]vlan batch 2 to 3
[sw1]int Eth-Trunk 1
[sw1-Eth-Trunk1]mode lacp-static
[sw1-Eth-Trunk1]trunkport g0/0/3
[sw1-Eth-Trunk1]trunkport g0/0/4
[sw1-Eth-Trunk1]trunkport g0/0/5
[sw1-Eth-Trunk1]trunkport g0/0/6
[sw1-Eth-Trunk1]port link-type trunk
[sw1-Eth-Trunk1]port trunk allow-pass vlan 2 3
PC1可以ping通PC3
PC>ping 192.168.2.2
Ping 192.168.2.2: 32 data bytes, Press Ctrl_C to break
From 192.168.2.2: bytes=32 seq=1 ttl=128 time=62 ms
From 192.168.2.2: bytes=32 seq=2 ttl=128 time=31 ms
From 192.168.2.2: bytes=32 seq=3 ttl=128 time=62 ms
From 192.168.2.2: bytes=32 seq=4 ttl=128 time=63 ms
From 192.168.2.2: bytes=32 seq=5 ttl=128 time=62 ms
--- 192.168.2.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 31/56/63 ms
PC2可以ping通PC4
PC>ping 192.168.3.2
Ping 192.168.3.2: 32 data bytes, Press Ctrl_C to break
From 192.168.3.2: bytes=32 seq=1 ttl=128 time=62 ms
From 192.168.3.2: bytes=32 seq=2 ttl=128 time=63 ms
From 192.168.3.2: bytes=32 seq=3 ttl=128 time=47 ms
From 192.168.3.2: bytes=32 seq=4 ttl=128 time=47 ms
From 192.168.3.2: bytes=32 seq=5 ttl=128 time=47 ms
--- 192.168.3.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 47/53/63 ms
2备份链路配置
通过配置链路优先级,实现主备链路配置
[sw1]dis Eth-Trunk 1
Eth-Trunk1's state information is:
Local:
LAG ID: 1 WorkingMode: STATIC
Preempt Delay: Disabled Hash arithmetic: According to SIP-XOR-DIP
System Priority: 32768 System ID: 4c1f-cc68-3f9c
Least Active-linknumber: 1 Max Active-linknumber: 8
Operate status: up Number Of Up Port In Trunk: 4
-----------------------------------------------------------------
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
GigabitEthernet0/0/3 Selected 1GE 32768 4 305 10111100 1
GigabitEthernet0/0/4 Selected 1GE 32768 5 305 10111100 1
GigabitEthernet0/0/5 Selected 1GE 32768 6 305 10111100 1
GigabitEthernet0/0/6 Selected 1GE 32768 7 305 10111100 1
#对端
Partner:
-----------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
GigabitEthernet0/0/3 32768 4c1f-ccec-0236 32768 4 305 10111100
GigabitEthernet0/0/4 32768 4c1f-ccec-0236 32768 5 305 10111100
GigabitEthernet0/0/5 32768 4c1f-ccec-0236 32768 6 305 10111100
GigabitEthernet0/0/6 32768 4c1f-ccec-0236 32768 7 305 10111100
修改SW1的LACP优先级,使SW1成为主动端
[sw1]lacp priority 100
[sw1]dis eth-trunk 1
Eth-Trunk1's state information is:
Local:
LAG ID: 1 WorkingMode: STATIC
Preempt Delay: Disabled Hash arithmetic: According to SIP-XOR-DIP
System Priority: 100 System ID: 4c1f-cc68-3f9c
Least Active-linknumber: 1 Max Active-linknumber: 8
Operate status: up Number Of Up Port In Trunk: 4
设置活动链路限制及端口LACP优先级,使g0/0/3、g0/0/4成为活动端口
[sw1]int Eth-Trunk 1
[sw1-Eth-Trunk1]max active-linknumber 2
[sw1-Eth-Trunk1]int g0/0/3
[sw1-GigabitEthernet0/0/3]lacp priority 100
[sw1-GigabitEthernet0/0/3]int g0/0/4
[sw1-GigabitEthernet0/0/4]lacp priority 100
[sw1-GigabitEthernet0/0/4]dis eth-trunk 1
... ...
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
GigabitEthernet0/0/3 Selected 1GE 100 4 305 10111100 1
GigabitEthernet0/0/4 Selected 1GE 100 5 305 10111100 1
GigabitEthernet0/0/5 Unselect 1GE 32768 6 305 10100000 1
GigabitEthernet0/0/6 Unselect 1GE 32768 7 305 10100000 1
由于SW1为主动端,SW2端口状态与对端端口状态保持一致
[sw2]dis eth-trunk 1
... ...
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
GigabitEthernet0/0/3 Selected 1GE 32768 4 305 10111100 1
GigabitEthernet0/0/4 Selected 1GE 32768 5 305 10111100 1
GigabitEthernet0/0/5 Unselect 1GE 32768 6 305 10110000 1
GigabitEthernet0/0/6 Unselect 1GE 32768 7 305 10110000 1
3负载均衡
配置方式与Eth-Trunk的负载均衡配置方法一致
(4)三层链路聚合
模拟器上三层链路聚合只能在路由器上启用
AR1:
[AR1]int Eth-Trunk 1
[AR1-Eth-Trunk1]undo portswitch
[AR1-Eth-Trunk1]ip add 12.1.1.1 24
[AR1-Eth-Trunk1]trunkport g0/0/1
[AR1-Eth-Trunk1]trunkport g0/0/0
AR2:
[AR2]int Eth-Trunk 1
[AR1-Eth-Trunk1]undo portswitch
[AR1-Eth-Trunk1]ip add 12.1.1.2 24
[AR1-Eth-Trunk1]trunkport g0/0/1
[AR1-Eth-Trunk1]trunkport g0/0/0
AR1可以ping通AR2
[AR1]ping 12.1.1.2
PING 12.1.1.2: 56 data bytes, press CTRL_C to break
Reply from 12.1.1.2: bytes=56 Sequence=1 ttl=255 time=1050 ms
Reply from 12.1.1.2: bytes=56 Sequence=2 ttl=255 time=120 ms
Reply from 12.1.1.2: bytes=56 Sequence=3 ttl=255 time=140 ms
Reply from 12.1.1.2: bytes=56 Sequence=4 ttl=255 time=160 ms
Reply from 12.1.1.2: bytes=56 Sequence=5 ttl=255 time=100 ms
--- 12.1.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 100/314/1050 ms