How to Configure Teaming and Bridging using nmcli command on RHEL 7 / CentOS 7

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

Some of the jobs of nmcli command are to add a new network, modify existing network, display list of connections which are configured in the machine, activate-deactivate the network, delete the existing network etc.

Let’s see few of them by examples:

To check all the 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 a connection using nmcli command

Use below syntax to delete a connection

# nmcli con delete “connection name”

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

There many more thing that we can do using nmcli command. Here we would see how to configure teaming and bridging using nmcli command.

Teaming

The literal meaning of teaming as per dictionary is “come together as a team to achieve a common goal”. Teaming with Linux justifies the literal meaning. In teaming we first create a virtual  network team interface and then we add the port interface to it in order to achieve a goal such as fault tolerance, load balancing etc.

Major components of Teaming

  1. Small kernel driver
  2. Teamd daemon
  3. Software named as the runner , which defines how the configured teaming should behave.

Below are the types of runners, that defines the behavior of teaming.

  • Broadcast:        this runner send each packet to all ports available.
  • Round-robin:   this runner send packets using round-robin algorithm.
  • Active-backup: these runners activates the other port if working port goes down.
  • Loadbalance:    this runner monitors the traffic and distributes the load accordingly.

Why teaming is required?

For understanding why teaming is important, let’s take an example. Let’s assume we are working in the production system in which two NIC cards are connected but let’s assume only one NIC card is configured in server. For any reason, its gets faulty then what happens next? Have you ever thought? In that scenario first issue would be we need to manually configure the other NIC card, second  issue would be if we were in the middle of some important work which requires LAN connection then it might get loss. So if we have configured both NIC card with virtual interface (teaming) then if one of the NIC cards gets faulty then automatically other NIC card will be active. Thus acting as savior.

It might also be used in increasing bandwidth. Let’s assume both network cards are of 100 MB each, now if we combine both to the virtual interface then total bandwidth would be of 200 MB. Thus increasing the bandwidth.

So there are different scenarios where we can use teaming, depending upon what is our requirement such as for fault tolerance, for load balancing etc.

Linux-teaming

Configuration of teaming using “active-backup” runner in RHEL7:

Step 1) Creating the connection for the network team interface:

Syntax:

# nmcli con add type con-name <name of the connection> ifname <name of the interface> config ‘{“runner” : {“name”: “any runner s/w name based on requirement”}}’

Here we have taken:

  • Con (Connection) name as: 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 IPv4 address to interface “teameg”

Here we are assigning the ipv4 address.

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

Step 3) Adding port interface to the above made teaming interface:

Syntax:

# nmcli con add type team-slave <name of the connection> ifname <name of the interface> master <name of the network team interface that we created in the first step>

Here we have:

Name of connection:            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)  Bringing the teaming and port interfaces up

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

So by following above mentioned steps we can configure teaming in RHEL7. Now lets us check the state of teaming i.e  it will give us information about which runner we have used, which port is active etc.

Checking team’s state 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

Here ,Configuration file would be created as:

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

By using the above mentioned steps you can configure teaming in RHEL7.  Now, lets see what is bridging and how it works.

Bridging

Bridging transparently receive and transfer traffic between network interfaces It uses mac address to determine the destination. It is used in layer 2 (data link layer) of the OSI model.

Why bridging is required ?

  • It is used to balance the traffic between the networks by using mac address.
  • It checks what hosts are connected to each network and creates a mac address table.
  • It checks tables and decides from which network packet should be transmitted in order to balance the traffic.

Steps to configure bridging in RHEL7 are as follows:

Creating the software bridge using nmcli commad:

Here we have taken:

  • Connection name as – 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 the ipv4 to the bridge interface

Here we have assigned ipv4 address

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

Attaching interfaces to the software bridge that is created:

Here we have:

  • Software bridge named as :     brexample
  • Connection name:                     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 check the software bridge created and list of interfaces attached to it:

We use “brctl” command

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

So this is all about teaming and bridging in RHEL7. Teaming and bridging can be used in the different scenarios as per the requirement.

Reference: Linux man page.

3 thoughts on “How to Configure Teaming and Bridging using nmcli command on RHEL 7 / CentOS 7”

  1. Just installed Centos 7.3 with KVM. It has the basic bridge 192.168.122.0 Default bridge. thats all I have now. I want to do everything listed here above on KVM link Nic teaming, then the bridge setup you have above. Please help, can’t find any help on books, video courses, net, etc
    Thanks
    Ray

Leave a Reply

Your email address will not be published. Required fields are marked *

1 × 1 =