服務器經常有多個網卡,為了保證網絡冗余性,一個網卡出現故障時,不導致網絡服務中斷,可以懂多網卡網卡綁定來解決此問題。
環境:
系統:Ubuntu16.04 網卡:em1 em2 ip:192.168.0.46
安裝ifenslave:
sudo apt-get install ifenslave echo "bonding" >>/etc/modules
網卡綁定配置:
vim /etc/network/interfaces
auto bond0
iface bond0 inet static
address 192.168.0.46
netmask 255.255.255.0
bond-slaves none
bond-mode active-backup
bond-miimon 100
auto eno1
iface eno1 inet manual
bond-master bond0
bond-primary eno1 eno2
auto eno2
iface eno2 inet manual
bond-master bond0
bond-primary eno1 eno2
配置完成后重啟網卡(如果重啟不生效,請重啟服務器):
/etc/init.d/networking restart
ifconfig 查看配置是否生效:

