Linux运维之路


华为HCNP_20 华为路由器交换机链路聚合

admin 2019-06-27 281浏览 0条评论
首页/正文
分享到: / / / /

[TOC]

链路聚合简介

链路聚合:

作用: 增加宽带,同事提供链路冗余

LACP模式支持链路备份 灵活多用

手工负载分担模式: 无法自由自定义配置

链路聚合: 手工负载配置所有活动接口都参与数据的转发分担负载流量

二层链路聚合 eth-trunk

​ LACP默认不转发,在一条链路断了才进行转发

三层交换机链路聚合

实验: 交换机交换机链路聚合

没捆绑之前状态LW1:

[Huawei]dis stp brief 
 MSTID  Port                        Role  STP State     Protection
   0    GigabitEthernet0/0/1        ROOT  FORWARDING      NONE
   0    GigabitEthernet0/0/2        ALTE  DISCARDING      NONE
   0    GigabitEthernet0/0/3        ALTE  DISCARDING      NONE
   0    GigabitEthernet0/0/4        ALTE  DISCARDING      NONE
   0    GigabitEthernet0/0/5        DESI  FORWARDING      NONE

没捆绑之前状态LW2:

[Huawei]dis stp brief 
 MSTID  Port                        Role  STP State     Protection
   0    GigabitEthernet0/0/1        DESI  FORWARDING      NONE
   0    GigabitEthernet0/0/2        DESI  FORWARDING      NONE
   0    GigabitEthernet0/0/3        DESI  FORWARDING      NONE
   0    GigabitEthernet0/0/4        DESI  FORWARDING      NONE
   0    GigabitEthernet0/0/5        DESI  FORWARDING      NONE

解释:

通过 dis stp bri 查看端口状态:

DISCARDING 预定端口状态 【阻塞状态】

FORWARDING 转发端口状态 【转发状态】

默认 stp 发现环路会自动阻塞。

二层链路捆绑方法:

模式1: 手工负载分担模式配置[默认就是这个模式]

LSW1:

[Huawei] interface Eth-Trunk 1   # 创建捆绑组

[Huawei-Eth-Trunk1]mode ?
  lacp-static  Static working mode  灵活分担模式
  manual       Manual working mode  手工负载分摊模式【默认使用】
  

[Huawei-Eth-Trunk1]mode manual load-balance     #【默认模式,没有配置的情况下就是手工负载分担模式】

加入多个接口配置聚合,都需要使用命令 
int g0/0/1    进入接口
Eth-Trunk 1   将接口加入到捆绑组1 

第二中聚合方式:
int Eth-Trunk 1  
  trunkport GigabitEthernet 0/0/1 to 0/0/4    ## 同时将四个接口都放在 trunk 1 链路中组成聚合链路
  
  
检查命令:
dis eth-trunk 1  #查看链路聚合接口

[Huawei-Eth-Trunk1]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: 3                     
--------------------------------------------------------------------------------
PortName                      Status      Weight 
GigabitEthernet0/0/1          Up          1      
GigabitEthernet0/0/2          Up          1      
GigabitEthernet0/0/4          Up          1      


dis stp brief    #检查转发状态

[Huawei-Eth-Trunk1]dis stp brief 
 MSTID  Port                        Role  STP State     Protection
   0    GigabitEthernet0/0/3        ALTE  DISCARDING      NONE
   0    GigabitEthernet0/0/5        DESI  FORWARDING      NONE
   0    Eth-Trunk1                  ROOT  FORWARDING      NONE
   
   
   
   取消接口:
   [Huawei-Eth-Trunk1]undo  trunkport g0/0/5

测试:

冗余性测试:

短小线路检查连通性

捆绑聚合链路也可以做trunk

捆绑聚合链路配置trunk
[Huawei-Eth-Trunk1]port link-type trunk 
[Huawei-Eth-Trunk1]port trunk allow-pass vlan all 

两台相连,两端都需要打trunk
dis port vlan 检查trunk

负载均衡配置:

