Chinaunix首页 | 论坛 | 博客
  • 博客访问: 64935
  • 博文数量: 29
  • 博客积分: 890
  • 博客等级: 准尉
  • 技术积分: 295
  • 用 户 组: 普通用户
  • 注册时间: 2009-09-09 14:51
文章分类

全部博文(29)

文章存档

2013年(2)

2012年(13)

2011年(1)

2010年(10)

2009年(3)

我的朋友

分类: LINUX

2013-01-07 14:20:44

RHEL6.1下实现双网卡绑定,
 
第一步添加虚拟网卡,并编写虚拟网卡信息。
 
vim /etc/sysconfig/network-script/ifcfg-bond0
 
DEVICE=bond0
NM_CONTROLLED=no
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.0.5
NETMASK=255.255.255.0
GATEWAY=192.168.0.200
DNS1=8.8.8.8
USERCTL=no
 
第二步修改本地网卡信息
 
[root@shuangwangka network-scripts]# cat ifcfg-eth0
DEVICE=eth0
NM_CONTROLLED=no
TYPE=Ethernet
BOOTPROTO=static
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
[root@shuangwangka network-scripts]# cat ifcfg-eth1
DEVICE=eth1
NM_CONTROLLED=no
TYPE=Ethernet
BOOTPROTO=static
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
[root@shuangwangka network-scripts]#
 
第三步 设置别名信息
 
[root@shuangwangka network-scripts]# cd /etc/modprobe.d/
[root@shuangwangka modprobe.d]# ls
anaconda.conf  dist-alsa.conf  dist-oss.conf
blacklist.conf  dist.conf      openfwwf.conf
[root@shuangwangka modprobe.d]# cat dist.conf |grep bond0
alias bond0 bonding
options bond0 miimon=100 mode=1
[root@shuangwangka modprobe.d]#
 
配置详解
 
miimon=100
miimon是指多久时间要检查网路一次,单位是ms(毫秒)
这边的100,是100ms,即是0.1秒
 
mode共有七种(0~6)
 
这里呢我们解释两个常用的选项。
mode=0:平衡负载模式,两块网卡都在工作。
mode=1:自动主备模式,其中一块网卡在工作(若eth0断掉),则自动切换到另一个块网卡(eth1做备份)。
 
第四步设置启动项
 
[root@shuangwangka etc]# more rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
ifenslave bond0 eth0 eht1
touch /var/lock/subsys/local
[root@shuangwangka etc]#
 
恭喜你成功了
另外:如果在RHEL6下执行:
  1. service network restart
时,报如下错误:
  1. Bringing up interface bond0: Error: Connection activation failed: Device not managed by NetworkManager
此错误是因为系统中默认由NetworkManager服务管理网络,可以将其停止:
  1. [root@Hostname ~]#chkconfig NetworkManager off
  2. [root@Hostname ~]#service NetworkManager stop
  3. [root@Hostname ~]#chkconfig network on
  4. [root@Hostname ~]#service network restart
阅读(618) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~