Where to start First steps track · 15 stages
Linux Labs

VLANs and interface bonding

4 min Ubuntu 24.04 · netplan

Logical networks over a cable and combining NICs into one interface; the bond mode must match the switch's config.

Cheat sheet

4 commands Printable version
  • cat /proc/net/bonding/bond0 bond status
  • netplan: bonds: mode active-backup|802.3ad ; vlans: id + link
  • sudo netplan try apply with a rollback

Overview

Two common tricks on servers:

  • VLAN — several logical networks over one cable (802.1Q tags). An interface like eth0.100.
  • Bond — combining several physical NICs into one logical interface bond0, for fault tolerance or throughput.

On Ubuntu, all of this is configured through netplan.

Bonding modes solve different problems. active-backup is simple fault tolerance: one NIC is active, the other waits in reserve, and no extra switch configuration is needed. 802.3ad (LACP) aggregates the throughput of several NICs, but only works if the switch port is configured into the same LACP aggregate (port-channel/EtherChannel) — without that, traffic simply won't flow, or will be unstable.

Recipes

2

netplan: VLAN and bond

yaml
network:
  version: 2
  ethernets:
    eth0: {}
    eth1: {}
  bonds:
    bond0:
      interfaces: [eth0, eth1]
      parameters:
        mode: active-backup        # fault tolerance (or 802.3ad — aggregation)
        mii-monitor-interval: 100
      addresses: [10.0.0.10/24]
  vlans:
    vlan100:
      id: 100
      link: bond0
      addresses: [10.100.0.10/24]
bash
sudo netplan try                  # apply with a rollback (see netplan)

Checking

bash
ip -br link                       # interfaces and their state
cat /proc/net/bonding/bond0       # bond status: active slave, mode, links
ip -d link show vlan100           # VLAN details (the tag)
ip -br a                          # addresses (see ip)

Troubleshooting

5

There's a bond, but traffic goes over one NIC only

That's normal for active-backup (the second is a spare). Aggregation needs 802.3ad (LACP) mode AND switch-side support (a configured port-channel).

The VLAN doesn't work

The id tag must match the switch port's configuration (a trunk with this VLAN). Check ip -d link show and the switch port.

The network went down after netplan apply

A typo or wrong link. Use netplan try (see netplan) — it rolls back. Check interface names against ip -br link.

A link keeps "flapping" in the bond

cat /proc/net/bonding/bond0 shows which slave is dropping; check the cable/port (ethtool).

Changed the bond mode, and the network went down completely

The switch port is still set for the old mode. Switching active-backup → 802.3ad (or back) on the server without also updating the switch port's configuration is a common cause of total connectivity loss, not partial degradation.

See also

  • netplan — Persistent network configuration on Ubuntu — YAML, static IP and DHCP, safe application.
  • ip — Managing interfaces, addresses, and routes (iproute2) — the ifconfig/route replacement.
  • ethtool — Link speed and duplex, error statistics, cable type — NIC diagnostics.
Loading…