[bonding双网卡实现负载均衡]

[bonding双网卡实现负载均衡]

[root@rhel6 ~]# cat /boot/config-2.6.32-220.el6.x86_64 |grep BONDING 查看linux是否支持BONDING         
CONFIG_BONDING=m
[root@rhel6 ~]# modprobe bonding加载模块
[root@rhel6 ~]# lsmod |grep bonding查看bonding
bonding               125610  0
ipv6                  322029  156 bonding,ip6t_REJECT,nf_conntrack_ipv6,nf_defrag_ipv6
[root@rhel6 ~]# cd /etc/sysconfig/network-scripts/
[root@rhel6 network-scripts]# cp ifcfg-eth0 ifcfg-eth1
[root@rhel6 network-scripts]# cp ifcfg-eth0 ifcfg-bond0
[root@rhel6 network-scripts]# vim ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet
SLAVE=yes
MASTER=bond0
IPV6INIT=no
USERCTL=no


[root@rhel6 network-scripts]# vim ifcfg-eth1编辑网卡配置文件
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet
SLAVE=yes
MASTER=bond0
IPV6INIT=no
USERCTL=no


[root@rhel6 network-scripts]# vim ifcfg-bond0编辑网卡配置文件
DEVICE=bond0
ONBOOT=yes
IPADDR=192.168.18.253
BOOTPROTO=none
NETMASK=255.255.255.0
TYPE=Ethernet
GATEWAY=192.168.18.1
IPV6INIT=no
USERCTL=no

[root@rhel6 network-scripts]# vim /etc/modprobe.d/bond.conf 配置bonding
alias bond0 bonding
options bond0 miimon=50 mode=1

[root@rhel6 network-scripts]# service network restart重启
[root@rhel6 network-scripts]# cat /proc/net/bonding/bond0 查看bond0
Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:66:c5:54
Slave queue ID: 0

Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 1
Permanent HW addr: 00:0c:29:66:c5:5e
Slave queue ID: 0


test bond0
依次关闭网卡看message日志

本文出自 “广园A班-林凡龙” 博客,谢绝转载!

你可能感兴趣的:(bonding)