跳转至

bond

单网卡配置

sudo nmcli connection add con-name eth0 ifname ens192 type Ethernet ip4 10.0.0.100/24 gw4 10.0.0.254 ipv4.dns 223.5.5.5 ipv4.method manual connection.autoconnect yes
sudo nmcli connection up eth0

双网卡 bond

1
2
3
sudo nmcli connection add type bond con-name bond0 ifname bond0 mode active-backup ip4 10.0.0.100/24 gw4 10.0.0.254 ipv4.dns 223.5.5.5 ipv4.method manual connection.autoconnect yes
nmcli connection add type ethernet slave-type bond con-name bond0-eth0 ifname eth0 master bond0
nmcli connection add type ethernet slave-type bond con-name bond0-eth1 ifname eth1 master bond0

切换测试

1
2
3
4
5
ifdown eth0
ifup eth0
cat /proc/net/bonding/bond0
nmcli con reload
systemctl restart network

参考文献

作者: aisuhua