[Huawei-Eth-Trunk1]load-balance ?
dst-ip		根据目标IP哈希算法
dst-mac		根据目标MAC哈希算法
src-dst-ip  根据源/目标IP哈希算法实现src-dst-ip  [默认负载方法]
src-dst-mac 根据源/目标MAC哈希算法
src-ip		根据源IP哈希算法实现
src-mac     根据源MAC哈希算法

修改负载均衡方式:
   注意: 两端交换机或路由器都需要同时修改
如: 都改成 src-mac 
int eth-trunk 1 
   load-balance  src-mac

路聚合路由器和路由器

R1:  
[Huawei]int Eth-Trunk 1 			       #进入 trunk1口
[Huawei-Eth-Trunk1]undo portswitch         #配置为三层接口
[Huawei-Eth-Trunk1]ip add 12.1.1.1 24      #配置trunk 1  ip地址
 
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]eth-trunk  1  #加入到 trunk 1
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]eth-trunk  1  #加入到 trunk 1


R2:
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]eth-trunk  1  #加入到 trunk 1
[Huawei]int g0/0/0 
[Huawei-GigabitEthernet0/0/1]eth-trunk  1  #加入到 trunk 1

[Huawei]int Eth-Trunk 1					    #进入 trunk1口
[Huawei-Eth-Trunk1]undo portswitch			#配置为三层接口
[Huawei-Eth-Trunk1]ip add 12.1.1.2 24       #配置trunk 1  ip地址

ping测试:
[Huawei]ping 12.1.1.1
  PING 12.1.1.1: 56  data bytes, press CTRL_C to break
    Reply from 12.1.1.1: bytes=56 Sequence=1 ttl=255 time=100 ms
    Reply from 12.1.1.1: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 12.1.1.1: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 12.1.1.1: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 12.1.1.1: bytes=56 Sequence=5 ttl=255 time=30 ms
    
    
检查状态:
<Huawei>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: 2                     
--------------------------------------------------------------------------------
PortName                      Status      Weight 
GigabitEthernet0/0/0          Up          1      
GigabitEthernet0/0/1          Up          1      

三层链路聚合 交换机和交换机

思路:

交换机上创建vlan 将接口划入到vlan,其他步骤与上面没啥区别

拓扑:

LSW3:

[Huawei]interface Eth-Trunk 1     #创建捆绑口
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]eth-trunk 1
[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/1]eth-trunk 1

ip地址配置:
[Huawei]vlan 10
[Huawei]quit
[Huawei]interface Eth-Trunk1
[Huawei-Eth-Trunk1]port link-type access
[Huawei-Eth-Trunk1]port default vlan 10  #将捆绑接口划入到vlan10
[Huawei-Eth-Trunk1]int vlan 10
[Huawei-Vlanif10]ip add 12.1.1.1 24

LSW4:

[Huawei]vlan 10
[Huawei]quit
[Huawei]interface Eth-Trunk 1     #创建捆绑口
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]eth-trunk 1
[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]eth-trunk 1
[Huawei]int Eth-Trunk 1

[Huawei-Eth-Trunk1] port link-type access
[Huawei-Eth-Trunk1] port default vlan 10  #将捆绑接口划入到vlan10

[Huawei-Eth-Trunk1]int vlan 10
[Huawei-Vlanif10]ip add 12.1.1.2 24

三层链路聚合路由器和多层交换机

R1:
[Huawei]interface Eth-Trunk 1
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]eth-trunk 1
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]eth-trunk 1


SW1:
[Huawei]un in en
[Huawei]vlan 10
Huawei]int Eth-Trunk 1
[Huawei-Eth-Trunk1]trunkport g0/0/1
[Huawei-Eth-Trunk1]trunkport g0/0/2
[Huawei-Eth-Trunk1]quit
[Huawei]int Eth-Trunk 1
[Huawei-Eth-Trunk1]port link-type access
[Huawei-Eth-Trunk1]port default vlan 10


