CORETEQ Technology

We are passionate about building our products and sharing insights with the community ✨

Featured

How to Configure a Bond Interface in Ubuntu with a UDM Pro Switch

--

At our company, we strive to maximize the potential of our hardware while keeping our solutions cost-effective. As a small company, we avoid enterprise-grade solutions whenever possible, opting instead for open-source tools that we customize to fit our needs.

We run Ubuntu on our servers and have chosen Ubiquiti devices for our network infrastructure. After transitioning from Docker Swarm to Kubernetes, we adopted Longhorn for data replication and storage availability. This shift, however, increased our network bandwidth requirements significantly.

Cover ubuntu

Since we don’t have fiber-optic connections between servers and aren’t planning to invest in such infrastructure in the near future, we decided to implement bonding on our servers, combining two network interfaces for improved throughput and redundancy. This article provides a step-by-step guide on setting up bonding in Ubuntu using Netplan and configuring the UDM Pro switch to ensure everything works seamlessly.

Steps to Configure Bonding

1. Configure Bonding in Ubuntu

  • Open the Netplan configuration file on your Ubuntu server:
sudo vim /etc/netplan/01-netcfg.yaml
  • Define your bond interface. Below is an example configuration:
network:
version: 2
ethernets:
eno1:
dhcp4: no
eno2:
dhcp4: no
bonds:
bond0:
dhcp4: yes
interfaces:
- eno1
- eno2
parameters:
mode: balance-rr
  • Apply the changes:
sudo netplan apply

Note: Applying this configuration will cause the network to stop functioning until the switch is configured. Proceed with caution.

2. Configuring Bonding on the UDM Pro Switch

To enable bonding on the UDM Pro switch, you must use contiguous ports. For instance, ports 5 and 6 can be bonded, but bonding between non-adjacent ports (e.g., port 5 and port 15) is not supported.
Log in to your UDM Pro’s web interface.

  • Log in to your UDM Pro interface.
  • Navigate to Network Devices and locate the correct switch.
  • Open the Port Management settings on the switch.
  • For the first port (e.g., Port 5), go to the Advanced section:
    - Change the Operation Mode to Aggregating.
    - Under Aggregate Ports, select the additional port(s) to include in the bonding setup. (e.g., Port 6)
Advanced settings for switch port
Setup aggregation on port 5.

Note: You cannot add a port with a lower number than the current one to the bond; only subsequent higher-numbered ports can be selected. Therefore, you need to start configuring from the lowest-numbered port in the bonding setup.

  • Apply the changes.

After configuring the bonding, a bonding icon will appear in the port overview for the ports assigned to it.

Bonding icon in port preview
Icon of bonding appeared

2. Verifying Functionality

Test with iperf

To verify functionality, I used iperf to measure network performance and disconnected one of the interfaces to ensure that the bonding works correctly and that the failure of one port or damage to one cable will not cause issues in the future.

To verify network performance, use iperf:

  • Install iperf on both the bonded server and a test client:
sudo apt install iperf3
  • Run iperf in server mode on one machine:
iperf3 -s
  • Run iperf in client mode on another machine, targeting the server’s IP:
iperf3 -c <server-ip>

Test Redundancy by Disconnecting a Cable

Physically disconnect one of the bonded cables from the server or switch. Then ensure the connection remains active and traffic continues to flow without interruption.

Conclusion

By combining Ubuntu’s Netplan bonding configuration with the UDM Pro switch’s port aggregation settings, we achieved a cost-effective solution to our increased network demands. This setup enhances both throughput and redundancy, ensuring reliable performance for our Kubernetes cluster.

--

--

CORETEQ Technology
CORETEQ Technology

Published in CORETEQ Technology

We are passionate about building our products and sharing insights with the community ✨

No responses yet