链路聚合
平衡轮循:传输速率块
主动备份:提高网卡稳定性
bond接口
bond最多支持两块网卡
1)进入虚拟机管理。给虚拟机添加网卡,确保虚拟机有两个网卡

2)删除所有网络接口

3)设定bond接口
watch -n 1 cat /proc/net/bonding/bond0 ##可用此命令监控以下操作
nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.160.214/24 ##创建一个bonding,设定bond主备模式
nmcli connection add con-name eth0 ifname eth0 type bond-slave master bond0 ##添加网卡eth0到bond0接口
nmcli connection add con-name eth1 ifname eth1 type bond-slave master bond0

nmcli connection show ##查看网卡接口信息
nmcli connection delete ##删除网卡接口
ifconfig eth0 down | up ##关闭|打开网卡

4)当关闭eth0网卡时会发现eth1会继续顶替eth0继续工作

5)当再次打开eth0网卡时eth0并不顶替eth1,而当关闭eth1时会发现eth0又顶替eth1继续工作


team接口
team功能与bond类似,team最多支持八块网卡
1)与bond一样,确保虚拟机有两个网卡,然后删除所有网络接口

2)设定
watch -n 1 teamdctl team0 state ##监控
nmcli connection add con-name team0 ifname team0 type team config '{"runner":{"name":"activebackup"}}' ip4 172.25.254.114/24 ##建立team接口
nmcli connection add con-name eth0 ifname eth0 type team-slave master team0 ##往team0上添加eth0
nmcli connection add con-name eth1 ifname eth1 type team-slave master team0 ##往team0上添加eth1

3)与bond相同,关闭一个网卡,另一个顶替继续工作

桥接
搭建网桥
1)为了方便恢复原来网卡配置文件,先把/etc/sysconfig/network-scripts/中相关网卡配置文件移到/mnt/中

2)打开网络图形管理删除网络 只留下virbr0和virbr1

3)创建相关配置文件
vim /etc/sysconfig/network-scripts/ifcfg-2333 ##创建网卡配置文件,写入下面内容
BOOTPROTO=none
BRIDGE=br0
DEVICE=enp0s25
ONBOOT=yes

vim /etc/sysconfig/network-scripts/ifcfg-br0 ##创建网桥配置文件,写入下面内容
DEVICE=br0
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.25.254.14
PREFIX=24
TYPE=Bridge

systemctl restart network -----------------重启网络

命令方式添加桥接
brctl addbr br0
ifconfig br0 172.25.254.13/24
brctl addif br0 eth0
brctl show

删除临时网桥
brctl delif br0 eth0
ifconfig br0 down
brctl delbr br0

本文详细介绍了链路聚合(Bonding)和网桥(Bridge)的设置方法,包括如何通过主动备份模式提高网络稳定性,以及如何创建和管理团队(Team)接口。同时,还提供了具体的命令行操作步骤,如使用nmcli和brctl工具来添加、删除网络接口和网桥。
2万+

被折叠的 条评论
为什么被折叠?



