NIC bonding on Redhat/CentOS 6

wKiom1LPreSDDAlAAAPBI7zzJAA144.jpg


1. 可选  

for Redhat 5 and Centos 5


vi /etc/modprobe.conf

alias bond0 bonding  #每个bonding interface一行


for Redhat 6 and Centos 6

vi/etc/modprobe.d/bonding.conf

alias bond0 bonding  #每个bonding interface一行



2. vi /etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0

#NM_CONTROLLED="yes"

BOOTPROTO=none

ONBOOT=yes

IPADDR=192.168.2.131

NETMASK=255.255.255.0

#GATEWAY=192.168.2.1

USERCTL=no

BONDING_OPTS="mode=1 miimon=100"  #mode 1 = failover,Active-backup policy


mode=0表示load balancing (round-robin)为负载均衡方式,两块网卡都工作, 交换机上对应端口要配置LACP ( active ) -- etherchannel

mode=1表示fault-tolerance (active-backup)提供冗余功能,工作方式是主备的工作方式,也就是说默认情况下只有一块网卡工作,另一块做备份.


3. vi /etc/sysconfig/network-scripts/ifcfg-eth0

#eth0

DEVICE=eth0

#NM_CONTROLLED="yes"

MASTER=bond0

SLAVE=yes

USERCTL=no

BOOTPROTO=none

ONBOOT=yes


4. sed  "s/eth0/eth1/g" ifcfg-eth0 > ifcfg-eth1


5. vi /etc/sysconfig/network,参考以下设置

NETWORKING=yes

NETWORKING_IPV6=no

HOSTNAME=test2.test.com

GATEWAY=192.168.2.1


vi /etc/resolv.conf,参考以下设置

search test.com

nameserver192.168.2.10


6. service network restart


7. cat /proc/net/bonding/bond0


8. vi /etc/sysconfig/network-scripts/route-bond0

10.0.2.0/24 via 192.168.0.144



你可能感兴趣的:(bonding)