Skip to content
Back to Blog
Linux

Linux Network Bonding, VLANs, and Bridges

Configure Linux network bonding for redundancy, 802.1Q VLANs for segmentation, and bridges for VM networking with systemd-networkd.

Nov 2025
12 min read

Introduction

Linux has powerful networking capabilities built into the kernel — bonding (NIC teaming), VLANs, and bridges allow you to build complex network topologies without any additional hardware. These are essential for hypervisors, routers-on-a-stick, and high-availability servers.

Linux Bonding (NIC Teaming)

Bonding combines multiple physical NICs into a single logical interface for redundancy or throughput.

Bonding Modes

ModeNameUse Case
0round-robinMax throughput, no redundancy
1active-backupHigh availability, one active NIC
2balance-xorLoad balance by XOR of MAC
4802.3ad (LACP)True link aggregation, needs switch support
5balance-tlbAdaptive load balancing, no switch config
6balance-albALB + receive load balancing

Setting Up Bonding (systemd-networkd)

Create /etc/systemd/network/bond0.netdev:

INI
[NetDev]
Name=bond0
Kind=bond

[Bond]
Mode=active-backup
MIIMonitorSec=100ms
FailOverMACPolicy=active

Create /etc/systemd/network/bond0.network:

INI
[Match]
Name=bond0

[Network]
Address=192.168.1.10/24
Gateway=192.168.1.1
DNS=8.8.8.8

Create member interfaces /etc/systemd/network/eth0.network:

INI
[Match]
Name=eth0

[Network]
Bond=bond0

Similarly for eth1. Then:

BASH
systemctl restart systemd-networkd

Setting Up Bonding (legacy ifconfig/ip method)

BASH
# Load bonding module
modprobe bonding

# Create bond interface
ip link add bond0 type bond mode active-backup miimon 100

# Add slaves
ip link set eth0 master bond0
ip link set eth1 master bond0

# Bring up the bond
ip link set bond0 up
ip addr add 192.168.1.10/24 dev bond0

# Check bond status
cat /proc/net/bonding/bond0

LACP (802.3ad) Setup

Requires switch configuration (portchannel/LAG):

BASH
# Server side
ip link add bond0 type bond mode 802.3ad lacp_rate fast miimon 100
ip link set eth0 master bond0
ip link set eth1 master bond0

# Switch side (Cisco IOS example)
interface range GigabitEthernet0/1-2
 channel-group 1 mode active  # LACP active
 channel-protocol lacp
interface Port-channel1
 no shutdown

Linux VLANs

VLANs segment network traffic on a single physical interface.

BASH
# Load VLAN module
modprobe 8021q

# Create VLAN interface
ip link add link eth0 name eth0.10 type vlan id 10
ip link add link eth0 name eth0.20 type vlan id 20

# Assign IPs
ip link set eth0.10 up
ip link set eth0.20 up
ip addr add 192.168.10.1/24 dev eth0.10
ip addr add 192.168.20.1/24 dev eth0.20

Persistent VLAN with systemd-networkd

INI
# /etc/systemd/network/vlan10.netdev
[NetDev]
Name=vlan10
Kind=vlan

[VLAN]
Id=10
INI
# /etc/systemd/network/vlan10.network
[Match]
Name=vlan10

[Network]
Address=192.168.10.1/24

Linux Bridges

A bridge acts as a virtual switch, connecting multiple interfaces at Layer 2.

BASH
# Create bridge
ip link add br0 type bridge

# Add interfaces to bridge
ip link set eth0 master br0
ip link set eth1 master br0

# Assign IP to bridge (not to individual interfaces)
ip link set br0 up
ip addr add 192.168.1.10/24 dev br0

# Enable STP on bridge
ip link set br0 type bridge stp_state 1

Complete Hypervisor Network Stack

Typical KVM/libvirt setup with bonding + VLANs + bridges:

TEXT
Physical NICs: eth0, eth1
   → bond0 (LACP/active-backup)
      → vlan10 (management)
         → br-mgmt (bridge for VMs using management VLAN)
      → vlan20 (production)
         → br-prod (bridge for production VMs)
      → vlan30 (storage)
         → br-storage (bridge for storage traffic)
BASH
# Full setup
ip link add bond0 type bond mode active-backup miimon 100
ip link set eth0 master bond0
ip link set eth1 master bond0
ip link set bond0 up

ip link add link bond0 name bond0.10 type vlan id 10
ip link add link bond0 name bond0.20 type vlan id 20

ip link add br-mgmt type bridge
ip link set bond0.10 master br-mgmt
ip addr add 10.0.10.1/24 dev br-mgmt
ip link set br-mgmt up

ip link add br-prod type bridge
ip link set bond0.20 master br-prod
ip link set br-prod up

Persistent Configuration with Netplan (Ubuntu)

YAML
# /etc/netplan/01-network.yaml
network:
  version: 2
  bonds:
    bond0:
      interfaces: [eth0, eth1]
      parameters:
        mode: active-backup
        mii-monitor-interval: 100
  vlans:
    bond0.10:
      id: 10
      link: bond0
    bond0.20:
      id: 20
      link: bond0
  bridges:
    br-mgmt:
      interfaces: [bond0.10]
      addresses: [10.0.10.1/24]
    br-prod:
      interfaces: [bond0.20]
BASH
netplan apply