RHEL6 の bonding

 

 

(0) 構築前に

 

以下の URL に RHEL6 の bonding の構築が記載

 

https://access.redhat.com/knowledge/docs/ja-JP/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s2-networkscripts-interfaces-chan.html

 

/etc/modprobe.d/bonding.conf については以下の情報あり

 

・モジュールをロードするため以下の設定を記載する

 

  ---------------------

  alias bondN bonding

  ---------------------

 

・BONDING_OPTS を記載するのは NG

  ifcfg-bondX に記載すること

 

以上を踏まえ、構築する。

 

 

 

(1)bonding 構築前の環境

 

# ifconfig

eth0      Link encap:Ethernet  HWaddr 00:0C:29:A4:C7:A9

          inet addr:192.168.84.152  Bcast:192.168.84.255  Mask:255.255.255.0

          inet6 addr: fe80::20c:29ff:fea4:c7a9/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:18463 errors:0 dropped:0 overruns:0 frame:0

          TX packets:11940 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:13396073 (12.7 MiB)  TX bytes:1908012 (1.8 MiB)

 

eth1      Link encap:Ethernet  HWaddr 00:0C:29:A4:C7:B3

          inet addr:192.168.84.153  Bcast:192.168.84.255  Mask:255.255.255.0

          inet6 addr: fe80::20c:29ff:fea4:c7b3/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:2977 errors:0 dropped:0 overruns:0 frame:0

          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:319866 (312.3 KiB)  TX bytes:636 (636.0 b)

 

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          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)

 

# lsmod | grep bond

 

bonding なし。

 

 

(2)bonding 構築後

 

/etc/modprobe.d/bonding.conf 無しでも問題ないように思える。

 

# ll /etc/modprobe.d/bonding*

ls: cannot access /etc/modprobe.d/bonding*: そのようなファイルやディレクトリはありません

#

 

/etc/modprobe.d/bonding.conf 無し。

 

# cat ifcfg-bond0

DEVICE=bond0

IPADDR=192.168.84.152

NETMASK=255.255.255.0

ONBOOT=yes

BOOTPROTO=none

USERCTL=no

BONDING_OPTS="mode=1 miimon=100"

#

# service network restart

インターフェース eth0 を終了中:  /etc/sysconfig/network-scripts/ifdown-eth: line 116: /sys/class/net/bond0/bonding/slaves: そのようなファイルやディレクトリはありません

                                                           [  OK  ]

インターフェース eth1 を終了中:  /etc/sysconfig/network-scripts/ifdown-eth: line 116: /sys/class/net/bond0/bonding/slaves: そのようなファイルやディレクトリはありません

                                                           [  OK  ]

ループバックインターフェースを終了中                       [  OK  ]

ループバックインターフェイスを呼び込み中                   [  OK  ]

インターフェース bond0 を活性化中:                         [  OK  ]

#

#

# lsmod | grep bond

bonding               125610  0

ipv6                  322029  82 bonding,ip6t_REJECT,nf_conntrack_ipv6,nf_defrag_ipv6

#

 

bonding がロードされている。

 

 

 

(3) boding 構築時の挙動

 

・bonding はどこからロードされているのか?

 

/etc/modprobe.d/ をロードするのは以下の処理だけ。

bonding のモジュールは関係無さそう。

 

# find /etc -type f -print | xargs grep '/etc/modprobe.d'

/etc/rc.d/init.d/iptables:      && grep -qIsE "^install:space:+${_IPV}:space:+/bin/(true|false)" /etc/modprobe.conf /etc/modprobe.d/* ; then

/etc/rc.d/init.d/ip6tables:     && grep -qIsE "^install:space:+${_IPV}:space:+/bin/(true|false)" /etc/modprobe.conf /etc/modprobe.d/* ; then

#

 

※bonding.conf を単独でロードする箇所は存在せず。

  ファイルがデフォルトでは存在しないので当たり前だろうが。

 

多分これ

 

/etc/sysconfig/network-scripts/network-functions

-------------------------------------------------------------

install_bonding_driver ()

{

   ethtool -i $1 2>/dev/null | grep -q "driver: bonding" && return 0

   [ ! -f /sys/class/net/bonding_masters ] && ( modprobe bonding || return 1 )

   echo "+$1" > /sys/class/net/bonding_masters 2>/dev/null

   return 0

}

-------------------------------------------------------------

 

 

 

 

・BONDING_OPTS を ifcfg-bondX に記載する必然性

 

BONDING_OPTS は以下の処理で使用される。

 

# find /etc -type f -print | xargs grep "BONDING_OPTS"

/etc/sysconfig/network-scripts/network-functions:    [ -n "$BONDING_OPTS" ] && install_bonding_driver $1

/etc/sysconfig/network-scripts/ifup-eth:    for arg in $BONDING_OPTS ; do

/etc/sysconfig/network-scripts/ifup-eth:    for arg in $BONDING_OPTS ; do

/etc/sysconfig/network-scripts/ifdown-eth:    for arg in $BONDING_OPTS ; do

#

 

※ifcfg-bondX で BONDING_OPTS が未設定の場合。

  bonding.conf に BONDING_OPTS を設定し、network 再起動しても情報は反映されない

  ただし、OS 再起動では反映される。