Eth-trunk的介绍以及实验配置

目录

技术背景

Eth-Trunk概念

LACP模式下优先级

LACP的抢占机制

Eth-Trunk 配置

LACP模式

手工模式

Eth-Trunk接口负载分担


技术背景

随着网络中部署的业务量不断增长,单条物理链路的带宽已不能满足正常的业务流量需求。这时可以选择使用更高带宽的接口板或者给设备增加链路。

1.如果将当前接口板替换为具备更高带宽的接口板,则会浪费现有的设备资源,花费较大。

2.如果增加设备间的链路数量,则在作为三层口使用时需要在每个接口上配置IP地址,从而导致浪费IP地址资源。

有没有一种不会浪费设备资源也不会浪费IP地址的技术?这种技术就是Eth-Trunk。

Eth-Trunk概念

原理:把多个独立的物理接口绑定在一起作为一个逻辑上带宽更大的逻辑接口的技术。

Eth-Trunk技术的分类

  • 手工负载分担:(不常用--因为现在的设备一般都支持LACP)

       1. 主要应用于不支持 LACP协议的设备。

        2.加入Eth-Trunk虚拟接口的成员接口,都有进行流量转发,所有成员接口分担所有流量。 

  • 基于LACP协议:

       1. LACP模式也称为M:N模式,M个参与数据转发的链路, N个备份的链路。
        2.只有当活跃的链路出现故障时,备份链路才进行转发。图中设置的活跃链路数为2,即2条链路处于转发状态,1条链路处于备份状态,不转发数据。

LACP模式下优先级

1.设备优先级:

        系统LACP优先级的值越小,则优先级越高,缺省情况下,系统LACP优先级的值为32768。

        在两端设备中选择系统LACP优先级较高的一端作为主动端,如果系统LACP优先级相同则选择MAC地址较小的一端作为主动端。

2.接口优先级:

        接口LACP优先级的值越小,则优先级越高。如果接口LACP优先级相同,接口ID(接口号)小的接口被优先选为活动接口。

        接口LACP优先级是为了区别同一个Eth-Trunk中的不同接口被选为活动接口的优先程度,优先级高的接口将优先被选为活动接口。

LACP的抢占机制

Port1由于链路故障切换为非活动接口,如果在Eth-Trunk接口下未使能抢占,则故障恢复时Port1将处于备份状态;如果使能了LACP抢占,当Port1故障恢复时,由于接口优先级比Port3高,经过抢占延时的时间将重新成为活动接口,Port3再次成为备份接口。

如果希望Port3接口替换Port1、Port2中的一个接口成为活动接口,可以将Port3的接口LACP优先级调高,但前提条件是已经使能了LACP抢占功能。如果没有使能LACP抢占功能,即使将备份接口的优先级调整为高于当前活动接口的优先级,系统也不会进行重新选择活动接口的过程,也不切换活动接口。

Eth-Trunk 配置

  • 一个Eth-Trunk接口中的成员接口必须是以太网类型和速率相同的接口。
  • Eth-Trunk链路两端相连的物理接口的数量、速率、双工方式、流控配置必须一致。
  • 如果本端设备接口加入了Eth-Trunk,与该接口直连的对端接口也必须加入Eth-Trunk,两端才能正常通信。
  • 两台设备对接时需要保证两端设备上链路聚合的模式一致。

LACP模式

1.创建Eth-Trunk1并配置为LACP模式。

SW1

<HUAWEI> system-view
[HUAWEI] sysname SW1
[SW1] interface eth-trunk 1   // 创建ID为1的Eth-Trunk接口
[SW1-Eth-Trunk1] mode lacp-static    // 配置链路聚合模式为LACP模式

SW2

<HUAWEI> system-view
[HUAWEI] sysname SW2
[SW2] interface eth-trunk 1   // 创建ID为1的Eth-Trunk接口
[SW2-Eth-Trunk1] mode lacp-static    // 配置链路聚合模式为LACP模式

2.配置接口加入Eth-Trunk1

SW1

[SW1] interface eth-trunk 1  
[SW1-Eth-Trunk1] trunkport GigabitEthernet 0/0/1 0/0/2 0/0/3
Info: This operation may take a few seconds. Please wait for a moment...done.

