华为--链路捆绑聚合实验or bond配置

一:捆绑链路原理

1.1:链路聚合基本概念
链路聚合(Link Aggregation),也称为端口捆绑,端口聚集或链路聚集。链路聚合是将多个端口聚合在一起形成一个汇聚组,以实现出/入负荷在和成员端口中的分担。从外面看起来,一个汇聚组好像就是一个端口。
使用链路汇聚服务的上层实体把同一聚合组内多条物理链路视为一条逻辑链路
链路聚合在数据链路层上实现
在这里插入图片描述
在这里插入图片描述
1.2:链路聚合的优点
在这里插入图片描述

如图:通过将多个物理链路捆绑为一个逻辑链路增加了带宽
提高了可靠性,当有一条链路,例如D断开,流量会自动在剩下的A B C三条链路间重新分配
避免二层环路
实现链路传输弹性和冗余
1.3:链路聚合的限制条件
在这里插入图片描述

聚合链路两端的物理参数必须保持一致

1.进行聚合的链路的数目要保持一致

2.进行聚合的链路的速率要保持一致

3.进行聚合的链路为全双工方式 要保持一致

聚合链路两端的逻辑参数必须要保持一致

同一个汇聚组中端口的基本配置必须保持一致

基本配置主要包括STP,QoS,VLAN,端口等相关配置

1.4:BPDU(实验配置中会用到)
BPDU是网桥协议数据单元(Bridge Protocol Data Unit)是一种生成树协议问候数据包
它以可配置的间隔发出,用来在网络的网桥间进行信息交换

二:以太网链路捆绑

2.1:链路捆绑分类:

二层链路捆绑

交换机与交换机之间的

二三层链路捆绑

交换机与路由器之间的

三层链路捆绑

路由器与路由器之间的

2.2:LACP

配置链路捆绑是会用到LACP,所以我们必须了解LACP

以太网链路聚合是指将多条以太网物理链路捆绑在一起成为一条逻辑链路,从而实现增加链路带宽的目的。链路聚合分为手工模式和LACP模式

LACP模式需要有链路聚合控制协议LACP的参与,当需要在两个直连设备间提供一个较大的链路带宽而设备支持LACP协议时,建议使用LACP模式。LACP模式不仅可以实现增加带宽,提高可靠性,负载分担的目的,而且可以提高Eth-Trunk的容错性,提供备份功能。

LACP模式下,部分链路是活动链路,所有活动链路均参与数据转发。如果某条活动链路故障,链路聚合组自动在非活动链路中选择一条链路作为活动链路,参与数据转发的链路数据不变。

三:链路捆绑实验

3.1:实验拓扑图

在这里插入图片描述

3.2:实验目的

通过链路捆绑实现两台主机互联互通,并在LSW1和LSW2之间 ,三条链路,两个活动,一个备份

3.3 实验步骤

3.3.1交换机LSW1配置



<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw1
Nov 12 2019 16:33:11-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 4, the c
hange loop count is 0, and the maximum number of records is 4095.fo	
[sw1]undo info-center enable			'//关闭华为信息提示中心,不建议关闭,我是为了你们看着方便'
Info: Information center is disabled.
[sw1]lacp priority 1000			'//设置优先级,可理解为sw1链路聚合的接口设置为“老大”'
[sw1]interface Eth-Trunk1		'//进入接口'
[sw1-Eth-Trunk1]bpdu enable			'//开启BPDU'
[sw1-Eth-Trunk1]mode lacp-static 		'//设置lacp模式为静态LACP'
[sw1-Eth-Trunk1]trunkport e 0/0/1 to 0/0/3		'//将物理接口加入到Eth-Trunk1中'
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw1-Eth-Trunk1]max active-linknumber 2		'//设置最大活动链路数为2(原本有三个,即表示为有一条作为备用)'

3.3.2:交换机LSW2配置

<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw2
Nov 12 2019 16:33:11-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 4, the c
hange loop count is 0, and the maximum number of records is 4095.fo	
[sw2]undo info-center enable			'//关闭华为信息提示中心,不建议关闭,我是为了你们看着方便
Info: Information center is disabled.
[sw2]interface Eth-Trunk1		'//进入接口'
[sw2-Eth-Trunk1]bpdu enable			'//开启BPDU'
[sw2-Eth-Trunk1]mode lacp-static 		'//设置lacp模式为静态LACP'
[sw2-Eth-Trunk1]trunkport e 0/0/1 to 0/0/3		'//将物理接口加入到Eth-Trunk1中'
Info: This operation may take a few seconds. Please wait for a moment...done.

3.3.3:主机配置
在这里插入图片描述

3.4:实验结果

