Bonding Study Bonding Introduction
Bonding to bind multiple network cards to the same IP address to provide services externally, can achieve high availability or load balancing. It is not possible to film the same IP address directly for two network cards. Through bonding, a virtual one network card to provide external connection, the physical network card is modified to the same max address
Bonding type
MODE 0 轮转策略:从头到尾顺序的在每一个slave接口上面发送数据包,模式0提供负载均衡和容错的能力MODE 1(高可用策略) 活动-备份策略:只有一个slave被激活,当且仅当活动的那个slave接口失败时才会激活其他slave。 为了避免交换机发生混乱此时绑定的MAC地址只有一个外部端口上 可见MODE 3 广播策略:在所有的slave接口上传送所有的报文,提供容错能力
Bonding realization of BOND0 experiment
step1:创建bonding 主设备的配置文件 vim /etc/sysconfig/network-scirpts/ifcfg-bond0 DEVICE=bond0 BOOTPROTO=none BONDING_OPTS="miimon=100 mode=0" (100为每100ms换一个设备接受数据包)step2:创建bonding 从设备的配置文件 vim /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 BOOTPROTO=none MASTER=bond0 SLAVE=yes USERCTL=nostep3:关闭 NetworkManager 服务 service NetworkManager stop 开启bond0 ifup bond0 查看一下网卡状态
The configuration was successful. Test:
step4:ping这台机器,断开其中一个网卡测试
说明了在模式0下数据包是在两个网卡上交替发送的,实现了负载均衡的功能
BOND1 Experiment
step1:创建bonding 主设备的配置文件 vim /etc/sysconfig/network-scirpts/ifcfg-bond1 DEVICE=bond1 BOOTPROTO=none BONDING_OPTS="miimon=100 mode=1" (100为每100ms换一个设备接受数据包)step2:创建bonding 从设备的配置文件 vim /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 BOOTPROTO=none MASTER=bond1 SLAVE=yes USERCTL=nostep3:关闭 NetworkManager 服务 service NetworkManager stop 开启bond1 ifup bond1 查看一下网卡状态
Configuration succeeded
step4:ping这台机器,断开其中一个网卡测试
Linux Bonding Learning