Interface (NICs) Bonding in Linux using nmcli

January 5, 2015 | By
| 5 Replies More

Today, we'll learn how to perform Interface (NICs) bonding in our CentOS 7.x using nmcli (Network Manager Command Line Interface).

NICs (Interfaces) bonding is a method for linking NICs together logically to allow fail-over or higher throughput. One of the ways to increase the network availability of a server is by using multiple network interfaces. The Linux bonding driver provides a method for aggregating multiple network interfaces into a single logical bonded interface. It is a new implementation that does not affect the older bonding driver in linux kernel; it offers an alternate implementation.

NIC bonding is done to provide two main benefits for us:

1. High bandwidth
2. Redundancy/resilience

Now lets configure NICs bonding in CentOS 7. We'll need to decide which interfaces that we would like to configure a Team interface.

run ip link  command to check the available interface in the system.

 $ ip link

ip link

Here we are using eno16777736 and eno33554960 NICs to create a team interface in activebackup mode.
Use nmcli command to create a connection for the network team interface,with the following syntax.

# nmcli con add type team con-name CNAME ifname INAME [config JSON]

Where CNAME will be the name used to refer the connection ,INAME will be the interface name and  JSON (JavaScript Object Notation) specifies the runner to be used.JSON has the following syntax:

'{"runner":{"name":"METHOD"}}' 

where METHOD is one of the following: broadcast, activebackup, roundrobin, loadbalance or lacp.

1. Creating Team Interface

Now let us create the team interface. here is the command we used to create the team interface.

 # nmcli con add type team con-name team0 ifname team0 config '{"runner":{"name":"activebackup"}}'

nmcli con create

run # nmcli con show command to verify the team configuration.

# nmcli con show

Show Teamed Interace

2. Adding Slave Devices

Now lets add the slave devices to the master team0. here is the syntax for adding the slave devices.

# nmcli con add type team-slave con-name CNAME ifname INAME master TEAM

Here we are adding eno16777736 and eno33554960 as slave devices for team0 interface.

 # nmcli con add type team-slave con-name team0-port1 ifname eno16777736 master team0

# nmcli con add type team-slave con-name team0-port2 ifname eno33554960 master team0

adding slave devices to team

Verify the connection configuration using  #nmcli con show again. now we could see the slave configuration.

#nmcli con show

show slave config

3. Assigning IP Address

All the above command will create the required configuration files under /etc/sysconfig/network-scripts/.
Lets assign an IP address to this team0 interface and enable the connection now. Here is the command to perform the IP assignment.

# nmcli con mod team0 ipv4.addresses "192.168.1.24/24 192.168.1.1"
# nmcli con mod team0 ipv4.method manual
# nmcli con up team0

ip assignment

 4. Verifying the Bonding

Verify the IP address information in #ip add show team0 command.

#ip add show team0

verfiy ip address

Now lets check the activebackup configuration functionality using the teamdctl command.

# teamdctl team0 state

teamdctl active backup check

Now lets disconnect the active port and check the state again. to confirm whether the active backup configuration is working as expected.

# nmcli dev dis eno33554960

disconnect activeport

disconnected the active port and now check the state again using #teamdctl team0 state.

# teamdctl team0 state

teamdctl check activeport disconnect

Yes its working cool !!  we will connect the disconnected connection back to team0 using the following command.

#nmcli dev con eno33554960

nmcli dev connect disconected

We have one more command called teamnl let us show some options with teamnl command.
to check the ports in team0 run the following command.

# teamnl team0 ports

teamnl check ports

Display currently active port of team0.

# teamnl team0 getoption activeport

display active port team0

Hurray, we have successfully configured NICs bonding :-) Please share feedback if any.

Filed Under : LINUX COMMANDS, LINUX HOWTO

Free Linux Ebook to Download

Comments (5)

Trackback URL | Comments RSS Feed

  1. helloworld says:

    Is it possible ubuntu?

  2. helloworld says:

    Ubuntu 14.10

    nmcli --help
    Użycie: nmcli [OPCJE] OBIEKT { POLECENIE | help }

    OPCJE
    -t[erse] zwięzłe wyjście
    -p[retty] sformatowane wyjście
    -m[ode] tabulatory|wielowierszowe tryb wyjścia
    -f[ields] |all|common określa pola do wyjścia
    -e[scape] yes|no modyfikuje separatory kolumn w wartościach
    -n[ocheck] bez sprawdzania wersji nmcli i NetworkManager
    -v[ersion] wyświetla wersję usługi
    -h[elp] wyświetla tę opcję

    OBIEKT
    nm stan usługi NetworkManager
    c[onnection] połączenia usługi NetworkManager
    d[evice] urządzenia zarządzane przez usługę NetworkManager

    nmcli con add type team con-name team0 ifname team0 config '{"runner":{"name":"activebackup"}}'
    Usage: nmcli connection { COMMAND | help }
    COMMAND := { list | status | up | down | delete }

    list [id | uuid ]
    status [id | uuid | path ]
    up id | uuid [iface ] [ap ] [--nowait] [--timeout ]
    down id | uuid
    delete id | uuid

    Error: command "con" "add" is incorrect.

    • Arun Pyasi says:

      Unfortunately, we have nmcli of old version in Ubuntu and its repository, we'll need the latest version of network-manager to make it working as the version we get from the repo doesn't support this feature. There's another working method too for Ubuntu, we'll be posting it too soon.

  3. Sagar P Dalvi says:

    Thank you for post
    I have problem
    Plz solve it

    Hi Guys Some one have Try NIC Teaming on RHEL 7.
    Well I am having SA3 RHEL 7 Student Workbook and i am trying to make NIC teaming on Redhat 7 OS , not on Foundation OS.
    Well it is not working.
    I have tried your Blogs..
    But it work but result won't show correct..

    "teamdctl team0 state" command does not show "team0" contain

    Well I see a new about 2nd NIC contain "Autoconfiguration" what is this i don't understand...
    Thank You

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.