一、实验目的
掌握使用手动模式配置链路聚合的方法
掌握使用静态 LACP 模式配置链路聚合的方法
掌握控制静态 LACP 模式下活动链路的方法
掌握静态 LACP 的部分特性的配置
二、实验环境
安装有eNSP模拟器的PC一台,要求PC能联网。
三、实验拓扑
LSW1与LSW2均为S3700交换机。
LSW1 与 LSW2之间的多条链路无法同时处于数据转发的状态。为了充分利用这些链路的带宽,需要在 LSW1 和 LSW2之间配置以太网链路聚合。
四、实验背景
随着网络规模不断扩大,用户对骨干链路的带宽和可靠性提出越来越高的要求。在传统技术中,常用更换高速率的接口板或更换支持高速率接口板的设备的方式来增加带宽,但这种方案需要付出高额的费用,而且不够灵活。
采用链路聚合技术可以在不进行硬件升级的条件下,通过将多个物理接口捆绑为一个逻辑接口,达到增加链路带宽的目的。
在实现增大带宽目的的同时,链路聚合采用备份链路的机制,可以有效的提高设备之间链路的可靠性。链路聚合技术主要有以下三个优势:
- 增加带宽:链路聚合接口的最大带宽可以达到各成员接口带宽之和。
- 提高可靠性:当某条活动链路出现故障时,流量可以切换到其他可用的成员链路上,从而提高链路聚合接口的可靠性。
- 负载分担:在一个链路聚合组内,可以实现在各成员活动链路上的负载分担。
本实验将通过手工和 LACP 的方式配置以太网链路聚合,帮助了解以太网链路聚合技术的配置及原理。
五、实验过程
实验配置思路如下:
- 配置手工模式链路聚合
- 配置 LACP 模式链路聚合
- 通过修改参数控制活动链路
- 修改负载分担方式
LSW1的初始配置
# 进入系统视图
<Huawei>system-view # 为设备命名
[Huawei]sysname LSW1# 禁用信息中心
[LSW1]undo info-center enable
LSW2的初始配置
# 进入系统视图
<Huawei>system-view # 为设备命名
[Huawei]sysname LSW2# 禁用信息中心
[LSW2]undo info-center enable
5.1 配置手工模式链路聚合
5.1.1 创建Eth-Trunk接口
(1)配置LSW1
# 创建Eth-Trunk接口
[LSW1]interface Eth-Trunk 1
注:interface eth-trunk命令用来进入已经存在的 Eth-Trunk接口,或创建并进入 Eth-Trunk 接口。数字“1”代表接口编号,编号范围根据设备情况有所不同。
(2)配置LSW2
# 创建Eth-Trunk接口
[LSW2]interface Eth-Trunk 1
5.1.2 配置Eth-Trunk接口为聚合模式
# 配置Eth-Trunk接口为聚合模式
[LSW1-Eth-Trunk1]mode manual load-balance # 退出接口配置视图
[LSW1-Eth-Trunk1]quit
mode 命令用来配置 Eth-Trunk 的工作模式,Eth-Trunk 的工作模式包括 LACP 模式和手工负载分担模式(手工模式)两种。缺省情况下,Eth-Trunk 的工作模式为手工负载分担模式。这里针对LSW1的模式配置仅为示范目的,实际操作时不需要。
5.1.3 将成员接口加入聚合组
(1)在LSW1设备中,分别对三个连接的接口进行配置,将它们分别加入到聚合组Eth-Trunk1中来。
# 进入e0/0/1接口
[LSW1]interface Eth 0/0/1# 将该接口加入到eth-trunk 1
[LSW1-Ethernet0/0/1]eth-trunk 1# 退出接口配置视图
[LSW1-Ethernet0/0/1]quit# 进入e0/0/2接口
[LSW1]interface Eth 0/0/2# 将该接口加入到eth-trunk 1
[LSW1-Ethernet0/0/2]eth-trunk 1# 退出接口配置视图
[LSW1-Ethernet0/0/2]quit# 进入e0/0/3接口
[LSW1]interface Eth 0/0/3# 将该接口加入到eth-trunk 1
[LSW1-Ethernet0/0/3]eth-trunk 1# 退出接口配置视图
[LSW1-Ethernet0/0/3]quit
(2)在LSW2中,可同样执行上面的命令完成将三个接口加入到Eth-Trunk1聚合组,也可以通过trunkport命令批量添加接口。两种方式,任选其一即可。
# 进入聚合组接口的配置模式
[LSW2]interface Eth-Trunk 1# 批量将Eth 0/0/1、0/0/2和0/0/3添加聚合组中
[LSW2-Eth-Trunk1]trunkport eth 0/0/1 to 0/0/3# 退出接口配置模式
[LSW2-Eth-Trunk1]quit
注:将成员接口加入 Eth-Trunk 时,需要注意以下问题:
- 每个 Eth-Trunk 接口下最多可以包含8个成员接口。
- Eth-Trunk接口不能嵌套,即 Eth-Trunk接口的成员接口不能是 Eth-Trunk接口。
- 一个以太网接口只能加入到一个 Eth-Trunk 接口,如果需要加入其它 Eth-Trunk 接口,必须先退出原来的 Eth-Trunk 接口。
- 如果本地设备使用了 Eth-Trunk,与成员接口直连的对端接口也必须捆绑为 Eth-Trunk 接口,两端才能正常通信。
- Eth-Trunk 链路两端相连的物理接口的数量、速率、双工方式等必须一致。
5.1.4 查看 Eth-Trunk接囗状态
在LSW1或者LSW2上执行【display eth-trunk 1】命令可以查看该聚合组中成员接口的状态。
# 查看聚合组eth-trunk 1的接口状态
[LSW1]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
Ethernet0/0/1 Up 1
Ethernet0/0/2 Up 1
Ethernet0/0/3 Up 1
5.2 配置LACP模式的链路聚合
5.2.1 删除现有的聚合组的成员接口
在LSW1上按顺序分别执行以下命令,删除 Eth-Trunk 1聚合组的成员接口。
# 进入聚合组的接口配置模式
[LSW1]interface Eth-Trunk 1# 批量删除聚合组的成员接口
[LSW1-Eth-Trunk1]undo trunkport Eth 0/0/1 to 0/0/3# 退出接口配置模式
[LSW1-Eth-Trunk1]quit
在LSW2上,执行以上同样的命令,删除 Eth-Trunk 1聚合组的成员接口。
# 进入聚合组的接口配置模式
[LSW2]interface Eth-Trunk 1# 批量删除聚合组的成员接口
[LSW2-Eth-Trunk1]undo trunkport Eth 0/0/1 to 0/0/3# 退出接口配置模式
[LSW2-Eth-Trunk1]quit
5.2.2 修改聚合模式
(1)修改LSW1的聚合模式
# 创建并进入Eth-Trunk 1聚合接口
[LSW1]interface Eth-Trunk 1# 将聚合模式指定为lacp
[LSW1-Eth-Trunk1]mode lacp-static # 退出接口配置模式
[LSW1-Eth-Trunk1]quit
(2)修改LSW2的聚合模式
# 创建并进入Eth-Trunk 1聚合接口
[LSW2]interface Eth-Trunk 1# 将聚合模式指定为lacp
[LSW2-Eth-Trunk1]mode lacp-static # 退出接口配置模式
[LSW2-Eth-Trunk1]quit
5.2.3 将成员接口加入聚合组
(1)为LSW1设备添加聚合组成员接口
# 进入Eth-Trunk 1聚合组的配置模式
[LSW1]interface Eth-Trunk 1# 批量添加聚合组的成员接口
[LSW1-Eth-Trunk1]trunkport Eth 0/0/1 to 0/0/3# 退出聚合组的配置模式
[LSW1-Eth-Trunk1]quit
(2)为LSW2设备添加聚合组成员接口
# 进入Eth-Trunk 1聚合组的配置模式
[LSW2]interface Eth-Trunk 1# 批量添加聚合组的成员接口
[LSW2-Eth-Trunk1]trunkport Eth 0/0/1 to 0/0/3# 退出聚合组的接口配置模式
[LSW2-Eth-Trunk1]quit
5.2.4 查看Eth-Trunk的接口状态
[LSW1]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-cc2b-1fe8
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
Ethernet0/0/1 Selected 100M 32768 2 289 10111100 1
Ethernet0/0/2 Selected 100M 32768 3 289 10111100 1
Ethernet0/0/3 Selected 100M 32768 4 289 10111100 1 Partner:
--------------------------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
Ethernet0/0/1 32768 4c1f-cc8b-6bdb 32768 2 289 10111100
Ethernet0/0/2 32768 4c1f-cc8b-6bdb 32768 3 289 10111100
Ethernet0/0/3 32768 4c1f-cc8b-6bdb 32768 4 289 10111100
5.2.5 配置转发接口与备份接口
考虑到网络流量情况,当网络正常时,假定需求如下:
- 只需要 Eth0/0/1 和Eth0/0/2接口处于转发状态,Eth0/0/3接口作为备份。
- 但当活动接口数量少于2时,直接关闭整个Eth-Trunk接口。
为满足上述需求,可做如下配置:
(1)配置LSW1的LACP优先级,使其成为主动端设备
[LSW1]lacp priority 100
使能了 LACP 模式链路聚合的两端设备均会收发的 LACPDU 报文。
首先选举主动端设备:
- 比较系统优先级字段,如果对端的系统优先级高于本端的系统优先级(默认为 32768,越小越优),则确定对端为 LACP 主动端。
- 如果系统优先级相同,比较两端设备的 MAC地址,MAC地址小的一端为 LACP 主动端。
选出主动端后,两端都会以主动端的接口优先级来选择活动接口,接口优先级越小越优,默认为 32768。
(2)配置Eth-Trunk活动接口数下限阈值
[LSW1]interface Eth-Trunk 1# 指定聚合组活动接口数的最小值
[LSW1-Eth-Trunk1]least active-linknumber 2# 退出聚合组接口的配置模式
[LSW1-Eth-Trunk1]quit
在一个 Eth-Trunk 接口内,活动接口数可以影响到 Eth-Trunk接口的状态和带宽。Eth-Trunk接口的带宽是所有处于 Up 状态的成员接口带宽之和。
为保证 Eth-Trunk接口的状态和带宽,可以设置以下两个阈值,以减小成员链路状态的变化带来的影响。
- 活动接口数下限阈值:当活动接口数小于配置的下限阈值时,Eth-Trunk 接口的状态转为Down。设置活动接口数下限阈值的目的是为了保证最小带宽。least active-linknumber 命令用来配置链路聚合组活动接口数目的下限阈值。
- 活动接口数上限阈值:当活动接口数达到上限阈值后,之后再发生成员链路状态变为 Up都不会使 Eth-Trunk接口的带宽增加。设置活动接口数上限阈值的目的是在保证了带宽的情况下提高网络的可靠性。max active-linknumber 命令用来配置链路聚合组活动接口数目的上限阈值。模拟器当前版本不支持配置活动接口数上限阈值。
(3)查看当前Eth-Trunk接口状态
[LSW1]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-cc2b-1fe8
Least Active-linknumber: 2 Max Active-linknumber: 8
Operate status: up Number Of Up Port In Trunk: 3
--------------------------------------------------------------------------------
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
Ethernet0/0/1 Selected 100M 32768 2 289 10111100 1
Ethernet0/0/2 Selected 100M 32768 3 289 10111100 1
Ethernet0/0/3 Selected 100M 32768 4 289 10111100 1 Partner:
--------------------------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
Ethernet0/0/1 32768 4c1f-cc8b-6bdb 32768 2 289 10111100
Ethernet0/0/2 32768 4c1f-cc8b-6bdb 32768 3 289 10111100
Ethernet0/0/3 32768 4c1f-cc8b-6bdb 32768 4 289 10111100
从上面的接口状态可以看到,Eth-Trunk 1聚合组状态(Operate status)为up,最小活动接口数为2。
(4)手工关闭LSW1设备上的Eth 0/0/1和Eth 0/0/2,模拟链路故障
[LSW1]interface Eth0/0/1# 关闭接口
[LSW1-Ethernet0/0/1]shutdown# 退出接口配置模式
[LSW1-Ethernet0/0/1]quit[LSW1]interface Eth0/0/2# 关闭接口
[LSW1-Ethernet0/0/2]shutdown# 退出接口配置模式
[LSW1-Ethernet0/0/2]quit
(5)再次查看Eth-Trunk接口状态
[LSW1]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-cc2b-1fe8
Least Active-linknumber: 2 Max Active-linknumber: 8
Operate status: down Number Of Up Port In Trunk: 0
--------------------------------------------------------------------------------
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
Ethernet0/0/1 Unselect 100M 32768 2 289 10100010 1
Ethernet0/0/2 Unselect 100M 32768 3 289 10100010 1
Ethernet0/0/3 Unselect 100M 32768 4 289 10100000 1 Partner:
--------------------------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
Ethernet0/0/1 0 0000-0000-0000 0 0 0 10100011
Ethernet0/0/2 0 0000-0000-0000 0 0 0 10100011
Ethernet0/0/3 32768 4c1f-cc8b-6bdb 32768 4 289 10110000
从上面的接口状态可以看到,Eth-Trunk 1聚合组状态(Operate status)为down。这是由于设置了 Eth-Trunk 的活动链路下限阈值为 2,关闭两个接口后,聚合组中可用活动接口数量少于2 导致整个聚合组对应的接口将会被关闭。尽管此时 GE1/0/3 处于 UP 状态,但是仍处于 Unselect状态。
5.2.6 修改负载分担模式
(1)开启上一步中关闭的LSW1设备接口
[LSW1]interface eth 0/0/1[LSW1-Ethernet0/0/1]undo shutdown [LSW1-Ethernet0/0/1]quit[LSW1]interface eth 0/0/2[LSW1-Ethernet0/0/2]undo shutdown[LSW1-Ethernet0/0/2]quit
(2)修改Eth-Trunk接口的负载分担模式为基于目的IP地址
# 进入聚合组接口配置模式
[LSW1]interface Eth-Trunk 1# 指定负载分担模式为基于目的IP
[LSW1-Eth-Trunk1]load-balance dst-ip# 退出聚合组接口配置模式
[LSW1-Eth-Trunk1]quit
当需要将 Eth-Trunk 接口的流量分散到不同的链路上,最后能到达统一目的地时,使用 load-balance 命令配置 Eth-Trunk 接口负载分担模式,以确保出方向的流量在各物理链路间进行合理的负载分担,避免链路阻塞。
(3)查看LSW1的Eth-Trunk接口状态
[LSW1]display eth-trunk 1
Eth-Trunk1's state information is:
Local:
LAG ID: 1 WorkingMode: STATIC
Preempt Delay: Disabled Hash arithmetic: According to DIP
System Priority: 100 System ID: 4c1f-cc2b-1fe8
Least Active-linknumber: 2 Max Active-linknumber: 8
Operate status: up Number Of Up Port In Trunk: 3
--------------------------------------------------------------------------------
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
Ethernet0/0/1 Selected 100M 32768 2 289 10111100 1
Ethernet0/0/2 Selected 100M 32768 3 289 10111100 1
Ethernet0/0/3 Selected 100M 32768 4 289 10111100 1 Partner:
--------------------------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
Ethernet0/0/1 32768 4c1f-cc8b-6bdb 32768 2 289 10111100
Ethernet0/0/2 32768 4c1f-cc8b-6bdb 32768 3 289 10111100
Ethernet0/0/3 32768 4c1f-cc8b-6bdb 32768 4 289 10111100
从接口状态中的Hash arithmetic可知,此时LSW1的Eth-Trunk 1基于目的 IP 地址进行负载分担。
(4)查看LSW2的Eth-Trunk接口状态
[LSW2]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-cc8b-6bdb
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
Ethernet0/0/1 Selected 100M 32768 2 289 10111100 1
Ethernet0/0/2 Selected 100M 32768 3 289 10111100 1
Ethernet0/0/3 Selected 100M 32768 4 289 10111100 1 Partner:
--------------------------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
Ethernet0/0/1 100 4c1f-cc2b-1fe8 32768 2 289 10111100
Ethernet0/0/2 100 4c1f-cc2b-1fe8 32768 3 289 10111100
Ethernet0/0/3 100 4c1f-cc2b-1fe8 32768 4 289 10111100
从接口状态中的Hash arithmetic可知,此时LSW2的Eth-Trunk 1负载分担模式为根据源IP地址(SIP)和目的IP地址(DIP)进行异或运算。
由于负载分担只对出方向的流量有效,因此链路两端接口的负载分担模式可以不一致,两端互不影响。
5.3 参考配置
完成上述配置后,LSW1和LSW2的配置详情如下。
5.3.1 LSW1的配置
[LSW1]display current-configuration
#
sysname LSW1
#
undo info-center enable
#
lacp priority 100
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaaauthentication-scheme defaultauthorization-scheme defaultaccounting-scheme defaultdomain defaultdomain default_adminlocal-user admin password simple adminlocal-user admin service-type http
#
interface Vlanif1
#
interface MEth0/0/1
#
interface Eth-Trunk1mode lacp-staticleast active-linknumber 2load-balance dst-ip
#
interface Ethernet0/0/1eth-trunk 1
#
interface Ethernet0/0/2eth-trunk 1
#
interface Ethernet0/0/3eth-trunk 1
#
interface Ethernet0/0/4
#
interface Ethernet0/0/5
#
interface Ethernet0/0/6
#
interface Ethernet0/0/7
#
interface Ethernet0/0/8
#
interface Ethernet0/0/9
#
interface Ethernet0/0/10
#
interface Ethernet0/0/11
#
interface Ethernet0/0/12
#
interface Ethernet0/0/13
#
interface Ethernet0/0/14
#
interface Ethernet0/0/15
#
interface Ethernet0/0/16
#
interface Ethernet0/0/17
#
interface Ethernet0/0/18
#
interface Ethernet0/0/19
#
interface Ethernet0/0/20
#
interface Ethernet0/0/21
#
interface Ethernet0/0/22
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
#
return
5.3.2 LSW2的配置
[LSW2]display current-configuration
#
sysname LSW2
#
undo info-center enable
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaaauthentication-scheme defaultauthorization-scheme defaultaccounting-scheme defaultdomain defaultdomain default_adminlocal-user admin password simple adminlocal-user admin service-type http
#
interface Vlanif1
#
interface MEth0/0/1
#
interface Eth-Trunk1mode lacp-static
#
interface Ethernet0/0/1eth-trunk 1
#
interface Ethernet0/0/2eth-trunk 1
#
interface Ethernet0/0/3eth-trunk 1
#
interface Ethernet0/0/4
#
interface Ethernet0/0/5
#
interface Ethernet0/0/6
#
interface Ethernet0/0/7
#
interface Ethernet0/0/8
#
interface Ethernet0/0/9
#
interface Ethernet0/0/10
#
interface Ethernet0/0/11
#
interface Ethernet0/0/12
#
interface Ethernet0/0/13
#
interface Ethernet0/0/14
#
interface Ethernet0/0/15
#
interface Ethernet0/0/16
#
interface Ethernet0/0/17
#
interface Ethernet0/0/18
#
interface Ethernet0/0/19
#
interface Ethernet0/0/20
#
interface Ethernet0/0/21
#
interface Ethernet0/0/22
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
#
return
思考题
配置 least active-linknumber 和 max active-linknumber 时,对两个参数大小有什么要求?
答案:Least active-linknumber 需要小于或等于 max active-linknumber。
参考文献
华为HCIA-Datacom V1.0 实验手册 (eNSP Pro)