您的位置:首页 > 其它

基于工作环境实现的的bond过程

2014-04-01 15:51 246 查看

0.首先关闭NetworkManager ,因为它会与network冲突。

/etc/init.d/NetworkManager stop

chkconfig NetworkManager off



1.编辑/etc/sysconfig/network-scripts/ ifcfg-bond0、ifcfg-eth0、ifcfg-eth1

[root@web network-scripts]# vim ifcfg-bond0
DEVICE=bond0

BOOTPROTO=static

IPADDR=10.0.0.211

NETMASK=255.255.255.0

GATEWAY=10.0.0.253

ONBOOT=yes

USERCTL=no

[root@web1 network-scripts]# vim ifcfg-eth0

DEVICE=eth0

ONBOOT=yes

BOOTPROTO=none

MASTER=bond0

SLAVE=yes

USERCTL=no

[root@web1 network-scripts]# vim ifcfg-eth1

DEVICE=eth1

ONBOOT=yes

BOOTPROTO=none

MASTER=bond0

SLAVE=yes

USERCTL=no

第二步,修改modprobe相关设定文件,并加载bonding模块:

创建一个加载bonding的专属设定文件/etc/modprobe.d/bonding.conf

[root@test ~]# vi /etc/modprobe.d/bonding.conf

#追加

alias bond0 bonding

options bonding mode=6 miimon=200

2.加载模块(重启系统后就不用手动再加载了)

[root@test ~]# modprobe bonding

3.确认模块是否加载成功:

[root@test ~]# lsmod | grep bonding

bonding 100065 0

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

[root@test ~]# /etc/init.d/network restart

[root@test ~]# cat /proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v3.5.0 (November 4, 2008)

Bonding Mode: fault-tolerance (active-backup)

Primary Slave: None

Currently Active Slave: eth0

MII Status: up

MII Polling Interval (ms): 200

Up Delay (ms): 0

Down Delay (ms): 0

Slave Interface: eth0

MII Status: up

Link Failure Count: 0

Permanent HW addr: 00:16:36:1b:bb:74

Slave Interface: eth1

MII Status: up

Link Failure Count: 0

Permanent HW addr: 00:16:36:1b:bb:80

[root@test ~]# ifconfig | grep HWaddr

bond0 Link encap:Ethernet HWaddr 00:16:36:1B:BB:74

eth0 Link encap:Ethernet HWaddr 00:16:36:1B:BB:74

eth1 Link encap:Ethernet HWaddr 00:16:36:1B:BB:74

从上面的确认信息中,我们可以看到3个重要信息:

1.现在的bonding模式是active-backup

2.现在Active状态的网口是eth0

3.bond0,eth1的物理地址和处于active状态下的eth0的物理地址相同,这样是为了避免上位交换机发生混乱。

任意拔掉一根网线,然后再访问你的服务器,看网络是否还是通的。

由于存储的操作系统会与系统自带的新的NetworkManager冲突,需将其设置为关闭状态。

/etc/init.d/NetworkManger stop chkconfig NetworkManager stop

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