linux6做双网卡,RHEL6 双网卡绑定

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下执行:

service network restart

时,报如下错误:

Bringing up interface bond0: Error: Connection activation failed: Device not managed by NetworkManager

此错误是因为系统中默认由NetworkManager服务管理网络,可以将其停止:

[root@Hostname ~]#chkconfig NetworkManager off

[root@Hostname ~]#service NetworkManager stop

[root@Hostname ~]#chkconfig network on

[root@Hostname ~]#service network restart

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值