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

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





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值