标题:bond网卡掉线问题
产品:openEuler
版本:openEuler-20.03-LTS-SP2
组件:bond
分类:网络
来源:总结
【背景及现象描述】
在openEuler-20.03-LTS-SP2环境通过如下shell脚本设置bond0 bond1网卡
nmcli con add type bond ifname bond0 bond.options "miimon=100,mode=1"
nmcli con add type ethernet ifname eno3 master bond0
nmcli con add type ethernet ifname enp30f1 master bond0
nmcli con add type vlan con-name bond0.1207 dev bond0 id 1207 ipv4.method manual connection.autoconnect yes ipv4.addresses 100.71.7.199/24 ipv4.gateway 100.71.7.254
nmcli con add type bond ifname bond1 bond.options "miimon=100,mode=4,xmit_hash_policy=layer3+4"
nmcli con add type ethernet ifname enp3s0f0 master bond1
nmcli con add type ethernet ifname enp129s0f0 master bond1
nmcli con add type vlan con-name bond1.1807 dev bond1 id 1807 ipv4.method manual connection.autoconnect yes ipv4.addresses 100.73.7.199/24 ipv4.gateway 100.73.7.254
nmcli con add type vlan con-name bond1.1839 dev bond1 id 1839 ipv4.method manual connection.autoconnect yes ipv4.addresses 100.73.39.199/24
nmcli connection modify bond0.1207 +ipv4.routes "100.71.0.0/16 100.71.7.254"
nmcli connection modify bond0.1207 +ipv4.routes "192.168.0.0/16 100.71.7.254"
nmcli c reload && nmcli networking off && nmcli networking on
创建后bond0,bond1会断开不展示
bond断开前网卡信息
bond断开后网卡信息
【原因分析】
后续使用nmcli d
命令查看设备连接状态,bond0 bond1为connecting状态,一直处于连接中
再使用 nmcli c show bond-bond0
命令查看bond状态,发现ipv4.method值为disabled,ipv6.method 值为auto
openEuler-20.03-LTS-SP2使用的4.19内核bond不支持ipv6,环境中bond0与bond1的ipv4.method默认为disabled但是ipv6.method 为auto,网卡一直卡在获取ip地址阶段,将ipv4.method ipv6.method均设置为disabled后,解决问题。
【解决方法】
使用NetworkManager创建bond接口时,需要关闭ipv4 ipv6的 method属性,ipv4.method ipv6.method 均需设置为disabled
在如下脚本创建bond0 bond1时加上ipv6.method disabled ipv4.method disabled
nmcli con add type bond ifname bond0 bond.options "miimon=100,mode=1" ipv6.method disabled ipv4.method disabled
nmcli con add type ethernet ifname eno3 master bond0
nmcli con add type ethernet ifname enp30f1 master bond0
nmcli con add type vlan con-name bond0.1207 dev bond0 id 1207 ipv4.method manual connection.autoconnect yes ipv4.addresses 100.71.7.199/24 ipv4.gateway 100.71.7.254
nmcli con add type bond ifname bond1 bond.options "miimon=100,mode=4,xmit_hash_policy=layer3+4" ipv6.method disabled ipv4.method disabled
nmcli con add type ethernet ifname enp3s0f0 master bond1
nmcli con add type ethernet ifname enp129s0f0 master bond1
nmcli con add type vlan con-name bond1.1807 dev bond1 id 1807 ipv4.method manual connection.autoconnect yes ipv4.addresses 100.73.7.199/24 ipv4.gateway 100.73.7.254
nmcli con add type vlan con-name bond1.1839 dev bond1 id 1839 ipv4.method manual connection.autoconnect yes ipv4.addresses 100.73.39.199/24
nmcli connection modify bond0.1207 +ipv4.routes "100.71.0.0/16 100.71.7.254"
nmcli connection modify bond0.1207 +ipv4.routes "192.168.0.0/16 100.71.7.254"
nmcli c reload && nmcli networking off && nmcli networking on
需要先删除/etc/sysconfig/network-scripts目录下bond文件,再执行脚本重新生成可解决