linux下网卡绑定

网卡绑定的作用:1、冗余,防止单点故障 

        2、防止传输瓶颈

1.交换机端口绑定:

1 system-view
2 link-aggregation group 1 mode manual
3 
4 比如把端口1和2进行绑定
5 
6 interface Ethernet1/0/1                  #进入交换机1口
7 port link-aggregation group 1        #把当前端口加入汇聚组1
8 interface Ethernet1/0/2                  #进入交换机2口
9 port link-aggregation group 1        

2.系统网卡绑定

1.设置Bounding
vi /etc/modules.conf   #添加以下内容
alias bond0 bonding
options bonding mode=1 miimon=200 primary=eth2 use_carrier=1

2. 加载bonding模块
modprobe bonding

3.创建/修改bond0 eth0 eth1 配置文件
vi /et/sysconfig/network-ifcfg-“网卡名”

DEVICE='bond0'
BOOTPROTO='static'
BROADCAST='x.x.x.x'
IPADDR='x.x.x.x'

DEVICE=eth0
BOOTPROTO='static'
STARTMODE='onboot'

DEVICE=eth1
BOOTPROTO='static'
STARTMODE='onboot'

4.重启所有网卡
rcnetwork restart

5.绑定eth0 eth1 到bond0
ifenslave bond0 eth0
ifenslave bond0 eth1

6.重启后自动加载设置:

在/etc/init.d/中添加bonding启动文件
vi /etc/init.d/bonding  #添加以下语句
case “$1in
    start)
/sbin/ifenslave bond0 eth0
/sbin/ifenslave bond0 eth1
;;
        *)
;;
esac

7.把加载bonding模块的脚本加入启动脚本中

vi /etc/init.d/boot.local
modprobe bonding

 

posted @ 2014-09-08 15:04  池偏一  阅读(305)  评论(0编辑  收藏  举报