7.4. Using the Command Line Interface (CLI) A bond is created using the bonding kernel module and a special network interface called a channel bonding interface . 7.4.1. Check if Bonding Kernel Module is Installed In Red Hat Enterprise Linux 7, the bonding module is not loaded by default. You can load the module by issuing the following command as root : This activation will not persist across system restarts. See the Red Hat Enterprise Linux Kernel Administration 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. To display information about the module, issue the following command: See the modprobe(8) man page for more command options. 7.4.2. Create a Channel Bonding Interface To create a channel bonding interface, create a file in the /etc/sysconfig/network-scripts/ directory called ifcfg-bond N , replacing N with the number for the interface, such as 0 . The contents of the file can be based on a configuration file for whatever type of interface is getting bonded, such as an Ethernet interface. The essential differences are that the DEVICE directive is bond N , replacing N with the number for the interface, and TYPE=Bond . In addition, set BONDING_MASTER=yes . Example 7.1. Example ifcfg-bond0 Interface Configuration File An example of a channel bonding interface. 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 " NM_CONTROLLED="no" The NAME directive is useful for naming the connection profile in NetworkManager . ONBOOT says whether the profile should be started when booting (or more generally, when auto-connecting a device). Important Parameters for the bonding kernel module must be specified as a space-separated list in the BONDING_OPTS=" bonding parameters " directive in the ifcfg-bond N interface file. Do not specify options for the bonding device in /etc/modprobe.d/ bonding .conf , or in the deprecated /etc/modprobe.conf file. The max_bonds parameter is not interface specific and should not be set when using ifcfg-bond N files with the BONDING_OPTS directive as this directive will cause the network scripts to create the bond interfaces as required. For further instructions and advice on configuring the bonding module and to view the list of bonding parameters, see Section 7.7, "Using Channel Bonding" . Note that if the NM_CONTROLLED="no" setting is not present, NetworkManager might override settings in this configuration file. 7.4.3. Creating Port Interfaces The channel bonding interface is the controller (also refered to as master ) and the interfaces to be bonded are referred to as the ports ( slaves ). 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 the configuration files of the ports. The configuration files for each of the port interfaces can be nearly identical. Example 7.2. Example Port Interface Configuration File For example, if two Ethernet interfaces are being channel bonded, enp1s0 and enp2s0 , they can both look like the following example: DEVICE= device_name NAME=bond0-slave TYPE=Ethernet BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes NM_CONTROLLED="no" In this example, replace device_name with the name of the interface. Note that if more than one profile or configuration file exists with ONBOOT=yes for an interface, they may race with each other and a plain TYPE=Ethernet profile may be activated instead of a bond port. Note Note that if the NM_CONTROLLED="no" setting is not present, NetworkManager might override settings in this configuration file. 7.4.4. Activating a Channel Bond To activate a bond, open all the ports. As root , issue the following commands: Note that if editing interface files for interfaces which are currently " up " , set them down first as follows: ifdown device_name Then when complete, open all the ports, which will open the bond (provided it was not set " down " ). To make NetworkManager aware of the changes, issue a command for every changed interface as root : Alternatively, to reload all interfaces: 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. To view the status of the bond interface, issue the following command: 7.4.5. Creating Multiple Bonds In Red Hat Enterprise Linux, for each bond a channel bonding interface is created including the 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-bond N files with the BONDING_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 port interfaces, to the channel bonding interfaces by means of the MASTER directive. Example 7.3. Example multiple ifcfg-bondN interface configuration files The following is an example of a channel bonding interface configuration file: 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 " In this example, replace N with the number for the bond interface. For example, to create two bonds create two configuration files, ifcfg-bond0 and ifcfg-bond1 , with appropriate IP addresses. Create the interfaces to be bonded as per Example 7.2, "Example Port Interface Configuration File" and assign them to the bond interfaces as required using the MASTER=bond N 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=bond 0 and the two using MASTER=bond 1 .

Commands:
~]# modprobe --first-time bonding
~]USD modinfo bonding
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 " NM_CONTROLLED="no"
DEVICE= device_name NAME=bond0-slave TYPE=Ethernet BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes NM_CONTROLLED="no"
~]# ifup ifcfg-enp1s0 Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
~]# ifup ifcfg-enp2s0 Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/8)
~]# nmcli con load /etc/sysconfig/network-scripts/ifcfg- device
~]# nmcli con reload
~]# 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: enp1s0: <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: enp2s0: <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
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 "