两台主机可以成功相互通信

3.5:总结

同一网段的两台主机可以直接通过交换机直接通信,不需要通过路由器。
交换机链路聚合接口需要有一个设置LACP优先级。还可以在此接口设置最大活动链路数量。
每个交换机都要打开bpdu
每个交换机都要设置LACP模式
四:捆绑链路+Linux配置Bond

4.1:实验拓扑图

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

4.2:实验目的

在生产环境中,Linux系统常用两块网卡做bond,并实现与主机的互联互通

4.3:实验步骤

4.3.1:R1设置

<Huawei>
<Huawei>sys		'//进入系统视图'
Enter system view, return user view with Ctrl+Z.	
[Huawei]sysname R1		'//更改名称'
Nov 12 2019 16:25:14-08:00 R1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 1, the ch
ange loop count is 0, and the maximum number of records is 4095.n	
[R1]undo info-center enable 		'//关闭华为信息提示中心,不建议关闭,我是为了你们看着方便'
Info: Information center is disabled.
[R1]int Eth-Trunk1			'//进入接口'
[R1-Eth-Trunk1]trunkport g 0/0/0 to 0/0/1		'//将物理接口添加进去'
[R1-Eth-Trunk1]ip address 12.0.0.1 30		'//添加ip地址'
[R1-Eth-Trunk1]q
[R1]int Eth-Trunk2		'//进入接口'
[R1-Eth-Trunk2]trunkport g 0/0/2 to 0/0/3		'//将物理接口添加进去'
[R1-Eth-Trunk2]ip add 192.168.10.1 24		'//添加IP地址

4.3.2:R2设置

<Huawei>
<Huawei>sys		'//进入系统视图'
Enter system view, return user view with Ctrl+Z.	
[Huawei]sysname R2		'//更改名称'
Nov 12 2019 16:25:14-08:00 R2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 1, the ch
ange loop count is 0, and the maximum number of records is 4095.n	
[R2]undo info-center enable 		'//关闭华为信息提示中心,不建议关闭,我是为了你们看着方便'
Info: Information center is disabled.
[R2]int Eth-Trunk5			'//进入接口'
[R2-Eth-Trunk5]trunkport g 0/0/0 to 0/0/1		'//将物理接口添加进去'
[R2-Eth-Trunk5]ip address 12.0.0.2 30		'//添加ip地址'
[R2-Eth-Trunk1]ip route-static 192.168.10.0 24 12.0.0.1			'//添加静态路由

4.3.3:sw1 补全设置

[sw1]int Eth-Trunk2			'//进入接口'
[sw1-Eth-Trunk2]trunkport g 0/0/1 to 0/0/2		'//将物理地址添加进来'
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw1-Eth-Trunk2]q		'//退出接口'
[sw1]int vlanif 1		'//进入vlan接口'
[sw1-Vlanif1]ip add 192.168.10.2 24		'//添加ip地址'

4.3.4:sw2补全设置

[sw2]int vlanif 1		'//进入vlan接口'
[sw2-Vlanif1]ip add 192.168.10.3 24		'//添加ip地址'
[sw1-Vlanif1]q		'//退出接口'
[sw2]int Eth-Trunk2		'//进入接口'
[sw2-Eth-Trunk2]trunkport e 0/0/5 to 0/0/6		'//将物理地址添加进来'

4.3.5:主机补全设置
在这里插入图片描述
4.3.6:打开虚拟机,配置
在这里插入图片描述

第二步

[root@localhost ~]# nmcli connection 		'//查看UUID值,准备编辑ens36配置文件'
名称        UUID                                  类型            设备   
ens33       fe60a0ac-7d04-46a3-b29c-633a50b88f33  802-3-ethernet  ens33  
virbr0      3f51e6f6-a4d0-4d6c-9df7-48e6e05ff5c6  bridge          virbr0 
有线连接 1  557ffd5e-8b03-38ce-bffb-17a68e0a8c17  802-3-ethernet  ens36  		'//新添加的网卡ens36的UUID复制粘贴到其他位置,后面会用'

第三步

