VXLAN packet transmission method, network device, and system
This application discloses a VXLAN packet transmission method, a network device, and a system. After receiving a first packet, a first network device obtains a VNI corresponding to the first packet. The first network device encapsulates the VNI in an IPV6 header by encapsulating the IPV6 header in the first packet, to obtain a second packet. The first network device sends the second packet to a second network device, so that the second network device forwards the packet based on the VNI included in the IPV6 header. In this application, the IPV6 header is used to carry the VNI, and no additional UDP header needs to be encapsulated to carry the VNI.
1 . A method, comprising:
obtaining, by a first network device, a first packet;
obtaining, by the first network device, a virtual extensible local area network identifier (VNI) based on the first packet;
encapsulating, by the first network device, an internet protocol version 6 (IPv6) header in the first packet to obtain a second packet, wherein the IPV6 header carries the VNI; and
sending, by the first network device, the second packet to a second network device.
2 . The method according to claim 1 , wherein the IPV6 header is an IPV6 basic header.
3 . The method according to claim 2 , wherein the VNI is carried in a destination address field of the IPV6 basic header.
4 . The method according to claim 3 , wherein the 65th bit to the 128th bit in the destination address field carry the VNI.
5 . The method according to claim 3 , wherein the destination address field comprises a virtual extensible local area network (VXLAN) header, and the VXLAN header carries the VNI.
6 . The method according to claim 5 , wherein the 65th bit to the 128th bit in the destination address field carry the VXLAN header.
7 . The method according to claim 3 , wherein a destination address in the destination address field indicates to the second network device to forward the packet based on the VNI carried in the destination address field.
8 . The method according to claim 1 , wherein the IPV6 header further comprises virtual extensible local area network (VXLAN) flags, and the VXLAN flags comprise a flag indicating that the second packet carries a valid VNI.
9 . The method according to claim 1 , wherein obtaining, by the first network device, the VNI based on the first packet comprises:
obtaining, by the first network device, the VNI based on an interface on which the first packet is received, wherein the VNI corresponds to the interface on which the first packet is received.
10 . A method, comprising:
receiving, by a second network device, a second packet from a first network device, wherein the second packet is encapsulated with an internet protocol version 6 (IPv6) header, and the IPV6 header carries a virtual extensible local area network identifier (VNI);
obtaining, by the second network device, the VNI from the IPV6 header;
decapsulating, by the second network device, the second packet to obtain a first packet, wherein the first packet does not comprise the IPV6 header; and
forwarding, by the second network device, the first packet based on the VNI.
11 . The method according to claim 10 , wherein the IPV6 header is an IPV6 extension header, and the IPV6 extension header comprises a destination option header (DOH) or a segment routing header (SRH).
12 . The method according to claim 11 , wherein the DOH comprises a type-length-value (TLV), and a type field of the TLV indicates that the DOH carries the VNI.
13 . The method according to claim 12 , wherein the DOH comprises a virtual extensible local area network (VXLAN) header, and the VXLAN header carries the VNI.
14 . The method according to claim 13 , wherein the VNI is carried in a segment identifier list (SID list) of the SRH.
15 . The method according to claim 14 , wherein a type of a segment identifier (SID) of the second network device is a virtual network endpoint (END.VN) type.
16 . A network device comprising:
at least one processor; and
one or more memories;
wherein the one or more memories store instructions or program code; and
wherein the at least processor is configured to execute the instructions or the program code in the one or more memories, to enable the network device to:
obtain a first packet;
obtain a virtual extensible local area network identifier (VNI) based on the first packet, and encapsulate an internet protocol version 6 (IPv6) header in the first packet to obtain a second packet, wherein the IPV6 header carries the VNI; and
send the second packet to a second network device.
17 . The network device according to claim 16 , wherein the IPV6 header is an IPV6 basic header, and the VNI is carried in a destination address field of the IPV6 basic header.
18 . The network device according to claim 17 , wherein the destination address field comprises a virtual extensible local area network (VXLAN) header, and the VXLAN header carries the VNI.
19 . A network device comprising:
at least one processor; and
one or more memories;
wherein the one or more memories store instructions or program code; and
wherein the at least processor is configured to execute the instructions or the program code in the one or more memories, to enable the network device to:
receive a second packet from a first network device, wherein the second packet is encapsulated with an internet protocol version 6 (IPv6) header, and the IPV6 header carries a virtual extensible local area network identifier (VNI);
obtain the VNI from the IPV6 header, and decapsulate the second packet to obtain a first packet, wherein the first packet does not comprise the IPV6 header; and
forward the first packet based on the VNI.
20 . The network device according to claim 19 , wherein the IPV6 header is an IPV6 extension header, and the IPV6 extension header comprises a destination option header DOH or a segment routing header (SRH).