链路聚合

本文详细介绍链路聚合(Bonding)、团队(Team)和桥接(Bridge)三种网络配置方式,包括配置步骤、监控方法及操作命令。通过具体实例,讲解如何在Linux环境下进行网络配置,以实现链路聚合,提高网络带宽和稳定性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

####链路聚合####
链路聚合是指将两个或更多的数据信道结合成一个单个的信道,该信道以一个单一的更高带宽的逻辑链路出现,
链路聚合能够提高链路带宽,增强网络可用性,支持负载分担。

##1.bond##
1删除全部网络配置
nm-connection-editor ##删除ip##
nmcil connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.254.150 ##添加bond0##
ifconfig ##查看ip##
nmcil connection add con-name eth0 ifname eth0 type bond-slave master bond0 ##插入eth0和eth1两块网卡##
nmcil connection add con-name eth1 ifname eth1 type bond-slave master bond0
watch -n 1 cat /proc/net/bonding/bond0 ##实施监控##

在这里插入图片描述

2分别写bond0和eth0的配置文件,复制eth0为eth1,之后查看/proc/net/bonding/bond0目录下的状态
注意:bond最多可以添加两个网卡,team可以添加八个网卡
cd /etc/sysconfig/network-scripts ##cd到此路径下##
vim ifcfg-bond0 ##写bond0配置文件##

在这里插入图片描述

vim ifcfg-eth0 ##写eth0配置文件##

在这里插入图片描述

cp ifcfg-eth0 ifcfg-eth1 ##给eth1复制eth0的配置文件##

vim ifcfg-eth1 ##修改eth1的配置文件##

在这里插入图片描述

systemctl restart network ##重启网络##

##2.team##
1.team服务,首先nm-connection-editor删除网络配置
之后添加team0,注意命令格式写正确。之后输入watch -n 1 teamdctl team0 stat监控team0,可以看到程序活跃但是没有网卡,之后添加eth0与eth1,可以在监控处看见eth0与eth1均为up状态
nm-connection-editor 删除其他网络配置
nmcli connection add con-name team0 ifname team0 type team config '{“runner”:{“name”:“activebackup”}}‘ip4 172.25.254.150/24##增加team##
打开另以shell输入watch -n 1 teamdctl team0 stat可以看到team开启成功,但是没有添加网卡

在这里插入图片描述

nmcli connection add con-name eht0 ifname eth0 type team-slave master team0 ##添加eth0网卡##

nmcli connection add con-name eht1 ifname eth1 type team-slave master team0 ##添加eth1网卡##
可以在监控出看到两块网卡已经被添加

在这里插入图片描述

通过修改文件开启team
nm-connection-editor 删除其他网络配置
cd /etc/sysconfig/network-scripts 切换到此目录下
vim ifcfg-team0 写team0的配置文件##

在这里插入图片描述

vim ifcfg-eth0 写eth0的配置文件

在这里插入图片描述

cp ifcfg-eth0 ifcfg-eth1 复制eth0为eth1
vim ifcfg-eth1 修改eth1的配置文件
systemctl restart network 重启网络服务
systemctl restart NetworkManage 重启网络服务

##3.桥接##
cd /etc/sysconfig/network-scripts ##切换到此路径下##
ls ##查看设备,此时无br0与enp0s25##
vim ifcfg-enp0s25 ##写enp0s25配置文件#

在这里插入图片描述

vim ifcfg-br0 ##写br0的文件##

在这里插入图片描述

systemctl stop NetworkManage.service ##停止网络服务##
systemctl restart NetworkManage.service ##重启网络服务##
通过指令实现桥接
brctl addbr br0 ##添加br0##
ifconfig br0 172.25.254.152/24 ##给br0赋予ip##
ifconfig ##查看有无br0##
brctl show ##查看桥接设备,此时br0已经出现,但是并无真实的接口##
brctl addif bro eth0 ##将br0插在eth0##
brctl show ##查看br0是否挂在了eth0上##

在这里插入图片描述

删除桥接
ifconfig br0 down ##让br0停止工作##
brctl delif br0 eth0 ##将br0在eth0上拔下##
brctl delbr br0 ##删除br0##

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值