[root@rhce-ryanrudolf]# rm -rf / 2> /dev/null

things I break/fix for fun and learning

Apr 15, 2018 - 4 minute read - Comments

NIC Bonding / Teaming in RHEL7

NIC bonding / teaming allows for redundancy and resiliency in server systems. If one of the NIC (network interface card) fails, the server still have network connectivity.

Configuring this in RHEL is pretty straightforward. There are several ways to configure this, and I am familiar doing this in the command line using nmcli.

  • Check network connections

    [root@lab1 ~]# nmcli con show
    NAME            UUID                                  TYPE      DEVICE 
    myteam0         f5ade751-e245-4305-a443-257bd2778a7d  team      team0  
    slave0-master0  6a683d9d-816d-4043-8796-a14af67a18f6  ethernet  ens192 
    slave0-master1  de41aab7-7e66-46f4-8cbd-c14eb050dce6  ethernet  ens224 
    [root@lab1 ~]# 
    
  • Since there are already connections configured, we will delete them and start from scratch

    nmcli con del myteam0
    nmcli con del slave0-master0
    nmcli con del slave0-master1
    
  • Verify again and check network connections and it should be blank

    nmcli con show
    NAME            UUID                                  TYPE      DEVICE 
    
  • Next we need to identify the name of the network interfaces

    nmcli dev
    DEVICE  TYPE        STATE       CONNECTION
    ens192  ethernet    disconnected    ---
    ens224  ethernet    disconnected    ---
    lo  loopback    unmanaged   ---
    
  • Now the fun part! Let’s add a NIC team, consisting of 2 network interfaces. First let’s create the team

    nmcli con add type team con-name myteam0 ifname team0 config '{"runner": {"name": "loadbalance"}}'
    nmcli con show
    NAME            UUID                                  TYPE      DEVICE 
    myteam0     random-uuid               team  team0
    
  • Let’s configure the team interface for static IP

    nmcli con mod myteam0 ip4 192.168.1.50/24 gw4 192.168.1.1 ipv4.dns 192.168.1.21 ipv4.dns-search ryanrudolf.com autoconnect yes ipv4.method manual
    
  • Now let’s add the 2 network interfaces to the team. You can get the interface name (ifname) from the result of nmcli dev

    nmcli con add type team-slave con-name slave0-master0 ifname ens192 master team0
    nmcli con add type team-slave con-name slave0-master1 ifname ens224 master team0
    
  • Let’s view network connections

    nmcli con show
    NAME            UUID                                  TYPE      DEVICE 
    myteam0         random-uuid               team      team0  
    slave0-master0  random-uuid               ethernet  ens192 
    slave0-master1  random-uuid               ethernet  ens224
    
  • Let’s restart the network and then view the ip address

    [root@lab1 ~]# systemctl restart network
    [root@lab1 ~]# ip addr
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        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: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master team0 state UP group default qlen 1000
        link/ether 00:50:56:8b:ee:4e brd ff:ff:ff:ff:ff:ff
    3: ens224: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master team0 state UP group default qlen 1000
        link/ether 00:50:56:8b:ee:4e brd ff:ff:ff:ff:ff:ff
    7: team0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
        link/ether 00:50:56:8b:ee:4e brd ff:ff:ff:ff:ff:ff
        inet 192.168.1.50/24 brd 192.168.1.255 scope global noprefixroute team0
           valid_lft forever preferred_lft forever
        inet6 fe80::d26e:569a:fb47:4b69/64 scope link tentative dadfailed 
           valid_lft forever preferred_lft forever
        inet6 fe80::3a54:1892:4ecb:7a39/64 scope link tentative dadfailed 
           valid_lft forever preferred_lft forever
        inet6 fe80::861a:d544:6eb5:e624/64 scope link tentative dadfailed 
           valid_lft forever preferred_lft forever
    [root@lab1 ~]# 
    
  • IP address is in place! Let’s try to ping to check connectivity

    [root@lab1 ~]# ping google.com
    PING google.com (216.58.216.78) 56(84) bytes of data.
    64 bytes from ord30s21-in-f14.1e100.net (216.58.216.78): icmp_seq=1 ttl=48 time=44.5 ms
    64 bytes from ord30s21-in-f14.1e100.net (216.58.216.78): icmp_seq=1 ttl=48 time=44.5 ms (DUP!)
    64 bytes from ord30s21-in-f14.1e100.net (216.58.216.78): icmp_seq=2 ttl=48 time=35.6 ms
    64 bytes from ord30s21-in-f14.1e100.net (216.58.216.78): icmp_seq=2 ttl=48 time=35.7 ms (DUP!)
    64 bytes from ord30s21-in-f14.1e100.net (216.58.216.78): icmp_seq=3 ttl=48 time=25.7 ms
    64 bytes from ord30s21-in-f14.1e100.net (216.58.216.78): icmp_seq=3 ttl=48 time=25.7 ms (DUP!)
    ^C
    
  • It show’s DUP! as there are 2 network interfaces on the team. If we disable one interface, the connection is still working

    [root@lab1 ~]# nmcli con down slave0-master0
    Connection 'slave0-master0' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/11)
    [root@lab1 ~]# nmcli con show
    NAME            UUID                                  TYPE      DEVICE 
    myteam0         cb152694-100f-48b8-8e80-9408e167dc07  team      team0  
    slave0-master1  2fe22df6-5a38-4175-a225-67320c88f73e  ethernet  ens224 
    slave0-master0  2caca644-2351-42bd-9a3a-cd4cdce61802  ethernet  --     
    [root@lab1 ~]# 
    
  • Try to ping again and there is still connectivity. Notice there is no more DUP! as there is only 1 network interface on the team

    [root@lab1 ~]# ping google.com
    PING google.com (216.58.216.78) 56(84) bytes of data.
    64 bytes from ord30s21-in-f78.1e100.net (216.58.216.78): icmp_seq=1 ttl=48 time=47.5 ms
    64 bytes from ord30s21-in-f78.1e100.net (216.58.216.78): icmp_seq=2 ttl=48 time=30.7 ms
    64 bytes from ord30s21-in-f78.1e100.net (216.58.216.78): icmp_seq=3 ttl=48 time=29.8 ms
    64 bytes from ord30s21-in-f78.1e100.net (216.58.216.78): icmp_seq=4 ttl=48 time=27.4 ms
    ^C
    

And there you have it. NIC teaming / bonding in RHEL7!

Like this page? Share it!

Playing with SELinux - Ports Bottleneck in my HomeLab

comments powered by Disqus