Linux bonding config

刪除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=1xx.xxx.xxx.12
NETMASK=255.255.255.0
GATEWAY=1xx.xxx.xxx.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=1xx.xxx.xxx.15
NETMASK=255.255.255.0
GATEWAY=1xx.xxx.xxx.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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章