Author Photo

Ahmer's SysAdmin Recipes is a blog for Linux System Administrators. This blog provides recipes for Installation & Configuration of Linux, Ubuntu, Oracle Database, MySQL, Apache, Nginx, Oracle Cloud Control, FreeIPA, Kerberos & OpenLDAP, Subversion, PXE, DevOps, etc. over Red Hat Enterprise Linux (RHEL), CentOS, Ubuntu and Windows.

Please give me your feedback and help me improve this blog. Please let me know If you want me to write on a specific topic.

Monday, 10 September 2018

Network Teaming for High Availability of Linux Servers

Network-Teaming-High-Availability-Linux-Servers2Link aggregation is a process of combining two or more network interfaces to work as a single unit. This combined interface is called Network Bond or Network Team based on the link aggregation method used to create it. Network Bond is a legacy method and it is now about to deprecate in favor of Network Team. Two main advantages of Network Teaming are redundancy and load balancing. Redundancy increases Network Availability, whereas Load Balancing increases Network Efficiency.

In this article, we will configure a Network Team of two interfaces using nmcli for High Availability of our server.

 

System Specification:

We have configured a Linux machine with three network interfaces.

Hostname: server1.example.com
IP Address: 192.168.116.11/24 (static)
Team IP Address: 192.168.116.155/24 (dhcp)
Network Device 1: eno16777728
Network Device 2: eno33554968
Network Device 3: eno50332192
Operating System: RHEL 7.0

 

Configure Network Team:

We have three network interfaces on our server, one of them is already configured and working fine. The other two interfaces are not in use. We will use these two devices to create a Network Team.

First of all check the status of network devices and connections.

[root@server1 ~]# nmcli device status
DEVICE       TYPE      STATE         CONNECTION
eno16777728  ethernet  connected     eno16777728
eno33554968  ethernet  disconnected  --
eno50332192  ethernet  disconnected  --
lo           loopback  unmanaged     --

[root@server1 ~]# nmcli connection show
NAME         UUID                                  TYPE            DEVICE
eno16777728  a5c248f9-1118-443e-a2bc-7b2de73afe72  802-3-ethernet  eno16777728

Above commands shows that are there are two disconnected devices, and there is only one connection is created on the server. Therefore, we can create connections for remaining two devices and utilize it as a Network Team.

A Network Team consist of one team-master and two or more team-slaves connections. Therefore, create the team-master connection now.

[root@server1 ~]# nmcli connection add con-name team0 ifname team0 autoconnect yes type team config '{ "runner": { "name": "activebackup" }}'
Connection 'team0' (f74faadb-9441-44f0-9b99-1433f4dd4882) successfully added.

We have created a team-master with activebackup runner, because we are creating a Network Team for High Availability.

Now its time to add our team-slaves to this team.

[root@server1 ~]# nmcli connection add con-name team0-slave0 ifname eno33554968 autoconnect yes type team-slave master team0
Connection 'team0-slave0' (a4d66f51-f40b-4558-9b3b-2df5fb24eb14) successfully added.
[root@server1 ~]# nmcli connection add con-name team0-slave1 ifname eno50332192 autoconnect yes type team-slave master team0
Connection 'team0-slave1' (7e72d440-b54a-46ea-a973-54d5ec4cb87c) successfully added.

Check the status of network devices and connections.

[root@server1 ~]# nmcli connection show
NAME          UUID                                  TYPE            DEVICE
team0-slave0  a4d66f51-f40b-4558-9b3b-2df5fb24eb14  802-3-ethernet  eno33554968
team0         f74faadb-9441-44f0-9b99-1433f4dd4882  team            team0
eno16777728   a5c248f9-1118-443e-a2bc-7b2de73afe72  802-3-ethernet  eno16777728
team0-slave1  7e72d440-b54a-46ea-a973-54d5ec4cb87c  802-3-ethernet  eno50332192
[root@server1 ~]# nmcli device status
DEVICE       TYPE      STATE      CONNECTION
eno16777728  ethernet  connected  eno16777728
eno33554968  ethernet  connected  team0-slave0
eno50332192  ethernet  connected  team0-slave1
team0        team      connected  team0
lo           loopback  unmanaged  --

You may observe that both of our formerly disconnected devices are now connected.

Check the IP Address of the Team.

[root@server1 ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eno16777728: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:63:0c:9a brd ff:ff:ff:ff:ff:ff
    inet 192.168.116.11/24 brd 192.168.116.255 scope global eno16777728
       valid_lft forever preferred_lft forever
    inet6 fd15:4ba5:5a2b:1008:20c:29ff:fe63:c9a/64 scope global dynamic
       valid_lft 86383sec preferred_lft 14383sec
    inet6 fe80::20c:29ff:fe63:c9a/64 scope link
       valid_lft forever preferred_lft forever
3: eno33554968: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master team0 state UP qlen 1000
    link/ether 00:0c:29:63:0c:a4 brd ff:ff:ff:ff:ff:ff
4: eno50332192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master team0 state UP qlen 1000
    link/ether 00:0c:29:63:0c:a4 brd ff:ff:ff:ff:ff:ff
5: team0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
    link/ether 00:0c:29:63:0c:a4 brd ff:ff:ff:ff:ff:ff
    inet 192.168.116.155/24 brd 192.168.116.255 scope global dynamic team0
       valid_lft 1463sec preferred_lft 1463sec
    inet6 fd15:4ba5:5a2b:1008:7496:bff:fed9:159c/64 scope global dynamic
       valid_lft 86383sec preferred_lft 86383sec
    inet6 fe80::7496:bff:fed9:159c/64 scope link
       valid_lft forever preferred_lft forever
[root@server1 ~]#

Our team has been configured successfully and a dynamic IP address has been assigned by the DHCP server to the Network Team connection.

Check the status of the Network Team and its runner.

[root@server1 ~]# teamdctl team0 state view
setup:
  runner: activebackup
ports:
  eno33554968
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
  eno50332192
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
runner:
  active port: eno33554968

The same steps can be used to configure a Network Team with others runners like loadbalancer, roundrobin, etc.

Network Teaming for High Availability of Linux Servers


YOU MIGHT ALSO LIKE:

No comments:

Post a Comment