650) this.width=650; "Src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20161106-1478393048220020745.jpg "/>
In the previous section we introduced the VXLAN package format as well as the VTEP.
Today we will discuss the process of VXLAN encapsulation and forwarding packages, as well as the native support of Linux to VXLAN.
VXLAN Packet Forwarding process
VXLAN a tunnel between VTEP and transmits the encapsulated Layer 2 data through a Layer 3 network.
The following example shows how the data is transmitted on the VXLAN:
650) this.width=650; "Src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20161106-1478392784308097415.png "/>
The Host-a and Host-b are located in the VXLAN of VNI 10, which communicates through VTEP-1 tunnels established between VTEP-2 and VXLAN.
The data transfer process is as follows:
When Host-a sends data to Host-b, Host-b's Mac and IP act as the source Mac and IP of the packet, and then send the data through the VTEP-1 as the destination Mac and Ip,host-a Mac of the packet.
VTEP-1 find the mac-b corresponding VTEP-2 from the mapping table that they maintain, then perform VXLAN encapsulation, plus VXLAN header, UDP header, and outer IP and MAC headers. At this point the outer IP header, the destination address is VTEP-2 IP, the source address is VTEP-1 IP. At the same time, because the next hop is Router-1, the target address in the outer MAC header is Router-1 Mac.
After the packets are sent out of the VTEP-1, the routers of the external network are routed according to the outer IP header and finally to the router Router-2 connected to the VTEP-2.
Router-2 sends the data packets to VTEP-2. VTEP-2 is responsible for unpacking the packets, removing the outer MAC header, the outer IP header, the UDP header, and the VXLAN header in turn.
VTEP-2 data packets to host-b based on the destination MAC address.
The above process we see VTEP is the most core component of VXLAN, responsible for the encapsulation and decryption of data. The tunnel is also built between VTEP, and VTEP is responsible for the transmission of the data.
Linux Support for VXLAN
VTEP can be implemented by proprietary hardware or by using pure software. The more mature VTEP software implementations currently include:
Linux with VXLAN kernel module
Open VSwitch
Let's start by looking at how Linux supports the Vxlan,open vSwitch approach, which is discussed later in this chapter.
650) this.width=650; "Src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20161106-1478392973783000572.jpg "/>
Implementation method:
Linux Vxlan creates a UDP Socket, which is monitored by default on port 8472.
After the Linux Vxlan receives the Vxlan packet on the UDP socket, it will unpack and then transfer it to a Vxlan interface based on the Vxlan ID, and then to the VM via the Linux bridge it is connected to.
After receiving the packets from the virtual machine, the Linux Vxlan is encapsulated as a multicast UDP packet and sent from the NIC.
Here, I believe you have a general understanding of the principle of VXLAN. In the next section we will learn how to configure and implement VXLAN in Neutron.
650) this.width=650; "Src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20161106-1478392975717028696.jpg "alt=" Blob.png "/>
VXLAN concept (part II)-5 minutes a day to play with OpenStack (109)