链路聚合_01

一、链路聚合技术

随着我们网络的不断拓展,业务流量也随之增多,那么我们就开始需要多链路进行通信

故研究出一个技术==Eth-Trunk(链路捆绑)

作用:

可以把多个独立的物理端口绑定在一起,当做一个大带宽逻辑接口去使用,这样的方法既不用替换端口也不必浪费IP地址资源

组建网络遇到的问题:

1. 网络需求大,单链路无法完成,增加链路又浪费IP地址,更换高带宽接口(E口换G口)又会增加维护设备的成本

2. 如果链路发生故障,又会影响通信和办公

解决:

两个问题均可以用eth-trunk来解决,将多个e口绑定为一起带宽转发就会增加(不必使用G口)由于是多个端口绑定故即便发生端口故障或者是单条链路故障也没有关系,因为其他端口也会进行转发(如果物理端口断掉,带宽转发也会稍微影响:比如,我用四条链路组成了一个链路捆绑(4000M)那么断开一个的话(-1000M),转发就会变成3000M)

Eth-Trunk链路聚合模式:

静态配置模式(手工负载分担)

动态配置模式(LACP)

Eth-trunk接口负载分担:

可以选择IP地址或者包作为负载分担依据

设置成员接口的负载分担分配

如果一个成员的分配权重值越大,承担的负载就越大

逐流负载分担:

当源地址、目标地址都相同或者报文的源MAC地址、目标MAC地址都相同时,就会在一条链路上传输

逐包负载分担:

以报文为单位分别从不同的成员链路上发送

手工负载分担模式:

当两台设备其中一个不支持LACP时,可以用手工负载方式来增加设备间的带宽和可靠性

Eth-Trunk接口配置流程:

 

1、交换机的初始化配置

<Huawei>undo  terminal  monitor   \\关闭终端消息提示

<Huawei>system-view       \\进去系统视图

[Huawei]sysname  SW1    \\修改设备名为SW1

[sw1]vlan batch  10 20    \\创建vlan 10 20

[sw1]quit          \\返回

2、交换机连接PC端口的配置 模式access并加入对应的vlan

[sw1]interface GigabitEthernet 0/0/3      \\进去接口0/0/3

[sw1-GigabitEthernet0/0/3]port link-type access    \\设置端口模式为access 

[sw1-GigabitEthernet0/0/3]port default vlan  10     \\将端口加入vlan 10 

[sw1-GigabitEthernet0/0/3]quit     \\返回

[sw1]interface GigabitEthernet 0/0/4      \\进去接口0/0/4

[sw1-GigabitEthernet0/0/4]port link-type access    \\设置端口模式为access 

[sw1-GigabitEthernet0/0/4]port default vlan  20     \\将端口加入vlan 20 

[sw1-GigabitEthernet0/0/4]quit     \\返回

[sw2]interface GigabitEthernet 0/0/3      \\进去接口0/0/3

[sw2-GigabitEthernet0/0/3]port link-type access    \\设置端口模式为access 

[sw2-GigabitEthernet0/0/3]port default vlan  10     \\将端口加入vlan 10 

[sw2-GigabitEthernet0/0/3]quit     \\返回

[sw2]interface GigabitEthernet 0/0/4      \\进去接口0/0/4

[sw2-GigabitEthernet0/0/4]port link-type access    \\设置端口模式为access 

[sw2-GigabitEthernet0/0/4]port default vlan  20     \\将端口加入vlan 20 

[sw2-GigabitEthernet0/0/4]quit     \\返回

3、交换机连接交换机之间先做链路捆绑在设置 模式trunk 并允许所有的vlan 通过

[sw1]interface Eth-Trunk 1  \\创建链路聚合接口 1

[sw1-Eth-Trunk1]mode  manual load-balance   \\设置模式为静态负载均衡模式

[sw1-Eth-Trunk1]trunkport g0/0/1   \\添加接口成员 g0/0/1

[sw1-Eth-Trunk1]trunkport g0/0/2    \\添加接口成员 g0/0/2

[sw1-Eth-Trunk1]port link-type trunk   \\设置端口模式为trunk

[sw1-Eth-Trunk1]port trunk allow-pass  vlan  all    \\并允许所有的vlan 通过

[sw1-Eth-Trunk1]quit    \\返回

[sw2]interface Eth-Trunk 2  \\创建链路聚合接口 2

[sw2-Eth-Trunk2]mode  manual load-balance   \\设置模式为静态负载均衡模式

