NICがSPFになるのを防ぐ為、bondingを使ったチーミングをするのはLinuxでは常套手段かと思う。
そこで、CentOSでNICのチーミング(冗長化)をするメモ
bondingモジュールの設定
bonding.confを作成
/etc/modprobe.d/bonding.conf
#0: balance-rr
#1: active-backup
alias bond0 bonding
options bonding mode=1 miimon=100
modeの代表的なもの(他にも色々ありますが下記2つが一般的)
No | 意味 |
---|---|
0 | ラウンドロビン方式 交互に通信が発生 |
1 | アクティブ-バックアップ方式 片方(アクテイブ)のみで通信し、fail時に切替 |
下にある、check方法の部分でmodeが意図したものになっているのかを
# rmmod bonding
# modprobe bond0
親
DEVICE=bond0
BOOTPROTO=static
ONBOOT=on
BROADCAST=192.168.2.255
IPADDR=192.168.2.xxx
NETMASK=255.255.255.0
GATEWAY=192.168.2.xxx
NETWORK=192.168.2.0
子
DEVICE=eth0
BOOTPROTO=static
#HWADDR=xxx
ONBOOT=yes
MASTER=bond0
SLAVE=yes
DEVICE=eth1
BOOTPROTO=static
#HWADDR=xxx
ONBOOT=yes
MASTER=bond0
SLAVE=yes
check方法
bond0に設定した場合、下記で確認。
# cat /proc/net/bonding/bond0
- Modeを確認する
- Interfaceが upしていることを確認する
│3-01.iso
Ethernet Channel Bonding Driver: v3.4.0-2 (October 7, 2008) │CentOS-6.7-x86 │_64-minimal.isBonding Mode: fault-tolerance (active-backup) │o
Primary Slave: None │xxx:iCurrently Active Slave: eth0 │mg nagais$ opeMII Status: up │nssl md5 ~/DowMII Polling Interval (ms): 100 │nloads/CentOS-Up Delay (ms): 0 │5.6-x86_64-LivDown Delay (ms): 0 │eCD.iso
│MD5(/Users/nagSlave Interface: eth0 │ais/Downloads/MII Status: up │CentOS-5.6-x86Speed: 1000 Mbps │_64-LiveCD.isoDuplex: full │)= 7449589dc07Link Failure Count: 1 │69d4e027832bfePermanent HW addr: 6c:f0:49:a8:f7:6c │3f6bfba
│xxx:iSlave Interface: eth1 │mg nagais$ 744MII Status: up │9589dc0769d4e0Speed: 1000 Mbps │MBP05-NAGAIS:iDuplex: full │mg nagais$ 744Link Failure Count: 1 │9589dc0769d4e0Permanent HW addr: 6c:f0:49:a8:f7:6d
抜き差しで動作確認
eth0,eth1を交互に抜き差しして、外部からpingが継続する事を確認