ensp 链路聚合的配置

  • Post author:
  • Post category:其他



链路聚合(英语:Link Aggregation)是一个计算机网络术语,指将多个物理端口汇聚在一起,形成一个逻辑端口,以实现出/入流量吞吐量在各成员端口的负荷分担,交换机根据用户配置的端口负荷分担策略决定网络封包从哪个成员端口发送到对端的交换机。当交换机检测到其中一个成员端口的链路发生故障时,就停止在此端口上发送封包,并根据负荷分担策略在剩下的链路中重新计算报文的发送端口,故障端口恢复后再次担任收发端口。链路聚合在增加链路带宽、实现链路传输弹性和工程冗余等方面是一项很重要的技术。 —来源百度百科



链路聚合的分类

类型 作用
手动模式 这个模式下的所有端口都是处于转发状态,每一个端口彼此分担流量的压力
LACP静态模式 又叫备份链路模式,有的链路在正常情况下是没有流量通过的(down掉的)当其他链路出现故障,自动会替换其工作
动态模式 不常用



配置过程如下



网络结构拓扑图



在这里插入图片描述



手动模式的配置




LSW1和LSW2的配置(配置相同)

[LSW1]interface Eth-Trunk 1      //进入eth-trunk接口
[LSW1-Eth-Trunk1]trunkport g 0/0/2 to 0/0/4   //将接口2到4捆绑在一起
Info: This operation may take a few seconds. Please wait for a moment...done.
[LSW1-Eth-Trunk1]port link-type trunk    //将链路设置trunk模式
[LSW1-Eth-Trunk1]port trunk allow-pass  vlan all 
[LSW1]display eth-trunk      //查看eth-trunk的状态
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: 3                     
--------------------------------------------------------------------------------
PortName                      Status      Weight 
GigabitEthernet0/0/2          Up          1      
GigabitEthernet0/0/3          Up          1      
GigabitEthernet0/0/4          Up          1  



LACP静态模式的配置




网络结构图如上一致



LSW1和LSW2的配置(配置相同)

[LSW1]lacp priority 1000    //修改当前交换机的优先级,使之成为主动端(默认的优先级为32768)[这个命令只在第一个交换机上进行修改]
[LSW1]interface Eth-Trunk 1    //进入eth-trunk接口
[LSW1-Eth-Trunk1]mode lacp-static   //设置模式为lacp-static
[LSW1-Eth-Trunk1]trunkport g 0/0/2 to 0/0/4    //绑定对应的端口
Info: This operation may take a few seconds. Please wait for a moment...done.
[LSW1-Eth-Trunk1]display eth-trunk    //查看当前的状态
Eth-Trunk1's state information is:
Local:
LAG ID: 1                   WorkingMode: STATIC (模式变为了静态)                              
Preempt Delay: Disabled     Hash arithmetic: According to SIP-XOR-DIP   (类型为)     
System Priority: 1000 (优先级)      System ID: 4c1f-ccd1-6fe8                         
Least Active-linknumber: 1  Max Active-linknumber: 8                          
Operate status: up          Number Of Up Port In Trunk: 3                     
--------------------------------------------------------------------------------
ActorPortName          Status   PortType PortPri PortNo PortKey PortState Weight
GigabitEthernet0/0/2   Selected 1GE      32768   3      305     10111100  1     
GigabitEthernet0/0/3   Selected 1GE      32768   4      305     10111100  1     
GigabitEthernet0/0/4   Selected 1GE      32768   5      305     10111100  1     

Partner:
--------------------------------------------------------------------------------
ActorPortName          SysPri   SystemID        PortPri PortNo PortKey PortState
GigabitEthernet0/0/2   32768    4c1f-ccfa-3154  32768   3      305     10111100
GigabitEthernet0/0/3   32768    4c1f-ccfa-3154  32768   4      305     10111100
GigabitEthernet0/0/4   32768    4c1f-ccfa-3154  32768   5      305     10111100

更改负载均衡(可以指定流量走对应的链路)
[LSW1-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
[LSW1-Eth-Trunk1]load-balance  dst-mac     //修改为目标地Mac地址

2:1备份链路
[LSW1-Eth-Trunk1]max active-linknumber 2   //默认会依据端口的序号来进行设置哪一些是活动端口
[LSW1-Eth-Trunk1]dis eth-trunk   
ActorPortName          Status   PortType PortPri PortNo PortKey PortState Weight
GigabitEthernet0/0/2   Selected 1GE      32768   3      305     10111100  1     
GigabitEthernet0/0/3   Selected 1GE      32768   4      305     10111100  1     
GigabitEthernet0/0/4   Unselect 1GE      32768   5      305     10100000  1     //只有端口4是unsettle状态

通过修改端口号的优先级来指定哪一些端口处于备份状态
[LSW1-Eth-Trunk1]int g0/0/2
[LSW1-GigabitEthernet0/0/2]lacp priority 100
[LSW1-GigabitEthernet0/0/2]int g0/0/4
[LSW1-GigabitEthernet0/0/4]lacp priority 100
[LSW1]int Eth-Trunk 1
[LSW1-Eth-Trunk1]shutdown    //关闭端口来进行测试
[LSW1-Eth-Trunk1]undo shutdown 
ActorPortName          Status   PortType PortPri PortNo PortKey PortState Weight
GigabitEthernet0/0/2   Selected 1GE      100     3      305     10111100  1     
GigabitEthernet0/0/3   Unselect 1GE      32768   4      305     10111100  1     
GigabitEthernet0/0/4   Selected 1GE      100     5      305     10100000  1   
[LSW1]display trunkmembership eth-trunk 1   //查看详细状态
Trunk ID: 1 
Used status: VALID 
TYPE: ethernet 
Working Mode : Static 
Number Of Ports in Trunk = 3
Number Of Up Ports in Trunk = 2
Operate status: up 
  
Interface GigabitEthernet0/0/2, valid, operate up, weight=1
Interface GigabitEthernet0/0/3, valid, operate down, weight=1
Interface GigabitEthernet0/0/4, valid, operate up, weight=1



版权声明:本文为qq_45631844原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。