4.4. Using the Command Line Interface (CLI)
bonding
kernel module and a special network interface called a channel bonding interface.
4.4.1. Check if Bonding Kernel Module is Installed
root
:
~]# modprobe --first-time bonding
This activation will not persist across system restarts. See the Red Hat Enterprise Linux System Administrator's Guide for an explanation of persistent module loading. Note that given a correct configuration file using the BONDING_OPTS
directive, the bonding module will be loaded as required and therefore does not need to be loaded separately.
~]$ modinfo bonding
See the modprobe(8)
man page for more command options.
4.4.2. Create a Channel Bonding Interface
/etc/sysconfig/network-scripts/
directory called ifcfg-bondN
, replacing N with the number for the interface, such as 0
.
DEVICE
directive is bondN
, replacing N with the number for the interface, and TYPE=Bond
. In addition, set BONDING_MASTER=yes
.
Example 4.1. Example ifcfg-bond0 Interface Configuration File
DEVICE=bond0 NAME=bond0 TYPE=Bond BONDING_MASTER=yes IPADDR=192.168.1.1 PREFIX=24 ONBOOT=yes BOOTPROTO=none BONDING_OPTS="bonding parameters separated by spaces"
Important
BONDING_OPTS="bonding parameters"
directive in the ifcfg-bondN
interface file. Do not specify options for the bonding device in /etc/modprobe.d/bonding.conf
, or in the deprecated /etc/modprobe.conf
file.
max_bonds
parameter is not interface specific and should not be set when using ifcfg-bondN
files with the BONDING_OPTS
directive as this directive will cause the network scripts to create the bond interfaces as required.
4.4.3. Creating SLAVE Interfaces
MASTER
and SLAVE
directives to the configuration files of the slaves. The configuration files for each of the slave interfaces can be nearly identical.
Example 4.2. Example Slave Interface Configuration File
eth0
and eth1
, they can both look like the following example:
DEVICE=ethN NAME=bond0-slave TYPE=Ethernet BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes
ONBOOT=yes
for an interface, they may race with each other and a plain TYPE=Ethernet
profile may be activated instead of a bond slave.
4.4.4. Activating a Channel Bond
root
, issue the following commands:
~]# ifup ifcfg-eth0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
~]# ifup ifcfg-eth1
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/8)
ifdown ethNThen when complete, open all the slaves, which will open the bond (provided it was not set “down”).
root
:
~]# nmcli con load /etc/sysconfig/network-scripts/ifcfg-device
Alternatively, to reload all interfaces:
~]# nmcli con reload
The default behavior is for NetworkManager not to be aware of the changes and to continue using the old configuration data. This is set by the monitor-connection-files
option in the NetworkManager.conf
file. See the NetworkManager.conf(5)
manual page for more information.
~]# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT qlen 1000
link/ether 52:54:00:e9:ce:d2 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT qlen 1000
link/ether 52:54:00:38:a6:4c brd ff:ff:ff:ff:ff:ff
4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT
link/ether 52:54:00:38:a6:4c brd ff:ff:ff:ff:ff:ff
4.4.5. Creating Multiple Bonds
BONDING_OPTS
directive. This configuration method is used so that multiple bonding devices can have different configurations. To create multiple channel bonding interfaces, proceed as follows:
- Create multiple
ifcfg-bondN
files with theBONDING_OPTS
directive; this directive will cause the network scripts to create the bond interfaces as required. - Create, or edit existing, interface configuration files to be bonded and include the
SLAVE
directive. - Assign the interfaces to be bonded, the slave interfaces, to the channel bonding interfaces by means of the
MASTER
directive.
Example 4.3. Example multiple ifcfg-bondN interface configuration files
DEVICE=bondN NAME=bondN TYPE=Bond BONDING_MASTER=yes IPADDR=192.168.1.1 PREFIX=24 ONBOOT=yes BOOTPROTO=none BONDING_OPTS="bonding parameters separated by spaces"
ifcfg-bond0
and ifcfg-bond1
, with appropriate IP
addresses.
MASTER=bondN
directive. For example, continuing on from the example above, if two interfaces per bond are required, then for two bonds create four interface configuration files and assign the first two using MASTER=bond0
and the next two using MASTER=bond1
.
Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.