トップ 差分 一覧 ソース 検索 ヘルプ PDF RSS ログイン

Linux bonding 実習

目的

  • Linux ネットワーク冗長化確認
  • bonding ドライバ
  • ネットワーク帯域の測定

概要

構成

  • Linux サーバ 2台
  • CentOS-6.3 Linux 2.6.32-279.22.1.el6.x86_64
  • オンボード イーサネット 2口 + 拡張ボード NIC = 合計3口
  • GbE (ギガビットイーサネット) スイッチ : Netgear GS110T
+-------+     +------------+     +-------+
|Linux  |     |GbE Switch  |     |Linux  |
|   +---+     +---+    +---+     +---+   |
|   |GbE|-----|GbE|    |GbE|-----|GbE|   |
|   +---+     +---+    +---+     +---+   |
|       |     |            |     |       |
|   +---+     +---+    +---+     +---+   |
|   |GbE|-----|GbE|    |GbE|-----|GbE|   |
|   +---+     +---+    +---+     +---+   |
|       |     |            |     |       |
|   +---+     +---+    +---+     +---+   |
|   |GbE|-----|GbE|    |GbE|-----|GbE|   |
|   +---+     +---+    +---+     +---+   |
|       |     |            |     |       |
+-------+     +------------+     +-------+

冗長化の種類

bonding-mode モード ネットワークスイッチ設定
0 ラウンドロビン 不要
1 アクティブー/バックアップ 不要
2 balance-xor 不要
3 broadcast 不要
4 LACP または 802.3ad 必要
5 balance-tlb 不要
6 balance-alb 不要
LACP
Link Aggregation Control Protocol

設定ファイル

ifcfg-共通

BOOTPROTO=none
NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
IPV6INIT=no
USERCTL=no

/etc/sysconfig/network-scripts/ifcfg-ethN

DEVICE=eth0
NAME="System eth0"
<<MASTER=bond0>>
<<SLAVE=yes>>

/etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0
NAME="bonding device"
BRIDGE=br0
BONDING_OPTS="mode=0 miimon=100 updelay=5000"
  • bonding モード指定
  • 今回はブリッジ接続
  • ブリッジ接続が必要ない場合は、IP設定

/etc/sysconfig/network-scripts/ifcfg-br0

DEVICE=br0
TYPE=Bridge
NAME="bridge device"
IPADDR=192.168.61.6
NETMASK=255.255.255.0
BROADCAST=192.168.61.255
GATEWAY=192.168.61.1

確認方法

bonding ドライバの状況確認

  • /proc/net/bonding/bond0 を使う
# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

Bonding Mode: IEEE 802.3ad Dynamic link aggregation
MII Polling Interval (ms): 100
Up Delay (ms): 5000
Down Delay (ms): 0

802.3ad info
LACP rate: fast
Aggregator selection policy (ad_select): stable
Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Slave Interface: eth2
MII Status: up
Speed: 1000 Mbps
Duplex: full

netperf によるネットワークスピードの測定

  • 受信側
# netserver
  • 送信側
# netperf -H ml110a
TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to ml110a.nona.to (192.168.61.5) port 0 AF_INET
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

87380  16384  16384    10.02     941.43
  • 経過時間: 10.02 秒
  • スループット: 941.43 Mbit/秒

bonding モード変更

  • 設定ファイル /etc/sysconfig/network-scripts/ifcfg-bond0
  • 編集コマンド1
# vi /etc/sysconfig/network-scripts/ifcfg-bond0
  • 編集コマンド2
# nano /etc/sysconfig/network-scripts/ifcfg-bond0
  • 設定変更
# service network restart

メッセージ

  • 確認
# tail -f /var/log/messages

切断時

bonding: bond0: link status definitely down for interface eth0, disabling it

接続時

e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
bonding: bond0: link status up for interface eth0, enabling it in 5000 ms.
bond0: link status definitely up for interface eth0, 1000 Mbps full duplex.

ネットワーク冗長確認

ping 継続表示

  • ml110a から
# ping ml110b

1本目切断

  • 接続

2本目切断

  • 接続

3本目切断

  • 切断を確認

帯域確認

active-backup 対 active-backup

round-robin 3本 対 round-robin 3本

round-robin 2本 対 round-robin 2本

802.3ad 2本 対 802.3ad 2本

802.3ad 3本 対 802.3ad 3本

(参考)802.3ad 対 3-NIC 6-IP

  • 同時に6IP から
# netperf -H 192.168.61.5 -- -P 12866 -L 192.168.61.221 & \
netperf -H 192.168.61.5 -- -P 12867 -L 192.168.61.222 & \
netperf -H 192.168.61.5 -- -P 12868 -L 192.168.61.223 & \
netperf -H 192.168.61.5 -- -P 12868 -L 192.168.61.224 & \
netperf -H 192.168.61.5 -- -P 12868 -L 192.168.61.225 & \
netperf -H 192.168.61.5 -- -P 12868 -L 192.168.61.226 &

TCP STREAM TEST from 192.168.61.224 (192.168.61.224) port 12868 AF_INET to 192.168.61.5 (192.168.61.5) port 12868 AF_INET
TCP STREAM TEST from 192.168.61.226 (192.168.61.226) port 12868 AF_INET to 192.168.61.5 (192.168.61.5) port 12868 AF_INET
TCP STREAM TEST from 192.168.61.225 (192.168.61.225) port 12868 AF_INET to 192.168.61.5 (192.168.61.5) port 12868 AF_INET
TCP STREAM TEST from 192.168.61.222 (192.168.61.222) port 12867 AF_INET to 192.168.61.5 (192.168.61.5) port 12867 AF_INET
TCP STREAM TEST from 192.168.61.221 (192.168.61.221) port 12866 AF_INET to 192.168.61.5 (192.168.61.5) port 12866 AF_INET
TCP STREAM TEST from 192.168.61.223 (192.168.61.223) port 12868 AF_INET to 192.168.61.5 (192.168.61.5) port 12868 AF_INET

Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

87380  16384  16384    10.03     629.74
87380  16384  16384    10.03     311.59
87380  16384  16384    10.27     657.43
87380  16384  16384    10.01     363.48
87380  16384  16384    10.02     298.03
87380  16384  16384    10.04     641.70
  • 合計 2901.97 Mbits/sec