Do You PHP はてブロ

Do You PHPはてなからはてブロに移動しました

VMwarePlayer+CentOS4.4でbonding

なかなか試す機会がなかったんですが、VMwarePlayer+CentOS4.4でやってみました。

設定自体は思ったより楽で、

  1. bondingデバイス用のifcfg-*ファイルの作成
  2. modprobe.confへの追記

だけなんですね。以下、設定内容です。

# head /etc/sysconfig/network-scripts/ifcfg-{bond,eth}?
==> /etc/sysconfig/network-scripts/ifcfg-bond0 <==
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
NETWORK=192.168.0.0
NETMASK=255.255.255.0
IPADDR=192.168.0.210
USERCTL=no

==> /etc/sysconfig/network-scripts/ifcfg-eth0 <==
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no

==> /etc/sysconfig/network-scripts/ifcfg-eth1 <==
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no

#
# grep bond /etc/modprobe.conf
alias bond0 bonding
options bond0 mode=0 miimon=100
#options bond0 mode=1 miimon=100 primary=eth1
#

bondingデバイスの状況の確認は、/proc/net/bonding/bondX(Xは数字)で行えるようです。たとえば、mode=0(round-robin)の場合は

# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v2.6.3 (June 8, 2005)

Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:23:d9:d2

Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:23:d9:dc

のようになります。mode=1(active-backup)の場合は

# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v2.6.3 (June 8, 2005)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: eth1
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
Link Failure Count: 0
Permanent HW addr: 00:0c:29:23:d9:d2

Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:23:d9:dc
#

です。
で、ケーブルを抜き差ししてテスト。。。って、VMwarePlayerじゃ無理ですね。。。Ethnetデバイスをdisconnectすると、デバイス自体がなくなっちゃうみたい orz 今度実機で試してみよう。