[sw2-Eth-Trunk2]trunkport g0/0/1   \\添加接口成员 g0/0/1

[sw2-Eth-Trunk2]trunkport g0/0/2    \\添加接口成员 g0/0/2

[sw2-Eth-Trunk2]port link-type trunk   \\设置端口模式为trunk

[sw2-Eth-Trunk2]port trunk allow-pass  vlan  all    \\并允许所有的vlan 通过

[sw2-Eth-Trunk2]quit    \\返回

[sw2]display  Eth-Trunk 2  显示eth-Trunk2的端口

二、LACP模式概述

1、LACP模式也可以称之为M:N模式

1)M代表处于活动状态的转发数据

2)N代表处于非活动状态的备份链路

3)例如我们建立的三条链路,就是其中两条转发,其中1条备份,当转发链路出现故障的时候,备份链路才会进行数据转发,平时是不转发数据的

2、LACP的选取:

 3、LACP的抢占:

三、LACP负载分担模式的配置命令

创建Eth-Trunk

命令格式:interface Eth-Trunk接口(范围0-63)

配置Eth-Trunk的工作模式

命令格式:mode lacp-static 

Eth-Trunk中加入接口成员

命令格式:trunkport gi0/0/1 

Eth-Trunk修改优先级(值越小优先级越大)

命令格式:lacp priority  优先级的值 (范围0-65535默认值 32768) 

Eth-Trunk最大连接数的设置

命令格式:interface Eth-Trunk 1

      max active-linkunmber 数量(范围1-8默认值 8)

配置Eth-Trunk的抢占功能

命令格式:interface Eth-Trunk 1

          lacp preempt enable  \\开启抢占功能

四、配置动态Eth-Trunk模式

1、创建Eth-Trunk

2、配置Eth-Trunk的工作模式

3、Eth-Trunk中加入接口成员

4、配置SW2为eth-trunk的主动端,优先级设置为100

5、交换机之间的最大连接宽带为2G

命令配置:

S1交换机的初始配置

<Huawei>u  t  m     

<Huawei>system-view 

[S1]sysname S1

② 创建vlan并将接口加入vlan设置接口的模式为acess:

[S1]vlan batch   10  20    \\创建vlan 10 20

[S1]interface  g0/0/4       \\进入接口0/0/4

[S1-GigabitEthernet0/0/4]port link-type access  \\设置接口模式为接入链路

[S1-GigabitEthernet0/0/4]port default vlan 10   \\将接口加入vlan10

[S1]interface  gth0/0/5     \\进入接口0/0/5

[S1-GigabitEthernet0/0/5]port link-type access   \\设置接口模式为接入链路

[S1-GigabitEthernet0/0/5]port default vlan 20    \\将接口加入vlan20

③ 配置链路聚合:LACP模式

[S1] interface  eth-trunk  1      \\创建链路聚合的端口1 (0-63)

[S1-Eth-Trunk1]mode  lacp-static 

[S1-Eth-Trunk1]trunkport  g0/0/1    \\将接口加入到负载模式

[S1-Eth-Trunk1]trunkport  g0/0/2 \\将接口加入到负载模式

[S1-Eth-Trunk1]trunkport  g0/0/3 \\将接口加入到负载模式

[S1-Eth-Trunk1]port link-type trunk          \\设置为trunk链路

[S1-Eth-Trunk1]port trunk allow-pass vlan all  \\ 设置为允许所有vlan

[S1-Eth-Trunk1]display eth-trunk 1         \\查看 eth-trunk

[S1]int  eth-trunk 1   \\进入eth-trunk1

S2交换机的初始配置

<Huawei> u  t  m

<Huawei>system-view 

[Huawei]sysname S2

创建vlan并将接口加入vlan:

[S2]vlan batch   10  20    \\创建vlan 10 20

[S2]interface  g0/0/4     \\进入接口0/0/5

[S2-GigabitEthernet0/0/4]port link-type access  \\设置接口模式为接入链路

[S2-GigabitEthernet0/0/4]port default vlan 10   \\将接口加入vlan10

[S2]interface  g0/0/5           \\进入接口0/0/5

[S2-GigabitEthernet0/0/5]port link-type access   \\设置接口模式为接入链路

[S2-GigabitEthernet0/0/5]port default vlan 20    \\将接口加入vlan20

配置链路聚合:LACP模式

[S2] interface  eth-trunk 1      \\创建链路聚合的端口1 (0-63)

