ネットワーク ボンディングとは、複数の LAN カードを 1 つのボンディングされたインターフェイスに集約または組み合わせて、高可用性と冗長性を提供することです。ネットワーク ボンディングは、NIC チーミングとも呼ばれます。
この記事では、Ubuntu 14.04 LTS サーバーでネットワーク ボンディングを構成する方法について説明します。私のシナリオでは、eth0 と eth1 の 2 つの LAN カードがあり、アクティブ-パッシブまたはアクティブ-バックアップ モードでボンド インターフェイス bond0 を作成します。
ステップ 1 :以下のコマンドを使用して、bonding カーネル モジュールをインストールします。
# apt-get install ifenslave-2.6
ステップ 2 :カーネル モジュールをロードします。
ファイル /etc/modules を編集し、ボンディング モジュールを最後に追加します。
root@mail:~# vi /etc/modules # /etc/modules: kernel modules to load at boot time. # # This file contains the names of kernel modules that should be loaded # at boot time, one per line. Lines beginning with "#" are ignored. # Parameters can be specified after the module name. lp rtc bonding
ファイルを保存して終了します。
以下に示すように、modprobe コマンドを使用してモジュールをロードします。
$ sudo modprobe bonding
ステップ 3 :インターフェイス構成ファイルを編集します。
$ sudo vi /etc/network/interfaces # interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback #eth0 is manually configured, and slave to the bondo interface auto eth0 iface eth0 inet manual bond-master bond0 bond-primary eth0 #manually configured eth1 and second interface used in bonding(bond0) auto eth1 iface eth1 inet manual bond-master bond0 # bond0 is the bonding NIC and can be used like any other normal NIC. # bond0 is configured using static network information. auto bond0 iface bond0 inet static address 192.168.1.151 gateway 192.168.1.1 netmask 255.255.255.0 dns-nameservers 4.2.2.2 bond-mode active-backup bond-miimon 100 bond-slaves none
ステップ 4 :ネットワーク サービスを再起動して、ボンド インターフェイスのステータスを確認してください。
# service networking restart
以下のコマンドを使用して結合インターフェースを確認します:
# ip add
また、ifconfig コマンドを使用して結合インターフェースを確認することもできます。
以下のコマンドを使用して、結合インターフェースのステータスを確認してください:
# cat /proc/net/bonding/bond0
注意 :テストを行うために、1 つのインターフェースを停止してサーバーにアクセスし、結合ステータスを確認します。
ネットワーク ボンディングで使用されるさまざまなモードを以下に示します。
- balance-rr または 0 — フォールト トレランスと負荷分散のためのラウンド ロビン モード
- アクティブ バックアップまたは 1 — フォールト トレランスのためのアクティブ バックアップ モードを設定します。
- balance-xor or 2 — 耐障害性と負荷分散のために XOR (排他的論理和) モードを設定します。
- ブロードキャストまたは 3 — フォールト トレランス用のブロードキャスト モードを設定します。すべての送信はすべてのスレーブ インターフェースで送信されます。
- 802.3ad または 4 — IEEE 802.3ad 動的リンク アグリゲーション モードを設定します。同じ速度とデュプレックス設定を共有する集約グループを作成します。
- balance-tlb または 5 — 耐障害性と負荷分散のために送信負荷分散 (TLB) モードを設定します。
- balance-alb または 6 — フォールト トレランスと負荷分散のためにアクティブ ロード バランシング (ALB) モードを設定します。