Network Bonding

The following Howto describes how to bond two or more network interfaces into on bonded interface. This is known as IEEE 802.1AX-2008 or under the working group title of 802.3ad.

Example Configuration

Here is an example on how to create a bonded interface with enp2s0 and enp3s6 network cards.


Firstly the “bonding” module needs to be loaded

modprobe bonding

To make it permanent add a file /etc/sysconfig/modules/bonding.modules and give it execute permissions. In it just put:

modprobe bonding

You can copy and paste the following two lines to do this:

echo "modprobe bonding" > /etc/sysconfig/modules/bonding.modules
chmod 0744 /etc/sysconfig/modules/bonding.modules

Network Configuration

First, you need to manually create or edit the configuration files for the interfaces you want to bond. In this example we will assume we are trying to bond enp2s0 and enp3s6.

Change /etc/sysconfig/network-scripts/ifcfg-enp2s0:


Change /etc/sysconfig/network-scripts/ifcfg-enp3s6:

If you leave TYPE=“Ethernet” they will work fine but the interfaces becomes editable in the Webconfig and you risk overwriting your settings. You can leave the setting out if you do not want the interfaces to appear in the Webconfig.

Create the file /etc/sysconfig/network-scripts/ifcfg-bond0:

BONDING_OPTS="mode=5 miimon=100"
You can also set TYPE=“Bonded” in the bond0 definition and the interface will work the same. Some of the references on the internet have TYPE=“Bond”. If you do this the bond0 interface will not appear in the Webconfig.
An alternate set of options that has worked well in testing, and is compliant with 802.3ad is: options bonding max_bonds=2 mode=4 miimon=100 downdelay=100 updelay=100 lacp_rate=1 xmit_hash_policy=layer3+4 use_carrier=1

You can find more information on bonding modes and parameters by following the link below.

Network Configuration

The firewall needs know about your new bond0 network interface. In the /etc/clearos/network.conf configuration file, update the LANIF parameter.



LANIF="enp2s0 enp3s6 bond0"
You can also use this method to bond external interfaces, in which case you change the EXTIF setting instead of the LANIF

Various software packages need to know about this network change. The easiest way to notify these packages about the change is to run:

systemctl restart network.service 

Checking the result

The Webconfig should look like:

The following commands are useful for checking the results:

cat /proc/net/bonding/bond0
ip link show

cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: transmit load balancing
Transmit Hash Policy: layer2 (0)
Primary Slave: None
Currently Active Slave: enp2s0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: enp2s0
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:1f:d0:97:f7:b1
Slave queue ID: 0

Slave Interface: enp3s6
MII Status: down
Speed: 10 Mbps
Duplex: half
Link Failure Count: 1
Permanent HW addr: 00:30:bd:70:ca:22
Slave queue ID: 0

ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp2s0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT qlen 1000
    link/ether 00:1f:d0:97:f7:b1 brd ff:ff:ff:ff:ff:ff
3: enp3s7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
    link/ether 00:1d:0f:be:4e:95 brd ff:ff:ff:ff:ff:ff
4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT qlen 1000
    link/ether 00:1f:d0:97:f7:b1 brd ff:ff:ff:ff:ff:ff
5: enp3s6: <NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP> mtu 1500 qdisc pfifo_fast master bond0 state DOWN mode DEFAULT qlen 1000
    link/ether 00:30:bd:70:ca:22 brd ff:ff:ff:ff:ff:ff

In these two examples enp3s6 shows as DOWN as only one interface is connected for testing reasons.

Notes on Configuration and Performance

Whether you use mode 4 or 5 will largely depend on whether your switch supports 802.3ad. For this to work properly using mode 4, your switch must also support bonding and have its interfaces configured for the bond. Your switch will not automatically detect NIC bonding.

To understand the performance of NIC bonding, you must also understand that the network devices involved are discrete interfaces. This means that network sessions are NOT duplexed over the multiple interfaces and then put back together. Rather, the individual transfer sessions will be conducted over only one interface at a time. This means that if your transactions are all serial, 'network bonding' will not provide any increase in performance. For configurations where multiple sessions are simultaneously performed, these discrete sessions will be farmed out to one network interface or another based on load and capacity.

Also, it is important to note that only the primary interface of the network bond will approach 100% performance capacity under 802.3ad. All secondary interfaces in the bond will produce about 50% of their maximal performance. For example, in a configuration with three 1 Gigabit Ethernet NICs, they will give the same performance as a single '2 gigabit' NIC. (1 x 1 Gb, 2 x .5 Gb)

content/en_us/kb_howtos_network_bonding.txt · Last modified: 2018/03/11 15:49 by nickh