[S2-Eth-Trunk1] mode  lacp-static

[S2-Eth-Trunk1]trunkport  g0/0/1 \\将接口加入到负载模式

[S2-Eth-Trunk1]trunkport  g0/0/2 \\将接口加入到负载模式

[S2-Eth-Trunk1]trunkport  g0/0/3 \\将接口加入到负载模式

[S2-Eth-Trunk1]port link-type trunk    \\设置为trunk链路

[S2-Eth-Trunk1]port trunk allow-pass vlpe trunkan all   \\ 设置为允许所有vlan

[S2-Eth-Trunk1]display eth-trunk 1   \\查看 eth-trunk

[S2]display port vlan  \\查看 vlan

[S2]display eth-trunk 1 \\查看 eth-trunk

 Local:本地信息   Partner:对端信息

Svstem Prioritv:32768   系统的优先级

System ID:4clf-cc4e-5   系统的mac地址

MAX Active-linknumber:8  最大的活动链路数是8条

链路数是可以进行调整的我们可以调整为2条

Number of Up Port In Trunk:0  目前有几条

端口的编号         端口的状态   端口的带宽  接口的优先级 接口编号

   UNSELECT 为备份端口     Selected 为活动端口

我们使用的是千兆端口,目前对方的信息都是0还没有启动

S2设置他的链路为2:

[S2]display eth-trunk 1 \\查看 eth-trunk

[S2]int  eth-trunk 1     \\进入eth-trunk1

[S2-Eth-Trunk1]max active-linknumber 2    \\设置为2条链路

修改sw2为主设备,默认值是32768 我们可以设置为100

[S2]lacp priority 100      \\设置默认值为100

[S2]display eth-trunk  1 \\查看 eth-trunk

设置S2抢占功能:

模拟1接口出现故障了

[S2]int g0/0/1                       \\加入接口1

[S2-GigabitEthernet0/0/1]shutdows \\关闭接口

[S2]display eth-trunk  1 \\查看 eth-trunk

[S2]display eth-trunk   \\查看 eth-trunk

Preempt Delay:Disabled  当前抢占功能未开启

配置启用抢占模式 S1  S2都需要开启

[S2]display eth-trunk 2             \\查看 eth-trunk

[S2-Eth-Trunk1]lacp preempt enable    \\配置抢占模式

[S1]display eth-trunk 1              \\查看 eth-trunk

[S1-Eth-Trunk1]lacp preempt enable     \\配置抢占模式

[S2]display eth-trunk   \\查看 eth-trunk

Preempt Delay Time:30  当前抢占功能已开启 30秒后抢

五、链路聚合综合实战

 

1、配置思路:

1.配置终端设备

  给PC机配置IP地址参数

2.配置网络设备

  -先初始化配置

  -创建vlan

  -将接口加入vlan并设置端口模式为access

eth-trunk

   -创建eth-trunk的端口

   -设置ETH-TRUNK模式

   -添加接口成员

   -设置端口模式为trunk并允许所有的vlan通过

2、配置命令:

二层交换机的配置 S3  S4  S5  S6

S3交换机的初始配置

<Huawei>u  t  m       \\关闭信息干扰

<Huawei>system-view   \\进入系统视图

[Huawei]sysname  S3     \\设置交换机的名字为S3

S3创建vlan 10 20

[S3]vlan  batch  10  20    \\创建vlan 10  20

S3将e0/0/1加入vlan10 并设置链路是access链路

[S3]int e0/0/1   \\进入接口0/0/1

[S3-Ethernet0/0/1]port link-type access    \\设置链路为接入链路(access链路)

[S3-Ethernet0/0/1]port default  vlan  10   \\将接口加入vlan10

创建链路聚合接口eth-trunk 1 并将设置模式为lacp、加入成员并设置链路为tunk并允许所有vlan通过

[S3]interface  Eth-Trunk 1        \\创建链路聚合的端口1

[S3-Eth-Trunk1]mode lacp-static    \\设置链路为动态lacp

[S3-Eth-Trunk1]trunkport e0/0/3    \\将接口加入到负载模式

[S3-Eth-Trunk1]trunkport e0/0/4     \\将接口加入到负载模式

[S3-Eth-Trunk1]port link-type trunk  \\设置为trunk链路

[S3-Eth-Trunk1] port  trunk allow-pass vlan all  \\并允许所有vlan通过

[S3-Eth-Trunk1]display eth-trunk 1   \\查看 eth-trunk