[Huawei-Eth-Trunk1]dis this
#
interface Eth-Trunk1
 port link-type access
 port default vlan 10
#
return

测试:

AR1:

SW1:

测试ping 然后断掉一个 看是否切换:

LACP模式讲解

LACP模式下 可以自定义备份链路,能发现链路问题,自定义备份链路,手工负载是无法做到的

实例:

SW2:

[Huawei]interface Eth-Trunk 1
[Huawei-Eth-Trunk1]mode lacp-static     ##更改为 lacp模式
[Huawei-Eth-Trunk1]trunkport GigabitEthernet 0/0/1 to 0/0/4   #修改接口
[Huawei-Eth-Trunk1]port link-type trunk 
[Huawei-Eth-Trunk1]port trunk allow-pass vlan all #trunk接口

SW1:

[Huawei]interface Eth-Trunk 1
[Huawei-Eth-Trunk1]mode lacp-static     ##更改为 lacp模式
[Huawei-Eth-Trunk1]trunkport GigabitEthernet 0/0/1 to 0/0/4   #修改接口
[Huawei-Eth-Trunk1]port link-type trunk 
[Huawei-Eth-Trunk1]port trunk allow-pass vlan all   #改trunk接口


[Huawei-Eth-Trunk1]max active-linknumber 2   # 激活接口的数量(就是几个接口参与转发,这里2个)

[Huawei-Eth-Trunk1]dis eth-trunk 1     #这里能看到两个Selected状态,为激活状态  Unselect 关闭状态
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-cc26-5849                         
Least Active-linknumber: 1  Max Active-linknumber: 2                          
Operate status: up          Number Of Up Port In Trunk: 2                     
--------------------------------------------------------------------------------
ActorPortName          Status     PortType PortPri PortNo PortKey PortState Weight
GigabitEthernet0/0/1   Selected[激活]   1GE      32768   2      305     10111100  1     
GigabitEthernet0/0/2   Selected[激活]   1GE      32768   3      305     10111100  1     
GigabitEthernet0/0/3   Unselect   1GE      32768   4      305     10100000  1     
GigabitEthernet0/0/4   Unselect   1GE      32768   5      305     10100000  1     

Partner:
--------------------------------------------------------------------------------
ActorPortName          SysPri   SystemID        PortPri PortNo PortKey PortState
GigabitEthernet0/0/1   32768    4c1f-cce2-10ea  32768   2      305     10111100
GigabitEthernet0/0/2   32768    4c1f-cce2-10ea  32768   3      305     10111100
GigabitEthernet0/0/3   32768    4c1f-cce2-10ea  32768   4      305     10110000
GigabitEthernet0/0/4   32768    4c1f-cce2-10ea  32768   5      305     10110000

检查状态:

[Huawei]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-cce2-10ea                         
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/1   Selected  1GE      32768   2      305     10111100  1     
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/1   32768    4c1f-cc26-5849  32768   2      305     10111100
GigabitEthernet0/0/2   32768    4c1f-cc26-5849  32768   3      305     10111100
GigabitEthernet0/0/3   32768    4c1f-cc26-5849  32768   4      305     10111100
GigabitEthernet0/0/4   32768    4c1f-cc26-5849  32768   5      305     10111100


这样就是被配置为了 lacp模式的链路聚合

可选配置:

最大活跃端口配置

[Huawei]interface Eth-Trunk 1
[Huawei-Eth-Trunk1]max active-linknumber 2   #指定最大活跃接口数量,如果up链路少于两个 则整条捆绑链路down

接口优先级:

[Huawei]int g0/0/1
[Huawei] lacp priority 10    #优先级越小越优先选用


[Huawei]interface Eth-Trunk 1
[Huawei-Eth-Trunk1]mode lacp-static     ##更改为 lacp模式
最后修改:2019-06-27 04:33:44 © 著作权归作者所有
如果觉得我的文章对你有用,请随意赞赏
扫一扫支付

上一篇

发表评论

评论列表

还没有人评论哦~赶快抢占沙发吧~