Linux bonding config

谁都会走 提交于 2020-01-11 17:23:44
删除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

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!