VXLAN (Virtual Extensible LAN) is a network virtualization overlay that encapsulates Layer 2 Ethernet frames inside UDP/IP packets, so that isolated Layer 2 segments can stretch across a routed Layer 3 fabric. Within Ethernet & switching, it is the standard answer to two old limits of classic VLANs: the ceiling of 4,094 usable VLAN IDs and the need to extend broadcast domains across physical links that run Spanning Tree Protocol.
The protocol is defined in RFC 7348 and uses a 24-bit VXLAN Network Identifier (VNI), which allows about 16 million logical segments. It is the dominant overlay in modern data centers, multi-tenant clouds and leaf-spine fabrics, usually paired with BGP EVPN as its control plane.
How VXLAN encapsulation works
VXLAN works by wrapping the original Ethernet frame in a new set of outer headers at a VXLAN tunnel endpoint (VTEP), sending it across the IP underlay, and removing those headers at the remote VTEP. The VTEP can be a hardware switch, typically a leaf switch, or a software component in a hypervisor host.
The receiving VTEP identifies VXLAN traffic by the IANA-assigned UDP destination port 4789. The outer UDP source port is derived from a hash of the inner frame headers, which gives the underlay enough entropy to spread flows across equal-cost paths with ECMP. The inner frame itself, including its MAC addresses and any payload, travels unchanged.
The table lists the headers that a VXLAN packet carries on the wire, from outermost to innermost.
| Header | Size | Purpose |
|---|---|---|
| Outer Ethernet | 14 bytes (18 with 802.1Q tag) | Hop-by-hop delivery in the underlay |
| Outer IPv4 | 20 bytes (40 for IPv6) | Routes the packet between VTEP addresses |
| Outer UDP | 8 bytes | Port 4789 plus a hashed source port for ECMP |
| VXLAN header | 8 bytes | Flags and the 24-bit VNI |
| Inner Ethernet frame | Original size | The tenant frame, carried unchanged |
In total, VXLAN adds 50 bytes of overhead over IPv4 and 70 bytes over IPv6. For that reason, the underlay must support an MTU of at least 1,550 bytes; most operators simply enable jumbo frames of about 9,000 bytes on every fabric link.
Control plane options for learning endpoints
A VTEP must learn which remote VTEP sits behind each tenant MAC address, and VXLAN supports several control plane models for this task. The original specification relied on flood-and-learn behavior, much like a traditional switch filling its MAC address table, but large deployments now prefer a protocol-driven approach.
Broadcast, unknown unicast and multicast traffic, often called BUM traffic, also needs a delivery method. The choice of control plane determines how that traffic is replicated and how quickly the fabric converges after a host moves.
| Model | How MAC addresses are learned | BUM handling | Typical use |
|---|---|---|---|
| Multicast flood-and-learn | Data plane, from received frames | Underlay IP multicast group per VNI | Early deployments, small fabrics |
| Static ingress replication | Data plane, peers listed manually | Unicast copies to each listed VTEP | Labs and very small sites |
| BGP EVPN | Control plane, MAC/IP routes in BGP | Ingress replication or multicast | Production data center fabrics |
| Controller-based | Central SDN controller pushes state | Controller-defined replication | Hypervisor overlays and clouds |
BGP EVPN has become the reference design because it distributes MAC and IP reachability before traffic flows, supports ARP suppression at the local VTEP, and enables distributed anycast gateways so that every leaf switch can route for its local hosts.
VXLAN compared with VLAN tagging and other overlays
VXLAN differs from VLAN tagging mainly in scale and transport: an 802.1Q tag segments traffic only within a single Layer 2 network, whereas VXLAN carries segments over any routed IP network. In practice, the two coexist, because access ports and trunk ports at the edge still use VLANs that the leaf switch maps to VNIs.
The comparison below places VXLAN next to the segmentation methods that engineers most often weigh against it.
| Method | Identifier size | Transport | Main strength |
|---|---|---|---|
| 802.1Q VLAN | 12 bits, 4,094 IDs | Native Layer 2 | Simple and universally supported |
| VXLAN | 24 bits, about 16 million IDs | UDP over IP | Broad hardware support, ECMP friendly |
| NVGRE | 24 bits | GRE over IP | Historical Hyper-V use, weak ECMP entropy |
| Geneve | 24 bits plus options | UDP over IP | Extensible metadata for software overlays |
| MPLS VPN | 20-bit labels | MPLS core | Carrier-grade traffic engineering |
Geneve offers more flexibility, but VXLAN keeps the advantage of mature switch ASIC support, which is why physical fabrics still standardize on it while some software overlays have moved to Geneve.
Designing a VXLAN fabric
A typical VXLAN design places VTEPs on the leaf switches of a leaf-spine topology and keeps the spine layer as a pure IP transport that never inspects the inner frames. The underlay runs a routing protocol such as OSPF, IS-IS or eBGP to provide loopback reachability between VTEPs, while the overlay carries tenant traffic.
- Map VLANs to VNIs consistently on every leaf, and document the mapping as the single source of truth.
- Raise the underlay MTU before the first tunnel is created, then verify it end to end with non-fragmenting pings.
- Use loopback interfaces as VTEP sources, so tunnels survive the failure of a single physical uplink.
- Separate Layer 2 and Layer 3 VNIs when tenants need routing between their segments in a VRF.
- Enable ARP suppression to reduce flooding in large broadcast domains.
Routing between VXLAN segments can be centralized on a border or spine gateway or distributed on every leaf. Distributed routing with symmetric integrated routing and bridging avoids hairpinning traffic through a central device and scales better as east-west traffic grows.
Limitations and common mistakes
VXLAN solves scaling and mobility problems, but it adds encapsulation overhead, operational complexity and new failure modes. Most production incidents trace back to a handful of recurring configuration errors rather than to the protocol itself.
| Symptom | Likely cause | Fix |
|---|---|---|
| Small packets pass, large ones fail | Underlay MTU below 1,550 bytes | Raise MTU on every underlay link |
| Hosts in one VNI cannot reach each other | Mismatched VLAN-to-VNI mapping | Align mappings on all VTEPs |
| Uneven link utilization | Hashing ignores the UDP source port | Enable 5-tuple load balancing |
| Flooding storms after host moves | Data plane learning without suppression | Deploy BGP EVPN and ARP suppression |
| Tunnels unreachable | VTEP loopback not advertised | Check underlay routing for loopbacks |
VXLAN also provides no encryption or authentication of its own. Any device that can inject UDP traffic on port 4789 toward a VTEP may be able to insert frames into a segment, so the underlay should be filtered at its edge and sensitive traffic protected with MACsec or IPsec where required.
Stripped to the essentials
VXLAN lets a large network pretend that computers in different racks or rooms sit on the same simple local network. It does this by putting each original network message inside an envelope that ordinary routers already know how to deliver.
Think of it as sending a sealed letter inside a courier parcel. The courier only reads the address on the parcel, and the recipient opens it and finds the original letter untouched. The key point is that VXLAN gives millions of separate private networks on one shared physical infrastructure, far more than older VLANs allow.
Where it is applied
A regional hosting provider runs two data center halls with 40 leaf switches and about 600 tenants. Classic VLANs had become a bottleneck: the provider was close to the 4,094 ID limit, and Spanning Tree Protocol blocked half of the links between halls.
The engineers rebuilt the network as a leaf-spine fabric with BGP EVPN and VXLAN. Each tenant received its own Layer 3 VNI and one or more Layer 2 VNIs, the underlay MTU was raised to 9,216 bytes, and every leaf became a distributed anycast gateway. Virtual machines can now migrate between halls while keeping their IP addresses.
The outcome was that all uplinks carry traffic through ECMP, the provider has room for many thousands of additional segments, and onboarding a new tenant takes a configuration change on the leaves rather than a redesign of the switching layer.