Linux bond how to

Create Network Bonds using Network Manager CLI

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. This lab guides you through using the NMCLI utility to create a network bond interface with multiple physical interfaces, change its bond mode, and delete the bond interface.

Objectives

In this lab, you’ll learn 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

Note: The procedures in this tutorial follow the recommendations of Oracle Engineering.

Prerequisites

Create the Bond Interface

The instance used in this lab environment is an Oracle Linux 8 cloud instance, with four network interfaces available. You create a bond interface using three of these network interfaces. All interfaces are on the same virtual cloud network private subnet.

Note: You can watch a free video demonstrating how the bond interface is created by following the link in the For Additional Information section at the end of the tutorial.

  1. Follow the instruction in Oracle Linux Lab Basics to establish an SSH connection and log in to your lab system instance. The following sections show you how to make the SSH connection to the instance.
    • Copy Public IP Address
    • Connect to Oracle Linux Instance
sudo nmcli connection add type bond con-name "Bondconn1" ifname bond0 
NAME UUID TYPE DEVICE Bondconn1 6a5605dc-49ad-4f8d-8e10-7c130b95aba7 bond bond0 System ens3 21d47e65-8523-1a06-af22-6f121086f085 ethernet ens3 
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.

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 

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.

Читайте также:  Linux all server list

    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).

You can find out more details of how the various bond modes operate at this documentation link: Document:Oracle Linux 8 — Working With Network Bonding

sudo nmcli connection show "Bondconn1" 
. . . 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 
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 -- 
sudo nmcli connection add type ethernet slave-type bond con-name bond0-if1 ifname ens5 master bond0 
Connection 'bond0-if1' (56e98603-099c-46d1-acd5-1268e4ef9005) successfully added. 
sudo nmcli connection add type ethernet slave-type bond con-name bond0-if2 ifname ens6 master bond0 
Connection 'bond0-if2' (577a9de4-43f4-46c7-9b29-dc51ef0f7c65) successfully added. 
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 -- 

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.

Читайте также:  Linux mint xrdp настройка

    Use the command ip addr to verify that bond0 reports its status as UP .

17: bond0: 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 as DOWN , then run the command sudo nmcli connection up «Bondconn1» to change its state to UP .
sudo nmcli connection up "Bondconn1" 
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/61) 
sudo nmcli connection modify "Bondconn1" ipv4.addresses '192.168.1.10/24' 
sudo nmcli connection modify "Bondconn1" ipv4.method manual 
33: bond0: 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 
sudo nmcli conn add type ethernet slave-type bond con-name bond0-if3 ifname ens7 master bond0 
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 -- 
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 

To remove the bond interface we first remove the bond links.

Caution: Do not delete a bond interface with active interface links connected to it.

  1. Use the command sudo nmcli connection delete and add the bond link interface name. Begin by removing the bond0-if3 connection and then repeat the action for the remaining bond interfaces.
sudo nmcli connection delete bond0-if3 
Connection 'bond0-if3' (5751ef04-43f4-46c7-9b29-dc51ef0f7c65) successfully deleted. 
sudo nmcli connection delete bond0-if2 
Connection 'bond0-if2' (577a9de4-43f4-46c7-9b29-dc51ef0f7c65) successfully deleted. 
sudo nmcli connection delete bond0-if1 
Connection 'bond0-if1' (56e98603-099c-46d1-acd5-1268e4ef9005) successfully deleted. 
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, you set the connection to the down state with the sudo nmcli connection down command.

Читайте также:  Межсетевой экран ufw astra linux

    Transition the bond interface.

sudo nmcli connection down "Bondconn1" 
Connection 'Bondconn1' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/86) 
sudo nmcli connection delete "Bondconn1" 
Connection 'Bondconn1' (a3d42efc-52ba-474a-9eea-67a4342420df) successfully deleted. 
NAME UUID TYPE DEVICE System ens3 21d47e65-8523-1a06-af22-6f121086f085 ethernet ens3 
cat: /proc/net/bonding/bond0: No such file or directory 

For Additional Information

See other related resources:

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

Copyright © 2022, Oracle and/or its affiliates.

Источник

Оцените статью
Adblock
detector