两交换机间存在多根线相连链路(没有配置以太网链路聚合)
此时,两个交换机stp端口角色对比
可以实现冗余性,转发状态的链路出现故障,其他备份链路通过stp协议选举端口角色,重新选择一条转发链路;
但带宽并没有增加;正常运行STP环境下,只会存在一根链路转发数据,导致带宽只有当前能转发的链路带宽。
如何实现多链路带宽增加,就需要配置链路聚合
链路聚合的优点:
1、增加带宽;所有参与链路都可以全部投入使用;
2、充分利用链路聚合成员链路,提供整个逻辑链路的效果;
3、增加网络的稳定性,链路聚合的逻辑链路只有当所有成员链路全部故障才会出现故障;
这样既具有冗余性,又增加了链路带宽
配置链路成员端口有2种方法:
方法1:
interface eth-trunk 1
trunkport Ethernet 0/0/1 to 0/0/3 #一次性关联成员端口
方法2:
interface eth-trunk 2
interface ethernet 0/0/1
eth-trunk 2
手动链路聚合配置
查看此时stp端口角色
查看链路聚合(此时链路带宽增加)
链路捆绑注意事项:(手动聚合的缺陷:因为设备间没有报文交换一旦非物理端口故障,就只能人为去确认,所以常运用到设备老旧、低端,不支持LACP协议)
1、两端设备的端口类型必须一致;
2、两端设备的端口配置(双工)保持一致;
链路聚合转发数据的算法:HASH 逐流转发
LACP模式配置(链路聚合控制协议)
LACP模式:采用LACP协议的一种链路聚合模式。设备间通过链路聚合控制协议数据单元(Link Aggregation Control Protocol Data Unit,LACPDU)进行交互,通过协议协商确保对端是同一台设备、同一个聚合接口的成员接口。
LACPDU报文中包含设备优先级、MAC地址、接口优先级、接口号等。 遵循越小越优先原则
为了方便实验,开启交换机先做以下配置
<sw5>undo terminal trapping #关闭终端告警信息
<sw5>system-view
[sw5]user-interface console 0 #进入console用户接口
[sw5-ui-console0]idle-timeout 0 0 #关闭用户界面的超时断连
[sw5-ui-console0]q
pc5属于vlan10,pc6、pc7属于vlan20
sw5 sw6间配置eth-trunk 56
创建vlan
vlan batch 5 10 20
pc5参数:
ip:192.168.10.1/24
gw:192.168.10.254
pc6参数:
ip:192.168.20.1/24
gw:192.168.20.254
sw5与sw6的接口:g0/0/4、g0/0/5做如下配置(以sw5接口g0/0/4为例做相同操作)
[sw5-GigabitEthernet0/0/4]dis th
#
interface GigabitEthernet0/0/4
port link-type access
port default vlan 10
#
return
[sw5]int Vlanif 10
[sw5-Vlanif10]ip add 192.168.10.1 24
链路聚合端口做如下配置(以sw5为例,sw6参考做相同配置)
[sw5]int Eth-Trunk 56
[sw5-Eth-Trunk56]mode lacp-static #设置lacp静态模式
[sw5-Eth-Trunk56]trunkport GigabitEthernet 0/0/1 to 0/0/3 #关联成员端口
[sw5-Eth-Trunk56]port link-type trunk
[sw5-Eth-Trunk56]port trunk allow-pass vlan all
[sw5-Eth-Trunk56]load-balance src-dst-mac #设置负载均衡,基于源目的mac
[sw5-Eth-Trunk56]max active-linknumber 2 #设置最大支持活动接口数为2
[sw5-Eth-Trunk56]lacp preempt enable #开启抢占功能
[sw5-Eth-Trunk56]display this
#
interface Eth-Trunk56
port link-type trunk
port trunk allow-pass vlan 2 to 4094
mode lacp-static
load-balance src-dst-mac
lacp preempt enable
max active-linknumber 2
#
return
设置系统优先级,默认都是32768,把sw5、sw6的g0/0/1、g0/0/2作为活动端口
[sw5-Eth-Trunk56]int g0/0/1
[sw5-GigabitEthernet0/0/1]lacp priority 30 #设置接口lacp优先级为30
[sw5-GigabitEthernet0/0/1]dis th
#
interface GigabitEthernet0/0/1
eth-trunk 56
lacp priority 33
#
做完lacp相关配置可以查看到活跃端口为g0/0/1、g0/0/2
关键一步需要做静态路由指向
sw1: ip route-static 192.168.20.0 24 10.1.1.2
sw2: ip route-static 192.168.10.0 24 10.1.1.1
[sw5]int Vlanif 5
[sw5-Vlanif5]di th
#
interface Vlanif5
ip address 10.1.1.1 255.255.255.0
#
return
[sw6-Vlanif5]
[sw6]int Vlanif 5
[sw6-Vlanif5]di th
#
interface Vlanif5
ip address 10.1.1.2 255.255.255.0
#
return
[sw6-Vlanif5]
测试: