Preparing a bonded interface
A bonded network interface allows multiple physical interfaces to be aggregated into a single link, balancing traffic and providing failover capabilities based on the selected mode, such as round-robin or active-backup.
Before you begin
Ensure that the channel bonding module is loaded, for example
using the following commands:
# modprobe bonding
# lsmod | grep bonding
bonding 156908 0
About this task
The following steps describe a bonded interface setup on the host that does not persist across host reboots.
For a persistent setup, see your host administration documentation (see also Persistent configuration).
Procedure
Example
This example shows how to set
up bonded interface bond1. In your distribution, bond0 might be automatically
created and registered. In this case, omit step 1 to make use of bond0.
- Add a new master bonded interface:
# echo "+bond1" > /sys/class/net/bonding_masters # ip link show bond1 8: bond1: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN mode DEFAULT link/ether 9a:80:45:ba:50:90 brd ff:ff:ff:ff:ff:ff
- Set the bonding parameters for the desired bonding mode. To set the mode to
active-backup
:# echo "active-backup 1" > /sys/class/net/bond1/bonding/mode # echo "100" > /sys/class/net/bond1/bonding/miimon # echo "active 1" > /sys/class/net/bond1/bonding/fail_over_mac
- Add slave interfaces to the bonded interface:
# ip link set enc8050 master bond1 # ip link set enc1108 master bond1 # ip link show enc8050 5: enc8050: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond1 state UNKNOWN mode DEFAULT qlen 1000 link/ether 02:11:10:66:1f:fb brd ff:ff:ff:ff:ff:ff # ip link show enc1108 6: enc1108: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond1 state UNKNOWN mode DEFAULT qlen 1000 link/ether 02:00:bb:66:1f:ec brd ff:ff:ff:ff:ff:ff
- Activate the interface:
# ip link set bond1 up # ip link show bond1 8: bond1: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT link/ether 02:11:10:66:1f:fb brd ff:ff:ff:ff:ff:ff
To verify the bonding settings, issue:
# cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup) (fail_over_mac active)
Primary Slave: None
Currently Active Slave: enc8050
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: enc8050
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 02:11:10:66:1f:fb
Slave queue ID: 0
Slave Interface: enc1108
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 02:00:bb:66:1f:ec
Slave queue ID: 0