CN112422713B - IP address obtaining method and VTEP node - Google Patents

IP address obtaining method and VTEP node Download PDF

Info

Publication number
CN112422713B
CN112422713B CN202011291191.3A CN202011291191A CN112422713B CN 112422713 B CN112422713 B CN 112422713B CN 202011291191 A CN202011291191 A CN 202011291191A CN 112422713 B CN112422713 B CN 112422713B
Authority
CN
China
Prior art keywords
dhcp
mac address
vtep
virtual machine
message
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011291191.3A
Other languages
Chinese (zh)
Other versions
CN112422713A (en
Inventor
张余
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China United Network Communications Group Co Ltd
Original Assignee
China United Network Communications Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China United Network Communications Group Co Ltd filed Critical China United Network Communications Group Co Ltd
Priority to CN202011291191.3A priority Critical patent/CN112422713B/en
Publication of CN112422713A publication Critical patent/CN112422713A/en
Application granted granted Critical
Publication of CN112422713B publication Critical patent/CN112422713B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • H04L61/5014Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/46Interconnection of networks
    • H04L12/4641Virtual LANs, VLANs, e.g. virtual private networks [VPN]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5038Address allocation for local use, e.g. in LAN or USB networks, or in a controller area network [CAN]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5046Resolving address allocation conflicts; Testing of addresses

Abstract

The invention discloses an IP address acquisition method, which is applied to VTEP nodes which are MP-BGP peers mutually and is characterized by comprising the following steps: when a DHCP offer message which is sent by a DHCP server through a router and carries an IP address and a first MAC address is received, the first MAC address carried in the DHCP offer message is obtained, wherein the IP address is distributed by the DHCP server based on a DHCP discover message sent by a virtual machine connected with a VTEP node in an MP-BGP peer; if the first MAC address is not inquired in the local MAC address table, acquiring the routing hop count from other VTEP nodes which are MP-BGP peers with the local VTEP node; and modifying the TTL value in the DHCP offer message according to the routing hop count, and forwarding the modified DHCP offer message to other VTEP nodes in the MP-BGP peer so that the VTEP node connected with the virtual machine forwards the DHCP offer message to the virtual machine. The method can ensure that the virtual machine can successfully acquire the IP address from the DHCP server when the router sends the DHCP offer message to other VTEP nodes. The invention also discloses a VTEP node.

Description

IP address obtaining method and VTEP node
Technical Field
The invention relates to the technical field of virtual extended local area networks, in particular to an IP address acquisition method and a VTEP node.
Background
In a VXLAN (Virtual eXtensible LAN) Network, in a networking scenario of an Ethernet Virtual Private Network (EVPN), leaf nodes (leaf)1 and leaf2 are distributed gateways, spine nodes (spine) are triple-layer gateways, two connections are made between leaf1, leaf2 and spine, and a connection between leaf1 and leaf2 is a Border Gateway Protocol (BGP) neighbor connection. spine is connected to a Dynamic Host Configuration Protocol (DHCP) server, and leaf1 or leaf2 hangs up a client, and leaf1 or leaf2 can be used as a DHCP relay. Taking leaf1 as an example, when a client hanging under leaf1 applies for an Internet Protocol (IP) address, it may send a DHCP Discover message to leaf1, and then leaf1 forwards the DHCP Discover message to spine as a DHCP relay, however, the source address of the DHCP Discover message forwarded by leaf1 is the interface address of the interface where leaf1 is connected to the client, so when a subsequent DHCP server sends a reply message, the interface address will be used as the destination address. However, Interface addresses of the same Virtual Switch Interface (VSI) on the leaf1 and the leaf2 are the same, which may cause the packet that should be forwarded to the leaf1 to be forwarded to the leaf2, and cause the client hanging below the leaf1 to be unable to apply for the IP address.
Disclosure of Invention
Therefore, the invention provides an IP address acquisition method and a VTEP node, so as to solve the problem that in the prior art, because the interface addresses of the same virtual switch interfaces on the leaf1 and the leaf2 are the same, a client hung under the leaf1 cannot apply for an IP address.
In order to achieve the above object, a first aspect of the present invention provides an IP address obtaining method, which is applied to VTEP nodes that are virtual extensible local area network tunnel terminations of backward compatible MP-BGP peers, and includes:
when receiving a DHCP offer message which is sent by a dynamic host configuration protocol DHCP server through a router and carries an IP address and a first physical MAC address, acquiring the carried first MAC address, wherein the IP address is distributed by the DHCP server based on a DHCP discovery discover message sent by a virtual machine connected with a VTEP node in the MP-BGP peer;
if the first MAC address is not inquired in the local MAC address table, acquiring the routing hop count from other VTEP nodes which are MP-BGP peers with the local VTEP node;
and modifying the TTL value in the DHCP offer message according to the routing hop count, and forwarding the modified DHCP offer message to other VTEP nodes in the MP-BGP peer so that the VTEP node connected with the virtual machine forwards the DHCP offer message to the virtual machine.
In some embodiments, the method further comprises:
when a DHCP acknowledgement ack message sent by a DHCP server through a router is received, a second MAC address carried in the DHCP acknowledgement ack message is obtained, wherein the DHCP ack message is generated by the DHCP server based on a DHCP request message sent by a virtual machine connected with a VTEP node in the MP-BGP peer;
and if the second MAC address is not inquired in a local MAC address table, modifying the TTL value in the DHCP ack message according to the routing hop count, and forwarding the modified DHCP ack message to other VTEP nodes so that the VTEP node connected with the virtual machine forwards the DHCP ack message to the virtual machine.
In some embodiments, the method further comprises:
when receiving DHCP offer messages sent by other VTEP nodes which are MP-BGP peers with the VTEP node, acquiring a third MAC address carried in the DHCP offer messages;
if the third MAC address is found in the local MAC address table, modifying the TTL value in the DHCP offer packet according to the number of route hops to the virtual machine corresponding to the third MAC address, and forwarding the modified DHCP offer packet to the virtual machine corresponding to the third MAC address;
and if the third MAC address is not inquired in the local MAC address table and the TTL value in the DHCP offer message is 0, discarding the DHCP offer message.
In some embodiments, the method further comprises:
when receiving DHCP ack messages sent by other VTEP nodes which are MP-BGP peers with the VTEP node, acquiring a fourth MAC address carried in the DHCP ack messages;
if the fourth MAC address is inquired in a local MAC address table, modifying the TTL value in the DHCP ack message according to the routing hop count of the virtual machine corresponding to the fourth MAC address, and forwarding the modified DHCP ack message to the virtual machine corresponding to the fourth MAC address;
and if the fourth MAC address is not inquired in the local MAC address table and the TTL value in the DHCP ack message is 0, discarding the DHCP ack message.
In some embodiments, the method further comprises:
receiving a DHCP discover message sent by a virtual machine connected with the VTEP node, and acquiring an MAC address carried in the DHCP discover message;
and storing the MAC address into a local MAC address table.
In order to achieve the above object, a second aspect of the present invention provides a VTEP node, comprising:
the system comprises a receiving module, a sending module and a sending module, wherein the receiving module is used for receiving a DHCP offer message which is sent by a Dynamic Host Configuration Protocol (DHCP) server through a router and carries an IP address and a first physical MAC address, and the IP address is allocated by the DHCP server based on a DHCP discovery discover message sent by a virtual machine connected with a VTEP node in an MP-BGP peer;
an obtaining module, configured to obtain a first MAC address carried in the DHCP offer message, and obtain a routing hop count to another VTEP node that is an MP-BGP peer with the local VTEP node if the first MAC address is not queried in a local MAC address table by the querying module;
the query module is used for querying the first MAC address in a local MAC address table;
and the forwarding module is configured to modify the TTL value in the DHCP offer packet according to the routing hop count, and forward the modified DHCP offer packet to other VTEP nodes in the MP-BGP peer, so that the VTEP node connected to the virtual machine forwards the DHCP offer packet to the virtual machine.
In some embodiments, the receiving module is further configured to receive a DHCP acknowledge ack message sent by the DHCP server through the router;
the obtaining module is further configured to obtain a second MAC address carried in the DHCP ack packet, where the DHCP ack packet is generated by the DHCP server based on a DHCP request packet sent by a virtual machine connected to a VTEP node in the MP-BGP peer;
the query module is further configured to query the second MAC address in a local MAC address table;
the forwarding module is further configured to, if the second MAC address is not queried in a local MAC address table by the querying module, modify a TTL value in the DHCP ack packet according to the routing hop count, and forward the modified DHCP ack packet to the other VTEP nodes, so that the VTEP node connected to the virtual machine forwards the DHCP ack packet to the virtual machine.
In some embodiments, the receiving module is further configured to receive a DHCP offer message sent by another VTEP node that is an MP-BGP peer with the VTEP node;
the obtaining module is further configured to obtain a third MAC address carried in the DHCP offer message;
the query module is further configured to query the third MAC address in a local MAC address table;
the forwarding module is further configured to, if the query module queries the third MAC address in a local MAC address table, modify a TTL value in the DHCP offer message according to a routing hop count to a virtual machine corresponding to the third MAC address, and forward the modified DHCP offer message to the virtual machine corresponding to the third MAC address; and the processing module is configured to discard the DHCP offer message if the third MAC address is not queried in the local MAC address table by the querying module and the TTL value in the DHCP offer message is 0.
In some embodiments, the receiving module is further configured to receive a DHCP ack packet sent by another VTEP node that is an MP-BGP peer with the VTEP node;
the acquisition module is further configured to acquire a fourth MAC address carried in the DHCP ack packet;
the query module is further configured to query the fourth MAC address in a local MAC address table
The forwarding module is further configured to, if the query module queries the fourth MAC address in a local MAC address table, modify a TTL value in the DHCP ack packet according to a routing hop count to the virtual machine corresponding to the fourth MAC address, and forward the modified DHCP ack packet to the virtual machine corresponding to the fourth MAC address; and the query module is used for discarding the DHCP ack message if the fourth MAC address is not queried in a local MAC address table and the TTL value in the DHCP ack message is 0.
In some embodiments, the receiving module is further configured to receive a DHCP discover message sent by a virtual machine connected to the VTEP node;
the acquisition module is further configured to acquire an MAC address carried in the DHCP discover message;
the VTEP node further comprises a storage module, wherein the storage module is used for storing the MAC address into a local MAC address table.
The invention has the following advantages:
according to the method for acquiring the IP address provided by the embodiment of the invention, when the router sends the DHCP discover message to other VTEP nodes which are MP-BGP peers with the VTEP node sending the corresponding DHCP discover message, the VTEP node receiving the DHCP discover message can acquire the routing hop count from other VTEP nodes in the MP-BGP peers, modifies the TTL value in the DHCP discover message according to the routing hop count, and forwards the modified DHCP discover message to other VTEP nodes in the MP-BGP peers, so that the VTEP node connected with the virtual machine sending the corresponding DHCP discover message forwards the DHCP discover message to the virtual machine, thereby ensuring that the virtual machine can successfully acquire the IP address from the DHCP server.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the principles of the invention and not to limit the invention.
Fig. 1 is a first flowchart of an IP address obtaining method according to embodiment 1 of the present invention;
fig. 2 is a schematic flowchart of a second method for acquiring an IP address according to embodiment 2 of the present invention;
fig. 3 is a schematic flowchart of a process when a VTEP node receives a DHCP offer packet forwarded by another VTEP node according to embodiment 3 of the present invention;
fig. 4 is a schematic flowchart of a process when a VTEP node receives a DHCP ack packet forwarded by another VTEP node according to embodiment 4 of the present invention;
fig. 5 is a schematic flowchart of a VTEP node storing a virtual machine MAC address according to embodiment 5 of the present invention;
fig. 6 is a schematic flowchart of a specific IP address obtaining method according to embodiment 6 of the present invention;
fig. 7 is a schematic structural diagram of a VTEP node according to embodiment 7 of the present invention.
Detailed Description
The following detailed description of embodiments of the invention refers to the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the present invention, are given by way of illustration and explanation only, not limitation.
An embodiment of the present invention provides an IP address obtaining method, which is applied to VTEP (VXLAN Tunnel End Point, VXLAN Tunnel termination) nodes that are backward compatible MP-BGP peers, and as shown in fig. 1, the method may include the following steps:
step 11, when receiving a DHCP offer message which is sent by the DHCP server through the router and carries the IP address and the first physical MAC address, obtaining the first MAC address carried therein.
The IP address is allocated by the DHCP server based on a DHCP discovery discover message sent by a virtual machine connected with a VTEP node in the MP-BGP peer.
In an embodiment of the invention, the router is connected to a DHCP server, and the virtual machine is connected to one VTEP node of a plurality of VTEP nodes which are MP-BGP peers with each other.
After the virtual machine is started, a DHCP discover message is sent to a VTEP node connected with the virtual machine, the VTEP node starts a DHCP relay function, the DHCP discover message is forwarded to a router, and the DHCP discover message is forwarded to a DHCP server by the router. The virtual machine sends a DHCP discover message to be used for acquiring an IP address from a DHCP server, and the DHCP server returns a DHCP offer message to the virtual machine sequentially through the router and the VTEP node after receiving the DHCP discover message. The DHCP discover message carries an MAC address of the virtual machine, and the DHCP offer message carries the MAC address and an IP address allocated by the DHCP server for the virtual machine, and when the VTEP node receives the DHCP offer message forwarded by the router, the first MAC address carried therein needs to be acquired.
And step 12, if the first MAC address is not inquired in the local MAC address table, acquiring the routing hop count from other VTEP nodes which are MP-BGP peers with the VTEP node.
When receiving the DHCP offer message returned by the DHCP server, the router forwards the DHCP offer message to the downlink interface IP address, but a plurality of VTEP nodes that are MP-BGP peers are distributed gateways and have the same downlink interface IP address, so that a situation may occur in which the router sends the DHCP offer message to other VTEP nodes that are MP-BGP peers with respect to the VTEP node that sends the DHCP offer message.
After the virtual machine sends a DHCP discover message to the VTEP node, the VTEP node stores a correspondence relationship between the MAC address of the virtual machine, a VNI (VXLAN Network Identifier ) and a message entry interface (i.e., a physical interface corresponding to the two-layer subinterface) carried in the DHCP discover message in a local MAC address table. Therefore, when the VTEP node receiving the DHCP offer message does not inquire the first MAC address in the local MAC address table, it indicates that the virtual machine corresponding to the first MAC address is not a virtual machine connected to the VTEP node, and a situation occurs in which the router sends the DHCP offer message to another VTEP node that is an MP-BGP peer with the VTEP node sending the DHCP discover message. At this time, the VTEP node receiving the DHCP offer message may send a traceroute message to other VTEP nodes that are MP-BGP peers with the VTEP node to obtain the route hop count.
For example, VTEP1, VTEP2, and VTEP3 are MP-BGP peers with each other, VM1 is a virtual machine connected to VTEP1, R1 is connected to VTEP1, VTEP2, VTEP3, and a DHCP server, VM1 sends a DHCP discover message to VTEP1, VTEP1 forwards the DHCP discover message to R1, R1 forwards the DHCP discover message to the DHCP server, the DHCP server expects to return a DHCP offer message to VM1, and first sends a DHCP offer message to R1, but since VTEP1, VTEP2, and VTEP3 have the same downlink interface IP address, R1 may send the DHCP offer message to VTEP2 (or VTEP3) instead of VTEP 1. When VTEP2 (or VTEP3) receives the DHCP offer message sent by R1 but the MAC address carried in the message does not exist in the local MAC address table, VTEP2 (or VTEP3) may obtain the number of routing hops from VTEP1 and VTEP3 (or VTEP1 and VTEP 2).
And step 13, modifying a TTL (Time To Live) value in the DHCP offer message according To the routing hop count, and forwarding the modified DHCP offer message To other VTEP nodes in the MP-BGP peer, so that the VTEP node connected To the virtual machine forwards the DHCP offer message To the virtual machine.
After obtaining the routing hop count from other VTEP nodes which are MP-BGP peers with the VTEP node, the VTEP node may modify the TTL value in the DHCP offer message so that the DHCP offer message may survive to reach other VTEP nodes, and forward the modified DHCP offer message to other VTEP nodes. Since the VTEP nodes connected to the virtual machine must be included in the other VTEP nodes which are MP-BGP peers with the VTEP node, after the VTEP node forwards the modified DHCP offer message to the other VTEP nodes, the VTEP node connected to the virtual machine must send the DHCP offer message to the virtual machine, so that the virtual machine can successfully obtain the IP address from the DHCP server.
Still taking the above-mentioned cases of VTEP1, VTEP2, and VTEP3 as examples, after VTEP2 obtains the routing hop counts from VTEP1 and VTEP3, the TTL value in the DHCP offer message may be modified according to the routing hop counts, and the modified DHCP offer message is forwarded to VTEP1 and VTEP3, because VTEP1 is a VTEP node connected to VM1, VTEP1 may certainly send the DHCP offer message to the virtual machine, and the virtual machine may also successfully obtain the IP address.
As can be seen from the foregoing steps 11-13, according to the IP address obtaining method provided in the embodiment of the present invention, when a router sends a DHCP offer packet to other VTEP nodes that are MP-BGP peers with respect to the VTEP node that sends the corresponding DHCP discover packet, the VTEP node that receives the DHCP offer packet may obtain a routing hop count from other VTEP nodes in the MP-BGP peers, modify a TTL value in the DHCP offer packet according to the routing hop count, and forward the modified DHCP offer packet to other VTEP nodes in the MP-BGP peers, so that the VTEP node connected to the virtual machine that sends the corresponding DHCP discover packet forwards the offer packet to the virtual machine, thereby ensuring that the virtual machine can successfully obtain an IP address from a DHCP server.
In some embodiments, the IP address obtaining method provided in the embodiments of the present invention, as shown in fig. 2, may further include the following steps:
and step 21, when receiving a DHCP acknowledge ack message sent by the DHCP server through the router, acquiring the second MAC address carried therein.
The DHCP ack message is generated by the DHCP server based on a DHCP request message sent by a virtual machine connected with a VTEP node in the MP-BGP peer.
Since the virtual machine sends DHCP discover messages to the DHCP servers to request to obtain IP addresses, the virtual machine may receive many DHCP offer messages, which all carry IP addresses allocated by the DHCP servers to the virtual machine. The virtual machine must select a DHCP server sending a DHCP offer message as a target server of the virtual machine, send a DHCP request message to the DHCP server, request to use an IP address allocated by the DHCP server, expect to return a DHCP ack message to the virtual machine after the DHCP server receives the DHCP request message, firstly send the DHCP ack message to the router, and the router forwards the DHCP ack message to the VTEP node. And when the VTEP node receives a DHCP ack message sent by the DHCP server through the router, the VTEP node needs to acquire the second MAC address carried in the DHCP ack message.
And step 22, if the second MAC address is not inquired in the local MAC address table, modifying the TTL value in the DHCP ack message according to the routing hop count, and forwarding the modified DHCP ack message to other VTEP nodes so that the VTEP nodes connected with the virtual machine forward the DHCP ack message to the virtual machine.
When receiving a DHCP ack message returned by the DHCP server, the router forwards the DHCP ack message to the downlink interface IP address, but a plurality of VTEP nodes that are MP-BGP peers are distributed gateways and have the same downlink interface IP address, so that a situation may occur in which the router sends the DHCP ack message to other VTEP nodes that are MP-BGP peers with respect to the VTEP node that sends the DHCP request message.
When the VTEP node receiving the DHCP ack message does not inquire the second MAC address in the local MAC address table, it indicates that the virtual machine corresponding to the second MAC address is not a virtual machine connected to the VTEP node, and a situation occurs where the router sends the DHCP ack message to other VTEP nodes that are MP-BGP peers with the VTEP node sending the DHCP request message. At this time, the VTEP node receiving the DHCP ack packet may directly modify the TTL value in the DHCP ack packet so that the DHCP ack packet may survive to reach other VTEP nodes, and forward the modified DHCP ack packet to other VTEP nodes. Since the other VTEP nodes which are MP-BGP peers with the VTEP node necessarily include the VTEP node connected to the virtual machine, after the VTEP node forwards the modified DHCP ack packet to the other VTEP nodes, the VTEP node connected to the virtual machine may necessarily send the DHCP ack packet to the virtual machine, and thus the virtual machine can successfully use the selected IP address.
Through the steps 21 to 22, according to the IP address obtaining method provided in the embodiment of the present invention, when the router sends the DHCP ack packet to other VTEP nodes that are MP-BGP peers with respect to the VTEP node that sends the corresponding DHCP request packet, the VTEP node that receives the DHCP ack packet may modify the TTL value in the DHCP ack packet according to the routing hop count, and forward the modified DHCP ack packet to other VTEP nodes in the MP-BGP peers, so that the VTEP node connected to the virtual machine that sends the corresponding DHCP request packet forwards the DHCP ack packet to the virtual machine, thereby ensuring that the virtual machine can successfully use the IP address allocated by the selected DHCP server.
In some embodiments, the IP address obtaining method provided in the embodiments of the present invention, as shown in fig. 3, may further include the following steps:
and step 31, when receiving the DHCP offer message sent by other VTEP nodes which are MP-BGP peers with the VTEP node, acquiring the third MAC address carried therein.
When the VTEP node receives DHCP offer messages sent by other VTEP nodes in the MP-BGP peer, it indicates that the router sends the DHCP offer messages to other VTEP nodes that are MP-BGP peers with the VTEP node that sends the corresponding DHCP discover message, and the other VTEP nodes that send the DHCP offer messages to the VTEP node are not the VTEP node that sends the corresponding DHCP discover message to the router, but the VTEP node may be the VTEP node that sends the corresponding DHCP discover message to the router, and first needs to obtain the third MAC address carried therein.
Step 32, if the third MAC address is found in the local MAC address table, modify the TTL value in the DHCP offer packet according to the number of routing hops to the virtual machine corresponding to the third MAC address, and forward the modified DHCP offer packet to the virtual machine corresponding to the third MAC address.
When the VTEP node queries the third MAC address in the local MAC address table, it is described that the virtual machine corresponding to the third MAC address is a virtual machine connected to the VTEP node, that is, the VTEP node is a VTEP node that sends a corresponding DHCP discover packet to the router, and at this time, the VTEP node may directly modify the TTL value in the DHCP offer packet according to the number of route hops to the virtual machine corresponding to the third MAC address, so that the DHCP offer packet may survive until reaching the virtual machine, and forward the modified DHCP offer packet to the virtual machine, so that the virtual machine may successfully obtain the IP address from the DHCP offer packet.
And step 33, if the third MAC address is not found in the local MAC address table and the TTL value in the DHCP offer message is 0, discarding the DHCP offer message.
The VTEP node receives DHCP offer messages sent by other VTEP nodes which are MP-BGP peers with the VTEP node, and the VTEP node is proved not to be the VTEP node which sends corresponding DHCP discover messages to the router, does not inquire a third MAC address in a local MAC address table by the VTEP node, and is proved not to be the VTEP node which sends corresponding DHCP discover messages to the router, wherein the TTL value in the DHCP offer messages is 0. However, since the VTEP node sending the DHCP offer packet to the VTEP node forwards the DHCP offer packet to all other VTEP nodes in the MP-BGP peer, there must be other VTEP nodes capable of querying the third MAC address in the local MAC address table, and at this time, the VTEP node may directly discard the DHCP discover packet.
In some embodiments, as shown in fig. 4, the IP address obtaining method provided in the embodiments of the present invention may further include the following steps:
and step 41, when receiving the DHCP ack message sent by other VTEP nodes which are MP-BGP peers with the VTEP node, acquiring the fourth MAC address carried therein.
When the VTEP node receives the DHCP ack packet sent by other VTEP nodes in the MP-BGP peer, it indicates that the router sends the DHCP ack packet to other VTEP nodes that are MP-BGP peers with the VTEP node sending the corresponding DHCP request packet, and the other VTEP nodes sending the DHCP ack packet to the VTEP node are not the VTEP nodes sending the corresponding DHCP request packet to the router, but the VTEP node may be the VTEP node sending the corresponding DHCP request packet to the router, and first needs to obtain the fourth MAC address carried therein.
Step 42, if the fourth MAC address is found in the local MAC address table, modifying the TTL value in the DHCP ack packet according to the routing hop count to the virtual machine corresponding to the fourth MAC address, and forwarding the modified DHCP ack packet to the virtual machine corresponding to the fourth MAC address.
When the VTEP node queries the fourth MAC address in the local MAC address table, it is described that the virtual machine corresponding to the fourth MAC address is a virtual machine connected to the VTEP node, that is, the VTEP node is a VTEP node that sends a corresponding DHCP request packet to the router, and at this time, the VTEP node may directly modify the TTL value in the DHCP ack packet according to the routing hop count of the virtual machine corresponding to the fourth MAC address, so that the DHCP ack packet may survive until reaching the virtual machine, and forward the modified DHCP ack packet to the virtual machine, so that the virtual machine may successfully use the IP address allocated by the selected DHCP server.
And step 43, if the fourth MAC address is not found in the local MAC address table and the TTL value in the DHCP ack message is 0, discarding the DHCP ack message.
The VTEP node receives DHCP ack messages sent by other VTEP nodes which are MP-BGP peers with the VTEP node, and the VTEP nodes are proved not to send corresponding DHCP request messages to the router, the VTEP node does not inquire a fourth MAC address in a local MAC address table, the TTL value in the DHCP ack messages is 0, and the VTEP node is proved not to send corresponding DHCP request messages to the router. However, since the VTEP node sending the DHCP ack packet to the VTEP node forwards the DHCP ack packet to all other VTEP nodes in the MP-BGP peer, there must be other VTEP nodes capable of querying the fourth MAC address in the local MAC address table, and at this time, the VTEP node may directly discard the DHCP ack packet.
In some embodiments, as shown in fig. 5, the IP address obtaining method provided in the embodiments of the present invention may further include the following steps:
and step 51, receiving a DHCP discover message sent by a virtual machine connected to the VTEP node, and acquiring an MAC address carried therein.
Step 52, store the MAC address in the local MAC address table.
After the virtual machine connected to the VTEP node is started up, the virtual machine sends a DHCP discover message carrying the MAC address of the virtual machine to the VTEP node, so that the VTEP node and the router request the DHCP server to obtain the IP address, and at this time, the VTEP node may store the MAC address of the virtual machine carried in the DHCP discover message. Specifically, the VTEP node may store the correspondence between the MAC address of the virtual machine, the VNI, and the packet ingress interface (i.e., the physical interface corresponding to the two-layer subinterface) carried in the DHCP discover packet in the local MAC address table.
The following briefly describes an IP address acquisition method provided by the present invention with reference to a specific embodiment.
VTEP1, VTEP2 and VTEP3 are distributed gateways, establish a peer between VTEP1, VTEP2 and VTEP3 through MP-BGP, establish a VXLAN tunnel, and the IP addresses of the downlink interfaces of VTEP1, VTEP2 and VTEP3 are the same. VM1 is linked up to VTEP1, R1 is a router in VXLAN, R1 is connected to DHCP server. As shown in fig. 6, the IP address obtaining method provided in this embodiment may include the following steps:
and step 61, after the VM1 is started, sending a DHCP discover message to the VTEP 1.
Step 62, the VTEP1 stores the correspondence between the MAC address of the VM1, the VNI, and the packet input interface (i.e., the physical interface corresponding to the two-layer subinterface) carried in the DHCP discover packet in the local MAC table.
Step 63, VTEP1 starts the DHCP relay function, and forwards the DHCP discover message to R1.
And step 64, the R1 forwards the DHCP discover message to the DHCP server.
Step 65, the DHCP server allocates an IP address to the VM1 based on the DHCP discover message, and sends a DHCP offer message carrying the MAC address and the IP address of the VM1 to the R1.
In step 66, R1 sends a DHCP offer message to VTEP 2.
The source address of the DHCP discover message received by R1 is the downlink interface IP address of VTEP1, and VTEP1, VTEP2 and VTEP3 are distributed gateways, and the downlink interface IP addresses are the same, so R1 may send the DHCP offer message to VTEP 2.
In step 67, the VTEP2 obtains the MAC address carried in the DHCP offer message, and does not query the MAC address in the local MAC address table.
VTEP2 sends a traceroute message to VTEP1 and VTEP3 to obtain the route hop count, step 68.
Step 69, the VTEP2 modifies the TTL value in the DHCP offer message according to the routing hop count, and sends the modified DHCP offer message to the VTEP1 and VTEP 3.
Step 70, the VTEP3 obtains the MAC address carried in the DHCP offer message, does not query the MAC address in the local MAC address table, determines that the TTL value in the DHCP offer message is 0, and discards the message.
Step 71, the VTEP1 obtains the MAC address carried in the DHCP offer message, and queries the MAC address in the local MAC address table.
Step 72, the VTEP1 modifies the TTL value in the DHCP offer message to a normal value, and sends the modified DHCP offer message to the VM 1.
In step 73, the VM1 sends a DHCP request message to the VTEP1 after obtaining the IP address from the DHCP offer message.
Step 74, VTEP1 forwards the DHCP request message to R1.
In step 75, R1 sends the DHCP request message to the DHCP server.
Step 76, the DHCP server sends a DHCP ack message to R1.
In step 77, R1 sends a DHCP ack message to VTEP 2.
The source address of the DHCP request message received by R1 is the downlink interface IP address of VTEP1, and VTEP1, VTEP2 and VTEP3 are distributed gateways, and the downlink interface IP addresses are the same, so R1 may send the DHCP ack message to VTEP 2.
Step 78, VTEP2 obtains the MAC address carried in the DHCP ack packet, and does not query the MAC address in the local MAC address table.
And step 79, the VTEP2 modifies the TTL value in the DHCP ack message according to the routing hop count, and sends the modified DHCP ack message to the VTEP1 and the VTEP 3.
Step 80, the VTEP3 obtains the MAC address carried in the DHCP ack packet, does not query the MAC address in the local MAC address table, determines that the TTL value in the DHCP ack packet is 0, and discards the packet.
Step 81, VTEP1 obtains the MAC address carried in the DHCP ack packet, and queries the MAC address in the local MAC address table.
And step 82, modifying the TTL value in the DHCP ack message into a normal value, and sending the modified DHCP ack message to the VM 1.
Based on the same technical concept, an embodiment of the present invention further provides a VTEP node, as shown in fig. 7, which may include:
the receiving module 101 is configured to receive a DHCP offer message that is sent by a dynamic host configuration protocol DHCP server through a router and carries an IP address and a first physical MAC address, where the IP address is allocated by the DHCP server based on a DHCP discovery discover message sent by a virtual machine connected to a VTEP node in an MP-BGP peer.
An obtaining module 102, configured to obtain the first MAC address carried in the DHCP offer packet, and obtain a routing hop count from another VTEP node that is an MP-BGP peer with the local VTEP node if the first MAC address is not queried in the local MAC address table by the querying module.
A query module 103, configured to query the first MAC address in a local MAC address table.
A forwarding module 104, configured to modify the TTL value in the DHCP offer packet according to the routing hop count, and forward the modified DHCP offer packet to other VTEP nodes in the MP-BGP peer, so that a VTEP node connected to the virtual machine forwards the DHCP offer packet to the virtual machine.
In some embodiments, the receiving module 101 is further configured to receive a DHCP ack message sent by the DHCP server through the router.
The obtaining module 102 is further configured to obtain a second MAC address carried in a DHCP ack message, where the DHCP ack message is generated by the DHCP server based on a DHCP request message sent by a virtual machine connected to a VTEP node in the MP-BGP peer.
The querying module 103 is further configured to query the second MAC address in a local MAC address table.
The forwarding module 104 is further configured to, if the query module does not query the second MAC address in the local MAC address table, modify the TTL value in the DHCP ack packet according to the routing hop count, and forward the modified DHCP ack packet to another VTEP node, so that the VTEP node connected to the virtual machine forwards the DHCP ack packet to the virtual machine.
In some embodiments, the receiving module 101 is further configured to receive a DHCP offer message sent by another VTEP node that is an MP-BGP peer with the VTEP node.
The obtaining module 102 is further configured to obtain a third MAC address carried in the DHCP offer message.
The lookup module 103 is further configured to lookup the third MAC address in the local MAC address table.
The forwarding module 104 is further configured to, if the query module queries the third MAC address in the local MAC address table, modify the TTL value in the DHCP offer message according to the routing hop count to the virtual machine corresponding to the third MAC address, and forward the modified DHCP offer message to the virtual machine corresponding to the third MAC address; and the processing module is used for discarding the DHCP offer message if the query module does not query the third MAC address in the local MAC address table and the TTL value in the DHCP offer message is 0.
In some embodiments, the receiving module 101 is further configured to receive DHCP ack messages sent by other VTEP nodes that are MP-BGP peers with the VTEP node.
The obtaining module 102 is further configured to obtain a fourth MAC address carried in the DHCP ack message.
The query module 103 is further configured to query the fourth MAC address in the local MAC address table.
The forwarding module 104 is further configured to, if the query module queries a fourth MAC address in the local MAC address table, modify a TTL value in the DHCP ack packet according to a routing hop count to the virtual machine corresponding to the fourth MAC address, and forward the modified DHCP ack packet to the virtual machine corresponding to the fourth MAC address; and the DHCP ack message is discarded if the query module does not query the fourth MAC address in the local MAC address table and the TTL value in the DHCP ack message is 0.
In some embodiments, the receiving module 101 is further configured to receive a DHCP discover message sent by a virtual machine connected to the VTEP node.
The obtaining module 102 is further configured to obtain a MAC address carried in the DHCP discover message.
The VTEP node may further include a storage module to store the MAC address in a local MAC address table.
It will be understood that the above embodiments are merely exemplary embodiments taken to illustrate the principles of the present invention, which is not limited thereto. It will be apparent to those skilled in the art that various modifications and improvements can be made without departing from the spirit and substance of the invention, and these modifications and improvements are also considered to be within the scope of the invention.

Claims (10)

1. An IP address obtaining method is applied to virtual extended local area network (VTEP) nodes which are mutually backward compatible MP-BGP peers, and is characterized by comprising the following steps:
when receiving a DHCP offer message which is sent by a dynamic host configuration protocol DHCP server through a router and carries an IP address and a first physical MAC address, acquiring the carried first MAC address, wherein the IP address is distributed by the DHCP server based on a DHCP discovery discover message sent by a virtual machine connected with a VTEP node in the MP-BGP peer;
if the first MAC address is not inquired in the local MAC address table, acquiring the routing hop count from other VTEP nodes which are MP-BGP peers with the local VTEP node;
and modifying the TTL value in the DHCP offer message according to the routing hop count, and forwarding the modified DHCP offer message to other VTEP nodes in the MP-BGP peer so that the VTEP node connected with the virtual machine forwards the DHCP offer message to the virtual machine.
2. The method of claim 1, further comprising:
when a DHCP acknowledgement ack message sent by a DHCP server through a router is received, a second MAC address carried in the DHCP acknowledgement ack message is obtained, wherein the DHCP ack message is generated by the DHCP server based on a DHCP request message sent by a virtual machine connected with a VTEP node in the MP-BGP peer;
and if the second MAC address is not inquired in a local MAC address table, modifying a TTL value in the DHCP ack message according to the routing hop count, and forwarding the modified DHCP ack message to other VTEP nodes so that the VTEP node connected with the virtual machine forwards the DHCP ack message to the virtual machine.
3. The method of claim 1, further comprising:
when receiving DHCP offer messages sent by other VTEP nodes which are MP-BGP peers with the VTEP node, acquiring a third MAC address carried in the DHCP offer messages;
if the third MAC address is found in the local MAC address table, modifying the TTL value in the DHCP offer packet according to the number of route hops to the virtual machine corresponding to the third MAC address, and forwarding the modified DHCP offer packet to the virtual machine corresponding to the third MAC address;
and if the third MAC address is not inquired in the local MAC address table and the TTL value in the DHCP offer message is 0, discarding the DHCP offer message.
4. The method of claim 1, further comprising:
when receiving DHCP ack messages sent by other VTEP nodes which are MP-BGP peers with the VTEP node, acquiring a fourth MAC address carried in the DHCP ack messages;
if the fourth MAC address is inquired in a local MAC address table, modifying the TTL value in the DHCP ack message according to the routing hop count of the virtual machine corresponding to the fourth MAC address, and forwarding the modified DHCP ack message to the virtual machine corresponding to the fourth MAC address;
and if the fourth MAC address is not inquired in the local MAC address table and the TTL value in the DHCP ack message is 0, discarding the DHCP ack message.
5. The method of claim 1, further comprising:
receiving a DHCP discover message sent by a virtual machine connected with the VTEP node, and acquiring an MAC address carried in the DHCP discover message;
and storing the MAC address into a local MAC address table.
6. A VTEP node, comprising:
the system comprises a receiving module, a sending module and a sending module, wherein the receiving module is used for receiving an offer message provided by a Dynamic Host Configuration Protocol (DHCP) server which is sent by a router and carries an IP address and a first physical MAC address, and the IP address is allocated by the DHCP server based on a DHCP discovery di scover message sent by a virtual machine connected with a virtual machine in an MP-BGP peer;
an obtaining module, configured to obtain a first MAC address carried in the DHCP offer message, and obtain a routing hop count to another VTEP node that is an MP-BGP peer with the local VTEP node if the first MAC address is not queried in a local MAC address table by the querying module;
the query module is used for querying the first MAC address in a local MAC address table;
and the forwarding module is configured to modify the TTL value in the DHCP offer packet according to the routing hop count, and forward the modified DHCP offer packet to other VTEP nodes in the MP-BGP peer, so that the VTEP node connected to the virtual machine forwards the DHCP offer packet to the virtual machine.
7. The VTEP node according to claim 6, wherein the receiving module is further configured to receive a DHCP acknowledge ack message sent by the DHCP server through the router;
the obtaining module is further configured to obtain a second MAC address carried in the DHCP ack packet, where the DHCP ack packet is generated by the DHCP server based on a DHCP request packet sent by a virtual machine connected to a VTEP node in the MP-BGP peer;
the query module is further configured to query the second MAC address in a local MAC address table;
the forwarding module is further configured to, if the second MAC address is not queried in a local MAC address table by the querying module, modify a TTL value in the DHCP ack packet according to the routing hop count, and forward the modified DHCP ack packet to the other VTEP nodes, so that the VTEP node connected to the virtual machine forwards the DHCP ack packet to the virtual machine.
8. The VTEP node according to claim 6, wherein the receiving module is further configured to receive a DHCP offer message sent by another VTEP node that is an MP-BGP peer with the VTEP node;
the acquisition module is further configured to acquire a third MAC address carried in the DHCP offer message;
the query module is further configured to query the third MAC address in a local MAC address table;
the forwarding module is further configured to, if the query module queries the third MAC address in a local MAC address table, modify a TTL value in the DHCP offer message according to a routing hop count to a virtual machine corresponding to the third MAC address, and forward the modified DHCP offer message to the virtual machine corresponding to the third MAC address; and the processing module is configured to discard the DHCP offer message if the third MAC address is not queried in the local MAC address table by the querying module and the TTL value in the DHCP offer message is 0.
9. The VTEP node according to claim 6, wherein the receiving module is further configured to receive a DHCP ack packet sent by other VTEP nodes that are MP-BGP peers with the VTEP node;
the acquisition module is further configured to acquire a fourth MAC address carried in the DHCP ack packet;
the query module is further configured to query the fourth MAC address in a local MAC address table
The forwarding module is further configured to, if the query module queries the fourth MAC address in a local MAC address table, modify a TTL value in the DHCP ack packet according to a routing hop count to the virtual machine corresponding to the fourth MAC address, and forward the modified DHCP ack packet to the virtual machine corresponding to the fourth MAC address; and the module is used for discarding the DHCP ack message if the query module does not query the fourth MAC address in a local MAC address table and the TTL value in the DHCP ack message is 0.
10. The VTEP node according to claim 6, wherein the receiving module is further configured to receive a DHCP di scover packet sent by a virtual machine connected to the VTEP node;
the acquisition module is further configured to acquire an MAC address carried in the DHCP discover message;
the VTEP node further comprises a storage module, wherein the storage module is used for storing the MAC address into a local MAC address table.
CN202011291191.3A 2020-11-18 2020-11-18 IP address obtaining method and VTEP node Active CN112422713B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011291191.3A CN112422713B (en) 2020-11-18 2020-11-18 IP address obtaining method and VTEP node

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011291191.3A CN112422713B (en) 2020-11-18 2020-11-18 IP address obtaining method and VTEP node

Publications (2)

Publication Number Publication Date
CN112422713A CN112422713A (en) 2021-02-26
CN112422713B true CN112422713B (en) 2022-08-26

Family

ID=74831649

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011291191.3A Active CN112422713B (en) 2020-11-18 2020-11-18 IP address obtaining method and VTEP node

Country Status (1)

Country Link
CN (1) CN112422713B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113438333B (en) * 2021-06-07 2022-12-20 中国联合网络通信集团有限公司 Network address allocation method, device and equipment
CN117459453A (en) * 2022-07-19 2024-01-26 中兴通讯股份有限公司 Data transmission method, operator edge device, and computer readable medium
CN115348238A (en) * 2022-08-16 2022-11-15 中国联合网络通信集团有限公司 DHCP relay method, VTEP gateway, electronic device and medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105763671A (en) * 2016-04-27 2016-07-13 杭州华三通信技术有限公司 IP address distribution method and apparatus
CN106209643A (en) * 2016-07-14 2016-12-07 杭州华三通信技术有限公司 Message forwarding method and device
CN106612211A (en) * 2015-10-23 2017-05-03 华为技术有限公司 A rout detecting method, a controller and a network device in a VxLAN
EP3264681A1 (en) * 2016-06-30 2018-01-03 Thomson Licensing Method and device for processing, at a network equipment, a processing request from a terminal
CN109495369A (en) * 2018-12-27 2019-03-19 新华三技术有限公司 A kind of message forwarding method and device
CN110768905A (en) * 2019-10-25 2020-02-07 新华三信息安全技术有限公司 Route tracking method and equipment
CN111628921A (en) * 2019-02-27 2020-09-04 华为技术有限公司 Message processing method, message forwarding device and message processing device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106612211A (en) * 2015-10-23 2017-05-03 华为技术有限公司 A rout detecting method, a controller and a network device in a VxLAN
CN105763671A (en) * 2016-04-27 2016-07-13 杭州华三通信技术有限公司 IP address distribution method and apparatus
EP3264681A1 (en) * 2016-06-30 2018-01-03 Thomson Licensing Method and device for processing, at a network equipment, a processing request from a terminal
CN106209643A (en) * 2016-07-14 2016-12-07 杭州华三通信技术有限公司 Message forwarding method and device
CN109495369A (en) * 2018-12-27 2019-03-19 新华三技术有限公司 A kind of message forwarding method and device
CN111628921A (en) * 2019-02-27 2020-09-04 华为技术有限公司 Message processing method, message forwarding device and message processing device
CN110768905A (en) * 2019-10-25 2020-02-07 新华三信息安全技术有限公司 Route tracking method and equipment

Also Published As

Publication number Publication date
CN112422713A (en) 2021-02-26

Similar Documents

Publication Publication Date Title
CN112422713B (en) IP address obtaining method and VTEP node
CN108476160B (en) switch interconnect based on layered overlay tunneling
JP3678348B2 (en) Zero configuration networking
US7467214B2 (en) Invoking protocol translation in a multicast network
EP2274897B1 (en) Technique for address resolution in a data transmission network
US6895443B2 (en) Method and system for facilitating communication between nodes on different segments of a network
EP2375643B1 (en) Communication device having VPN accomodation function
US20020196802A1 (en) Data forwarding method and apparatus
EP2456130A1 (en) System for network deployment and method for mapping and data forwarding thereof
CN107094110B (en) DHCP message forwarding method and device
JP2003087336A (en) Address conversion method
EP2493117A1 (en) Method, apparatus and system for duplicate address detection proxy
CN108429680B (en) Route configuration method, system, medium and equipment based on virtual private cloud
WO2010139194A1 (en) Method and device of host with ipv4 application for performing communication
TW200924462A (en) System and method for connection of hosts behind NATs
EP2894819B1 (en) Message sending method, routing bridge and system
WO2022068436A1 (en) Service processing method and related device
WO2023125239A1 (en) Flood attack defense method and related device
US20080240132A1 (en) Teredo connectivity between clients behind symmetric NATs
US20180167231A1 (en) Managing multiple virtual network memberships
US10637825B2 (en) Router and method for connecting an IPv4 network and an IPv6 network
CN109218459B (en) Apparatus and method for converting between internet protocols
JP5818272B2 (en) Home gateway apparatus and packet transfer method
US20050201372A1 (en) Systems and methods for virtual broadcast subnetworks
WO2010066144A1 (en) Method, device and multi-address space mobile network for sending and forwarding data

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant