Create NIC Channel Bonding in RedHat/CentOS/Fedora

Channel Bonding enables two or more network interfaces to act as one, simultaneously increasing the bandwidth and providing redundancy. This is a great way of achieving redundancy to a server. If one physical NIC is down or unplugged, it will automatically move resource to other NIC card. Channel bonding will work with the help of bonding driver in kernel. This post guides you through how to create NIC / Channel Bonding in RedHat, CentOS and Fedora Linux.

Create Channel Bonding in Linux

Create Channel Bonding in Linux

How to Create NIC Channel Bonding in RedHat, CentOS and Fedora

Step 1: Creating Bonding Channel

As a root, create a new file name bonding.conf in the /etc/modprobe.d/ directory. Name can be anything you like as long as it ends with a .conf extension. Insert the following line in this new file.

alias bond0 bonding

For each configured channel bonding interface, there must be a corresponding entry in your new /etc/modprobe.d/bonding.conf file.

Step 2: Creating Channle Bonding Interface

To create a channel bonding interface, create a file in the /etc/sysconfig/network-scripts/ directory called ifcfg-bond0. The following is a sample channel bonding configuration file. (Note : IP Address may differ in your environment.)

# vi /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
IPADDR=192.168.1.8
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no

Step 3: Configuring Channel Bonding Interface

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. Edit physical interface card details as under.

For eth0

# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

For eth1

# vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

The above directives are self explanatory for many system admin, however, let me explain to newbie.

  1. DEVICE: Indicates what is the device name
  2. USERCTL: Indicates that can user control this device(here its no)
  3. ONBOOT:  Indicates that at the boot time do this device should be up?
  4. MASTER: Is this device has master? Then what it is(here its bond0)
  5. SLAVE: Is this device acting as slave?
  6. BOOTPROTO: What about getting IP Address from DHCP? It’s set to none which indicate it’s a static IP)

Step 4: Restarting Network Service

Restart the network service and see the output of ifconfig.

# service network restart
[[email protected] network-scripts]# ifconfig

bond0     Link encap:Ethernet  HWaddr 00:0C:21:60:30:C4
          inet addr:192.168.1.8  Bcast:172.16.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe69:31c4/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
          RX packets:19676 errors:0 dropped:0 overruns:0 frame:0
          TX packets:342 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1623240 (1.5 MiB)  TX bytes:42250 (41.2 KiB)

eth0      Link encap:Ethernet  HWaddr 00:0C:21:60:30:C4
          UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
          RX packets:10057 errors:0 dropped:0 overruns:0 frame:0
          TX packets:171 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:832257 (812.7 KiB)  TX bytes:22751 (22.2 KiB)
          Interrupt:19 Base address:0x2000

eth1      Link encap:Ethernet  HWaddr 00:0C:21:60:30:C4
          UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
          RX packets:9620 errors:0 dropped:0 overruns:0 frame:0
          TX packets:173 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:791043 (772.5 KiB)  TX bytes:20207 (19.7 KiB)
          Interrupt:19 Base address:0x2080

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:104 (104.0 b)  TX bytes:104 (104.0 b)
Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Narad Shrestha

He has over 10 years of rich IT experience which includes various Linux Distros, FOSS and Networking. Narad always believes sharing IT knowledge with others and adopts new technology with ease.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

29 Responses

  1. Amol Jawarkar says:

    Hi,

    To create bonding, Follow below steps.

    1. create a file ifcfg-bondX and add below lines.

    DEVICE=bond0
    IPADDR=192.168.0.1
    NETMASK=255.255.255.0
    ONBOOT=yes
    HOTPLUG=no
    BOOTPROTO=none
    USERCTL=no
    BONDING_OPTS=”bonding parameters separated by spaces” # Such as BONDING_OPTS=”miimon=100 mode=1″
    NM_CONTROLLED=no

    2. After creating bonding interface, its time to configure slave interface.

    3. Edit interface files and add below lines.

    DEVICE=ethX
    BOOTPROTO=none
    ONBOOT=yes
    HOTPLUG=no
    MASTER=bond0
    SLAVE=yes
    USERCTL=no
    NM_CONTROLLED=no

    4. Restart the network service to load the newly added configuration.
    #service network restart

    This is explained a bit further at below link.
    https://www.kernel.org/doc/Documentation/networking/bonding.txt

  2. Joginder says:

    We trying to configure em2 and em3 two bonds in Redhat 6.7 but not success ,
    Bond0 and bond1 configured W/O any issue but due to some oracle dB limitation we em2 and em3 two bonds
    Please suggest

  3. muthukumar says:

    i have configured. but eth0 and eth1 are same mac address. could you please help me on this issue.

    • Ravi Saive says:

      @Muthu,

      Open each file and modify the MAC address, that’s it and don’t forget to restart the network service.

  4. rnz says:

    why is it i followed the steps but when i type ifconfig i dont have an ip?

    • Ravi Saive says:

      @Medina,

      May I know any error you getting while running ifconfig? also let me know on which Linux distributions you’re trying?

      • rnz says:

        the problem is i cant ping the gateway of the nic bonding. i can ping the ip address but the gateway i cant.

        • rnz says:

          i’m using it on redhat linux 6.6. the only problem is i cant ping the gateway. i cannot access the bonding using putty. i always access it remotely

  5. Javier says:

    Hello and thanks for this page. Only a quick question. Please can you tell me if another IP address is needed in addition to the existing IP from the network interfaces?. In other words, if I have got eth0 and eth1 with its respectives IP, is another IP required for bonding?
    Thanks a lot.

  6. radha says:

    Nice post, thank you.

    Small typo in eth1 editing , kindly change
    For eth1
    # vi /etc/sysconfig/network-scripts/ifcfg-eth0

  7. Khairul says:

    Hi Expert,

    My network bonding works perfectly after do this setting but I’ve an other issue after i done all this configuration given here my “network connection icon got red “x””.
    It’s this normal after do the bonding?

    I’m using Rhel 6.5

    Please advise.

    Thank you.

Leave a Reply to Joginder Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.