ClearOS Documentation

×

Warning

301 error for file:https://clearos.com/dokuwiki2/lib/exe/css.php?t=dokuwiki&tseed=82873f9c9a1f5784b951644363f20ef8

User Tools

Site Tools


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.

Drivers

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:

DEVICE=enp2s0
TYPE="Bonded"
ONBOOT="yes"
USERCTL="no"
BOOTPROTO="none"
MASTER="bond0"
SLAVE="yes"

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

DEVICE=enp3s6
TYPE="Bonded"
ONBOOT="yes"
USERCTL="no"
BOOTPROTO="none"
MASTER="bond0"
SLAVE="yes"

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:

DEVICE=bond0
ONBOOT="yes"
USERCTL="no"
BOOTPROTO="none"
IPADDR="192.168.1.1"
NETMASK="255.255.255.0"
BONDING_MASTER="yes"
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="bond0"

-or-

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:

https://clearos.com/dokuwiki2/lib/exe/fetch.php?media=content:en_us:7-network-bond-example.png

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:  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:  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:  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:  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:  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 09:49 by nickh

https://clearos.com/dokuwiki2/lib/exe/indexer.php?id=content%3Aen_us%3Akb_howtos_network_bonding&1563436382