How to configure teaming and bridging using nmcli commands on RHEL 7 / CentOS 7

nmcli is a command line tool for controlling the network daemon, Network Manager. The NetworkManager daemon monitors and manages network settings. Daemons are programs that run in the background.

Some jobs of the nmcli command include adding a new network, modifying an existing network, displaying a list of connections configured on a machine, activating / deactivating networks, and deleting existing networks.

Let’s look at some of them in the example:

To check all connections (both active and inactive)

[[email protected] ~]# nmcli con show
NAME UUID TYPE DEVICE 
virbr0-nic adcb25aa-7056-49d8-926a-4b08624973d8 802-3-ethernet virbr0-nic 
virbr0 6011c1c1-1802-4037-8492-19fc1225889a bridge virbr0 
dynamic 920f19a5-3d36-4996-8cd0-e948688c861c 802-3-ethernet eno16777736

Delete connection using nmcli command

Delete the connection using the following syntax

#Nmcli con delete “connection name”

[[email protected] ~]# nmcli con delete virbr0
Connection 'virbr0' (6011c1c1-1802-4037-8492-19fc1225889a) successfully deleted.

You can do more with the nmcli command. Here we will see how to configure teaming and bridging using nmcli commands.

Teaming

The literal meaning of dictionary teaming is “joining as a team to achieve a common goal.” Teaming with Linux justifies its literal meaning. Teaming involves creating a virtual network team interface and then adding port interfaces to achieve goals such as fault tolerance and load balancing.

Key components of teaming

  1. Small kernel driver
  2. Teamd daemon
  3. Software named runner. Define how the configured teaming works.

The following are the runner types that define the teaming behavior.

  • broadcastA: This runner sends each packet to all available ports.
  • Round robinA: This runner sends packets using a round robin algorithm.
  • Active backupA: These runners activate other ports if a working port goes down.
  • Load balancingA: This runner monitors traffic and balances the load accordingly.

Why do we need teaming?

Let’s take an example to understand why teaming is important. Suppose you are working on a production system with two NIC cards connected, but assume that the server has only one NIC card configured. If for some reason the next failure occurs, what will happen next? Have you ever thought about it? In that scenario, the first problem is that you need to manually configure the other NIC cards, and the second problem is that the loss can occur during critical tasks that require a LAN connection. Therefore, if a virtual interface (teaming) is configured on both NIC cards, if one of the NIC cards fails, the other NIC card will be automatically activated. Therefore, it functions as a savior.

It can also be used to increase bandwidth. Suppose both network cards are 100 MB each. When both are combined into a virtual interface, the total bandwidth is 200 MB. Therefore, the bandwidth increases.

Therefore, there are different scenarios in which teaming can be used, depending on the requirements for fault tolerance, load balancing, and so on.

Configuring teaming using the RHEL7 “active backup” runner:

Step 1) Create a connection for the network team interface.

syntax:

#Nmcli con add type con-name ifname config ‘{“ runner ”: {“ name ”:“ any runner s / w name based on requirements ”}}”

Here we took:

  • Con (connection) name: teameg
  • Ifname (interface name): teameg
[[email protected] ~]# nmcli con add type team con-name teameg ifname teameg config '{"runner": {"name": "activebackup"}}'
 Connection 'teameg' (dc21250a-6a3d-4263-b971-cbbf53d58ed0) successfully added.

Step 2) Now assign an IPv4 address to the interface “teameg”

Here, the ipv4 address is assigned.

[[email protected] ~]# nmcli con mod teameg ipv4.addresses 172.25.1.20/24
 [[email protected] ~]# nmcli con mod teameg ipv4.method manual

Step 3) Add a port interface to the teaming interface above.

syntax:

#Nmcli con add type team slave ifname Master

It’s here:

Connection Name: slave1 and salve2 Interface Name (ifname): eno33554992 and eno50332216

[[email protected] ~]# nmcli con add type team-slave con-name slave1 ifname eno33554992 master teameg
Connection 'slave1' (128ee559-95d9-4d7e-a0f0-2f2cfe70be68) successfully added.
[[email protected] ~]# nmcli con add type team-slave con-name slave2 ifname eno50332216 master teameg
Connection 'slave2' (75bd516c-6a66-4728-9684-5dabc718ae3a) successfully added.

Step 4) Launch Teaming and Port Interface

[[email protected] ~]# nmcli con up teameg
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/17)

Therefore, you can configure teaming on RHEL7 by following the steps above. Now you can see the status of teaming. In other words, you can get information about the runner used, active ports, and more.

Check the status of the team using the teamdctl command.

[[email protected] ~]# teamdctl teameg state
setup:
 runner: activebackup
ports:
 eno33554992
 link watches:
 link summary: up
 instance[link_watch_0]:
 name: ethtool
 link: up
 down count: 0
 eno50332216
 link watches:
 link summary: up
 instance[link_watch_0]:
 name: ethtool
 link: up
 down count: 0
runner:
 active port: eno33554992

Where the configuration file is created as follows:

  • / etc / sysconfig / network-scripts / ifcfg-teameg
  • / etc / sysconfig / network-scripts / ifcfg-salve1
  • / etc / sysconfig / network-scripts / ifcfg-slave2

You can configure teaming on RHEL7 using the steps above. Next, let’s look at what a bridge is and how it works.

Bridging

Uses a bridging MAC address to transparently send and receive traffic between network interfaces to determine destinations. Used in layer 2 (data link layer) of the OSI model.

Why do you need bridging?

  • Used to balance traffic between networks using MAC addresses.
  • Check the hosts connected to each network and create a MAC address table.
  • Check the table to determine which network packets need to be sent to balance the traffic.

The steps to configure a bridge on RHEL7 are as follows:

Create a software bridge using nmcli:

Here we took:

  • Connection name – brexample
  • ifname name as – brexample
[[email protected] ~]# nmcli con add type bridge con-name brexample ifname brexample
Connection 'brexample' (d5f7cee4-29bb-4498-9db6-c49daedb57ec) successfully added.

Assigning IPv4 to bridge interface

Here, we assigned the ipv4 address.

[[email protected] ~]# nmcli con mod brexample ipv4.addresses 172.25.1.10/24
[[email protected] ~]# nmcli con mod brexample ipv4.method manual

Connecting the interface to the created software bridge:

It’s here:

  • A software bridge named: brexample
  • Connection names: brslave1 and brslave2
  • Ifname: eno33554992 and eno50332216
[[email protected] ~]# nmcli con add type bridge-slave con-name brslave1 ifname eno33554992 master brexample
Connection 'brslave1' (52aac89e-25ce-41a3-8019-8bcb60b4237f) successfully added.
[[email protected] ~]# nmcli con add type bridge-slave con-name brslave2 ifname eno50332216 master brexample
Connection 'brslave2' (fd5e750a-769d-4492-931b-df24ba30e638) successfully added.
[[email protected] ~]#

To see a list of created software bridges and the interfaces connected to them:

We are using “brctl“command

[[email protected] ~]# brctl show
bridge name bridge id STP enabled interfaces
brexample 8000.000c292106ce yes eno33554992
                                eno50332216

This is about teaming and bridging in RHEL7. Teaming and bridging can be used in different scenarios depending on your requirements.

Reference: Linux man pages.

.

Sidebar