11.5 Configuring Network Interface Bonding

11.5.1 Using ifenslave to Create Bonded Interfaces

Network interface bonding (also known as port trunking, channel bonding, link aggregation, NIC teaming, among other names) combines multiple network connections into a single logical interface. A bonded network interface can increase data throughput by load balancing or can provide redundancy by allowing failover from one component device to another. By default, a bonded interface appears like a normal network device to the kernel, but it sends out network packets over the available slave devices by using a simple round-robin scheduler. You can configure bonding module parameters in the bonded interface's configuration file to alter the behavior of load-balancing and device failover.

Basic load-balancing modes (balance-rr and balance-xor) work with any switch that supports EtherChannel or trunking. Advanced load-balancing modes (balance-tlb and balance-alb) do not impose requirements on the switching hardware, but do require that the device driver for each component interfaces implement certain specific features such as support for ethtool or the ability to modify the hardware address while the device is active. For more information see /usr/share/doc/iputils-*/README.bonding.

You can use the bonding driver that is provided with the Oracle Linux kernel to aggregate multiple network interfaces, such as eth0 and eth1, into a single logical interface such as bond0.

To create a bonded interface:

  1. Create a file named ifcfg-bondN in the /etc/sysconfig/network-scripts directory, where N is number of the interface, such as 0.

  2. Edit the contents of ifcfg-bondN to be similar to the configuration settings for an Ethernet interface except that DEVICE is set to bondN rather than ethn, for example:

    DEVICE="bond0"
    IPADDR=192.168.1.121
    NETMASK=255.255.255.0
    NETWORK=192.168.1.0
    BROADCAST=192.168.1.255
    ONBOOT=yes
    BOOTPROTO=none
    USERCTL=no
    TYPE=Ethernet
    BONDING_OPTS="bonding parameters separated by spaces"

    The BONDING_OPTS setting is optional, unless you need to pass parameters to the bonding module, for example, to specify the load balancing mechanism or to configure ARP link monitoring. For more information, see /usr/share/doc/iputils-*/README.bonding.

  3. For each interface that you want to bond, edit its ifcfg-interface file so that it contains MASTER=bondN and SLAVE entries, for example:

    DEVICE="eth0"
    NAME="System eth0"
    IPADDR=192.168.1.101
    NETMASK=255.255.255.0
    BROADCAST=192.0.2.255
    NM_CONTROLLED="yes"
    ONBOOT=yes
    USERCTL=no
    TYPE=Ethernet
    BOOTPROTO=none
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=yes
    IPV6INIT=no
    PEERDNS=yes
    PEERROUTES=yes
    MASTER=bond0
    SLAVE
  4. Create the file /etc/modprobe.d/bonding.conf, so that it contains an entry for each bonded interface, for example:

    alias bond0 bonding

    The existence of this file ensures that the kernel loads the bonding module is loaded when you bring up the bonded interface. All bonded interfaces that you configure require an entry in this file.

  5. If the component interfaces are up, bring them down, and then bring up the bonded interface:

    # ip link set eth0 down
    # ip link set eth1 down
    # ip link set bond0 up

11.5.1 Using ifenslave to Create Bonded Interfaces

The ifenslave command provides an alternate method of creating bonded interfaces. Only round-robin load balancing is available.

To create a bonded device by using the ifenslave command:

  1. Load the bonding module:

    # modprobe bonding
  2. Configure the network settings for the bonded interface:

    # ip addr add 192.168.1.121/24 dev bond0
  3. Attach the component network interfaces to the bonded interface:

    # ifenslave bond0 eth0 eth1
  4. Bring up the bonded interface:

    # ip link set bond0 up

For more information, see the ifenslave(8) manual page.