Eth-Trunk链路聚合的配置

一。原理简述

采用Eth-Trunk技术可以把多个接口捆绑在一起,可以有效的降低成本以满足提高接口宽带的要求。例如:将2个100Mbit/s的全双工接口捆绑在一起,就能达到300Mbit/s的最大宽带。

Eth-Trunk就是一种捆绑技术,他可以将多个物理接口捆绑成一个逻辑接口,这个逻辑接口就称为Eth-Trunk接口,而捆绑在在一起的每个物理接口称为成员接口。Eth-Trunk只能由以太网链路构成。

Trunk的优势:

(1)负载分担:在一个Eth-Trunk接口内,可以实现流量负载分担;

(2)提高可靠性:当某个成员接口连接的物理链路出现故障时,流量就会切换到其他可用的链路上,从而提高整个Eth-Trunk链路的可靠性;

(3)增加带宽:Trunk接口的总带宽是各个成员接口的带宽之和。

Eth-Trunk在逻辑上把多个物理链路捆绑等同于一条逻辑链路,对上层数据透明传输。所有的Eth-Trunk中的物理接口的参数是必须保持一致的,Eth-Trunk链路两端的要求一致的物理参数有:Eth-Trunk链路两端相连的物理接口类型、物理接口数量、物理接口的速率、物理接口的双工方式及物理接口的流控方式。

二。实验目的

(1)理解Eth-Trunk的应用情况;

(2)掌握Eth-Trunk链路聚合的手工负载分担模式的配置方法;

(3)掌握Eth-Trunk链路聚合的静态LACP模式的配置方法;

三。实验内容

S1和S2交换机之间通过一条光纤线路相连,出于带宽和冗余角度考虑需要使用Eth-Trunk对其进行改进,实现此要求。

四。实验拓扑

五。实验操作

1.基本实验配置:

根据实验要求进行基本的实验配置,使用ping命令检测各PC间的连通性。根据实验要求,先将S1和S2相连的GE0/0/2和GE0/0/5接口关闭。

2.查看未配置Eth-Trunk时的情况:

现在模拟在原有的网络基础上增加一条链路,提高带宽,将带宽增加到2Gbit/s。(一条为1Gbit/s)

[S1]int g0/0/2
[S1-GigabitEthernet0/0/2]undo shutdown    //模拟链路增加
[S2]int g0/0/2	
[S2-GigabitEthernet0/0/2]undo shutdown 

在链路增加后,组网拓扑中,默认开启的STP协议一定会将其中一条链路阻塞掉。使用display stp brief 命令查看STP状态信息。

[S1]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
[S2]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        DESI  FORWARDING      NONE

想要实质性的增加S1和S2之间的带宽,单靠增加链路数量是不行的。因为生成树会阻塞多余的接口,所以现在的情况是,S1好S2之间的数据依然是仅仅通过GE0/0/1接口进行传输的。

3.配置Eth-Trunk 的手工负载分担模式实现链路聚合:

Eth-Trunk的工作模式分为两种:

(1)手工负载分担模式:需要手动创建链路聚合组,并且要配置多个接口加入到所创建的Eth-Trunk中;

(2)静态LACP模式:该模式通过LACP协议协商Eth-Trunk参数后自动选择活动接口。

使用interface Eth-Trunk命令创建Eth-Trunk接口,使用mode manual load-balance 命令指定为手工负载分担模式。并将相应的接口加入到Eth-Trunk接口中。

[S1]int Eth-Trunk 1    //创建Eth-Trunk
[S1-Eth-Trunk1]mode manual load-balance   //开启手工负载分担模式
[S1]int g0/0/1
[S1-GigabitEthernet0/0/1]eth-trunk 1     //加入相应的接口
[S1]int g0/0/2
[S1-GigabitEthernet0/0/2]eth-trunk 1

。。。。。。(S2的配置过程一样)

使用display eth-trunk 命令查看交换机的Eth-Trunk接口的状态。

使用display interface eth-trunk命令查看Eth-Trunk接口信息。

[S2]dis interface Eth-Trunk 1
Eth-Trunk1 current state : UP
Line protocol current state : UP
Description:
Switch Port, PVID :    1, Hash arithmetic : According to SIP-XOR-DIP,Maximal BW:
 2G, Current BW: 2G, The Maximum Frame Length is 9216   //总带宽为两个接口的带宽之和
IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-cce5-47d5
Current system time: 2019-04-13 15:48:16-08:00
    Input bandwidth utilization  :    0%
    Output bandwidth utilization :    0%
-----------------------------------------------------
PortName                      Status      Weight
-----------------------------------------------------
GigabitEthernet0/0/1          UP          1
GigabitEthernet0/0/2          UP          1
-----------------------------------------------------
The Number of Ports in Trunk : 2
The Number of UP Ports in Trunk : 2

使用display stp brief 命令查看生成树状态,并使用ping命令持续测试,将S2的GE0/0/1或GE0/0/2接口关闭模拟故障的发生。

[S2]dis stp brief 
 MSTID  Port                        Role  STP State     Protection
   0    GigabitEthernet0/0/3        DESI  FORWARDING      NONE
   0    Eth-Trunk1                  ROOT  FORWARDING      NONE   //处于转发状态

当链路发生故障时,链路会立刻进行切换,只要物理链路有一条是正常的,Eth-Trunk接口就不会断开,仍可以保证数据的转发。可以看出,Eth-Trunk在提高了带宽的情况下,也实现了链路冗余。

4.配置Eth-Trunk的静态LACP模式实现链路聚合

采用静态LACP模式配置Eth-Trunk实现两条链路同时转发,一条链路备份,当其中一条转发的链路出现故障时,备份链路可以立刻进行数据的转发。

[S1-GigabitEthernet0/0/1]undo eth-trunk   //删除原来加入的物理接口
[S1-GigabitEthernet0/0/1]int g0/0/2	
[S1-GigabitEthernet0/0/2]undo eth-trunk 
	
[S1]int Eth-Trunk 1		
[S1-Eth-Trunk1]mode lacp-static   //修改模式为静态LACP
[S1-Eth-Trunk1]int g0/0/1       //加入相应的接口到Eth-Trunk接口下
[S1-GigabitEthernet0/0/1]eth-trunk 1
[S1-GigabitEthernet0/0/1]int g0/0/2
[S1-GigabitEthernet0/0/2]eth-trunk 1
[S1-GigabitEthernet0/0/2]int g0/0/5
[S1-GigabitEthernet0/0/5]eth-trunk 1 

。。。。。。(S2交换机的配置方法一样)

配置完成后,使用命令查看Eth-Trunk接口的状态。

[S1]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-cc1c-469d                         
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/1   Selected 1GE      32768   2      305     10111100  1     
GigabitEthernet0/0/2   Selected 1GE      32768   3      305     10111100  1     
GigabitEthernet0/0/5   Selected 1GE      32768   6      305     10111100  1     
     //Selected:活动状态
Partner:
--------------------------------------------------------------------------------
ActorPortName          SysPri   SystemID        PortPri PortNo PortKey PortState
GigabitEthernet0/0/1   32768    4c1f-cce5-47d5  32768   2      305     10111100
GigabitEthernet0/0/2   32768    4c1f-cce5-47d5  32768   3      305     10111100
GigabitEthernet0/0/5   32768    4c1f-cce5-47d5  32768   6      305     10111100

 可以使用 lacp priority 命令修改交换机系统的优先级(值越小优先级越高),使其成为主动端,并按照主动端设备的接口来选择活动接口。两端设备在选出主动端后,两端都会以主动端的接口优先级来选择活动接口。两端设备选择出一致的活动接口,活动链路组便开始建立,设置这些活动链路以负载分担的方式来转发数据。

[S1]lacp priority 100

[S1]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: 100        System ID: 4c1f-cc1c-469d                     
...... //优先级已经修改为100

 使用 max active-linknumber 命令配置活动接口上的上限阈值(默认活动接口的最大阈值为8)。

[S1]int Eth-Trunk 1
[S1-Eth-Trunk1]max active-linknumber 2  //配置活动接口阈值

[S1]int g0/0/1	
[S1-GigabitEthernet0/0/1]lacp priority 100    //配置接口的优先级来确定活动链路
[S1-GigabitEthernet0/0/1]int g0/0/2	
[S1-GigabitEthernet0/0/2]lacp priority 100


[S1]dis eth-trunk 1   //查看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: 100        System ID: 4c1f-cc1c-469d                         
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      100     3      305     10111100  1     
GigabitEthernet0/0/5   Unselect 1GE      32768   6      305     10100000  1     
......  //优先级已完成修改

现在Eth-Trunk接口下将只存在两个成员处于活动状态,而且具备负载分担的能力。GE0/0/5接口处于不活动状态,作为备份链路。当活动链路出现故障时,会替代故障链路,保持数据传输的可靠性。

现在将S1的GE0/0/1接口关闭和再次打开,即可检验Eth-Trunk链路聚合的信息。

[S1]int g0/0/1
[S1-GigabitEthernet0/0/1]shutdown 

[S1]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: 100        System ID: 4c1f-cc1c-469d                         
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   Unselect 1GE  //处于不活动状态    100     2      305     10100010  1     
GigabitEthernet0/0/2   Selected 1GE      100     3      305     10111100  1     
GigabitEthernet0/0/5   Selected 1GE //处于活动状态     32768   6      305     10111100  1     
......

[S1]int g0/0/1	
[S1-GigabitEthernet0/0/1]undo shutdown   //开启接口功能

[S1]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: 100        System ID: 4c1f-cc1c-469d                         
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      100     3      305     10111100  1     
GigabitEthernet0/0/5   Unselect 1GE //处于不活动状态     32768   6      305     10100000  1     
......

补充:

当一条高优先级的接口因为故障切换为非活动状态而后又恢复时,只有使能抢占功能后高优先级的接口将重新成为活动接口。默认情况下,抢占功能是关闭的,需要在Eth-Trunk接口下手动开启并根据实际的情况作出相应的抢占时延的配置(默认为30s)。

 

 

 

 

 

 

 

 

  • 10
    点赞
  • 64
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小柒憨憨吖~

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值