欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

Linux网卡bond

最编程 2024-02-04 22:07:06
...

网卡bond的模式

网卡绑定mode共有七种(0~6) bond0、bond1、bond2、bond3、bond4、bond5、bond6。 常用的有三种:

mode=0:平衡负载模式,有自动备援,但需要”Switch”支援及设定。

mode=1:自动备援模式,其中一条线若断线,其他线路将会自动备援。

mode=6:平衡负载模式,有自动备援,不必”Switch”支援及设定。

配置网卡bond

确认NetworkManager关闭

service NetworkManger stop
chkconfig NetworkManger off

修改网卡配置文件

添加MASTER、SLAVE配置项
eth0:

$vi /etc/sysconfig/network-scripts/ifcfg-eth0
 DEVICE=eth0
 BOOTPROTO=dhcp
 ONBOOT=yes
 TYPE=Ethernet
 SLAVE=yes
 MASTER=bond0

eth1:

$vi /etc/sysconfig/network-scripts/ifcfg-eth1
 DEVICE=eth1
 BOOTPROTO=dhcp
 ONBOOT=yes
TYPE=Ethernet
 SLAVE=yes
 MASTER=bond0
 

bond0(不存在,需要自己创建):

$vi /etc/sysconfig/network-scripts/ifcfg-bond0
 DEVICE=bond0
 BOOTPROTO=dhcp
 ONBOOT=yes
 TYPE=Ethernet

修改modprobe.d(bond6模式)

$vi /etc/modprobe.d/bonding.conf
 alias bond0 bonding
 options bond0 miimon=100 mode=6

重启network

service network restart

检查

ip a可以看到eth0\eth1上的master为bond0