說明:
(1)、在網卡聚合綁定之前,要先停用NetworkManager服務(或者在網卡中添加參數:NM_CONTROLLED=no),否則系統重啟后綁定的IP失效了。
# systemctl stop NetworkManager # systemctl disable NetworkManager
(2)、網卡橋接服務器需要依賴KVM虛擬化相關服務:
# vim /etc/yum.repos.d/opennebula.repo
添加如下內容:
[opennebula]
name=opennebula
baseurl=http://downloads.opennebula.org/repo/5.0/CentOS/7/x86_64
enabled=1
gpgcheck=0
# yum install opennebula-node-kvm
准備工作完成后,就可以正式開始了!
1、編輯物理網卡配置文件:
# vim ifcfg-eno1
DEVICE=eno1
TYPE=Ethernet
BOOTPROTO=none
NM_CONTROLLED=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
# vim ifcfg-ens15f0
DEVICE=ens15f0
TYPE=Ethernet
BOOTPROTO=none
NM_CONTROLLED=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
2、創建聚合網卡配置文件:
# vim ifcfg-bond0
DEVICE=bond0
TYPE=bond
BOOTPROTO=none
NM_CONTROLLED=no
ONBOOT=yes
BRIDGE=br0
3、創建橋接網卡配置文件:
# vim ifcfg-br0
DEVICE=br0
TYPE=Bridge
BOOTPROTO=none
ONBOOT=yes
NM_CONTROLLED=no
IPADDR=192.168.1.233
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
4、編輯網卡聚服務配置文件:
# vim /etc/modprobe.d/bonding.conf
alias bond0 bonding
options bonding mode=4 miimon=100
5、執行網卡聚合命令:
# modprobe bonding
6、查看聚合網卡的狀態:
# cat /proc/net/bonding/bond0
[THE END]
