Bonding or Teaming for redhat Server
Type : SystemOperating System : Redhat,Fedora,Centos
This Howto explain how to install the Bonding or the
Teaming solution on a RedHat distribution. One of the goal of the
teaming and bonding solution is to use all networks interfaces for
backup or round robin solution.
The bonding need to work with a minimum of 2 NIC to have real goal.
The concept of NIC Bonding (or sometimes called NIC
Teaming) is that you have two NICs bonded together to create only one
physical device.
Bonding schema and switch topology :
| |
|port3 port3|
+-----+----+ +-----+-----+
| |port2 port2 | |
| switch A +---------------------------------+ switch B |
| | | |
+-----+----+ +-----+-----+
|port1 port1|
| +-------+ |
+-----------------+ host1 +------------------+
eth0 +-------+ eth1
Before attempting to bond two NICs, i recommended to verify the integrity and functionality of each NIC. Please check your interface status with ethtool:
#ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full Port: MII
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: g
Current message level: 0x00000007 (7)
Link detected: yes
#ethtool eth1
Settings for eth1:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s Duplex: Full Port: MII
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: g
Current message level: 0x00000007 (7)
Link detected: yes
Now the Interface seems to be good for the configuration, we have to ckeck if you have all kernel modules.
#modprobe --list | grep bonding
/lib/modules/2.6.*/kernel/drivers/net/bonding/bonding.ko
#modprobe --list | grep mii
/lib/modules/2.6.*/kernel/drivers/net/mii.ko
Your server seems to be ready fot the configuration of the module for a backup connection:
#vi /etc/modprobe.conf
alias bond0 bonding
options bond0 miimon=80 mode=1
To have more information about the bonding module you have to do this command line.
In bold font you have the main status for the bonding function.
#modinfo bonding
author: Thomas Davis, tadavis@lbl.gov and many others
description: Ethernet Channel Bonding Driver, v3.1.2
version: 3.1.2
license: GPL
srcversion: 6CD19765D6431C07199456E
depends:
vermagic: 2.6.18-53.1.4.el5xen SMP mod_unload gcc-4.1
parm: max_bonds:Max number of bonded devices (int)
parm: miimon:Link check interval in milliseconds (int)
parm: updelay:Delay before considering link up, in milliseconds (int)
parm: downdelay:Delay before considering link down, in milliseconds (int)
parm: use_carrier:Use netif_carrier_ok (vs MII ioctls) in miimon; 0 for off, 1 for on (default) (int)
parm: mode:Mode of operation : 0 for balance-rr, 1 for active-backup, 2 for balance-xor, 3 for broadcast, 4 for 802.3ad, 5 for balance-tlb, 6 for balance-alb (charp)
parm: primary:Primary network device to use (charp)
parm: lacp_rate:LACPDU tx rate to request from 802.3ad partner (slow/fast) (charp)
parm: xmit_hash_policy:XOR hashing method: 0 for layer 2 (default), 1 for layer 3+4 (charp)
parm: arp_interval:arp interval in milliseconds (int)
parm: arp_ip_target:arp targets in n.n.n.n form (array of charp)
parm: arp_validate:validate src/dst of ARP probes: none (default), active, backup or all (charp)
module_sig: 883f350474fb1b5bf23bf4d191725311298f009e2cbe4ce27b13fd747fc988615153453d50a29aff0a08158d98a7570129eb3197be02aebeaf52d9aebe
miimon is use for the monitoring of each ethX each 80 milliseconds, but you can use also a arp_ip_target like this other configuration for this module.
#vi /etc/modprobe.conf
alias bond0 bonding
options bond0 mode=1 arp_ip_target=192.168.1.1 arp_interval=200 primary=eth0
This configuration use arp resquest on the primary interface each 200ms
Now the kernel module is configure and we have to load thoses modules :
#modprobe bonding
#modprobe mii
All modules are loaded and ready for the configuration of each NIC
Configuration of eth0:
#vi /etc/sysconfig/network-script/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
Configuration of eth1
#vi /etc/sysconfig/network-script/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
Configuration of bond0
#vi /etc/sysconfig/network-script/ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=192.168.1.5
USERCTL=no
Now to finish the installation we have to applied the network parameters.
#/etc/init.d/network restart
Your bonding is now operational.
We have to test the bonding interface :
# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.1.2 (January 20, 2007)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 80
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:XX:XX:XX:XX:c2
Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:XX:XX:XX:XX:c4
source: http://www.generationip.com/documentation/system-documentation/65-bonding-or-teaming-for-redhat-server
Không có nhận xét nào:
Đăng nhận xét