Friday, October 2, 2009

Set different bonding mode for each bonding interface

Instead of settings in the /etc/modprobe.conf to specify bonding mode systemwide, we also can specify bond mode in scripts of each bonding interface. (Avaliable from RHEL 5 onwards)

For example, we can specify bonding mode 4, regardless of the systemwide settings of mode 1.

/etc/modprobe.conf

alias bond0 bonding
alias bond1 bonding
alias bond2 bonding
options bonding miimon=100 mode=1


[root@VMXDB01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond2
DEVICE=bond2
USERCTL=no
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.0.20
NETMASK=255.255.255.0
TYPE=Ethernet
IPV6INIT=no
PEERDNS=yes
BONDING_OPTS="mode=4 miimon=100"

Restart the interface to make the settings active:

[root@VMXDB01 ~]# ifdown bond2
[root@VMXDB01 ~]# ifup bond2


[root@VMXDB01 ~]# cat /proc/net/bonding/bond2
Ethernet Channel Bonding Driver: v3.2.4 (January 28, 2008)

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: slow
Active Aggregator Info:
Aggregator ID: 1
Number of ports: 1
Actor Key: 17
Partner Key: 1
Partner Mac Address: 00:25:83:46:a2:80

Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:24:e8:61:5e:7f
Aggregator ID: 1

Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:24:e8:61:5e:81
Aggregator ID: 2


Reference:
http://www.dbaglobe.com/2009/09/how-to-linux-ethernet-bonding.html

No comments:

Post a Comment