Bondingドライバの設定

★2つの物理NIC「eth1」と「eth2」の上に論理デバイス「bond0」を設定し、NIC冗長化を行う手順

1.「/etc/modprobe.conf」に対象のBondingデバイスを定義する。
論理デバイス「bond0」のaliasを追加し、デバイス・ドライバ「bonding」を指定

■「/etc/modprobe.conf」の設定
alias eth1 8139cp
alias eth2 8139cp
alias bond0 bonding

2.ネットワーク設定ファイル「eth1」と「eth2」の設定ファイルを編集
各設定ファイルで、bond0をマスターとし自身をスレイブ・アダプタとして指定

■「/etc/sysconfig/network-scripts/ifcfg-eth1」の設定
DEVICE=eth1
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
HWADDR=54:52:00:1a:9d:de
■「/etc/sysconfig/network-scripts/ifcfg-eth2」の設定
DEVICE=eth2
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
HWADDR=54:52:00:40:d5:f7

3.論理アダプター「bond0」の設定ファイルを作成

■「/etc/sysconfig/network-scripts/ifcfg-bond0」の設定
DEVICE=bond0
IPADDR=192.168.11.155
NETMASK=255.255.255.0
GATEWAY=192.168.11.1
ONBOOT=yes
BOOTPROTO=static
BONDING_OPTS="mode=1 primary=eth1 miimon=100 updelay=5000"

4.networkサービスの再起動

[root@ha-01 ~]# service network restart

5.Bondingデバイスの稼働状況確認。

[root@ha-01 ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.4.0-1 (October 7, 2008)

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

Slave Interface: eth1
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 54:52:00:1a:9d:de

Slave Interface: eth2
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 54:52:00:40:d5:f7
[root@ha-01 ~]#

★アクティブ・アダプタを手動で切り替える場合は、ifenslaveコマンドを使用する

例)eth2をbond0のアクティブに変更

[root@ha-01 ~]# ifenslave -c bond0 eth2

★メモ
「ifcfg-bondX」の設定で「BONDING_OPTS」の「primary」を指定している場合、
対象の「ethX」が優先的にアクティブになる。アクティブの「ethX」の障害後、復旧すると自動的にアクティブに戻る。

自動切り戻しを行いたくない場合は、「primary」パラメータを指定しないようにする。
この場合、サーバ起動時にアクティブのethファイルがどちらになるかはわからない。
起動時にアクティブに指定したい場合は、「/etc/rc.local」に「ifenslave -c bondX ethX」を記載し、
明示的に切り替えるよう指定する。