S4交换机的初始配置

<Huawei>u  t  m       \\关闭信息干扰

<Huawei>system-view   \\进入系统视图

[Huawei]sysname  S4     \\设置交换机的名字为S4

S4创建vlan 10 20

[S4]vlan  batch  10  20    \\创建vlan 10  20

S4将e0/0/1加入vlan10 并设置链路是access链路

[S4]int e0/0/1   \\进入接口0/0/1

[S4-Ethernet0/0/1]port link-type access    \\设置链路为接入链路(access链路)

[S4-Ethernet0/0/1]port default  vlan  20   \\将接口加入vlan20

创建链路聚合接口eth-trunk 1 并将设置模式为lacp、加入成员并设置链路为tunk并允许所有vlan通过

[S4]interface  Eth-Trunk 2        \\创建链路聚合的端口2

[S4-Eth-Trunk2]mode lacp-static    \\设置链路为动态lacp

[S4-Eth-Trunk2]trunkport e0/0/5    \\将接口加入到负载模式

[S4-Eth-Trunk2]trunkport e0/0/6     \\将接口加入到负载模式

[S4-Eth-Trunk2]port link-type trunk  \\设置为trunk链路

[S4-Eth-Trunk2] port  trunk allow-pass vlan all  \\并允许所有vlan通过

[S4-Eth-Trunk2]display eth-trunk 1   \\查看 eth-trunk

S5交换机的初始配置

<Huawei>u  t  m       \\关闭信息干扰

<Huawei>system-view   \\进入系统视图

[Huawei]sysname  S5     \\设置交换机的名字为S5

S5创建vlan 10 20

[S5]vlan  batch  10  20    \\创建vlan 10  20

S5将e0/0/1加入vlan10 并设置链路是access链路

[S5]int e0/0/1   \\进入接口0/0/1

[S5-Ethernet0/0/1]port link-type access    \\设置链路为接入链路(access链路)

[S5-Ethernet0/0/1]port default  vlan  10   \\将接口加入vlan10

创建链路聚合接口eth-trunk 1 并将设置模式为lacp、加入成员并设置链路为tunk并允许所有vlan通过

[S5]interface  Eth-Trunk 1        \\创建链路聚合的端口1

[S5-Eth-Trunk1]mode lacp-static    \\设置链路为动态lacp

[S5-Eth-Trunk1]trunkport e0/0/3    \\将接口加入到负载模式

[S5-Eth-Trunk1]trunkport e0/0/4     \\将接口加入到负载模式

[S5-Eth-Trunk1]port link-type trunk  \\设置为trunk链路

[S5-Eth-Trunk1] port  trunk allow-pass vlan all  \\并允许所有vlan通过

[S5-Eth-Trunk1]display eth-trunk 1   \\查看 eth-trunk

S6交换机的初始配置

<Huawei>u  t  m       \\关闭信息干扰

<Huawei>system-view   \\进入系统视图

[Huawei]sysname  S6     \\设置交换机的名字为S6

S6创建vlan 10 20

[S6]vlan  batch  10  20    \\创建vlan 10  20

S6将e0/0/1加入vlan10 并设置链路是access链路

[S6]int e0/0/1   \\进入接口0/0/1

[S6-Ethernet0/0/1]port link-type access    \\设置链路为接入链路(access链路)

[S6-Ethernet0/0/1]port default  vlan  20   \\将接口加入vlan20

创建链路聚合接口eth-trunk 1 并将设置模式为lacp、加入成员并设置链路为tunk并允许所有vlan通过

[S6]interface  Eth-Trunk 2        \\创建链路聚合的端口2

[S6-Eth-Trunk2]mode lacp-static    \\设置链路为动态lacp

[S6-Eth-Trunk2]trunkport e0/0/5    \\将接口加入到负载模式

[S6-Eth-Trunk2]trunkport e0/0/6     \\将接口加入到负载模式

[S6-Eth-Trunk2]port link-type trunk  \\设置为trunk链路

[S6-Eth-Trunk2] port  trunk allow-pass vlan all  \\并允许所有vlan通过

[S6-Eth-Trunk2]display eth-trunk 1   \\查看 eth-trunk

层交换机的配置 S1  S2

S1交换机的初始配置

<Huawei>u  t  m    \\关闭信息干扰

<Huawei>system-view   \\进入系统视图

[Huawei]sysname  S1     \\设置交换机的名字为S1

S1创建vlan 10 20

[S1]vlan  batch  10  20         \\创建vlan 10  20

