162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci====================================================== 462306a36Sopenharmony_ciVirtual eXtensible Local Area Networking documentation 562306a36Sopenharmony_ci====================================================== 662306a36Sopenharmony_ci 762306a36Sopenharmony_ciThe VXLAN protocol is a tunnelling protocol designed to solve the 862306a36Sopenharmony_ciproblem of limited VLAN IDs (4096) in IEEE 802.1q. With VXLAN the 962306a36Sopenharmony_cisize of the identifier is expanded to 24 bits (16777216). 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ciVXLAN is described by IETF RFC 7348, and has been implemented by a 1262306a36Sopenharmony_cinumber of vendors. The protocol runs over UDP using a single 1362306a36Sopenharmony_cidestination port. This document describes the Linux kernel tunnel 1462306a36Sopenharmony_cidevice, there is also a separate implementation of VXLAN for 1562306a36Sopenharmony_ciOpenvswitch. 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ciUnlike most tunnels, a VXLAN is a 1 to N network, not just point to 1862306a36Sopenharmony_cipoint. A VXLAN device can learn the IP address of the other endpoint 1962306a36Sopenharmony_cieither dynamically in a manner similar to a learning bridge, or make 2062306a36Sopenharmony_ciuse of statically-configured forwarding entries. 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ciThe management of vxlan is done in a manner similar to its two closest 2362306a36Sopenharmony_cineighbors GRE and VLAN. Configuring VXLAN requires the version of 2462306a36Sopenharmony_ciiproute2 that matches the kernel release where VXLAN was first merged 2562306a36Sopenharmony_ciupstream. 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci1. Create vxlan device:: 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci # ip link add vxlan0 type vxlan id 42 group 239.1.1.1 dev eth1 dstport 4789 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ciThis creates a new device named vxlan0. The device uses the multicast 3262306a36Sopenharmony_cigroup 239.1.1.1 over eth1 to handle traffic for which there is no 3362306a36Sopenharmony_cientry in the forwarding table. The destination port number is set to 3462306a36Sopenharmony_cithe IANA-assigned value of 4789. The Linux implementation of VXLAN 3562306a36Sopenharmony_cipre-dates the IANA's selection of a standard destination port number 3662306a36Sopenharmony_ciand uses the Linux-selected value by default to maintain backwards 3762306a36Sopenharmony_cicompatibility. 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci2. Delete vxlan device:: 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci # ip link delete vxlan0 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci3. Show vxlan info:: 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci # ip -d link show vxlan0 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ciIt is possible to create, destroy and display the vxlan 4862306a36Sopenharmony_ciforwarding table using the new bridge command. 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci1. Create forwarding table entry:: 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci # bridge fdb add to 00:17:42:8a:b4:05 dst 192.19.0.2 dev vxlan0 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci2. Delete forwarding table entry:: 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci # bridge fdb delete 00:17:42:8a:b4:05 dev vxlan0 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci3. Show forwarding table:: 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci # bridge fdb show dev vxlan0 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ciThe following NIC features may indicate support for UDP tunnel-related 6362306a36Sopenharmony_cioffloads (most commonly VXLAN features, but support for a particular 6462306a36Sopenharmony_ciencapsulation protocol is NIC specific): 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci - `tx-udp_tnl-segmentation` 6762306a36Sopenharmony_ci - `tx-udp_tnl-csum-segmentation` 6862306a36Sopenharmony_ci ability to perform TCP segmentation offload of UDP encapsulated frames 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci - `rx-udp_tunnel-port-offload` 7162306a36Sopenharmony_ci receive side parsing of UDP encapsulated frames which allows NICs to 7262306a36Sopenharmony_ci perform protocol-aware offloads, like checksum validation offload of 7362306a36Sopenharmony_ci inner frames (only needed by NICs without protocol-agnostic offloads) 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ciFor devices supporting `rx-udp_tunnel-port-offload` the list of currently 7662306a36Sopenharmony_cioffloaded ports can be interrogated with `ethtool`:: 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci $ ethtool --show-tunnels eth0 7962306a36Sopenharmony_ci Tunnel information for eth0: 8062306a36Sopenharmony_ci UDP port table 0: 8162306a36Sopenharmony_ci Size: 4 8262306a36Sopenharmony_ci Types: vxlan 8362306a36Sopenharmony_ci No entries 8462306a36Sopenharmony_ci UDP port table 1: 8562306a36Sopenharmony_ci Size: 4 8662306a36Sopenharmony_ci Types: geneve, vxlan-gpe 8762306a36Sopenharmony_ci Entries (1): 8862306a36Sopenharmony_ci port 1230, vxlan-gpe 89