2011年7月15日 星期五

linux bonding設置

linux bonding設置 DebianRedHat
Debian
    1. apt-get install ifenslave-2.6
    2. edit the "/etc/network/interfaces"
         
auto bond0
iface bond0 inet static
address 10.3.240.1
netmask 255.255.255.0
network 10.3.240.0
gateway 10.3.240.254
up /sbin/ifenslave bond0 eth2
up /sbin/ifenslave bond0 eth3
        然後把eht2eth3原來的給註釋掉。

    3. edit the "/etc/modprobe.d/arch/i386"
             
alias bond0 bonding
options bonding mode=1 miimon=100 downdelay=200 updelay=200

RedHat:

    1. edit "/etc/sysconfig/network-scripts/ifcfg-bond0"
DEVICE=bond0
IPADDR=10.3.240.1
NETMASK=255.255.255.0
NETWORK=10.3.240.0
BROADCAST=10.3.240.255
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
        
    2. edit "/etc/sysconfig/network-scripts/ifcfg-eth{1,2}"
DEVICE=eth0 //eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
         

    3. edit "/etc/modprobe.conf"
alias bond0 bonding







Reference: bonding mode
 0    balance-rr       ‧負載平衡模式, 需有 switch 設定 (trunk) 支援才能發揮實質效果
‧具容錯功能, 其中一張 Slave 網卡失效仍可持續運作
 1     active-backup       ‧同一時間只有單一 Slave 網卡運作
Active Slave 網卡失效時自動啟用次一順位 Slave 網卡
‧不需 switch 支援
 2   balance-xor      
 3    broadcast       ‧所有 Slave 網卡一齊收送網路封包
‧具容錯功能, 其中一張 Slave 網卡失效仍可持續運作
 4    802.3ad         
 5    balance-tlb     ‧傳出自動負載平衡
‧傳入由 Current Active Slave 負責
‧具容錯功能, 其中一張 Slave 網卡失效仍可持續運作
‧不需 switch 支援及設定
 6    balance-alb     ‧傳出及傳入皆自動負載平衡
‧具容錯功能, 其中一張 Slave 網卡失效仍可持續運作
Slave 網卡 driver 需支援 setting hardware address 功能
‧不需 switch 支援及設定