服务器经常有多个网卡,为了保证网络冗余性,一个网卡出现故障时,不导致网络服务中断,可以懂多网卡网卡绑定来解决此问题。
环境:
系统: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 查看配置是否生效:

Ubuntu16.04双网卡绑定-LMLPHP

05-27 18:05