物理でLinuxを構築する機会があり、bondingをセットアップでハマったので、その時の
ワークアラウンド。
環境
CentOS release 6.4
bondingインターフェース作成
作成スクリプトをgitからclone
$ git init
$ git export all_proxy=http://userid:password@hogehoge:8080
$ git clone https://gist.github.com/3f1d26dbb4910d5a7392.git
スクリプト実行
$ cd 3f1d26dbb4910d5a7392/
$ sudo bash ./create_bondif.sh
cp -ip /etc/modprobe.d/bonding.conf /tmp/bonding.conf.20140512-095355
cp /dev/null /etc/modprobe.d/bonding.conf
cp -ip /etc/sysconfig/network-scripts/ifcfg-bond0 /etc/sysconfig/network-scripts/_ifcfg-bond0.20140512-095355
cp /dev/null /etc/sysconfig/network-scripts/ifcfg-bond0
create /etc/sysconfig/network-scripts/ifcfg-bond0
ifup bond0
cp -ip /etc/sysconfig/network-scripts/ifcfg-bond1 /etc/sysconfig/network-scripts/_ifcfg-bond1.20140512-095355
cp /dev/null /etc/sysconfig/network-scripts/ifcfg-bond1
create /etc/sysconfig/network-scripts/ifcfg-bond1
ifup bond1
cp -ip /etc/sysconfig/network-scripts/ifcfg-bond2 /etc/sysconfig/network-scripts/_ifcfg-bond2.20140512-095355
cp /dev/null /etc/sysconfig/network-scripts/ifcfg-bond2
create /etc/sysconfig/network-scripts/ifcfg-bond2
ifup bond2
create /etc/modprobe.d/bonding.conf
確認作業
bondインターフェースが起動している。
$ ifconfig
bond0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
bond1 Link encap:Ethernet HWaddr 00:00:00:00:00:00
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
bond2 Link encap:Ethernet HWaddr 00:00:00:00:00:00
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
eth0 Link encap:Ethernet HWaddr 08:00:27:00:E9:DF
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:47 errors:0 dropped:0 overruns:0 frame:0
TX packets:37 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7099 (6.9 KiB) TX bytes:5371 (5.2 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
念のためOSを再起動
$ sudo shutdown -r now
再度確認
・・・なぜかない。
$ ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:00:E9:DF
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:47 errors:0 dropped:0 overruns:0 frame:0
TX packets:37 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7099 (6.9 KiB) TX bytes:5371 (5.2 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
調査
手動で起動しようとしても、エラーになる。
$ sudo ifup bond0
WARNING: All config files need .conf: /etc/modprobe.d/net-pf-10, it will be ignored in a future release.
FATAL: Error inserting bonding (/lib/modules/2.6.32-358.el6.x86_64/kernel/drivers/net/bonding/bonding.ko): Unknown symbol in module, or unknown parameter (see dmesg)
./network-functions: line 419: /sys/class/net/bonding_masters: No such file or directory
./network-functions: line 425: /sys/class/net/bond0/bonding/slaves: No such file or directory
./network-functions: line 425: [: too many arguments
WARNING: All config files need .conf: /etc/modprobe.d/net-pf-10, it will be ignored in a future release.
WARNING: All config files need .conf: /etc/modprobe.d/net-pf-10, it will be ignored in a future release.
FATAL: Error inserting bonding (/lib/modules/2.6.32-358.el6.x86_64/kernel/drivers/net/bonding/bonding.ko): Unknown symbol in module, or unknown parameter (see dmesg)
./network-functions: line 419: /sys/class/net/bonding_masters: No such file or directory
./network-functions: line 425: /sys/class/net/bond0/bonding/slaves: No such file or directory
./network-functions: line 425: [: too many arguments
WARNING: All config files need .conf: /etc/modprobe.d/net-pf-10, it will be ignored in a future release.
bonding device bond0 does not seem to be present, delaying initialization.
テスト環境で再度作り直し、bondが起動した状態でbonding.koの依存関係を見てみる。
$ cat /lib/modules/$(uname -r)/modules.dep | grep bonding.ko
kernel/drivers/net/bonding/bonding.ko: kernel/net/ipv6/ipv6.ko kernel/net/8021q/8021q.ko kernel/net/802/garp.ko kernel/net/802/stp.ko kernel/net/llc/llc.ko
ipv6のモジュールが関係しているみたい。
モジュールの依存関係でbondingドライバのdependsを見ると、確かにipv6が含まれていた。
$ modinfo bonding | grep depends
depends: 8021q,ipv6
原因は、VMの設定でいつも実施していたipv6モジュールをインストールしない以下の設定が原因だった。
$ cat /etc/modprobe.d/disable-ipv6.conf
install ipv6 /bin/true
これを削除して、rebootするとbondingインターフェースが起動していた。