RHEL: Bonding network interfaces

RHEL: Bonding network interfaces

# Tested on RHEL 5, 6 & 7

# Red Hat Enterprise Linux allows administrators to bind multiple network interfaces
# together into a single channel using the bonding kernel module and a special network
# interface called a "channel bonding interface". Channel bonding enables two or more
# network interfaces to act as one, simultaneously increasing the bandwidth and providing
# redundancy.

# To create a channel bonding interface, create a file in the /etc/sysconfig/network-scripts
# directory called <ifcfg-bondN>, replacing "N" with the number for the interface, such as 0.

# The contents of the file can be identical to whatever type of interface is getting
# bonded, such as an Ethernet interface. The only difference is that the DEVICE directive
# must be bondN, replacing N with the number for the interface.

# The following is a sample channel bonding configuration file (RHEL 6):

   DEVICE=bond0
   IPADDR=192.168.1.1
   NETMASK=255.255.255.0
   ONBOOT=yes
   BOOTPROTO=none
   USERCTL=no
   BONDING_OPTS="bonding parameters separated by spaces"

# After the channel bonding interface is created, the network interfaces to be bound
# together must be configured by adding the MASTER and SLAVE directives to their
# configuration files. The configuration files for each of the channel-bonded interfaces
# can be nearly identical.

# For example, if two Ethernet interfaces are being channel bonded, both eth0 and eth1
# may look like the following example:

   DEVICE=<ethN>
   BOOTPROTO=none
   ONBOOT=yes
   MASTER=bond0
   SLAVE=yes
   USERCTL=no

# For a channel bonding interface to be valid, the kernel module must be loaded
# ('modprobe bonding
'). To ensure that the module is loaded when the channel bonding
# interface is brought up, for RHEL 6, create a new file as root named bonding.conf in
# the /etc/modprobe.d directory or, if working with RHEL 5, add the configuration
# directly to /etc/modprobe.conf (this file is deprecated on RHEL 6). On RHEL 7 it is
# not necessary to indicate explicitly to load bonding kernel module as, once the
# interfaces configured for bonding, module will be automatically loaded on startup.


# RHEL 7:
# No need to explicitly load bonding module
 

# RHEL 6:

vi /etc/modprobe.d/bonding.conf
   alias <bondN> bonding


# RHEL 5:

vi /etc/modprobe.conf
   alias <bondN> bonding
   options <bondN> mode=<active-backup> miimon=<100> primary_reselect=<failure> primary=<ethX> downdelay=<100> updelay=<5000>


# *** Note: On RHEL 6 we'll put all bonding module parameters in <ifcfg-bondN> files.
#     that will allow to specify different configurations for different bonding
#     interfaces.



# Additional commands
# ------------------------------------------------------------------------------------------

# Start a "bonding" network interface

ifup <bond0>


# Stop a "bonding" network interface and free all slave interfaces

ifdown <bond0>


# Remove a slave interface without stopping "bonding" interface:

ifenslave {-d|--detach} <bond0> <eth0> [<eth1> <eth2> ...]


# Change active slave:

ifenslave {-c|--change-active} <bond0> <eth0>


# Show information about "master" interface:

ifenslave <bond0>

cat /proc/net/bonding/<bond0>


# Show information about all interfaces:

ifenslave {-a|--all-interfaces}



# Configuration examples
# ------------------------------------------------------------------------------------------

# RHEL 5
# ------------------------------------------------------------------------------------------

vi /etc/modprobe.conf
   alias bond0 bonding
   options bond0 mode=active-backup miimon=100 primary_reselect=failure primary=eth3 downdelay=100 updelay=5000

modprobe bonding

cd /etc/sysconfig/network-scripts

vi ifcfg-bond0
   DEVICE=bond0
   BOOTPROTO=static
   IPADDR=10.150.0.107
   NETMASK=255.255.252.0
   ONBOOT=yes
   USERCTL=no

vi ifcfg-eth3
   DEVICE=eth3
   BOOTPROTO=none
   HWADDR=90:E2:BA:55:1F:DB
   MASTER=bond0
   SLAVE=yes
   ONBOOT=yes
   USERCTL=no

vi ifcfg-eth6
   DEVICE=eth6
   BOOTPROTO=none
   HWADDR=40:F2:E9:0C:9A:5E
   MASTER=bond0
   SLAVE=yes
   ONBOOT=yes
   USERCTL=no

ifup bond0

cat /proc/net/bonding/bond0
   Ethernet Channel Bonding Driver: v3.4.0-1 (October 7, 2008)

   Bonding Mode: fault-tolerance (active-backup)
   Primary Slave: eth3 (primary_reselect failure)
   Currently Active Slave: eth3
   MII Status: up
   MII Polling Interval (ms): 100
   Up Delay (ms): 5000
   Down Delay (ms): 100

   Slave Interface: eth3
   MII Status: up
   Speed: 1000 Mbps
   Duplex: full
   Link Failure Count: 0
   Permanent HW addr: 90:e2:ba:55:1f:db

   Slave Interface: eth6
   MII Status: up
   Speed: 1000 Mbps
   Duplex: full
   Link Failure Count: 0
   Permanent HW addr: 40:f2:e9:0c:9a:5e



