Skip to content

VXLAN overlay bridges: building L2 over L3 with the Linux kernel

How VXLAN encapsulates Ethernet over UDP, how to build a multi-host L2 overlay on Linux without a controller, and the operational tradeoffs against EVPN and flannel.

VXLAN (Virtual Extensible LAN) takes an Ethernet frame, wraps it in UDP, and sends it across an IP underlay to another VXLAN endpoint that unwraps and delivers it to a local bridge. The result is that two hosts on different IP subnets — or even in different data centres — can share what looks like a single L2 segment. The Linux kernel has supported VXLAN natively since 3.7, and the configuration is short enough to fit in a single script. This article walks through a working three-host overlay, the FDB-based unicast variant we use when multicast underlays are unavailable, and the operational rough edges.

How to verify

Inspect overlay state and remote learning:

ip -d link show vxlan100
bridge fdb show dev vxlan100
ip route get 10.250.0.5
tcpdump -ni eth0 udp port 4789 -c 5
bridge link show
ip -s link show vxlan100

bridge fdb show exposes the forwarding database — for unicast VXLAN, you should see one dst <peer-ip> entry per remote tunnel endpoint, plus learned entries for MACs heard via the overlay.

What’s happening

A VXLAN packet is an Ethernet frame inside an 8-byte VXLAN header (carrying a 24-bit VNI — Virtual Network Identifier), inside UDP, inside IP. Destination UDP port is 4789 by default (legacy implementations used 8472). The 24-bit VNI gives ~16 million segments; in practice you allocate one VNI per tenant or per logical L2 network.

Endpoints — called VTEPs (VXLAN Tunnel Endpoints) — handle encap/decap. When an L2 frame for an unknown MAC arrives at a VTEP, the VTEP needs to decide which remote VTEP to send it to. There are three approaches:

  • Multicast underlay (group 239.1.1.1): the VTEP floods unknown unicast / broadcast / multicast (BUM) traffic to a multicast group all peers have joined. Simple, but requires multicast routing in the underlay — uncommon outside well-controlled data centres.
  • Static FDB unicast (remote <peer-ip>): you populate the FDB with one entry per peer per VNI, telling the VTEP to replicate BUM to those addresses. Manual but no underlay assumptions.
  • EVPN with BGP (the modern answer): a BGP control plane exchanges MAC-to-VTEP mappings, eliminating BUM flooding for unicast learning. Requires FRR or a vendor stack — see the BGP routing basics article.

For multi-tenant overlays on commodity Linux without a separate control plane, the static-FDB unicast variant is what most engagements end up running.

The procedure

  1. Pick an underlay address per VTEP. Three hosts: VTEP-A at 198.51.100.10, VTEP-B at 198.51.100.11, VTEP-C at 198.51.100.12. Underlay MTU 1500 — VXLAN overhead is 50 bytes, so inner MTU is 1450.

  2. Create the VXLAN interface and add it to a bridge on each host. On VTEP-A:

    ip link add vxlan100 type vxlan id 100 dstport 4789 local 198.51.100.10 nolearning
    ip link set vxlan100 mtu 1450
    ip link add br100 type bridge
    ip link set vxlan100 master br100
    ip link set vxlan100 up
    ip link set br100 up

    nolearning disables source-MAC learning on the overlay side; combined with static FDB entries, it removes a class of flapping bugs.

  3. Populate the FDB with peer VTEP addresses. On VTEP-A:

    bridge fdb append 00:00:00:00:00:00 dev vxlan100 dst 198.51.100.11
    bridge fdb append 00:00:00:00:00:00 dev vxlan100 dst 198.51.100.12

    The all-zero MAC is the BUM-replication entry — any frame with an unknown destination MAC is replicated to all listed peers.

  4. Attach a tenant workload to the bridge. A veth pair or a container interface lands on br100:

    ip link add veth-tenant-a type veth peer name veth-tenant-host
    ip link set veth-tenant-host master br100
    ip link set veth-tenant-host up
    ip link set veth-tenant-a netns tenant
    ip -n tenant addr add 10.250.0.5/24 dev veth-tenant-a
    ip -n tenant link set veth-tenant-a up
  5. Mirror the configuration on B and C. Each host needs the local IP set correctly and the other two as FDB entries.

  6. Allow UDP 4789 in the firewall. On every VTEP:

    iptables -A INPUT -p udp --dport 4789 -s 198.51.100.0/24 -j ACCEPT
  7. Persist with a systemd-networkd .netdev.

    # /etc/systemd/network/10-vxlan100.netdev
    [NetDev]
    Name=vxlan100
    Kind=vxlan
    MTUBytes=1450
    
    [VXLAN]
    VNI=100
    Local=198.51.100.10
    DestinationPort=4789
    MacLearning=false

    FDB entries are still managed out-of-band by a script that reads peer addresses from an inventory file.

Operational notes

  • VXLAN does not authenticate or encrypt. Anyone on the underlay path can spoof or eavesdrop. Wrap the underlay in IPsec or run VXLAN-over-WireGuard for any inter-DC link.
  • MTU surprises bite hard. With underlay 1500, inner MTU is 1450; with underlay 9000 (jumbo), inner MTU is 8950. A misconfigured inner MTU causes large-packet loss while pings succeed.
  • FDB age-out. Entries learned dynamically (with default learning enabled) expire after 5 minutes; bridge mac-learn followed by silence causes flap. Either set nolearning and manage FDB statically, or accept the relearn cost.
  • Multicast underlay is a trap outside controlled fabrics. If you control IP routing across the path, fine. If you don’t, the multicast group is silently dropped at the first un-PIM-aware router and the overlay never gets past handshake.
  • Hardware offload matters. Modern NICs (Intel X710+, Mellanox ConnectX-5+) can offload VXLAN encap/decap and TSO/GSO; without offload, a busy VXLAN host burns CPU on per-packet work.

In the engagements we run, VXLAN is how we extend a single L2 segment across hosts that the kernel is going to deal with anyway — typically for legacy applications that assume neighbour discovery within a broadcast domain, or for container fabrics that lean on flannel or Cilium VXLAN mode. For greenfield multi-tenant networks we now reach for EVPN with FRR (BGP control plane), because it removes the FDB bookkeeping; both patterns live in the managed-operations playbook.