Implementing High Availability with NIC Teaming in Linux

Meher Askri
5 min readAug 2, 2024

--

Hello Folks and welcome to this first article in this series :

The network is one of the fundamental pillars of the IT world. In fact, if I had to summarize, I would say that the entire operational side revolves around two things : network and storage .

So I thought, why not create a series of articles on Linux networking, starting from the basics and moving to more advanced topics .

And that’s what we’re going to cover today , NIC teaming or Ethernet channel bonding as some people like to call it ( Just like how fruits have different names depending on where you are 😄) . I want to keep it short and get straight to the point . So, before we start bonding interfaces , let me give you a quick introduction to answer two questions : what does it mean and why do we need it ?

What does it mean ?

Network Interface Card (NIC) bonding simply means combining multiple network interfaces into a single logical interface . If you have a background in networking, think of it as similar to Link Aggregation. However, whereas link aggregation operates at the network infrastructure level to combine links between network devices, here we combine network interfaces within a single system.

Why do we need this?

Well, there are several reasons why we might want to pursue NIC bonding:

  1. Improving Performance: NIC bonding can enhance performance through load balancing and increasing bandwidth. By combining multiple network interfaces into a single logical one . We can distribute network traffic more evenly and use the available bandwidth more effectively.
  2. High Availability (HA): NIC bonding provides redundancy. In the event of a network interface or link failure, the remaining interfaces can seamlessly handle network traffic, ensuring uninterrupted connectivity. This is crucial for maintaining network availability and minimizing downtime.

There are various types of NIC bonding modes available in Linux , each with its own characteristics but for simplicity, we’ll focus on teaming NICs to achieve High Availability (HA) .

Okay, now that we’ve set our goal , let’s jump to the terminal :

As you can see on the screen, the two network interfaces (enp7s0 and enp8s0) are currently unconfigured, with no assigned IP addresses.

In modern Linux distributions, NetworkManager is the default network management service, which includes the nmcli command-line tool. So, let’s bond these two interfaces using the nmcli command :

The syntax may seem unusual at first, but once you get used to it, it’s actually quite simple. Let me explain this long command :

“ nmcli con add con-name bond0 ifname bond0 type bond mode active-backup ipv4.add 10.1.1.200/24 gw4 10.1.1.1 ipv4.method manual ipv6.method disabled “

  • nmcli: This is the command-line tool used for managing network connections in Linux.
  • con add: This part of the command tells nmcli that we want to add a new network connection.
  • con-name bond0: Here, we’re giving the new network connection a name, “bond0”, so we can refer to it later.
  • ifname bond0: This specifies the interface name for the connection, also “bond0” in this case.
  • type bond: We’re specifying the type of connection, which is a bonding interface in this case.
  • mode active-backup: This sets the bonding mode to “active-backup”, meaning one interface is active while the other is on standby, ready to take over if the active one fails ( for High Availability ) .
  • ipv4.addresses 10.1.1.200/24: This assigns an IP add of “10.1.1.200” to the interface, with a subnet mask of “24” .
  • gw4 10.1.1.1: This sets the default IPv4 gateway to “10.1.1.1” .
  • ipv4.method manual: This specifies that the IP add configuration is done manually, rather than through DHCP .
  • ipv6.method disabled: Finally, this disables IPv6 configuration for this interface, as indicated by “disabled”.

OK, let’s move on to the next step and add our network interfaces ( enp7s0 and enp8s0) :

Again let me explain these two commands :

“ nmcli con add con-name slave1 ifname enp7s0 type bond-slave master bond0 “

“ nmcli con add con-name slave2 ifname enp8s0 type bond-slave master bond0 “

  • nmcli con add: Again this tells the NetworkManager (nmcli) that we want to add a new network connection.
  • con-name slave1–2: A name to the new network connection. Here, it’s named “slave1” and “slave2” .
  • ifname enp7s0-enp8s0: The interface name for the connection. In this case “enp7s0” and “enp8s0” are the name of the network interface we want to add as a slaves to this connection.
  • type bond-slave: The type of connection as a bond slave, meaning it will be a part of a bonded interface group.
  • master bond0: Indicates that this network connection will be a slave to another connection named “bond0”. In other words, it specifies that this interface will be part of a bonded interface group named “bond0”.

And that’s it , Let’s test it :

And voila , As you can see, I turned down the “enp7s0” interface and on the right side, the ping continued without interruption . Then I turned down the second one “enp8s0” and the ping also continued without any downtime and 0% packet loss . This demonstrates more than just High Availability, it’s what we call fault tolerance (FT) .

And if you wonder why the “bond0” interface is down because it’s a logical interface and doesn’t represent any NIC .

Thank you for taking the time to read my article , Don’t forget to like and share and I’ll see you in the next one .

--

--

Meher Askri
Meher Askri

Written by Meher Askri

Linux System Engineer || RHCA

No responses yet