How to Configure systemd-networkd for Network Bonding and VLANs on Ubuntu

High-throughput enterprise server clusters and virtualization hosts require network interface aggregation to provide hardware fault tolerance and multiplied bandwidth. While desktop systems frequently manage interfaces via NetworkManager, enterprise Ubuntu servers achieve maximum deterministic performance by leveraging systemd-networkd. Configuring Link Aggregation (IEEE 802.3ad LACP bonding) alongside 802.1Q tagged Virtual LANs (VLANs) enables robust network segmentation and redundant uplink failover directly through native systemd daemons.

Architecture of systemd-networkd Virtual Interfaces

In systemd-networkd, complex network topologies are organized into two primary configuration primitives residing in /etc/systemd/network/:

  • .netdev files: Define virtual network devices created by the kernel (e.g., bond masters, bridges, VLAN sub-interfaces, and VXLAN tunnels).
  • .network files: Define matching rules and operational parameters (IP addressing, routing gateways, DNS, and bridge bindings) applied to physical or virtual interfaces.

Configuring the Bond Master Netdev (802.3ad LACP)

Create a virtual bond master device aggregating two physical Gigabit/10G network ports:

sudo nano /etc/systemd/network/10-bond0.netdev

Append the configuration directives:

[NetDev]
Name=bond0
Kind=bond

[Bond]
Mode=802.3ad
LACPTransmitRate=fast
MIIMonitorSec=100ms
TransmitHashPolicy=layer2+3

Setting Mode=802.3ad engages dynamic LACP negotiation with upstream managed switches, while TransmitHashPolicy=layer2+3 distributes outbound traffic flows across member physical interfaces using both MAC and IP hash keys.

Enslaving Physical Interfaces to the Bond Master

Configure physical interfaces (e.g., enp3s0 and enp4s0) to attach to bond0 without assigning independent IP addresses:

sudo nano /etc/systemd/network/20-bond-slaves.network
[Match]
Name=enp3s0 enp4s0

[Network]
Bond=bond0

Creating Tagged VLAN Interfaces on Top of the Bond

To trunk multiple isolated networks (e.g., VLAN 10 for management and VLAN 20 for storage traffic) across the aggregated bond, define distinct VLAN netdev devices:

# Create VLAN 10
sudo nano /etc/systemd/network/30-vlan10.netdev
[NetDev]
Name=bond0.10
Kind=vlan

[VLAN]
Id=10

Update the bond’s network configuration file to host the VLAN:

sudo nano /etc/systemd/network/25-bond0.network
[Match]
Name=bond0

[Network]
VLAN=bond0.10
LinkLocalAddressing=no

Assigning Static IP Addressing to the Tagged VLAN Sub-Interface

Assign production network configuration to the virtual VLAN device:

sudo nano /etc/systemd/network/40-vlan10.network
[Match]
Name=bond0.10

[Network]
Address=192.168.10.50/24
Gateway=192.168.10.1
DNS=192.168.10.1

Applying Configuration and Validating Link Aggregation

Ensure systemd-networkd is enabled and reload configuration:

# Enable and restart service
sudo systemctl enable --now systemd-networkd.service
sudo systemctl restart systemd-networkd.service

# Inspect network link states
networkctl status bond0
networkctl status bond0.10

# Audit LACP bonding aggregation details
cat /proc/net/bonding/bond0

The /proc/net/bonding/bond0 output will verify active LACP partner negotiation, confirming redundant network aggregation and VLAN trunking across Ubuntu server hosts.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.