Note:
- This tutorial is available in an Oracle-provided free lab environment.
- It uses example values for Oracle Cloud Infrastructure credentials, tenancy, and compartments. When completing your lab, substitute these values with ones specific to your cloud environment.
Create Network Bonds using Network Manager CLI
Introduction
A network bond groups multiple physical network interfaces on a system into a single logical group interface and is connected to a network switch. Bonding can facilitate higher connection availability through redundancy by maintaining the connection if a link in the bond group fails. Also, the aggregation of the physical network interface provides higher throughput by load balancing the traffic across the interfaces in the bond.
Objectives
This lab demonstrates using the Network Manager CLI (nmcli) utility to:
- Create a bond interface
- Add multiple physical interfaces as links in the bond interface group
- Change the bond mode used for monitoring the status and the distribution of traffic across the bond interface links
- Delete the bond interface
Prerequisites
- A cloud instance system with current release Oracle Linux installed
Create the Bond Interface
The instance used in this lab environment is an Oracle Linux cloud instance, with four network interfaces available. It is possible to create a bond interface using three of these network interfaces. All interfaces are on the same virtual cloud network private subnet.
Note: A free video demonstrating how the bond interface is created is available by following the link in the For Additional Information section at the end of the tutorial.
-
Follow the instruction in Oracle Linux Lab Basics to establish an SSH connection and log in to the lab system instance.
The following sections show how to make the SSH connection to the instance.
- Copy Public IP Address
- Connect to Oracle Linux Instance
ssh oracle@<ip address of instance>
-
Create a bond interface. Set the bond connection name to Bondconn1, and the interface name as bond0.
sudo nmcli connection add type bond con-name "Bondconn1" ifname bond0
-
View the new bond created.
sudo nmcli connection
Example output:
NAME UUID TYPE DEVICE Bondconn1 6a5605dc-49ad-4f8d-8e10-7c130b95aba7 bond bond0 System ens3 21d47e65-8523-1a06-af22-6f121086f085 ethernet ens3
-
View the bond configuration file to see detailed information for the new bond interface.
sudo nmcli connection show "Bondconn1"
Note: Use the ‘space’ key to continue to the next page of information in the output. Use the ‘q’ key to exit the output and return to the command line.
Partial example output:
connection.id: Bondconn1 connection.uuid: e8092374-4397-4452-bc55-2f64c506b518 connection.stable-id: -- connection.type: bond connection.interface-name: bond0 connection.autoconnect: yes connection.autoconnect-priority: 0 connection.autoconnect-retries: -1 (default) connection.multi-connect: 0 (default) ... ... bond.options: mode=balance-rr proxy.method: none proxy.browser-only: no proxy.pac-url: -- proxy.pac-script: -- GENERAL.NAME: Bondconn1 GENERAL.UUID: 37845378-f29a-4b10-8107-49b9f5a0f564 GENERAL.DEVICES: bond0 GENERAL.IP-IFACE: -- GENERAL.STATE: activating ... ... connection.master: -- connection.slave-type: -- connection.autoconnect-slaves: -1 (default) connection.secondaries: -- connection.gateway-ping-timeout: 0 connection.metered: unknown connection.lldp: default connection.mdns: -1 (default) connection.llmnr: -1 (default) connection.wait-device-timeout: -1 ipv4.method: auto lines 1-25
Become familiar with finding information in the output such as the bond ID, the UUID, the interface name, IP settings, and note the bond mode used.
Change the Bond Mode
The bond mode indentifies how the bond interface distributes traffic over its links and how it handles the failure of one or more links in the bond group by altering the behavior of load-balancing and device failover.
-
Change the bond mode used by the bond interface from Round Robin to Active Backup using the
bond.options "mode=active-backup"
command option.sudo nmcli connection modify Bondconn1 bond.options "mode=active-backup"
Note: The modes supported are the default Round Robin (balance-rr), Active Backup (active-backup), XOR (balance-xor), Broadcast (broadcast), 802.3ad (802.3ad), Adaptive transmit load balancing (balance-tlb) and Adaptive load balancing (balance-alb).
Find more details of how the various bond modes operate here:
-
View the detailed information for the new bond interface to see the changed bond mode.
sudo nmcli connection show "Bondconn1"
Partial example output:
... ... ... cipv6.dhcp-timeout: 0 (default) ipv6.dhcp-send-hostname: yes ipv6.dhcp-hostname: -- ipv6.dhcp-hostname-flags: 0x0 (none) ipv6.token: -- bond.options: mode=active-backup proxy.method: none proxy.browser-only: no proxy.pac-url: -- lines 56-80
Add Interface Links to the Bond Interface
-
View the network device interface information on the system.
sudo nmcli device
Example output:
DEVICE TYPE STATE CONNECTION ens3 ethernet connected System ens3 bond0 bond connecting (getting IP configuration) Bondconn1 ens5 ethernet disconnected -- ens6 ethernet disconnected -- ens7 ethernet disconnected -- lo loopback unmanaged --
Listed are the bond interface and four network devices. The devices
ens5
,ens6
,ens7
are listed as ‘disconnected’. These devices can be used as interface links for the bond interface. -
Add the interface
ens5
as a link for the bond interface group.sudo nmcli connection add type ethernet slave-type bond con-name bond0-if1 ifname ens5 master bond0
Example output:
Connection 'bond0-if1' (56e98603-099c-46d1-acd5-1268e4ef9005) successfully added.
-
Add the interface
ens6
as a second link for the bond interface group.sudo nmcli connection add type ethernet slave-type bond con-name bond0-if2 ifname ens6 master bond0
Example output:
Connection 'bond0-if2' (577a9de4-43f4-46c7-9b29-dc51ef0f7c65) successfully added.
-
View the network device interface information on the system.
sudo nmcli device
Example output:
DEVICE TYPE STATE CONNECTION ens3 ethernet connected System ens3 ens5 ethernet connected bond0-if1 ens6 ethernet connected bond0-if2 bond0 bond connecting (getting IP configuration) Bondconn1 ens7 ethernet disconnected -- lo loopback unmanaged --
The two links are now associated with the bond interface.
Configure IP Address to the Bond interface
By default the bond is configured to use DHCP. IP address assignment, gateway and network resolution information can be configured to the logical bond interface.
-
Use the command
ip addr
to verify thatbond0
reports its status asUP
.ip addr
Example output:
17: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 02:00:17:09:f8:b0 brd ff:ff:ff:ff:ff:ff inet6 fe80::cd09:f18d:f202:3ae4/64 scope link noprefixroute valid_lft forever preferred_lft forever
-
If the output shows
bond0
asDOWN
, then run the commandsudo nmcli connection up "Bondconn1"
to change its state toUP
.sudo nmcli connection up "Bondconn1"
Example output:
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/61)
-
-
Assign the IP address and subnet mask of
'192.168.1.10/24'
to thebond0
interface with theipv4.addresses
command option.sudo nmcli connection modify "Bondconn1" ipv4.addresses '192.168.1.10/24'
-
Set the IP address assignment method to manual. This configures the IP address and mask for the bond interface.
sudo nmcli connection modify "Bondconn1" ipv4.method manual
-
View the layer three network information for the system.
The
bond0
interface now has an assigned the IP address.ip addr
Partial example output:
33: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 00:00:17:01:2f:ef brd ff:ff:ff:ff:ff:ff inet 192.168.1.10/24 brd 192.168.1.255 scope global noprefixroute bond0 valid_lft forever preferred_lft forever inet6 fe80::5149:fd05:55e5:9eff/64 scope link noprefixroute valid_lft forever preferred_lft forever
Assign Additional Links to the Bond Interface
-
Assign the last unassigned network device
ens7
to thebond0
interface.sudo nmcli conn add type ethernet slave-type bond con-name bond0-if3 ifname ens7 master bond0
The command output shows the bond interfaces was added successfully.
-
View the network device interface information on the system.
sudo nmcli device
Example output:
DEVICE TYPE STATE CONNECTION ens3 ethernet connected System ens3 bond0 bond connected Bondconn1 ens5 ethernet connected bond0-if1 ens6 ethernet connected bond0-if2 ens7 ethernet connected bond0-if3 lo loopback unmanaged --
The output shows the third network device connected to the bond interface.
-
View the bond configuration information.
This shows information about the bond, it’s status, as well as the link interfaces in the bond group and their status.
cat /proc/net/bonding/bond0
Example output:
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: load balancing (round-robin) MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0 Peer Notification Delay (ms): 0 Slave Interface: ens5 MII Status: up Speed: Unknown Duplex: Unknown Link Failure Count: 0 Permanent HW addr: 02:00:17:09:f8:b0 Slave queue ID: 0 Slave Interface: ens6 MII Status: up Speed: Unknown Duplex: Unknown Link Failure Count: 0 Permanent HW addr: 00:00:17:02:a1:10 Slave queue ID: 0 Slave Interface: ens7 MII Status: up Speed: Unknown Duplex: Unknown Link Failure Count: 0 Permanent HW addr: 02:00:17:03:f1:3a Slave queue ID: 0
The output shows the bond configuration and status, including which bond links are active, their information and their status.
Delete the Bond Links
To remove the bond interface, first remove the bond links.
Caution: Do not delete a bond interface with active interface links connected to it.
-
Use the command
sudo nmcli connection delete
and add the bond link interface name. Begin by removing thebond0-if3
connection and then repeat the action for the remaining bond interfaces.Note: The order in which the bond links are deleted is not important.
sudo nmcli connection delete bond0-if3
Example output:
Connection 'bond0-if3' (5751ef04-43f4-46c7-9b29-dc51ef0f7c65) successfully deleted.
sudo nmcli connection delete bond0-if2
Example output:
Connection 'bond0-if2' (577a9de4-43f4-46c7-9b29-dc51ef0f7c65) successfully deleted.
sudo nmcli connection delete bond0-if1
Example output:
Connection 'bond0-if1' (56e98603-099c-46d1-acd5-1268e4ef9005) successfully deleted.
-
Use the command
sudo nmcli device
to verify the devices have been disconnected.sudo nmcli device
Example output:
DEVICE TYPE STATE CONNECTION ens3 ethernet connected System ens3 bond0 bond connected Bondconn1 ens5 ethernet disconnected -- ens6 ethernet disconnected -- ens7 ethernet disconnected -- lo loopback unmanaged --
Delete the Bond Interface
Before deleting the bond interface, set the connection to the down
state with the sudo nmcli connection down
command.
-
Transition the bond interface.
sudo nmcli connection down "Bondconn1"
Example output:
Connection 'Bondconn1' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/86)
-
Use the command
ip addr
to verify the bond interface has been removed.ip addr
The output shows the bond interface is no longer listed.
-
Use the command
sudo nmcli connection delete
along with the bond interface name to delete the bond interface.sudo nmcli connection delete "Bondconn1"
Example output:
Connection 'Bondconn1' (a3d42efc-52ba-474a-9eea-67a4342420df) successfully deleted.
-
Use the command
sudo nmcli connection
to verify.sudo nmcli connection
Example output:
NAME UUID TYPE DEVICE System ens3 21d47e65-8523-1a06-af22-6f121086f085 ethernet ens3
The output shows the only connection is
ens3
. -
View the bond configuration file.
cat /proc/net/bonding/bond0
cat: /proc/net/bonding/bond0: No such file or directory
Note: Deleting the bond interface also removes its configuration file.
For Additional Information
See other related resources:
- Oracle Learning Library
- Oracle Documentation
- Video: Network Bonding in Oracle Linux with the NMCLI Utility
More Learning Resources
Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.
For product documentation, visit Oracle Help Center.
Create Network Bonds using Network Manager CLI
F56775-02
July 2022
Copyright © 2022, Oracle and/or its affiliates.