DEV Community

TAKUMI SUGATA
TAKUMI SUGATA

Posted on

Making Tokyo and Osaka the Same Floor — Understanding VLAN, VXLAN, and VNI

Introduction

While studying for CompTIA Network+, I couldn't grasp what VNI is.
I could only memorize that " VNI is the number used to identify a VXLAN network", but I couldn't totally understand what it is and what it differ from VLAN.

Once I matched familiar example with it, everything fell into place, so I decided to write it down.


The difference between VLAN and VXLAN

First of all, we need to understand the difference between them to comprehend VNI.


What is VLAN

VLAN = Virtual LAN

A mechanism for dividing physical network into virtual segments within the same switch or  building.

┌────────────────────────────┐
│  A switch                  │
│  VLAN10 │ VLAN20 │ VLAN30  │
└────────────────────────────┘
Enter fullscreen mode Exit fullscreen mode
Physical constraint:
 → The same switch or until the adjacent switch
 → It cannot reach long distance
 → Max : 4094
Enter fullscreen mode Exit fullscreen mode

VLAN limitation

In a cloud environment, it is essential to divide network for each tenant ( enterprise )
Thousand or ten thousand networks are needed
 ↓
VLAN's maximum of 4094 is far from sufficient for this scale
Enter fullscreen mode Exit fullscreen mode

What is VXLAN

VXLAN = Virtual Extensible LAN

A mechanism that extends VLAN to create networks beyond physical boundaries.

Datacenter A            Datacenter B
┌─────────┐             ┌─────────┐
│ Server  │─── VXLAN ───│ Server  │
└─────────┘    Tunnel   └─────────┘
Enter fullscreen mode Exit fullscreen mode
VLAN:
 → No tunnel
 → Segments are divided using physical switch ports

VXLAN:
 → UDP Tunnel( Port 4789)
 → Layer 2 Frame is transferred on Layer 3 network
 → It can overcome the physical constraint
Enter fullscreen mode Exit fullscreen mode

Compare VLAN with VXLAN

Category VLAN VXLAN
Purpose Divide physical NW Create NW beyond place
Identifier VLAN ID(12bit) VNI(24bit)
Maximum 4094 16million
Range Inside building Regardless of the place
Transfer Layer 2 UDP( On Layer 3)
Use Small or medium-scale environment Large-scale cloud environment

Understanding with familiar example

VLAN:
 → Segment rooms for each floor inside a building 
 → It can just us inside the area

VXLAN:
 → It can use every office (Tokyo, Osaka, Fukuoka) virtually as the same floor
 → It can surpass physical distance
Enter fullscreen mode Exit fullscreen mode

What is VNI

VXLAN Network Identifier

In a nutshell, ** it is the number used to identify a virtual network created by VXLAN **.

VLAN ID = VLAN identification number(12bit・max 4094)
VNI     = VXLAN identification number(24bit・max 16million)

VNI is an extended version of VLAN ID
 → VLAN ID is 12bit
 → VNI is 24bit
 → This allows approximately 4000 times more identifiers
Enter fullscreen mode Exit fullscreen mode

Understanding with postcode

VLAN ID:
 → Apartment room number (Max 4094 rooms)
 → Lack for large-scale environment

VNI:
 → Country's postcode( Max 16 million)
 → It can accommodate any scale of environment
Enter fullscreen mode Exit fullscreen mode

The mechanism of VXLAN

VXLAN uses a UDP tunnel to transfer Layer 2 frames over Layer 3 network

┌───────────────────────────────────────────────────────────────┐
│         VXLAN Packet                                          │                                                                                   │                                                               │
│  ┌─────────────────────────────┐                              │                                      │  │                             │                              │
│  │    Original Layer 2 frames  │                              │                                       │  │                             │                              │
│  └─────────────────────────────┘                              │                                
│ VNI( Identifier that specifies                               │
│                 which virtual network the packet belongs to) │
└───────────────────────────────────────────────────────────────┘
      ↓
  Transfer on UDP port 4789
Enter fullscreen mode Exit fullscreen mode

Summary

VLAN :
The mechanism to divide network inside building
 → Max 4094・12bit

VXLAN :
The mechanism to create virtual network beyond building
 → Max 16million・UDP tunnel

VNI :
An identifying number used to distinguish virtual networks created by VXLAN
 → 24bit・Max 16 million
 → Extended version of VLAN ID

The difference between VLAN and VXLAN:
VLAN  → Inside the same building・ Max 4094
VXLAN → Regardless of the building・ Max 16 million
Enter fullscreen mode Exit fullscreen mode

Conclusion

I used to struggle with memorizing that VNI is the identification number for VXLAN.
Once I understood the structure behind each term, I could naturally grasp why VNI is essential.

Top comments (0)