一、bond的工作原理 所谓的bond就是将两块或两块以上网卡绑定同一个IP地址对外提供服务,从而实现负载均衡高可用。当然,直接给两块网卡设置同一IP地址 是不可能的。通过bonding,虚拟一块网卡对外提供连接, 物理网卡的被修改为相同的MAC地址。
二、bond工作模式分类 1)Mode 0 (balance-rr) 轮转(Round-robin)策略:从头到尾顺序的在每一个slave 接口上面发送数据包。本模式提供负载均衡和容错的能力
2)Mode 1 (active-backup) 活动-备份(主备)策略:在绑定中,只有一个slave被激活。 当且仅当活动的slave接口失败时才会激活其他slave。为了 避免交换机发生混乱此时绑定的MAC地址只有一个外部端口上可见
3)Mode 3 (broadcast) 广播策略:在所有的slave接口上传送所有的报文。本模式提供 无容错能力。
三、实现步骤 1、为每个设备生成独立的接口配置文件,关闭NetworkManager服务。 chkconfig --level 3 NetworkManager off
2、添加网卡,配置静态联网(bond0) [root@centos6 network-scripts]# cat ifcfg-bond0DEVICE=bond0IPADDR=10.1.249.34PRFIX=16GATEWAY=10.1.249.254DNS1=8.8.8.8BONDING_OPTS="miimon=101 mode=0" #如果mode=0则为轮转模式,为1则为主备模式,为3则为广播策略[root@centos6 network-scripts]# cat ifcfg-eth0DEVICE=eth0SLAVE=yesMASTER=bond0[root@centos6 network-scripts]# cat ifcfg-eth1DEVICE=eth1SLAVE=yesMASTER=bond0[root@centos6 network-scripts]#3、随意断开一网卡测试,并查看结果 [root@centos6 network-scripts]# !catcat /proc/net/bonding/bond0Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)Bonding Mode: fault-tolerance (active-backup)Primary Slave: NoneCurrently Active Slave: eth0MII Status: upMII Polling Interval (ms): 102Up Delay (ms): 0Down Delay (ms): 0Slave Interface: eth0MII Status: upSpeed: 1000 MbpsDuplex: fullLink Failure Count: 0Permanent HW addr: 00:0c:29:7c:55:8dSlave queue ID: 0Slave Interface: eth1MII Status: upSpeed: 1000 MbpsDuplex: fullLink Failure Count: 0Permanent HW addr: 00:0c:29:7c:55:97Slave queue ID: 0[root@centos6 network-scripts]#[root@centos6 ~]# cat /proc/net/bonding/bond0Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)Bonding Mode: load balancing (round-robin)MII Status: upMII Polling Interval (ms): 100Up Delay (ms): 0Down Delay (ms): 0Slave Interface: eth0MII Status: upSpeed: 1000 MbpsDuplex: fullLink Failure Count: 3Permanent HW addr: 00:0c:29:7c:55:8dSlave queue ID: 0Slave Interface: eth1MII Status: downSpeed: UnknownDuplex: UnknownLink Failure Count: 3Permanent HW addr: 00:0c:29:7c:55:97Slave queue ID: 0[root@centos6 ~]# cat /proc/net/bonding/bond0Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)Bonding Mode: fault-tolerance (broadcast)MII Status: upMII Polling Interval (ms): 101Up Delay (ms): 0Down Delay (ms): 0Slave Interface: eth0MII Status: upSpeed: 1000 MbpsDuplex: fullLink Failure Count: 2Permanent HW addr: 00:0c:29:7c:55:8dSlave queue ID: 0Slave Interface: eth1MII Status: upSpeed: 1000 MbpsDuplex: fullLink Failure Count: 1Permanent HW addr: 00:0c:29:7c:55:97Slave queue ID: 0[root@centos6 ~]#
(责任编辑:好模板) |


ecshop仿万表网2014网店模板
人气:941
ecshop也买酒2012最新模板
人气:2991
英文卖包包衣服商城|ecs
人气:5353
ecshop团购风格模板
人气:1114
Logancee多用途外贸服饰鞋包
人气:435
ecshop仿和茶2013宽屏茶叶网
人气:8844