1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0 2*4882a593Smuzhiyun 3*4882a593Smuzhiyun====================================================== 4*4882a593SmuzhiyunVirtual eXtensible Local Area Networking documentation 5*4882a593Smuzhiyun====================================================== 6*4882a593Smuzhiyun 7*4882a593SmuzhiyunThe VXLAN protocol is a tunnelling protocol designed to solve the 8*4882a593Smuzhiyunproblem of limited VLAN IDs (4096) in IEEE 802.1q. With VXLAN the 9*4882a593Smuzhiyunsize of the identifier is expanded to 24 bits (16777216). 10*4882a593Smuzhiyun 11*4882a593SmuzhiyunVXLAN is described by IETF RFC 7348, and has been implemented by a 12*4882a593Smuzhiyunnumber of vendors. The protocol runs over UDP using a single 13*4882a593Smuzhiyundestination port. This document describes the Linux kernel tunnel 14*4882a593Smuzhiyundevice, there is also a separate implementation of VXLAN for 15*4882a593SmuzhiyunOpenvswitch. 16*4882a593Smuzhiyun 17*4882a593SmuzhiyunUnlike most tunnels, a VXLAN is a 1 to N network, not just point to 18*4882a593Smuzhiyunpoint. A VXLAN device can learn the IP address of the other endpoint 19*4882a593Smuzhiyuneither dynamically in a manner similar to a learning bridge, or make 20*4882a593Smuzhiyunuse of statically-configured forwarding entries. 21*4882a593Smuzhiyun 22*4882a593SmuzhiyunThe management of vxlan is done in a manner similar to its two closest 23*4882a593Smuzhiyunneighbors GRE and VLAN. Configuring VXLAN requires the version of 24*4882a593Smuzhiyuniproute2 that matches the kernel release where VXLAN was first merged 25*4882a593Smuzhiyunupstream. 26*4882a593Smuzhiyun 27*4882a593Smuzhiyun1. Create vxlan device:: 28*4882a593Smuzhiyun 29*4882a593Smuzhiyun # ip link add vxlan0 type vxlan id 42 group 239.1.1.1 dev eth1 dstport 4789 30*4882a593Smuzhiyun 31*4882a593SmuzhiyunThis creates a new device named vxlan0. The device uses the multicast 32*4882a593Smuzhiyungroup 239.1.1.1 over eth1 to handle traffic for which there is no 33*4882a593Smuzhiyunentry in the forwarding table. The destination port number is set to 34*4882a593Smuzhiyunthe IANA-assigned value of 4789. The Linux implementation of VXLAN 35*4882a593Smuzhiyunpre-dates the IANA's selection of a standard destination port number 36*4882a593Smuzhiyunand uses the Linux-selected value by default to maintain backwards 37*4882a593Smuzhiyuncompatibility. 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun2. Delete vxlan device:: 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun # ip link delete vxlan0 42*4882a593Smuzhiyun 43*4882a593Smuzhiyun3. Show vxlan info:: 44*4882a593Smuzhiyun 45*4882a593Smuzhiyun # ip -d link show vxlan0 46*4882a593Smuzhiyun 47*4882a593SmuzhiyunIt is possible to create, destroy and display the vxlan 48*4882a593Smuzhiyunforwarding table using the new bridge command. 49*4882a593Smuzhiyun 50*4882a593Smuzhiyun1. Create forwarding table entry:: 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun # bridge fdb add to 00:17:42:8a:b4:05 dst 192.19.0.2 dev vxlan0 53*4882a593Smuzhiyun 54*4882a593Smuzhiyun2. Delete forwarding table entry:: 55*4882a593Smuzhiyun 56*4882a593Smuzhiyun # bridge fdb delete 00:17:42:8a:b4:05 dev vxlan0 57*4882a593Smuzhiyun 58*4882a593Smuzhiyun3. Show forwarding table:: 59*4882a593Smuzhiyun 60*4882a593Smuzhiyun # bridge fdb show dev vxlan0 61*4882a593Smuzhiyun 62*4882a593SmuzhiyunThe following NIC features may indicate support for UDP tunnel-related 63*4882a593Smuzhiyunoffloads (most commonly VXLAN features, but support for a particular 64*4882a593Smuzhiyunencapsulation protocol is NIC specific): 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun - `tx-udp_tnl-segmentation` 67*4882a593Smuzhiyun - `tx-udp_tnl-csum-segmentation` 68*4882a593Smuzhiyun ability to perform TCP segmentation offload of UDP encapsulated frames 69*4882a593Smuzhiyun 70*4882a593Smuzhiyun - `rx-udp_tunnel-port-offload` 71*4882a593Smuzhiyun receive side parsing of UDP encapsulated frames which allows NICs to 72*4882a593Smuzhiyun perform protocol-aware offloads, like checksum validation offload of 73*4882a593Smuzhiyun inner frames (only needed by NICs without protocol-agnostic offloads) 74*4882a593Smuzhiyun 75*4882a593SmuzhiyunFor devices supporting `rx-udp_tunnel-port-offload` the list of currently 76*4882a593Smuzhiyunoffloaded ports can be interrogated with `ethtool`:: 77*4882a593Smuzhiyun 78*4882a593Smuzhiyun $ ethtool --show-tunnels eth0 79*4882a593Smuzhiyun Tunnel information for eth0: 80*4882a593Smuzhiyun UDP port table 0: 81*4882a593Smuzhiyun Size: 4 82*4882a593Smuzhiyun Types: vxlan 83*4882a593Smuzhiyun No entries 84*4882a593Smuzhiyun UDP port table 1: 85*4882a593Smuzhiyun Size: 4 86*4882a593Smuzhiyun Types: geneve, vxlan-gpe 87*4882a593Smuzhiyun Entries (1): 88*4882a593Smuzhiyun port 1230, vxlan-gpe 89