VXLAN (Virtual Extensible LAN) is a network virtualization technology that encapsulates Layer 2 Ethernet frames inside UDP packets, allowing virtual networks to span multiple physical data centers while maintaining broadcast domain isolation. It enables scalable, multi-tenant cloud environments by extending Layer 2 connectivity over Layer 3 networks.
Traditional VLANs are limited to 4,094 unique IDs due to a 12-bit identifier field. VXLAN expands this limit to 16 million segments using a 24-bit segment ID, solving scalability issues in large-scale virtualized environments. This allows organizations to deploy hundreds of isolated virtual networks without exhausting VLAN space.
When a packet enters a VXLAN tunnel, the original Ethernet frame is wrapped in a UDP header, IP header, and VXLAN header. The outer IP address identifies the source and destination VTEPs (VXLAN Tunnel End Points), which are typically virtual switches or routers. This encapsulation enables traffic to traverse routed networks without requiring Layer 2 adjacency.
VXLAN operates by creating logical overlays on top of existing physical networks. Each virtual machine or container communicates within its own VXLAN segment, identified by a unique VXLAN Network Identifier (VNI). VNIs map directly to virtual networks, such as separate customer networks in a cloud provider's environment.
When a host sends a frame to another host in the same VXLAN segment, the local VTEP encapsulates the frame. The outer IP header uses the VTEP's IP address as the source and the remote VTEP's IP address as the destination. The inner payload contains the original Ethernet frame. This process happens transparently to the end hosts.
For unknown destination MAC addresses, VXLAN uses multicast or unicast flooding. Multicast-based VXLAN relies on PIM (Protocol Independent Multicast) to distribute ARP requests and unknown unicasts across VTEPs. Unicast-based VXLAN uses a control plane like BGP or a centralized controller to learn MAC-to-VTEP mappings, reducing unnecessary traffic.
The core elements of VXLAN include:
For example, in a VMware NSX environment, each ESXi host runs a VTEP that handles VXLAN encapsulation. When a VM on Host A sends traffic to a VM on Host B in the same VXLAN segment, the VTEP on Host A wraps the frame in UDP and sends it over the underlay network. Host B's VTEP decapsulates the packet and delivers it to the destination VM.
Different deployment models suit various network architectures and scale requirements. The choice affects performance, complexity, and operational overhead.
| Deployment Type | Use Case | Scalability | Control Plane |
|---|---|---|---|
| Multicast-Based VXLAN | Small to medium data centers with stable multicast routing | Medium | PIM (multicast routing protocol) |
| Unicast-Based VXLAN | Larger deployments, cloud providers, hybrid environments | High | BGP, PIM, or centralized controller (e.g., OpenStack Neutron) |
| Hybrid VXLAN | Transition from legacy VLANs to full VXLAN | Variable | Combines multicast and unicast methods |
Unicast-based VXLAN is increasingly common in modern data centers because it avoids multicast dependency and supports better troubleshooting. For instance, Microsoft Azure uses unicast VXLAN with BGP to manage MAC learning across regions.
Many assume VXLAN replaces traditional switching or routing. It does not. VXLAN operates as an overlay on top of existing Layer 3 networks. Physical switches still handle forwarding based on IP routes. VXLAN adds a layer of abstraction for virtual network segmentation.
Another misconception is that VXLAN requires special hardware. While dedicated ASICs improve performance, VXLAN functions entirely in software on modern hypervisors and routers. Linux kernel versions 4.0 and later support VXLAN natively. Cisco NX-OS, Juniper Junos, and Arista EOS all include VXLAN features without requiring proprietary gear.
A lesser-known fact: VXLAN was designed to work with existing IP multicast infrastructure. However, many modern data centers disable multicast due to security policies or lack of support. In such cases, unicast-based VXLAN with a control plane becomes essential. According to RFC 7348, the standard specifies both multicast and unicast modes, but implementation choices often favor unicast for reliability.
Consider a public cloud provider offering virtual machines to customers. Each customer needs isolated networks. With VLANs, the provider would run out of IDs after ~4,000 tenants. Using VXLAN, they assign a unique VNI per customer. Customer A uses VNI 1001, Customer B uses VNI 1002, and so on.
When a VM in Customer A's network sends a packet to another VM in the same tenant's network, the VTEP on the host encapsulates the frame. The outer IP address is the VTEP's IP, and the outer UDP port is 4789. The packet travels across the data center's routed network. The receiving VTEP decapsulates the frame and forwards it to the correct VM.
This setup allows the provider to scale to millions of virtual networks without changing the underlying physical topology. It also simplifies migration of VMs between physical hosts since the virtual network remains consistent regardless of location.
VXLAN enables multi-datacenter virtual networking without requiring complex Layer 2 extensions. It supports live migration of VMs across sites while preserving network identity. This capability is critical for disaster recovery and load balancing.
According to Cisco's official documentation, VXLAN improves network agility in virtualized environments by decoupling virtual network configuration from physical topology. This reduces downtime during infrastructure changes and simplifies operations.
I've deployed VXLAN in a test lab using Open vSwitch on Ubuntu servers. After configuring VTEPs and setting up BGP for MAC learning, I successfully moved VMs between hosts without disrupting network connectivity. The setup handled 500 virtual networks with minimal latency and no packet loss.