bond网卡的制作

概览:

目前网卡绑定mode共有七种(0~6)bond0bond1bond2bond3bond4bond5bond6

 

常用的有三种:

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

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

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


一:在机其上安装两块网卡,并修改相应的网络配置文件

vi  /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

ONBOOT=yes

BOOTPROTO=none

MASTER=bond0

SLAVE=yes

USERCTL=no

vi /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1

ONBOOT=yes

BOOTPROTO=none

MASTER=bond0

SLAVE=yes

USERCTL=no

vi /etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0

BOOTPROTO=static

BROADCAST=

IPADDR=192.168.101.129

NETMASK=255.255.255.0

ONBOOT=yes

TYPE=Ethernet

GATEWAY=192.168.101.2

USERCTL=no

二、vim /etc/modprobe.conf 加载相关的网卡驱动

alias bond0 bonding

options bond0 miimon=100 mode=1

spacer.gif

开机脚本

vi /etc/rc.local

 ifenslave bond0 eth0 eth1

spacer.gif

2.加载模块(重启系统后就不用手动再加载了)  
    [root@woo ~]# modprobe bonding  

确认模块是否加载成功:  
    [root@woo ~]# lsmod | grep bonding  
        bonding               131724  0 

第三步,重启一下网络,然后确认一下状况:

service network restart