链路聚合 eth-trunk (链路捆绑)
① 链路聚合概述
作用:增加链路带宽,同时提供链路冗余
链路聚合两种模式:
a 手工负载分担模式:强制模式,没有协商机制,有几条
链路用几条链路,“死板” (默认模式)
b LACP模式 :可以自定义备份链路,“灵活”,有协商报文。(推荐)
② 二层链路聚合
配置:
sw1:
int eth-trunk 1 创建捆绑组1
interface GigabitEthernet0/0/1
eth-trunk 1 将gi0/0/1口加入捆绑组1
interface GigabitEthernet0/0/2
eth-trunk 1
interface GigabitEthernet0/0/3
eth-trunk 1
interface GigabitEthernet0/0/4
eth-trunk 1
sw2:(配置方法二)
int eth-trunk 1
trunkport gi 0/0/1 to 0/0/4 将接口gi0/0/1 到gi0/0/4
全部加入捆绑组 1
修改负载均衡的方式:(可选)
int eth-trunk 1
load-balance xxxx
注意:默认负载均衡方式src-dst-ip 。
将捆绑之后的链路配置为trunk链路:
两台交换机:
interface Eth-Trunk1
port link-type trunk
port trunk allow-pass vlan all
③ 三层链路聚合路由器和路由器
R1:
interface Eth-Trunk 1
undo portswitch 将二层逻辑接口提升为三层接口
ip address 12.1.1.1 255.255.255.0
interface GigabitEthernet0/0/0
eth-trunk 1
interface GigabitEthernet0/0/1
eth-trunk 1
R2:
interface Eth-Trunk1
undo portswitch
ip address 12.1.1.2 255.255.255.0
interface GigabitEthernet0/0/0
eth-trunk 1
interface GigabitEthernet0/0/1
eth-trunk 1
负载均衡 冗余 断掉任何一根线缆 通信不受影响
三层链路聚合 交换机和交换机
两台交换机配置类似:
sw1:
vlan 10
interface Eth-Trunk 1
port link-type access
port default vlan 10
interface GigabitEthernet0/0/1
eth-trunk 1
interface GigabitEthernet0/0/2
eth-trunk 1
interface Vlanif10
ip address 12.1.1.2 255.255.255.0
sw2:
vlan 10
interface Vlanif10
ip address 12.1.1.1 255.255.255.0
interface Eth-Trunk1
port link-type access
port default vlan 10
interface GigabitEthernet0/0/1
eth-trunk 1
interface GigabitEthernet0/0/2
eth-trunk 1
三层链路聚合 路由器和多层交换机
R1:
interface Eth-Trunk1
undo portswitch
ip address 12.1.1.1 255.255.255.0
interface GigabitEthernet0/0/0
eth-trunk 1
interface GigabitEthernet0/0/1
eth-trunk 1
sw1:
vlan 10
interface Eth-Trunk1
port link-type access
port default vlan 10
interface GigabitEthernet0/0/1
eth-trunk 1
interface GigabitEthernet0/0/2
eth-trunk 1
interface Vlanif10
ip address 12.1.1.2 255.255.255.0
完成后,任意断某根线不受影响。
LACP 模式特性
sw1:
int eth-trunk 1
mode lacp-static (该指令必须先配置,然后再向该捆绑组添加成员接口)
trunkport gi 0/0/1 to 0/0/4
sw2:
int eth-trunk 1
mode lacp-static (该指令必须先配置,然后再向该捆绑组添加成员接口)
trunkport gi 0/0/1 to 0/0/4
配置sw1 为主设备:
[ ] lacp priority 50 系统优先级默认是32768 ,数字越小越优先。
int eth-trunk 1
max active-linknumber 2 指定最大活跃接口数量
int gi 0/0/1
lacp priority 10 接口优先级,数字越小越被优先选用
int gi 0/0/2
lacp priority 20
int gi 0/0/3
lacp priority 30
int gi 0/0/4
lacp priority 40
int eth-trunk 1
least active-linknumber 2 最少活跃链路的数量,如果up链路少于2个 整条捆绑链路down 掉。
,