[root@localhost ~]# cd /etc/sysconfig/network-scripts/		'//进入网卡配置文件中'
[root@localhost network-scripts]# ls		'//查看后发现只有ens33的配置文件'
ifcfg-ens33  ifdown-isdn      ifup          ifup-plip      ifup-tunnel
ifcfg-lo     ifdown-post      ifup-aliases  ifup-plusb     ifup-wireless
ifdown       ifdown-ppp       ifup-bnep     ifup-post      init.ipv6-global
ifdown-bnep  ifdown-routes    ifup-eth      ifup-ppp       network-functions
ifdown-eth   ifdown-sit       ifup-ib       ifup-routes    network-functions-ipv6
ifdown-ib    ifdown-Team      ifup-ippp     ifup-sit
ifdown-ippp  ifdown-TeamPort  ifup-ipv6     ifup-Team
ifdown-ipv6  ifdown-tunnel    ifup-isdn     ifup-TeamPort
[root@localhost network-scripts]# cp ifcfg-ens33 ifcfg-ens36		'//我们将ens33的配置文件复制一份'
[root@localhost network-scripts]# ls
ifcfg-ens33  ifdown-ipv6      ifdown-tunnel  ifup-isdn    ifup-TeamPort
ifcfg-ens36  ifdown-isdn      ifup           ifup-plip    ifup-tunnel
ifcfg-lo     ifdown-post      ifup-aliases   ifup-plusb   ifup-wireless
ifdown       ifdown-ppp       ifup-bnep      ifup-post    init.ipv6-global
ifdown-bnep  ifdown-routes    ifup-eth       ifup-ppp     network-functions
ifdown-eth   ifdown-sit       ifup-ib        ifup-routes  network-functions-ipv6
ifdown-ib    ifdown-Team      ifup-ippp      ifup-sit
ifdown-ippp  ifdown-TeamPort  ifup-ipv6      ifup-Team
[root@localhost network-scripts]# vim ifcfg-ens33		'//配置ens33的设置'

第四步
[root@localhost network-scripts]# vim ifcfg-ens36 '//配置ens36’

第五步
[root@localhost network-scripts]# vim ifcfg-bond0 '//配置ifcfg-bond0’

这里简单说下bond的模式,详细的说明可自行百度

mode=0 ,(平衡抡循环策略)

mode=1,(主-备份策略)

mode=2,(平衡策略)

mode=4,( IEEE 802.3ad 动态链路聚合,需要交换机配置)

mode=5,

mode=6

miimon:指定MII链路监控频率,单位是毫秒(ms)。这将决定驱动检查每个slave链路状态频率。0表示禁止MII链路监控。100可以作为一个很好的初始参考值

第六步

[root@localhost network-scripts]# cd		'//返回到家目录'
[root@localhost ~]# systemctl restart network		'//重启网卡'
[root@localhost ~]# ping 192.168.10.1		'//尝试与网关通信'
PING 192.168.10.1 (192.168.10.1) 56(84) bytes of data.
64 bytes from 192.168.10.1: icmp_seq=1 ttl=255 time=69.5 ms
64 bytes from 192.168.10.1: icmp_seq=2 ttl=255 time=49.7 ms
64 bytes from 192.168.10.1: icmp_seq=3 ttl=255 time=56.0 ms
64 bytes from 192.168.10.1: icmp_seq=4 ttl=255 time=63.9 ms
^C

    
[root@localhost ~]# ping 192.168.10.4		'//尝试与PC 1通信'
PING 192.168.10.4 (192.168.10.4) 56(84) bytes of data.
64 bytes from 192.168.10.4: icmp_seq=1 ttl=128 time=119 ms
64 bytes from 192.168.10.4: icmp_seq=2 ttl=128 time=49.7 ms
64 bytes from 192.168.10.4: icmp_seq=3 ttl=128 time=63.5 ms
64 bytes from 192.168.10.4: icmp_seq=4 ttl=128 time=56.0 ms
64 bytes from 192.168.10.4: icmp_seq=5 ttl=128 time=45.0 ms
^C

[root@localhost ~]# ping 192.168.10.5		'//尝试与PC 2通信'
PING 192.168.10.5 (192.168.10.5) 56(84) bytes of data.
64 bytes from 192.168.10.5: icmp_seq=1 ttl=128 time=68.9 ms
64 bytes from 192.168.10.5: icmp_seq=2 ttl=128 time=42.6 ms
64 bytes from 192.168.10.5: icmp_seq=3 ttl=128 time=35.6 ms
64 bytes from 192.168.10.5: icmp_seq=4 ttl=128 time=27.3 ms
64 bytes from 192.168.10.5: icmp_seq=5 ttl=128 time=40.2 ms
^C

4.4:实验结果

bond可以和主机通信

4.5:总结

添加bond后需要通过路由器和主机实验联通,所以需要配置路由器和足迹网关
lacp命令配置和bpdu命令配置在二层链路绑定中使用,同样,最大链路活动数也在此中使用
交换机上配置IP地址需要添加虚拟接口vlanif
Linux新添加的网卡不会自动生成配置文件,我们需要手动复制并配置文件
bond文件也需要手动添加,建议将完整的配置文件保存下来,以后备用

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值