# 等同于如下几个步骤
------------------------------------------------------------
[SW1] interface gigabitethernet 0/0/1
[SW1-GigabitEthernet0/0/1] eth-trunk 1   //将GE1/0/1接口加入Eth-Trunk1中
[SW1] interface gigabitethernet 0/0/2
[SW1-GigabitEthernet0/0/2] eth-trunk 1   //将GE1/0/2接口加入Eth-Trunk1中
[SW1] interface gigabitethernet 0/0/3
[SW1-GigabitEthernet0/0/3] eth-trunk 1   //将GE1/0/3接口加入Eth-Trunk1中
------------------------------------------------------------

SW2

[SW2] interface Eth-trunk 1  
[SW2-Eth-Trunk1] trunkport GigabitEthernet 0/0/1 0/0/2 0/0/3

3.在SW1上配置系统优先级为100,使其成为LACP主动端(系统LACP优先级缺省为32768,系统LACP优先级的值越小,则优先级越高)

[SW1] lacp priority 100   

4.在SW1上配置活动接口上限阈值为2 (上限阈值缺省是8)

[SW1] interface Eth-trunk 1
[SW1-Eth-Trunk1] max active-linknumber 2  

5.在SW1上配置接口优先级确定活动链路,(接口LACP优先级缺省为32768,接口LACP优先级的值越小,则优先级越高)。

[SW1] interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1] lacp priority 100  

[SW1] interface GigabitEthernet 0/0/2
[SW1-GigabitEthernet0/0/2] lacp priority 100   

# 这一步不做也不影响,因为优先级一样的情况下,会看接口ID,ID越小越优先  

6.创建VLAN并将接口加入VLAN。

SW1

[SW1] vlan batch 10 20
[SW1] interface GigabitEthernet 0/0/4
[SW1-GigabitEthernet0/0/4] port link-type access  
[SW1-GigabitEthernet0/0/4] port default vlan 10

[SW1] interface GigabitEthernet 0/0/5
[SW1-GigabitEthernet0/0/5] port link-type access   
[SW1-GigabitEthernet0/0/5] port default vlan 20

SW2

[SW2] vlan batch 10 20
[SW2] interface GigabitEthernet 0/0/4
[SW2-GigabitEthernet0/0/4] port link-type access  
[SW2-GigabitEthernet0/0/4] port default vlan 10

[SW2] interface GigabitEthernet 0/0/5
[SW2-GigabitEthernet0/0/5] port link-type access   
[SW2-GigabitEthernet0/0/5] port default vlan 20

7.配置Eth-Trunk1接口允许VLAN10和VLAN20通过。

SW1

[SW1] interface eth-trunk 1
[SW1-Eth-Trunk1] port link-type trunk   
[SW1-Eth-Trunk1] port trunk allow-pass vlan 10 20

SW2

[SW2] interface eth-trunk 1
[SW2-Eth-Trunk1] port link-type trunk  
[SW2-Eth-Trunk1] port trunk allow-pass vlan 10 20

结果验证

SW1

[SW1]display 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-cc9f-2150                         
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      100     2      305     10111100  1     
GigabitEthernet0/0/2   Selected 1GE      32768   3      305     10111100  1     
GigabitEthernet0/0/3   Unselect 1GE      32768   4      305     10100000  1     

Partner:
--------------------------------------------------------------------------------
ActorPortName          SysPri   SystemID        PortPri PortNo PortKey PortState
GigabitEthernet0/0/1   32768    4c1f-cc94-03fb  32768   2      305     10111100
GigabitEthernet0/0/2   32768    4c1f-cc94-03fb  32768   3      305     10111100
GigabitEthernet0/0/3   32768    4c1f-cc94-03fb  32768   4      305     10110000
    

SW2

[SW2]display 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-cc94-03fb                         
Least Active-linknumber: 1  Max Active-linknumber: 8                          
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     10110000  1     

Partner:
--------------------------------------------------------------------------------
ActorPortName          SysPri   SystemID        PortPri PortNo PortKey PortState
GigabitEthernet0/0/1   100      4c1f-cc9f-2150  100     2      305     10111100
GigabitEthernet0/0/2   100      4c1f-cc9f-2150  32768   3      305     10111100
GigabitEthernet0/0/3   100      4c1f-cc9f-2150  32768   4      305     10100000

