网卡的链路聚合
将多块网卡连接起来,有效的防止网卡损坏带来的损失
环境:需配置网卡
- bond模式(最多支持2块网卡)
轮询聚合(两块网卡同时工作)
主备聚合(一块网卡工作,一块网卡预备)
nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.254.229/24 添加bond聚合接口 nmcli connection add con-name eth0 ifname eth0 type bond-slave master bond0 绑定真实物理网卡 nmcli connection add con-name eth1 ifname eth1 type bond-slave master bond0
nmcli connection show 查看聚合网卡
watch -n 1 "cat /proc/net/bonding/bond0" ifconfig device down/up 开启/关闭网卡
nmcli connection delete device 删除设备
- team模式(最多支持2块网卡)
nmcli connection add con-name team0 ifname team0 type team config ’{"runner":{"name":"activebackup"}}‘ ip4 172.25.254.229/24 添加team聚合接口 nmcli connection add con-name eth0 ifname eth0 type bond-slave master team0 绑定真实物理网卡 nmcli connection add con-name eth1 ifname eth1 type bond-slave master team0
watch -n 1 "teamdctl team0 stat "
- 网桥
(不需要地址转化,也不需要路由器转发,不需要配置网关;不需要IP,工作在数据链路层)
命令添加网桥
添加
brctl addbr br0 添加网桥br0 ifconfig br0 ip/24 网桥添加ip brctl show brctl addif br0 eth0给网桥添加一个真实网卡
删除
brctl delif br0 eth0 删除搭建上网桥br0的eth0 ifconfig br0 down 关闭网桥 brctl delbr br0 删除网桥
文本添加网桥
cd /etc/sysconfig/network-scripts cp ifcfg-eth0 ifcfg-br0 vim ifcfg-eth0 修改物理网卡
vim ifcfg-br0 创建br0配置文件
systemctl restart network
ip a
删除桥接
rm -rf ifcfg-br0
编辑eth0 恢复物理网卡