# RHEL 6
# ------------------------------------------------------------------------------------------

vi /etc/modprobe.d/bonding.conf
   alias bond0 bonding

modprobe bonding

cd /etc/sysconfig/network-scripts

vi ifcfg-bond0
   DEVICE=bond0
   BOOTPROTO=static
   IPADDR=10.149.72.202
   NETMASK=255.255.252.0
   ONBOOT=yes
   USERCTL=no
   IPV6INIT=no
   BONDING_OPTS="mode=active-backup miimon=100 primary_reselect=failure primary=eth0 downdelay=100 updelay=5000"

vi ifcfg-eth0
   DEVICE=eth0
   BOOTPROTO=none
   HWADDR=F0:92:1C:0D:53:90
   MASTER=bond0
   SLAVE=yes
   ONBOOT=yes
   USERCTL=no

vi ifcfg-eth1
   DEVICE=eth1
   BOOTPROTO=none
   HWADDR=F0:92:1C:0D:53:94
   MASTER=bond0
   SLAVE=yes
   ONBOOT=yes
   USERCTL=no

ifup bond0

cat /proc/net/bonding/bond0
   Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

   Bonding Mode: fault-tolerance (active-backup)
   Primary Slave: eth0 (primary_reselect failure)
   Currently Active Slave: eth0
   MII Status: up
   MII Polling Interval (ms): 100
   Up Delay (ms): 5000
   Down Delay (ms): 100

   Slave Interface: eth0
   MII Status: up
   Speed: 600 Mbps
   Duplex: full
   Link Failure Count: 0
   Permanent HW addr: f0:92:1c:0d:53:90
   Slave queue ID: 0

   Slave Interface: eth1
   MII Status: up
   Speed: 600 Mbps
   Duplex: full
   Link Failure Count: 0
   Permanent HW addr: f0:92:1c:0d:53:94
   Slave queue ID: 0



# RHEL 7
# ------------------------------------------------------------------------------------------

modprobe bonding

cd /etc/sysconfig/network-scripts

vi ifcfg-bond0
   DEVICE=bond0
   TYPE=bond
   NAME=bond0
   BONDING_MASTER=yes
   BOOTPROTO=none
   ONBOOT=yes
   IPADDR=192.168.1.22
   NETMASK=255.255.255.0
   GATEWAY=192.168.1.254
   BONDING_OPTS="mode=active-backup miimon=100 primary_reselect=failure primary=eth0 downdelay=100 updelay=5000"

vi ifcfg-enp2s7
   TYPE=Ethernet
   BOOTPROTO=static
   DEVICE=enp2s7
   ONBOOT=yes
   HWADDR=00:00:1c:d5:e3:6f
   MASTER=bond0
   SLAVE=yes

vi ifcfg-enp2s8
   TYPE=Ethernet
   BOOTPROTO=static
   DEVICE=enp2s8
   ONBOOT=yes
   HWADDR=00:08:a1:6c:7e:79
   MASTER=bond0
   SLAVE=yes

ifup bond0

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

   Bonding Mode: fault-tolerance (active-backup)
   Primary Slave: None
   Currently Active Slave: enp2s7
   MII Status: up
   MII Polling Interval (ms): 100
   Up Delay (ms): 5000
   Down Delay (ms): 100

   Slave Interface: enp2s7
   MII Status: up
   Speed: 100 Mbps
   Duplex: full
   Link Failure Count: 0
   Permanent HW addr: 00:00:1c:d5:e3:6f
   Slave queue ID: 0

   Slave Interface: enp2s8
   MII Status: up
   Speed: 100 Mbps
   Duplex: full
   Link Failure Count: 0
   Permanent HW addr: 00:08:a1:6c:7e:79
   Slave queue ID: 0
0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
Need to set up yum repository for locally-mounted DVD on Red Hat Enterprise Linux 7
Viewed 2723 times since Mon, Oct 29, 2018
WatchDog watchdog.sh script for checking server running
Viewed 5059 times since Tue, Jul 31, 2018
OpenSSL: Check If Private Key Matches SSL Certificate & CSR
Viewed 2672 times since Mon, Feb 18, 2019
rabbitmq Troubleshooting TLS-enabled Connections
Viewed 2006 times since Sun, Dec 6, 2020
Logrotate Example for Custom Logs
Viewed 2293 times since Sun, Jan 12, 2020
Improve security with polyinstantiation
Viewed 12708 times since Fri, May 15, 2020
HowTo: Retrieve Email from a POP3 Server using the Command Line
Viewed 9139 times since Mon, Feb 18, 2019
How to create stunnel with systemd? stunnel
Viewed 8587 times since Thu, Jan 16, 2020
A Simple Guide to Oracle Cluster File System (OCFS2) using iSCSI on Oracle Cloud Infrastructure
Viewed 7670 times since Sat, Jun 2, 2018
How to enable automatic security updates on CentOS 7 with yum-cron
Viewed 2232 times since Fri, Oct 26, 2018