The VNI (VXLAN Network Identifier) is a 24-bit identifier used in VXLAN to distinguish different virtual Layer 2 segments, similar to how VLAN IDs work in traditional networks.

VXLAN encapsulates Ethernet frames inside UDP packets for transport over an IP network. Each VXLAN segment is identified by a VNI, which tells the VXLAN Tunnel Endpoint (VTEP) which overlay network the packet belongs to.

The VNI range is from 1 to 16,777,215 (24 bits). This large range is a key advantage of VXLAN compared to VLAN (which only supports up to 4096).

VNI is mandatory for VXLAN operation because:

  • VXLAN is designed to create multiple isolated Layer 2 networks over a shared Layer 3 underlay.
  • Without VNI, the VTEP cannot determine which virtual network the traffic belongs to.
  • VNI serves the same purpose in VXLAN as VLAN tagging does in traditional networks.
  • Normal hosts connected to a VXLAN-backed network do not need to know VNI. They just see a regular Ethernet segment. VTEPs (switches, routers, or devices that encapsulate VXLAN) need VNI to encapsulate and decapsulate traffic correctly.