How to configure network interface teaming on Ubuntu?

by keegan.towne , in category: Networking & Wireless , 2 years ago

How to configure network interface teaming on Ubuntu?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

by benny_schoen , 2 years ago

@keegan.towne 

Network interface teaming, also known as NIC teaming or bonding, allows you to combine multiple network interfaces into a single virtual interface, providing increased bandwidth, redundancy, and load balancing. Here are the steps to configure network interface teaming on Ubuntu:

  1. Install the bonding kernel module:
1
2
sudo apt-get update
sudo apt-get install ifenslave


  1. Configure the network interfaces in /etc/network/interfaces. For example, if you have two network interfaces named eth0 and eth1, you can configure them as follows:
1
2
3
4
5
auto bond0
iface bond0 inet dhcp
    bond-mode 4
    bond-miimon 100
    bond-slaves eth0 eth1


  • bond0 is the name of the virtual interface that will be created.
  • inet dhcp specifies that the interface will use DHCP to obtain its IP address.
  • bond-mode 4 specifies that the interface will use the 802.3ad LACP bonding mode.
  • bond-miimon 100 specifies that the interface will use a 100ms MII monitoring interval.
  • bond-slaves eth0 eth1 specifies that eth0 and eth1 are the physical interfaces that will be used for bonding.
  1. Restart networking:
1
sudo systemctl restart networking


  1. Verify that the bonding interface is up and running:
1
sudo ifconfig bond0


You should see output similar to the following:

1
2
3
4
5
6
7
bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500
        inet6 fe80::a00:27ff:fe5b:e716  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:5b:e7:16  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


That's it! You have now configured network interface teaming on Ubuntu.

by benny_schoen , 4 months ago

@keegan.towne 

Please note that the procedure described above assumes that you are using the traditional network configuration method in Ubuntu, which involves editing the /etc/network/interfaces file directly.


Ubuntu 18.04 and newer versions have transitioned to using Netplan for network configuration. If you are using a newer version of Ubuntu that utilizes Netplan, you will need to create a Netplan YAML configuration file to set up network interface teaming.


Here's how you can configure network interface teaming on Ubuntu using Netplan:

  1. Create a Netplan configuration file in the /etc/netplan directory. For example, you can create a file named 99-bonding.yaml:
1
sudo nano /etc/netplan/99-bonding.yaml


  1. Add the following YAML content to the file, assuming eth0 and eth1 are the physical interfaces you want to bond:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0: {}
    eth1: {}
  bonds:
    bond0:
      interface: eth0 eth1
      parameters:
        mode: 802.3ad
        miimon: 100


  1. Apply the Netplan configuration changes:
1
sudo netplan apply


  1. Restart networking for the changes to take effect:
1
sudo systemctl restart systemd-networkd


  1. Verify that the bonding interface is up and running:
1
sudo ip addr show bond0


At this point, you should see the bond0 interface configured with the specified parameters and bonded physical interfaces.


By following these steps, you should be able to configure network interface teaming on Ubuntu using Netplan.