删除bond
rmmod bonding
rm -rf /etc/modprobe.d/bond.conf
rm -rf /etc/sysconfig/network-scripts/ifcfg-bond0
reboot 服务器
##确认是否删除,如果bonding目录不存在,这删除
cat /proc/net/bonding/bond0
### config bond4
##交换机需要配置lacp 和端口聚合
systemctl stop NetworkManager
systemctl disable NetworkManager
cat >/etc/sysconfig/network-scripts/ifcfg-eno1<<EOF
DEVICE=eno1
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
USERCTL=no
SLAVE=yes
EOF
cat >/etc/sysconfig/network-scripts/ifcfg-eno2<<EOF
DEVICE=eno2
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
USERCTL=no
SLAVE=yes
EOF
cat >/etc/sysconfig/network-scripts/ifcfg-bond0<<EOF
DEVICE=bond4
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.8.5.15
NETMASK=255.255.255.0
GATEWAY=10.8.5.254
EOF
##3、配置bonding
cat >/etc/modprobe.d/bond.conf<<EOF
alias bond0 bonding
options bond0 miimon=100 mode=4 lacp_rate=1
EOF
systemctl restart network
###确认信息
cat /proc/net/bonding/bond0
###bond1 config
###交换机无需做修改
systemctl stop NetworkManager
systemctl disable NetworkManager
cat >/etc/sysconfig/network-scripts/ifcfg-eno1<<EOF
DEVICE=eno1
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
USERCTL=no
SLAVE=yes
EOF
cat >/etc/sysconfig/network-scripts/ifcfg-eno2<<EOF
DEVICE=eno2
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
USERCTL=no
SLAVE=yes
EOF
cat >/etc/sysconfig/network-scripts/ifcfg-bond0<<EOF
DEVICE=bond0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.8.5.15
NETMASK=255.255.255.0
GATEWAY=10.8.5.254
EOF
##3、配置bonding
cat >/etc/modprobe.d/bond.conf<<EOF
alias bond0 bonding
options bond0 miimon=100 mode=1
EOF
systemctl restart network
###确认信息
cat /proc/net/bonding/bond0
来源:CSDN
作者:左丿仔
链接:https://blog.csdn.net/zuopiezia/article/details/103935741