Network bonding or teaming in Ubuntu allows you to combine multiple network interfaces into a single logical interface. This setup can increase bandwidth, provide redundancy, and improve network reliability by ensuring continuous connectivity if one link fails. It is commonly used in servers, virtualization hosts, and critical network appliances.
What You’ll Need
- Ubuntu system (desktop or server) with at least two network interfaces
- Root or sudo access to configure network settings
- Basic familiarity with the command line and network configuration
- Backup of existing network configuration files
Step-by-Step
- Check your network interfaces: Run
ip link showorifconfig -ato identify the interfaces you want to bond or team. Make sure they are not in use or configured with static IPs that might conflict. - Install necessary packages: For bonding, the kernel module is usually included by default; for teaming, install the
teamddaemon:
sudo apt update && sudo apt install ifenslave teamd - Load the bonding kernel module: Execute
sudo modprobe bonding. To load it permanently, addbondingto/etc/modules:echo bonding | sudo tee -a /etc/modules
- Create a bonding interface configuration: Ubuntu uses Netplan by default (18.04+). Edit your Netplan config in
/etc/netplan/(e.g.,01-netcfg.yaml), or create a new file:network: version: 2 renderer: networkd ethernets: enp3s0: {} enp4s0: {} bonds: bond0: interfaces: [enp3s0, enp4s0] parameters: mode: balance-rr primary: enp3s0 dhcp4: yesReplace
enp3s0andenp4s0with your interface names. Themodecan be one ofbalance-rr,active-backup,802.3ad(LACP),balance-xor,broadcast, orbalance-tlb. - Apply the Netplan configuration: Run
sudo netplan apply. This will create and activate the bonded interface. - Verify the bonding interface: Use
cat /proc/net/bonding/bond0to check status and active interfaces. Also,ip addr show bond0should display the bonded interface with its IP. - Configure teaming (optional alternative to bonding): Create a team configuration file, e.g.,
/etc/systemd/network/team0.netdev:[NetDev] Name=team0 Kind=team
Then create
/etc/systemd/network/team0.networkto assign IP and add slaves:[Match] Name=team0 [Network] DHCP=yes
And create slave configs for each interface, e.g.,
enp3s0.network:[Match] Name=enp3s0 [Network] TeamSlave=yes
Repeat for other interfaces. Restart systemd-networkd with
sudo systemctl restart systemd-networkd. - Test failover and bonding: Disconnect one cable or disable one interface and check if network stays up with
pingorip a. - Make configurations persistent: Ensure your changes are saved and backed up. For older Ubuntu versions using ifupdown, bonding is configured in
/etc/network/interfacesinstead.
Common Mistakes
- Not unloading or conflicting with existing network configurations before bonding.
- Using incorrect interface names or typos in Netplan YAML files causing failed applies.
- Forgetting to load the bonding kernel module or teamd service.
- Choosing an inappropriate bonding mode without understanding switch support (e.g., 802.3ad requires switch LACP support).
- Applying bonding without coordinating settings on the connected switch ports.
- Not testing failover, leading to unnoticed single points of failure.
Tips
- Always backup your current network configuration files before making changes.
- Use
balance-rroractive-backupmodes if unsure, as they are simpler and widely supported. - Check switch compatibility and configuration when using LACP (802.3ad) mode.
- Use
ethtoolto verify link status and speed on interfaces. - Monitor bonding interfaces with
cat /proc/net/bonding/bond0to confirm active slaves and errors. - For complex setups, consider teaming with
teamdfor more advanced features and control. - Use descriptive interface names to avoid confusion, especially on systems with many NICs.
Troubleshooting
If bonding or teaming does not work as expected, try these steps:
- Check kernel modules: Ensure bonding module is loaded with
lsmod | grep bonding. Load if missing:sudo modprobe bonding. - Inspect logs: Use
journalctl -xeordmesgfor errors related to network or bonding. - Validate Netplan syntax: Run
sudo netplan tryto test config before applying permanently. - Verify interface states: Use
ip link showandethtoolto confirm interfaces are up and operational. - Switch configuration: Confirm that your network switch ports are configured correctly, especially if using LACP bonding.
- Restart networking: Restart systemd-networkd or networking service to reload configurations:
sudo systemctl restart systemd-networkdorsudo systemctl restart networking. - Fallback to simple mode: Temporarily switch to
active-backupmode to isolate issues with switch compatibility. - Check IP conflicts: Ensure no IP address conflicts exist on the network.
Frequently Asked Questions
What is the difference between bonding and teaming?
Bonding is a kernel-level method to aggregate network interfaces; teaming is a newer user-space alternative offering more flexible and modern features. Teaming uses the teamd daemon and systemd-networkd integration.
Do I need special hardware to use bonding or teaming?
No special hardware is required, but some bonding modes like 802.3ad (LACP) need your switch to support link aggregation protocols.
Can I bond interfaces with different speeds?
It is possible but not recommended. Bonding works best with identical or similar interface speeds to avoid performance issues and packet reordering.
Will bonding increase my network speed?
Bonding can increase throughput by combining multiple links, but actual speed depends on the mode used and switch support. Some modes provide redundancy rather than speed boost.
How do I check if bonding is working?
Use cat /proc/net/bonding/bond0 to see bonding status and active slaves. You can also test failover by disconnecting one link and verifying network continuity.
Can I configure bonding on a desktop Ubuntu system?
Yes, bonding or teaming can be configured on desktop systems, but it is more common on servers or systems requiring high availability or increased bandwidth.
Is it possible to use DHCP with bonded interfaces?
Yes, bonded interfaces can be assigned IP addresses via DHCP or static configuration depending on your network needs and Netplan or ifupdown settings.
By following these instructions and tips, you can successfully configure network bonding or teaming on your Ubuntu system to enhance network performance and reliability.
Related
- How to Install Cinnamon Desktop on Ubuntu: Beginner’s Guide
- How to Make Pancakes Without a Waffle Iron: Easy Step-by-Step Guide
- How to Identify Antique Spinning Wheels: A Beginner’s Guide