PC之间的通信测试

PC2 和PC4 之间可以互通,PC1和PC3之间可以互通,实验成功。

手工模式

跟刚才LACP一样的,然后清空交换机配置,我们再来做手工模式

手工模式的情况下,就不需要协商优先级了,因为所有的接口都要参与转发,所以也不需要协商接口的优先级。

1.在SW1和SW2上创建Eth-Trunk接口并加入成员接口

<HUAWEI> system-view
[HUAWEI] sysname SW1
[SW1] interface eth-trunk 1   
[SW1-Eth-Trunk1] trunkport GigabitEthernet 0/0/1 to 0/0/3  

<HUAWEI> system-view
[HUAWEI] sysname SW2
[SW2] interface eth-trunk 1   
[SW2-Eth-Trunk1] trunkport GigabitEthernet 0/0/1 to 0/0/3  

2.SW1和SW2创建VLAN并将接口加入VLAN

SW1

[SW1] vlan batch 10 20
[SW1] interface GigabitEthernet 0/0/4
[SW1-GigabitEthernet0/0/4] port link-type access
[SW1-GigabitEthernet0/0/4] port default vlan 10

[SW1] interface GigabitEthernet 0/0/5
[SW1-GigabitEthernet0/0/5] port link-type access   
[SW1-GigabitEthernet0/0/5] port  default vlan 20

 SW2

[SW2] vlan batch 10 20
[SW2] interface GigabitEthernet 0/0/4
[SW2-GigabitEthernet0/0/4] port link-type access
[SW2-GigabitEthernet0/0/4] port default vlan 10

[SW2] interface GigabitEthernet 0/0/5
[SW2-GigabitEthernet0/0/5] port link-type access   
[SW2-GigabitEthernet0/0/5] port  default vlan 20

3.配置Eth-Trunk1接口允许VLAN10和VLAN20通过

SW1

[SW1] interface eth-trunk 1
[SW1-Eth-Trunk1] port link-type trunk   
[SW1-Eth-Trunk1] port trunk allow-pass vlan 10 20

SW2

[SW2] interface eth-trunk 1
[SW2-Eth-Trunk1] port link-type trunk   
[SW2-Eth-Trunk1] port trunk allow-pass vlan 10 20

验证配置结果

在任意视图下执行display eth-trunk 1命令,检查Eth-Trunk是否创建成功,及成员接口是否正确加入

SW1

[SW1]display 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/3          Up          1      

SW2

[SW2]display 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/3          Up          1   

PC之间的通信测试

PC2 和PC4 之间可以互通,PC1和PC3之间可以互通,实验成功。

Eth-Trunk接口负载分担

1.配置基于IP地址(源IP地址、目的IP地址、源MAC、目的MAC)的散列算法。即,逐流负载分担

  • 逐流负载分担是指根据报文的IP地址区别数据流,使属于同一数据流的报文从同一个的成员链路上通过。
  • 逐流负载分担能保证包的顺序,但不能保证带宽利用率。

[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

配置Eth-Trunk1的逐流负载分担。SW1和SW2必须配置一样的

[SW1] interface eth-trunk 1
[SW1-Eth-Trunk1] load-balance src-dst-mac   //配置Eth-Trunk1基于源MAC地址与目的MAC地址进行负载分担

[SW2]interface Eth-Trunk 1
[SW2-Eth-Trunk1]load-balance src-dst-mac

2.配置基于包的散列算法。即,逐包负载分担

  • 逐包负载分担是指不区分数据流,而是以报文为单位,将流量分担到不同的成员链路上进行传输。
  • 逐包负载分担能保证带宽利用率,但不能保证包的顺序,适用于对包的顺序没有严格要求的场景。

这个命令模拟器没有,只要命令是 load-balance packet-all 即可

[SW1] interface eth-trunk 1
[SW1-Eth-Trunk1] load-balance packet-all

[SW2] interface eth-trunk 1
[SW2-Eth-Trunk1] load-balance packet-all

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值