简介

    这里介绍一下Centos6网卡的bond配置方法,由于CentOS6、和CentOS7配置bond的方法不太一样,所以这里单独的介绍一下Centos6bond配置的方法,当然这种方法也适用于CentOS7只不过CentOS7配置的方法要更高效,以后会再对CentOS7bond的配置方法。

一、概念

    bond,就是网卡绑定啦,对于大型的机房来讲,是要有冗余机制的,bond便是一种网卡冗余机制,用来增加可靠性,防止单个网卡损坏出现的网络不通的情况,当然也可以提高可用性,让两张网卡同事进行数据传输。

二、配置方法

当然要做这个技术是需要两块以上的网卡的 

bonding(网卡绑定)

/etc/sysconfig/network-scripts下

建立ifcfg-bond0文件添加一下内容

DEVICE=bond0   设备名   

ONBOOT=yes  开机自启

BOOTPROTO=static  设置ip获取协议dhcp|static

IPADDR=6.6.6.6  这是IP

PREFIX=8 这是子网掩码

GATEWAY=6.6.6.1  设置网关

BONDING_OPTS="miimon=100 mode=0 primary=eth0"

mode 绑定模式:

                       0负载均衡模式

                     1准备模式

                     3镜像模式

miimon 多长时间测试物理网卡是否联通

primary 指定主网卡

    删除bond

ifconfig bond0 down

删除bond0文件

修改eth0、1文件

rmmod bonding

前导工作

[root@centos6 Desktop]# mkdir ~/if.bak     建立备份文件夹[root@centos6 Desktop]# cp /etc/sysconfig/network-scripts/ifcfg-eth* ~/if.bak/    备份网卡文件[root@centos6 Desktop]# service NetworkManager stop    关闭NetworkManager服务Stopping NetworkManager daemon:               [  OK  ][root@centos6 Desktop]# chkconfig NetworkManager off    关闭NetworkManager自启动服务[root@centos6 Desktop]# iptables -F             清空防火墙

bond0 的操作

[root@centos6 Desktop]# cd /etc/sysconfig/network-scripts/ 进入网卡配置文件存放目录[root@centos6 network-scripts]# touch ifcfg-bond0         创建bond0文件[root@centos6 network-scripts]# vim ifcfg-bond0           编辑bond0文件[root@centos6 network-scripts]# cat ifcfg-bond0 DEVICE=bond0ONBOOT=yesBOOTPROTO=noneIPADDR=172.18.17.203PREFIX=24BONDING_OPTS="mode=1 miimon=100 primary=eth0"

eth0的操作

[root@centos6 network-scripts]# vim ifcfg-eth0DEVICE=eth0SLAVE=yesMASTER=bond0

eth1的操作

[root@centos6 network-scripts]# vim ifcfg-eth1DEVICE=eth1SLAVE=yesMASTER=bond0

后续操作

[root@centos6 network-scripts]#service network restart[root@centos6 network-scripts]# cat /proc/net/bonding/bond0    查看bond0状态Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)Bonding Mode: fault-tolerance (active-backup)Primary Slave: eth0 (primary_reselect always)Currently Active Slave: eth0MII Status: upMII Polling Interval (ms): 100Up Delay (ms): 0Down Delay (ms): 0Slave Interface: eth0MII Status: upSpeed: 1000 MbpsDuplex: fullLink Failure Count: 0Permanent HW addr: 00:0c:29:08:bd:6dSlave queue ID: 0Slave Interface: eth1MII Status: upSpeed: 1000 MbpsDuplex: fullLink Failure Count: 0Permanent HW addr: 00:0c:29:08:bd:77Slave queue ID: 0