3.创建链路聚合接口eth-trunk 1 、2并将设置模式为lacp加入成员并设置链路为tunk并允许所有vlan通过

[S1]interface  Eth-Trunk 1        \\创建链路聚合的端口1

[S1-Eth-Trunk1]mode lacp-static    \\设置链路为动态lacp

[S1-Eth-Trunk1]trunkport g0/0/3    \\将接口加入到负载模式

[S1-Eth-Trunk1]trunkport g0/0/4     \\将接口加入到负载模式

[S1-Eth-Trunk1]port link-type trunk  \\设置为trunk链路

[S1-Eth-Trunk1] port  trunk allow-pass vlan all  \\并允许所有vlan通过

[S1]interface  Eth-Trunk 2        \\创建链路聚合的端口2

[S1-Eth-Trunk2]mode lacp-static    \\设置链路为动态lacp

[S1-Eth-Trunk2]trunkport g0/0/5    \\将接口加入到负载模式

[S1-Eth-Trunk2]trunkport g0/0/6     \\将接口加入到负载模式

[S1-Eth-Trunk2]port link-type trunk  \\设置为trunk链路

[S1-Eth-Trunk2] port  trunk allow-pass vlan all  \\并允许所有vlan通过

[S1]interface  Eth-Trunk 3        \\创建链路聚合的端口3

[S1-Eth-Trunk3]mode lacp-static    \\设置链路为动态lacp

[S1-Eth-Trunk3]trunkport g0/0/7    \\将接口加入到负载模式

[S1-Eth-Trunk3]trunkport g0/0/8     \\将接口加入到负载模式

[S1-Eth-Trunk3]port link-type trunk  \\设置为trunk链路

[S1-Eth-Trunk3] port  trunk allow-pass vlan all  \\并允许所有vlan通过

[S1]display eth-trunk 1   \\查看 eth-trunk

[S1]display eth-trunk 2   \\查看 eth-trunk

[S1]display eth-trunk 3   \\查看 eth-trunk

S2交换机的初始配置

<Huawei>u  t  m    \\关闭信息干扰

<Huawei>system-view   \\进入系统视图

[Huawei]sysname  S2     \\设置交换机的名字为S2

S2创建vlan 10 20

[S2]vlan  batch  10  20         \\创建vlan 10  20

创建链路聚合接口eth-trunk 1 、2并将设置模式为lacp加入成员并设置链路为tunk并允许所有vlan通过

[S2]interface  Eth-Trunk 1        \\创建链路聚合的端口1

[S2-Eth-Trunk1]mode lacp-static    \\设置链路为动态lacp

[S2-Eth-Trunk1]trunkport g0/0/3    \\将接口加入到负载模式

[S2-Eth-Trunk1]trunkport g0/0/4     \\将接口加入到负载模式

[S2-Eth-Trunk1]port link-type trunk  \\设置为trunk链路

[S2-Eth-Trunk1] port  trunk allow-pass vlan all  \\并允许所有vlan通过

[S2-Eth-Trunk1]display eth-trunk 1   \\查看 eth-trunk

[S2]interface  Eth-Trunk2        \\创建链路聚合的端口2

[S2-Eth-Trunk2]mode lacp-static    \\设置链路为动态lacp

[S2-Eth-Trunk2]trunkport g0/0/5    \\将接口加入到负载模式

[S2-Eth-Trunk2]trunkport g0/0/6     \\将接口加入到负载模式

[S2-Eth-Trunk2]port link-type trunk  \\设置为trunk链路

[S2-Eth-Trunk2] port  trunk allow-pass vlan all  \\并允许所有vlan通过

[S2-Eth-Trunk2]display eth-trunk 2   \\查看 eth-trunk

[S2]interface  Eth-Trunk3        \\创建链路聚合的端口3

[S2-Eth-Trunk3]mode lacp-static    \\设置链路为动态lacp

[S2-Eth-Trunk3]trunkport g0/0/7    \\将接口加入到负载模式

[S2-Eth-Trunk3]trunkport g0/0/8     \\将接口加入到负载模式

[S2-Eth-Trunk3]port link-type trunk  \\设置为trunk链路

[S2-Eth-Trunk3] port  trunk allow-pass vlan all  \\并允许所有vlan通过

[S2-Eth-Trunk3]display eth-trunk 3   \\查看 eth-trunk

猜你喜欢

转载自blog.csdn.net/pitch_dark/article/details/127627352