Skip to content

Lesson 3 of 9 · 25m

Linux Bridges and VLANs: One Host, Many L2 Domains

Build bridge and VLAN topology with modern vlan-aware bridge configuration, understand tagging, and avoid the loops and leaks that ruin labs and production alike.

Linux bridging is simple right up until a virtual machine cannot reach a guest VLAN, the host loses its own management address, or one bad cable creates a broadcast storm. The reliable mental model is: a Linux bridge is a software switch. Ports have VLAN membership; the bridge itself is just another interface that can own IP addresses.

Use the vlan-aware bridge

Old-style VLAN interfaces (eth0.10) still work, but they do not represent what a switch does. Modern Linux bridges have a VLAN database:

ip link add name br0 type bridge vlan_filtering 1
ip link set dev eth0 master br0
ip link set dev br0 up
ip link set dev eth0 up

bridge vlan add dev eth0 vid 10 pvid untagged
bridge vlan add dev eth0 vid 20
bridge vlan show

pvid untagged means untagged ingress frames are classified into VLAN 10 and egress untagged. A VLAN listed without untagged is tagged on that port. This distinction is the source of most 'the VM can talk but the host cannot' incidents.

The host interface on a bridge

When you enslave eth0 to br0, Layer 3 configuration generally moves to the bridge interface:

ip address add 192.0.2.14/24 dev br0
ip route replace default via 192.0.2.1 dev br0

The physical port is now a switch port. It should not also carry the host's ordinary IP configuration. Keeping both is how operators create duplicate paths, asymmetric behavior, and hours of confusion.

Inspect like a switch, not like a host

bridge link
bridge fdb show br br0
bridge vlan show
ip -statistics link show dev br0

bridge fdb shows learned MACs. If the expected MAC never appears, frames are not arriving. If it appears on the wrong port, your mental topology is wrong. If entries flap between ports, suspect a loop, duplicated NIC, or broken bonding upstream.

Loops do not forgive optimism

Spanning Tree is disabled by default on Linux bridges. Two bridged paths between the same L2 domains can turn one broadcast into a storm in seconds:

ip link set dev br0 type bridge stp_state 1

STP is not a substitute for understanding topology, and in many virtualization fabrics it is intentionally unnecessary. But if you cannot explain every redundant path, enabling it is safer than discovering broadcast amplification during a migration.

Field notes

  • A VLAN-aware bridge port that expects tagged traffic will silently not match traffic sent untagged, and vice versa.
  • bridge vlan show is mandatory after every change; memory is not an audit mechanism.
  • When troubleshooting VM networking, inspect hypervisor port groups, the physical NIC, bridge membership, and guest interface as separate layers.
  • Linux bridges forward at Layer 2. Routes do not fix missing VLAN membership.
  • For virtual taps, verify both ends: br0 membership and the hypervisor's attachment. One correct end is still a broken wire.

Was this lesson helpful?

Sign in to rate