bondingのactive-backupで冗長化
http://d.hatena.ne.jp/bose999/20100916/1284642271
今回は上記で設定したルータマシンにNICを2枚追加して
bondingのactive-backupで冗長化してみます。
active-backupはネットワークスイッチに特別な機能は必要の無いモードです。
他のモードはEther Channel などの Trunkingが必要になったりしますので
今回はactive-backupを試します。active-backupは通信を行っている
activeなNICに障害が起こった際に待機しているbackupのNICに
切り替わるモードです。
【CentOS5でルータにするマシンをbondingする為の設定から追加したもの】
/etc/modprobe.conf
alias eth0 e1000e alias eth1 e1000e alias eth2 e1000e alias eth3 e1000e alias scsi_hostadapter ata_piix # add bonding alias bond0 bonding alias bond1 bonding
/etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0 IPADDR=192.168.11.101 NETMASK=255.255.255.0 NETWORK=192.168.11.0 BROADCAST=192.168.11.255 ONBOOT=yes BOOTPROTO=static BONDING_OPTS="mode=1 primary=eth0 miimon=100 updelay=5000"
/etc/sysconfig/network-scripts/ifcfg-bond1
DEVICE=bond1 IPADDR=192.168.12.11 NETMASK=255.255.255.0 NETWORK=192.168.12.0 BROADCAST=192.168.12.255 ONBOOT=yes BOOTPROTO=static BONDING_OPTS="mode=1 primary=eth2 miimon=100 updelay=5000"
/etc/sysconfig/network-scripts/ifcfg-eth0
# Intel Corporation 82574L Gigabit Network Connection DEVICE=eth0 HWADDR=xx:xx:xx:xx:xx:xx MASTER=bond0 SLAVE=yes BOOTPROTO=none
/etc/sysconfig/network-scripts/ifcfg-eth1
# Intel Corporation 82574L Gigabit Network Connection DEVICE=eth1 HWADDR=xx:xx:xx:xx:xx:xx MASTER=bond0 SLAVE=yes BOOTPROTO=none
/etc/sysconfig/network-scripts/ifcfg-eth2
# Intel Corporation 82574L Gigabit Network Connection DEVICE=eth2 HWADDR=xx:xx:xx:xx:xx:xx MASTER=bond1 SLAVE=yes BOOTPROTO=none
/etc/sysconfig/network-scripts/ifcfg-eth3
# Intel Corporation 82574L Gigabit Network Connection DEVICE=eth3 HWADDR=xx:xx:xx:xx:xx:xx MASTER=bond1 SLAVE=yes BOOTPROTO=none
ネットワークケーブル抜き差しのログ
# tail -f /var/log/messages Sep 17 01:23:00 gt110b01 kernel: e1000e: eth0 NIC Link is Down Sep 17 01:23:00 gt110b01 kernel: bonding: bond0: link status definitely down for interface eth0, disabling it Sep 17 01:23:00 gt110b01 kernel: bonding: bond0: making interface eth1 the new active one 1400 ms earlier. Sep 17 01:23:07 gt110b01 kernel: e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX Sep 17 01:23:07 gt110b01 kernel: bonding: bond0: link status up for interface eth0, enabling it in 5000 ms. Sep 17 01:23:09 gt110b01 kernel: e1000e: eth1 NIC Link is Down Sep 17 01:23:09 gt110b01 kernel: bonding: bond0: link status definitely down for interface eth1, disabling it Sep 17 01:23:09 gt110b01 kernel: bonding: bond0: making interface eth0 the new active one 2600 ms earlier. Sep 17 01:23:16 gt110b01 kernel: e1000e: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX Sep 17 01:23:16 gt110b01 kernel: bonding: bond0: link status up for interface eth1, enabling it in 5000 ms. Sep 17 01:23:20 gt110b01 kernel: e1000e: eth3 NIC Link is Down Sep 17 01:23:20 gt110b01 kernel: bonding: bond1: link status definitely down for interface eth3, disabling it Sep 17 01:23:21 gt110b01 kernel: bonding: bond0: link status definitely up for interface eth1. Sep 17 01:23:23 gt110b01 kernel: e1000e: eth3 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX Sep 17 01:23:23 gt110b01 kernel: bonding: bond1: link status up for interface eth3, enabling it in 5000 ms. Sep 17 01:23:25 gt110b01 kernel: e1000e: eth2 NIC Link is Down Sep 17 01:23:25 gt110b01 kernel: bonding: bond1: link status definitely down for interface eth2, disabling it Sep 17 01:23:25 gt110b01 kernel: bonding: bond1: making interface eth3 the new active one 1600 ms earlier. Sep 17 01:23:29 gt110b01 kernel: e1000e: eth2 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX Sep 17 01:23:29 gt110b01 kernel: bonding: bond1: link status up for interface eth2, enabling it in 5000 ms. Sep 17 01:23:34 gt110b01 kernel: bonding: bond1: link status definitely up for interface eth2. Sep 17 01:23:34 gt110b01 kernel: bonding: bond1: making interface eth2 the new active one.
bondingの状態を見る
# cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008) Bonding Mode: fault-tolerance (active-backup) Primary Slave: eth0 (primary_reselect always) Currently Active Slave: eth0 MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 5000 Down Delay (ms): 0 Slave Interface: eth0 MII Status: up Link Failure Count: 2 Permanent HW addr: xx:xx:xx:xx:xx:xx Slave Interface: eth1 MII Status: up Link Failure Count: 3 Permanent HW addr: xx:xx:xx:xx:xx:xx # cat /proc/net/bonding/bond1 Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008) Bonding Mode: fault-tolerance (active-backup) Primary Slave: eth2 (primary_reselect always) Currently Active Slave: eth2 MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 5000 Down Delay (ms): 0 Slave Interface: eth2 MII Status: up Link Failure Count: 2 Permanent HW addr: xx:xx:xx:xx:xx:xx Slave Interface: eth3 MII Status: up Link Failure Count: 3 Permanent HW addr: xx:xx:xx:xx:xx:xx
※同じドライバーのNICが複数枚あるとどれがethXなのか
混乱するかもしれません。その際は/var/log/messagesで
抜き差ししてログを確認しながら作業すると分かりやすいと思います。
※ログ監視等を行う場合は/var/log/messagesの下記のような行を
監視できるようにすると障害検出が可能になるかと思います。
Sep 17 01:23:20 gt110b01 kernel: bonding: bond1: link status definitely down for interface eth3, disabling it