[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日誌

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章