To configure bonding interface in RedHat machine by hand:
[root@localhost ~]# modprobe bonding mode=4 lacp_rate=1 [root@localhost ~]# ifconfig bond0 up [root@localhost ~]# ifenslave bond0 eth0 eth3
The above commands
- Will add again the module with the parameters already set (m0de 4 means lacp as it is explained below).
- will enable bond0 interface.
- will enslave the required interfaces
Check on the current status.
[root@localhost ~]# cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: IEEE 802.3ad Dynamic link aggregation Transmit Hash Policy: layer2 (0) MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0 802.3ad info LACP rate: fast Min links: 0 Aggregator selection policy (ad_select): stable
Bonding Modes
Red Hat Enterprise Virtualization supports the following common bonding modes:
- (Mode 1) Active-backup policy sets all interfaces to the backup state while one remains active. Upon failure on the active interface, a backup interface replaces it as the only active interface in the bond. The MAC address of the bond in mode 1 is visible on only one port (the network adapter), to prevent confusion for the switch. Mode 1 provides fault tolerance and is supported in Red Hat Enterprise Virtualization.
- (Mode 2) XOR policy selects an interface to transmit packages to based on the result of a XOR operation on the source and destination MAC addresses multiplied by the modulo slave count. This calculation ensures that the same interface is selected for each destination MAC address used. Mode 2 provides fault tolerance and load balancing and is supported in Red Hat Enterprise Virtualization.
- (Mode 4) IEEE 802.3ad policy creates aggregation groups for which included interfaces share the speed and duplex settings. Mode 4 uses all interfaces in the active aggregation group in accordance with the IEEE 802.3ad specification and is supported in Red Hat Enterprise Virtualization.
- (Mode 5) Adaptive transmit load balancing policy ensures the outgoing traffic distribution is according to the load on each interface and that the current interface receives all incoming traffic. If the interface assigned to receive traffic fails, another interface is assigned the receiving role instead. Mode 5 is supported in Red Hat Enterprise Virtualization.
Setting the configuration files and the VLAN tagging example files:
root@server1:/root# cat /etc/modprobe.d/bonding.conf alias bond0 bonding options bond0 miimon=100 mode=4 lacp_rate=1 root@server1:/root# cd /etc/sysconfig/network-scripts/ root@server1:/root# cat ifcfg-bond0 DEVICE=bond0 BOOTPROTO=none ONBOOT=yes USERCTL=no BONDING_MODULE_OPTS="mode=4 miimon=100" BONDING_SLAVE0="eth0" BONDING_SLAVE1="eth3" VLAN=yes IPV6INIT=no root@server1:/root# cat ifcfg-eth[0,3] DEVICE=eth0 ONBOOT=yes NM_CONTROLLED=no BOOTPROTO=none MASTER=bond0 SLAVE=yes TYPE=Ethernet DEVICE=eth3 ONBOOT=yes NM_CONTROLLED=no BOOTPROTO=none MASTER=bond0 SLAVE=yes TYPE=Ethernet
For the VLAN tagging you require a files with bond0 name but finishing in the VLAN number to be used (in this case, 3027)
root@server1:/root# cat ifcfg-bond0.3027 DEVICE=bond0.3027 BOOTPROTO=none ONBOOT=yes IPADDR=10.41.27.10 NETMASK=255.255.255.0 GATEWAY=10.41.27.1 NETWORK=10.41.27.0 BROADCAST=10.41.27.255 USERCTL=no BONDING_MODULE_OPTS="mode=4 miimon=100" BONDING_SLAVE0="eth0" BONDING_SLAVE1="eth3" VLAN=yes IPV6INIT=no
Now restart the network or the server to apply the new configuration.