CN113286011A - IP address allocation method and device based on VXLAN - Google Patents
IP address allocation method and device based on VXLAN Download PDFInfo
- Publication number
- CN113286011A CN113286011A CN202110459492.0A CN202110459492A CN113286011A CN 113286011 A CN113286011 A CN 113286011A CN 202110459492 A CN202110459492 A CN 202110459492A CN 113286011 A CN113286011 A CN 113286011A
- Authority
- CN
- China
- Prior art keywords
- dhcp
- request message
- address
- vxlan tunnel
- dhcp request
- 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.)
- Granted
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/50—Address allocation
- H04L61/5007—Internet protocol [IP] addresses
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/50—Address allocation
- H04L61/5007—Internet protocol [IP] addresses
- H04L61/5014—Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L2101/00—Indexing scheme associated with group H04L61/00
- H04L2101/60—Types of network addresses
- H04L2101/618—Details of network addresses
- H04L2101/622—Layer-2 addresses, e.g. medium access control [MAC] addresses
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/50—Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses an IP address allocation method and device based on VXLAN, the method comprises: after receiving a first DHCP request message broadcasted by each connected terminal, learning a source MAC address of the first DHCP request message in a first Media Access Control (MAC) address table; if the DHCP request message forwarding function of the connected first VXLAN tunnel is determined to be in a closed state, forwarding the first DHCP request message to a connected first DHCP server, so that the first DHCP server allocates a first IP address according to a first local IP address library after receiving the first DHCP request message, and returns a first DHCP response message carrying the first IP address; and after receiving the first DHCP response message, forwarding the first DHCP response message based on the first MAC address table. The proposal can reduce the number of DHCP request messages forwarded by the VXLAN tunnel and reduce the message forwarding burden of the VXLAN tunnel.
Description
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a Virtual eXtensible Local Area Network (VXLAN) based Internet Protocol (IP) address allocation method and apparatus.
Background
VXLAN is an Overlay network technology established over an IP network, and is encapsulated by using a Media Access Control (MAC) in User Datagram Protocol (UDP) method, that is, a general ethernet packet is encapsulated in a UDP packet, and the general ethernet packet is transmitted as UDP data.
A virtual extensible local area network Tunnel End Point (VTEP) is an edge device of a VXLAN, is connected to a physical network, and is allocated with an IP address of the physical network, where the address is used for encapsulation and decapsulation of a VXLAN packet, and a VXLAN Tunnel is established on the IP network between two VTEPs, and these tunnels implement a transmission service for the VXLAN packet to traverse the IP network. Each VTEP may be connected to at least one terminal (e.g., a server, etc.) and a Dynamic Host Configuration Protocol (DHCP) server, and an IP address of the terminal is assigned by the DHCP server.
As shown in fig. 1, which is a schematic diagram of connection between two VTEPs, terminals PC1 and PC2 are located in the same vlan and are connected to VTEP1 and VTEP2, respectively, DHCP SERVER1 and DHCP SERVER2 may be active and standby DHCP servers and are connected to VTEP1 and VTEP2, respectively, VXLAN Tunnel is VXLAN Tunnel between VTEP1 and VTEP2, when PC1 and PC2 need to acquire an IP address, will broadcast the DHCP request message, after VTEP1 and VTEP2 receive the DHCP request message and learn the source MAC address of the DHCP request message in the MAC address table, broadcasting DHCP request message to the VXLAN tunnel and connected DHCP server, after DHCP SERVER1 and DHCP SERVER2 receive DHCP request message, it will negotiate with opposite end according to its own role and then allocate IP address from address pool, then sending DHCP response message to the connected VTEP, after receiving the DHCP response message, and forwarding the DHCP response message based on the MAC address table, so that the received terminal can acquire the IP address through the DHCP response message.
In the above IP address assignment method based on VXLAN, if there are a large number of terminals that need to assign IP addresses, a large number of DHCP request messages are broadcasted through VXLAN tunnels, and the message forwarding burden of VXLAN tunnels is increased.
Disclosure of Invention
The embodiment of the invention provides an IP address allocation method and device based on VXLAN, which are used for solving the problem that the message forwarding burden of a VXLAN tunnel is increased in the prior art.
According to the embodiment of the invention, an IP address allocation method based on VXLAN is provided, which is applied to the virtual extensible local area network tunnel terminals VTEP at two ends of each VXLAN tunnel of VXLAN, and the VXLAN also comprises a dynamic host configuration protocol DHCP server connected with the VTEP at two ends of each VXLAN tunnel, and the method comprises the following steps:
after receiving a first DHCP request message broadcasted by each connected terminal, learning a source MAC address of the first DHCP request message in a first Media Access Control (MAC) address table;
if the DHCP request message forwarding function of the connected first VXLAN tunnel is determined to be in a closed state, forwarding the first DHCP request message to a connected first DHCP server, so that the first DHCP server allocates a first IP address according to a first local IP address library after receiving the first DHCP request message, and returns a first DHCP response message carrying the first IP address;
and after receiving the first DHCP response message, forwarding the first DHCP response message based on the first MAC address table.
Optionally, the method further includes:
after receiving an Ethernet virtual private network EVPN message which is sent by a VTEP connected with the opposite end of the first VXLAN tunnel and carries a second IP address and a first MAC address through the first VXLAN tunnel, sending a synchronization request message which carries the second IP address and the first MAC address to the first DHCP server, so that the first DHCP server saves the first IP address and the first MAC address in the first local IP address base after receiving the synchronization request message and returns a corresponding synchronization response message;
if the synchronous response message is received within a set time length and the DHCP request message forwarding function of the first VXLAN tunnel is in an open state, the DHCP request message forwarding function of the first VXLAN tunnel is changed into a closed state; and if the synchronous response message is not received within the set time length and the DHCP request message forwarding function of the first VXLAN tunnel is in a closed state, changing the DHCP request message forwarding function of the first VXLAN tunnel into an open state.
Optionally, the method further includes:
receiving a second DHCP request message through the first VXLAN tunnel, and after learning a source MAC address of the second DHCP request message in the first MAC address table, forwarding the second DHCP request message to the first DHCP server, so that the first DHCP server receives the second DHCP request message, allocates a second IP address according to the first local IP address library, and returns a second DHCP response message carrying the second IP address;
and after receiving the second DHCP response message, forwarding the second DHCP response message based on the first MAC address table.
Optionally, the method further includes:
if the DHCP request message forwarding function of the first VXLAN tunnel is determined to be in an open state, forwarding the first DHCP request message through the first VXLAN tunnel so that a VTEP connected to the opposite end of the first VXLAN tunnel learns the source MAC address of the first DHCP request message in a second MAC address table and forwards the first DHCP request message to a second DHCP server connected to the first VXLAN tunnel, the second DHCP server receives the first DHCP request message, allocates a third IP address according to a second local IP address base, returns a third DHCP response message carrying the third IP address, and the VTEP connected to the opposite end of the first VXLAN tunnel forwards the third DHCP response message according to the second MAC address table;
and after receiving the third DHCP response message through the first VXLAN tunnel, forwarding the third DHCP response message according to the first MAC address table.
Optionally, the method further includes:
if the DHCP request message forwarding function of the first VXLAN tunnel is determined to be in an open state, trying to establish communication connection with the first DHCP server;
and if the communication connection with the first DHCP server is successfully established, changing the DHCP request message forwarding function of the first VXLAN tunnel into a closed state.
According to an embodiment of the present invention, there is further provided a VXLAN-based IP address assignment device, applied to VTEPs at both ends of each VXLAN tunnel of VXLAN, where the VXLAN further includes a dynamic DHCP server for VTEP connection at both ends of each VXLAN tunnel, including:
the learning module is used for learning a source MAC address of a first DHCP request message in a first Media Access Control (MAC) address table after receiving the first DHCP request message broadcast by each connected terminal;
the receiving and sending module is used for forwarding the first DHCP request message to a connected first DHCP server if the DHCP request message forwarding function of the connected first VXLAN tunnel is determined to be in a closed state, so that the first DHCP server allocates a first IP address according to a first local IP address library after receiving the first DHCP request message and returns a first DHCP response message carrying the first IP address; and after receiving the first DHCP response message, forwarding the first DHCP response message based on the first MAC address table.
Optionally, the system further comprises a modification module, wherein:
the forwarding module is further configured to send a synchronization request message carrying a second IP address and a first MAC address to the first DHCP server after receiving an ethernet virtual private network EVPN message carrying the second IP address and the first MAC address sent by a VTEP connected to an opposite end of the first VXLAN tunnel through the first VXLAN tunnel, so that the first DHCP server stores the first IP address and the first MAC address in the first local IP address repository after receiving the synchronization request message, and returns a corresponding synchronization response message;
the modification module is used for modifying the DHCP request message forwarding function of the first VXLAN tunnel into a closed state if the synchronous response message is received within a set time length and the DHCP request message forwarding function of the first VXLAN tunnel is in an open state; and if the synchronous response message is not received within the set time length and the DHCP request message forwarding function of the first VXLAN tunnel is in a closed state, changing the DHCP request message forwarding function of the first VXLAN tunnel into an open state.
Optionally, the learning module is further configured to learn, in the first MAC address table, a source MAC address of a second DHCP request message when the second DHCP request message is received through the first VXLAN tunnel;
the transceiver module is further configured to forward the second DHCP request message to the first DHCP server, so that the first DHCP server allocates a second IP address according to the first local IP address library after receiving the second DHCP request message, and returns a second DHCP response message carrying the second IP address; and after receiving the second DHCP response message, forwarding the second DHCP response message based on the first MAC address table.
Optionally, the transceiver module is further configured to:
if the DHCP request message forwarding function of the first VXLAN tunnel is determined to be in an open state, forwarding the first DHCP request message through the first VXLAN tunnel so that a VTEP connected to the opposite end of the first VXLAN tunnel learns the source MAC address of the first DHCP request message in a second MAC address table and forwards the first DHCP request message to a second DHCP server connected to the first VXLAN tunnel, the second DHCP server receives the first DHCP request message, allocates a third IP address according to a second local IP address base, returns a third DHCP response message carrying the third IP address, and the VTEP connected to the opposite end of the first VXLAN tunnel forwards the third DHCP response message according to the second MAC address table;
and after receiving the third DHCP response message through the first VXLAN tunnel, forwarding the third DHCP response message according to the first MAC address table.
Optionally, the method further includes an establishing module, wherein:
the establishing module is configured to attempt to establish a communication connection with the first DHCP server if it is determined that the DHCP request message forwarding function of the first VXLAN tunnel is in an open state;
the changing module is further configured to change a DHCP request message forwarding function of the first VXLAN tunnel to a closed state if the communication connection with the first DHCP server is successfully established.
According to the embodiment of the invention, the electronic equipment comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
a processor for implementing the above method steps when executing the program stored in the memory.
According to an embodiment of the present invention, there is also provided a computer-readable storage medium having stored therein a computer program, which when executed by a processor, performs the above-mentioned method steps.
The invention has the following beneficial effects:
the embodiment of the invention provides an IP address allocation method and device based on VXLAN, which learns the source MAC address of a first DHCP request message in a first media access control MAC address table after receiving the first DHCP request message broadcasted by each connected terminal; if the DHCP request message forwarding function of the connected first VXLAN tunnel is determined to be in a closed state, forwarding the first DHCP request message to a connected first DHCP server, so that the first DHCP server allocates a first IP address according to a first local IP address library after receiving the first DHCP request message, and returns a first DHCP response message carrying the first IP address; and after receiving the first DHCP response message, forwarding the first DHCP response message based on the first MAC address table. In the scheme, after receiving the first DHCP request message broadcasted by each connected terminal, if it is determined that the DHCP request message forwarding function of the connected first VXLAN tunnel is in an off state, that is, after it is determined that the first DHCP server is available, the first DHCP request message is forwarded to the connected first DHCP server, and the first DHCP request message is not forwarded through the first VXLAN tunnel, so that the number of the VXLAN tunnel forwarding DHCP request messages can be reduced, and the message forwarding burden of the VXLAN tunnel is reduced.
Drawings
FIG. 1 is a schematic diagram of two prior art VTEP connections;
fig. 2 is a flowchart of an IP address assignment method based on VXLAN in an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an IP address assignment device based on VXLAN in an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device shown in the present application.
Detailed Description
For the problem of increased message forwarding burden of a VXLAN tunnel in the prior art, an embodiment of the present invention provides a VXLAN-based IP address assignment method, which is applied to VTEPs at both ends of each VXLAN tunnel of a VXLAN, where the VXLAN further includes a DHCP server connected to the VTEPs at both ends of each VXLAN tunnel, and a flow of the method is shown in fig. 2, and the method includes the following steps:
s21: after receiving a first DHCP request message broadcasted by each connected terminal, learning a source MAC address of the first DHCP request message in a first MAC address table.
When a terminal connected with the VTEP needs to acquire an IP address, a DHCP request message is broadcasted, and the DHCP request messages may be defined as a first DHCP request message. After receiving the first DHCP request message, the VTEP needs to learn the source MAC address of the first DHCP request message in its own MAC address table, and the own MAC address table may be defined as the first MAC table.
S22: and if the DHCP request message forwarding function of the connected first VXLAN tunnel is determined to be in a closed state, forwarding the first DHCP request message to the connected first DHCP server, so that the first DHCP server allocates a first IP address according to the first local IP address library after receiving the first DHCP request message, and returns a first DHCP response message carrying the first IP address.
The VXLAN tunnel connected by the VTEP may be defined as a first VXLAN tunnel, the first VXLAN tunnel may be configured with a DHCP request message forwarding function, the DHCP request message forwarding function may be implemented by, but not limited to, configuring a forwarding entry of the first VXLAN tunnel, the DHCP request message forwarding function may be in an on state or an off state, when the DHCP request message forwarding function is in the on state, the DHCP request message may be forwarded through the first VXLAN tunnel, and when the DHCP request message forwarding function is in the off state, forwarding of the DHCP request message through the first VXLAN tunnel is stopped, therefore, if the VTEP determines that the DHCP request message forwarding function of the first VXLAN tunnel connected is in the off state, the VTEP forwards the first DHCP request message to the first DHCP server connected without forwarding the first DHCP request message through the first VXLAN tunnel.
The DHCP server connected to the VTEP may be defined as a first DHCP server, and after receiving the first DHCP request message, the first DHCP server allocates a first IP address according to the first local IP address repository, and returns a first DHCP response message carrying the first IP address, where the first DHCP server does not have a primary/standby relationship with a DHCP server (which may be defined as a second DHCP server) connected to the VTEP at the other end of the first VXLAN tunnel, and therefore, the first IP address may be allocated based on the local IP address repository (which may be defined as the first local IP address repository), and then the DHCP response message carrying the first IP address (which may be defined as the first DHCP response message) is returned to the connected VTEP.
S23: and after receiving the first DHCP response message, forwarding the first DHCP response message based on the first MAC address table.
After receiving the first DHCP response message, the VTEP forwards the first DHCP response message based on the first MAC address table, that is, unicasts the first DHCP response message, so that the terminal sending the first DHCP request message can obtain the first IP address from the first DHCP response message.
In the scheme, after receiving the first DHCP request message broadcasted by each connected terminal, if it is determined that the DHCP request message forwarding function of the connected first VXLAN tunnel is in an off state, that is, after it is determined that the first DHCP server is available, the first DHCP request message is forwarded to the connected first DHCP server, and the first DHCP request message is not forwarded through the first VXLAN tunnel, so that the number of the VXLAN tunnel forwarding DHCP request messages can be reduced, and the message forwarding burden of the VXLAN tunnel is reduced.
Optionally, the method further includes:
after receiving an Ethernet Virtual Private Network (EVPN) message which is sent by a VTEP connected with the opposite end of a first VXLAN tunnel and carries a second IP address and a first MAC address through the first VXLAN tunnel, sending a synchronization request message which carries the second IP address and the first MAC address to a first DHCP server, so that the first DHCP server stores the first IP address and the first MAC address in a first local IP address base after receiving the synchronization request message and returns a corresponding synchronization response message;
if the synchronous response message is received within the set time length and the DHCP request message forwarding function of the first VXLAN tunnel is in an open state, the DHCP request message forwarding function of the first VXLAN tunnel is changed into a closed state; and if the synchronous response message is not received within the set time length and the DHCP request message forwarding function of the first VXLAN tunnel is in a closed state, changing the DHCP request message forwarding function of the first VXLAN tunnel into an open state.
EVPN is a VPN technology for two-layer network interconnection, and VXLAN introduces EVPN as a control plane, and functions such as VTEP automatic discovery, host information mutual notification and the like are realized by exchanging Border Gateway Protocol (BGP) EVPN routes between VTEPs, thereby avoiding unnecessary data traffic flooding.
The VTEP receives an EVPN message sent by the VTEP connected with the opposite end of the first VXLAN tunnel through the first VXLAN tunnel, the EVPN message can carry an IP Address and a Media Access Control (MAC) Address, the IP Address can be defined as a second IP Address, the MAC Address can be defined as a first MAC Address, the VTEP can send a synchronization request message carrying the second IP Address and the first MAC Address to the first DHCP server, and the first DHCP server stores the first IP Address and the first MAC Address in a first local IP Address base after receiving the synchronization request message, so that the first local IP Address base is updated, IP Address conflict is avoided when IP addresses are subsequently distributed, and a corresponding synchronization response message is returned.
The VTEP can monitor whether a synchronous response message is received within a set time length, if the synchronous response message is received within the set time length and the DHCP request message forwarding function of the first VXLAN tunnel is in an open state, because the synchronous response message is received within the set time length, the communication connection between the VTEP and the first DHCP server is normal, an IP address can be allocated to the terminal through the first DHCP server, and an IP address does not need to be allocated through a second DHCP server connected with the VTEP at the other end of the first VXLAN tunnel, the DHCP request message forwarding function of the first VXLAN tunnel is changed into a closed state, and the DHCP request message is stopped to be forwarded through the first VXLAN tunnel; if the synchronous response message is not received within the set time length and the DHCP request message forwarding function of the first VXLAN tunnel is in a closed state, because the synchronous response message is not received within the set time length, the communication connection between the terminal and the first DHCP server is abnormal, an IP address cannot be allocated to the terminal through the first DHCP server, and an IP address needs to be allocated to the terminal through a second DHCP server connected with a VTEP at the other end of the first VXLAN tunnel, the DHCP request message forwarding function of the first VXLAN tunnel is changed into an open state, and the DHCP request message is forwarded through the first VXLAN tunnel.
The set time period may be set according to actual needs, for example, may be set to 0.5 second, 1 second, and the like.
Optionally, the method further includes:
after a second DHCP request message is received through the first VXLAN tunnel, after a source MAC address of the second DHCP request message is learned by the first MAC address table, the second DHCP request message is forwarded to the first DHCP server, so that the first DHCP server receives the second DHCP request message, allocates a second IP address according to the first local IP address library and returns a second DHCP response message carrying the second IP address;
and after receiving the second DHCP response message, forwarding the second DHCP response message based on the first MAC address table.
Receiving a DHCP request message through a first VXLAN tunnel, wherein the DHCP request message can be defined as a second DHCP request message, and if the communication between a VTEP at the other end of the first VXLAN tunnel and a connected second DHCP server is abnormal at the moment, the second DHCP request message is forwarded to the first DHCP server, and after receiving the second DHCP request message, the first DHCP server allocates a second IP address according to a first local IP address library and returns a second DHCP response message carrying the second IP address; after receiving the second DHCP response message, the terminal that sends the second DHCP request message may obtain the required IP address by forwarding the second DHCP response message based on the first MAC address table.
Optionally, the method further includes:
if the DHCP request message forwarding function of the first VXLAN tunnel is determined to be in an open state, forwarding the first DHCP request message through the first VXLAN tunnel so that a VTEP connected to the opposite end of the first VXLAN tunnel learns the source MAC address of the first DHCP request message in a second MAC address table and then forwards the first DHCP request message to a second DHCP server connected with the first VXLAN tunnel, receiving the first DHCP request message by the second DHCP server, allocating a third IP address according to a second local IP address base, returning a third DHCP response message carrying the third IP address, and forwarding the third DHCP response message by the VTEP connected to the opposite end of the first VXLAN tunnel according to the second MAC address table;
and after receiving the third DHCP response message through the first VXLAN tunnel, forwarding the third DHCP response message according to the first MAC address table.
If the DHCP request message forwarding function of the first VXLAN tunnel is determined to be in an open state, which indicates that the communication connection between the first VXLAN tunnel and the first DHCP server is abnormal, the first DHCP request message is forwarded through the first VXLAN tunnel, a VTEP connected to the opposite end of the first VXLAN tunnel learns the source MAC address of the first DHCP request message in an MAC address table (which can be defined as a second MAC address table) of the VTEP, then the first DHCP request message is forwarded to a second DHCP server which is connected, the second DHCP server receives the first DHCP request message, allocates a third IP address according to a second local IP address base, returns a third DHCP response message carrying the third IP address, and then the VTEP connected to the opposite end of the first VXLAN tunnel forwards a third DHCP response message according to the second MAC address table; and after receiving the third DHCP response message through the first VXLAN tunnel, forwarding the third DHCP response message according to the first MAC address table, and acquiring the allocated IP address by the terminal sending the first DHCP request message.
Optionally, the method further includes:
if the DHCP request message forwarding function of the first VXLAN tunnel is determined to be in an open state, trying to establish communication connection with a first DHCP server;
and if the communication connection with the first DHCP server is successfully established, changing the DHCP request message forwarding function of the first VXLAN tunnel into a closed state.
If the DHCP request message forwarding function of the first VXLAN tunnel is determined to be in an open state, and the communication connection between the first VXLAN tunnel and the first DHCP server is abnormal, trying to establish communication connection with the first DHCP server; if the communication connection with the first DHCP server is successfully established, the DHCP request message forwarding function of the first VXLAN tunnel is changed into a closed state, so that the forwarding of the DHCP request message through the first VXLAN tunnel is suspended; if the communication connection with the first DHCP server is not successfully established, the communication connection with the first DHCP server can be continuously attempted to be established.
Based on the same inventive concept, an embodiment of the present invention provides an IP address assignment device based on VXLAN, which is applied to VTEPs at both ends of each VXLAN tunnel of VXLAN, where VXLAN further includes a dynamic DHCP server connected to VTEPs at both ends of each VXLAN tunnel, and the structure of the device is shown in fig. 3, and includes:
the learning module 31 is configured to learn a source MAC address of a first DHCP request packet in a first MAC address table after receiving the first DHCP request packet broadcast by each connected terminal;
the transceiver module 32 is configured to forward the first DHCP request message to the connected first DHCP server if it is determined that the DHCP request message forwarding function of the connected first VXLAN tunnel is in an off state, so that the first DHCP server allocates a first IP address according to the first local IP address library after receiving the first DHCP request message, and returns a first DHCP response message carrying the first IP address; and after receiving the first DHCP response message, forwarding the first DHCP response message based on the first MAC address table.
In the scheme, after receiving the first DHCP request message broadcasted by each connected terminal, if it is determined that the DHCP request message forwarding function of the connected first VXLAN tunnel is in an off state, that is, after it is determined that the first DHCP server is available, the first DHCP request message is forwarded to the connected first DHCP server, and the first DHCP request message is not forwarded through the first VXLAN tunnel, so that the number of the VXLAN tunnel forwarding DHCP request messages can be reduced, and the message forwarding burden of the VXLAN tunnel is reduced.
Optionally, the system further comprises a modification module, wherein:
the forwarding module is further configured to send a synchronization request message carrying the second IP address and the first MAC address to the first DHCP server after receiving an ethernet virtual private network EVPN message carrying the second IP address and the first MAC address sent by a VTEP connected to an opposite end of the first VXLAN tunnel through the first VXLAN tunnel, so that the first DHCP server stores the first IP address and the first MAC address in a first local IP address repository after receiving the synchronization request message, and returns a corresponding synchronization response message;
the change module is used for changing the DHCP request message forwarding function of the first VXLAN tunnel into a closed state if the synchronous response message is received within the set time length and the DHCP request message forwarding function of the first VXLAN tunnel is in an open state; and if the synchronous response message is not received within the set time length and the DHCP request message forwarding function of the first VXLAN tunnel is in a closed state, changing the DHCP request message forwarding function of the first VXLAN tunnel into an open state.
Optionally, the learning module is further configured to learn, in the first MAC address table, a source MAC address of the second DHCP request message when the second DHCP request message is received through the first VXLAN tunnel;
the transceiver module is further used for forwarding a second DHCP request message to the first DHCP server, so that the first DHCP server receives the second DHCP request message, allocates a second IP address according to the first local IP address base, and returns a second DHCP response message carrying the second IP address; and after receiving the second DHCP response message, forwarding the second DHCP response message based on the first MAC address table.
Optionally, the transceiver module is further configured to:
if the DHCP request message forwarding function of the first VXLAN tunnel is determined to be in an open state, forwarding the first DHCP request message through the first VXLAN tunnel so that a VTEP connected to the opposite end of the first VXLAN tunnel learns the source MAC address of the first DHCP request message in a second MAC address table and then forwards the first DHCP request message to a second DHCP server connected with the first VXLAN tunnel, receiving the first DHCP request message by the second DHCP server, allocating a third IP address according to a second local IP address base, returning a third DHCP response message carrying the third IP address, and forwarding the third DHCP response message by the VTEP connected to the opposite end of the first VXLAN tunnel according to the second MAC address table;
and after receiving the third DHCP response message through the first VXLAN tunnel, forwarding the third DHCP response message according to the first MAC address table.
Optionally, the method further includes an establishing module, wherein:
the establishing module is used for trying to establish communication connection with a first DHCP server if the DHCP request message forwarding function of the first VXLAN tunnel is determined to be in an open state;
and the changing module is also used for changing the DHCP request message forwarding function of the first VXLAN tunnel into a closed state if the communication connection with the first DHCP server is successfully established.
An electronic device is further provided in the embodiment of the present application, please refer to fig. 4, which includes a processor 410, a communication interface 420, a memory 430, and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 complete communication with each other through the communication bus 440.
A memory 430 for storing computer programs;
the processor 410 is configured to implement the VXLAN-based IP address assignment method according to any of the embodiments described above when executing the program stored in the memory 430.
The communication interface 420 is used for communication between the above-described electronic device and other devices.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
In the scheme, after receiving the first DHCP request message broadcasted by each connected terminal, if it is determined that the DHCP request message forwarding function of the connected first VXLAN tunnel is in an off state, that is, after it is determined that the first DHCP server is available, the first DHCP request message is forwarded to the connected first DHCP server, and the first DHCP request message is not forwarded through the first VXLAN tunnel, so that the number of the VXLAN tunnel forwarding DHCP request messages can be reduced, and the message forwarding burden of the VXLAN tunnel is reduced.
Accordingly, an embodiment of the present application further provides a computer-readable storage medium, which stores instructions that, when executed on a computer, cause the computer to execute any of the VXLAN-based IP address assignment methods described in the foregoing embodiments.
In the scheme, after receiving the first DHCP request message broadcasted by each connected terminal, if it is determined that the DHCP request message forwarding function of the connected first VXLAN tunnel is in an off state, that is, after it is determined that the first DHCP server is available, the first DHCP request message is forwarded to the connected first DHCP server, and the first DHCP request message is not forwarded through the first VXLAN tunnel, so that the number of the VXLAN tunnel forwarding DHCP request messages can be reduced, and the message forwarding burden of the VXLAN tunnel is reduced.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While alternative embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following appended claims be interpreted as including alternative embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made in the embodiments of the present invention without departing from the spirit or scope of the embodiments of the invention. Thus, if such modifications and variations of the embodiments of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to encompass such modifications and variations.
Claims (12)
1. An internet protocol IP address allocation method based on a virtual extensible local area network VXLAN, which is applied to virtual extensible local area network tunnel terminals VTEP at two ends of each VXLAN tunnel of the VXLAN, wherein the VXLAN further comprises a dynamic host configuration protocol DHCP server connected with the VTEP at two ends of each VXLAN tunnel, and the method is characterized by comprising the following steps:
after receiving a first DHCP request message broadcasted by each connected terminal, learning a source MAC address of the first DHCP request message in a first Media Access Control (MAC) address table;
if the DHCP request message forwarding function of the connected first VXLAN tunnel is determined to be in a closed state, forwarding the first DHCP request message to a connected first DHCP server, so that the first DHCP server allocates a first IP address according to a first local IP address library after receiving the first DHCP request message, and returns a first DHCP response message carrying the first IP address;
and after receiving the first DHCP response message, forwarding the first DHCP response message based on the first MAC address table.
2. The method of claim 1, further comprising:
after receiving an Ethernet virtual private network EVPN message which is sent by a VTEP connected with the opposite end of the first VXLAN tunnel and carries a second IP address and a first MAC address through the first VXLAN tunnel, sending a synchronization request message which carries the second IP address and the first MAC address to the first DHCP server, so that the first DHCP server saves the first IP address and the first MAC address in the first local IP address base after receiving the synchronization request message and returns a corresponding synchronization response message;
if the synchronous response message is received within a set time length and the DHCP request message forwarding function of the first VXLAN tunnel is in an open state, the DHCP request message forwarding function of the first VXLAN tunnel is changed into a closed state; and if the synchronous response message is not received within the set time length and the DHCP request message forwarding function of the first VXLAN tunnel is in a closed state, changing the DHCP request message forwarding function of the first VXLAN tunnel into an open state.
3. The method of claim 1, further comprising:
receiving a second DHCP request message through the first VXLAN tunnel, and after learning a source MAC address of the second DHCP request message in the first MAC address table, forwarding the second DHCP request message to the first DHCP server, so that the first DHCP server receives the second DHCP request message, allocates a second IP address according to the first local IP address library, and returns a second DHCP response message carrying the second IP address;
and after receiving the second DHCP response message, forwarding the second DHCP response message based on the first MAC address table.
4. The method of claim 1, further comprising:
if the DHCP request message forwarding function of the first VXLAN tunnel is determined to be in an open state, forwarding the first DHCP request message through the first VXLAN tunnel so that a VTEP connected to the opposite end of the first VXLAN tunnel learns the source MAC address of the first DHCP request message in a second MAC address table and forwards the first DHCP request message to a second DHCP server connected to the first VXLAN tunnel, the second DHCP server receives the first DHCP request message, allocates a third IP address according to a second local IP address base, returns a third DHCP response message carrying the third IP address, and the VTEP connected to the opposite end of the first VXLAN tunnel forwards the third DHCP response message according to the second MAC address table;
and after receiving the third DHCP response message through the first VXLAN tunnel, forwarding the third DHCP response message according to the first MAC address table.
5. The method of any of claims 1-4, further comprising:
if the DHCP request message forwarding function of the first VXLAN tunnel is determined to be in an open state, trying to establish communication connection with the first DHCP server;
and if the communication connection with the first DHCP server is successfully established, changing the DHCP request message forwarding function of the first VXLAN tunnel into a closed state.
6. An IP address allocation device based on VXLAN, applied to VTEPs at both ends of each VXLAN tunnel of VXLAN, wherein the VXLAN further includes a dynamic DHCP server connected to VTEPs at both ends of each VXLAN tunnel, comprising:
the learning module is used for learning a source MAC address of a first DHCP request message in a first Media Access Control (MAC) address table after receiving the first DHCP request message broadcast by each connected terminal;
the receiving and sending module is used for forwarding the first DHCP request message to a connected first DHCP server if the DHCP request message forwarding function of the connected first VXLAN tunnel is determined to be in a closed state, so that the first DHCP server allocates a first IP address according to a first local IP address library after receiving the first DHCP request message and returns a first DHCP response message carrying the first IP address; and after receiving the first DHCP response message, forwarding the first DHCP response message based on the first MAC address table.
7. The apparatus of claim 6, further comprising a change module, wherein:
the forwarding module is further configured to send a synchronization request message carrying a second IP address and a first MAC address to the first DHCP server after receiving an ethernet virtual private network EVPN message carrying the second IP address and the first MAC address sent by a VTEP connected to an opposite end of the first VXLAN tunnel through the first VXLAN tunnel, so that the first DHCP server stores the first IP address and the first MAC address in the first local IP address repository after receiving the synchronization request message, and returns a corresponding synchronization response message;
the modification module is used for modifying the DHCP request message forwarding function of the first VXLAN tunnel into a closed state if the synchronous response message is received within a set time length and the DHCP request message forwarding function of the first VXLAN tunnel is in an open state; and if the synchronous response message is not received within the set time length and the DHCP request message forwarding function of the first VXLAN tunnel is in a closed state, changing the DHCP request message forwarding function of the first VXLAN tunnel into an open state.
8. The apparatus of claim 6, wherein the learning module is further configured to learn a source MAC address of a second DHCP request message in the first MAC address table if the second DHCP request message is received through the first VXLAN tunnel;
the transceiver module is further configured to forward the second DHCP request message to the first DHCP server, so that the first DHCP server allocates a second IP address according to the first local IP address library after receiving the second DHCP request message, and returns a second DHCP response message carrying the second IP address; and after receiving the second DHCP response message, forwarding the second DHCP response message based on the first MAC address table.
9. The apparatus of claim 6, wherein the transceiver module is further configured to:
if the DHCP request message forwarding function of the first VXLAN tunnel is determined to be in an open state, forwarding the first DHCP request message through the first VXLAN tunnel so that a VTEP connected to the opposite end of the first VXLAN tunnel learns the source MAC address of the first DHCP request message in a second MAC address table and forwards the first DHCP request message to a second DHCP server connected to the first VXLAN tunnel, the second DHCP server receives the first DHCP request message, allocates a third IP address according to a second local IP address base, returns a third DHCP response message carrying the third IP address, and the VTEP connected to the opposite end of the first VXLAN tunnel forwards the third DHCP response message according to the second MAC address table;
and after receiving the third DHCP response message through the first VXLAN tunnel, forwarding the third DHCP response message according to the first MAC address table.
10. The apparatus of any of claims 6-9, further comprising a setup module, wherein:
the establishing module is configured to attempt to establish a communication connection with the first DHCP server if it is determined that the DHCP request message forwarding function of the first VXLAN tunnel is in an open state;
the changing module is further configured to change a DHCP request message forwarding function of the first VXLAN tunnel to a closed state if the communication connection with the first DHCP server is successfully established.
11. An electronic device, characterized in that the electronic device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1-5 when executing a program stored on a memory.
12. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of the claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110459492.0A CN113286011B (en) | 2021-04-27 | 2021-04-27 | IP address allocation method and device based on VXLAN |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110459492.0A CN113286011B (en) | 2021-04-27 | 2021-04-27 | IP address allocation method and device based on VXLAN |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113286011A true CN113286011A (en) | 2021-08-20 |
CN113286011B CN113286011B (en) | 2023-08-22 |
Family
ID=77277464
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110459492.0A Active CN113286011B (en) | 2021-04-27 | 2021-04-27 | IP address allocation method and device based on VXLAN |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113286011B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115348238A (en) * | 2022-08-16 | 2022-11-15 | 中国联合网络通信集团有限公司 | DHCP relay method, VTEP gateway, electronic device and medium |
Citations (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102843667A (en) * | 2012-09-17 | 2012-12-26 | 北京交通大学 | Method for deploying subnet mobile in separation mechanism mobility management system |
US20140317312A1 (en) * | 2013-02-20 | 2014-10-23 | Gary Mitchell | System and Methods for Dynamic Network Address Modification |
CN104243630A (en) * | 2014-09-29 | 2014-12-24 | 杭州华三通信技术有限公司 | MAC (media access control) address learning method and MAC address learning device in VXLAN (virtual extensible local area network) |
WO2015085788A1 (en) * | 2013-12-10 | 2015-06-18 | 华为技术有限公司 | Method and apparatus for processing dynamic host configuration protocol message |
CN105657081A (en) * | 2016-04-07 | 2016-06-08 | 华为技术有限公司 | DHCP (dynamic host configuration protocol) service providing method, device and system |
US20160211989A1 (en) * | 2015-01-16 | 2016-07-21 | Alcatel-Lucent Usa Inc. | Bidirectional Forwarding Detection Over a Virtual Extensible Local Area Network |
CN106209643A (en) * | 2016-07-14 | 2016-12-07 | 杭州华三通信技术有限公司 | Message forwarding method and device |
CN106559292A (en) * | 2015-09-29 | 2017-04-05 | 杭州华三通信技术有限公司 | A kind of broad band access method and device |
CN106936943A (en) * | 2017-03-21 | 2017-07-07 | 深信服科技股份有限公司 | The distribution method and system of virtual machine address |
WO2018177353A1 (en) * | 2017-03-29 | 2018-10-04 | 中兴通讯股份有限公司 | Multicast data forwarding method and apparatus |
CN109067784A (en) * | 2018-09-19 | 2018-12-21 | 迈普通信技术股份有限公司 | The method and apparatus of anti-fraud in a kind of VXLAN |
US20190215190A1 (en) * | 2016-09-20 | 2019-07-11 | Huawei Technologies Co., Ltd. | VXLAN Packet Forwarding Method, Device, and System |
CN110460684A (en) * | 2019-07-10 | 2019-11-15 | 锐捷网络股份有限公司 | The broadcast domain partition method and device of VXLAN same network segment |
WO2020108531A1 (en) * | 2018-11-27 | 2020-06-04 | 新华三技术有限公司 | Packet forwarding |
-
2021
- 2021-04-27 CN CN202110459492.0A patent/CN113286011B/en active Active
Patent Citations (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102843667A (en) * | 2012-09-17 | 2012-12-26 | 北京交通大学 | Method for deploying subnet mobile in separation mechanism mobility management system |
US20140317312A1 (en) * | 2013-02-20 | 2014-10-23 | Gary Mitchell | System and Methods for Dynamic Network Address Modification |
WO2015085788A1 (en) * | 2013-12-10 | 2015-06-18 | 华为技术有限公司 | Method and apparatus for processing dynamic host configuration protocol message |
CN104243630A (en) * | 2014-09-29 | 2014-12-24 | 杭州华三通信技术有限公司 | MAC (media access control) address learning method and MAC address learning device in VXLAN (virtual extensible local area network) |
US20160211989A1 (en) * | 2015-01-16 | 2016-07-21 | Alcatel-Lucent Usa Inc. | Bidirectional Forwarding Detection Over a Virtual Extensible Local Area Network |
US20180205575A1 (en) * | 2015-09-29 | 2018-07-19 | New H3C Technologies Co., Ltd. | Broadband access |
CN106559292A (en) * | 2015-09-29 | 2017-04-05 | 杭州华三通信技术有限公司 | A kind of broad band access method and device |
CN105657081A (en) * | 2016-04-07 | 2016-06-08 | 华为技术有限公司 | DHCP (dynamic host configuration protocol) service providing method, device and system |
CN106209643A (en) * | 2016-07-14 | 2016-12-07 | 杭州华三通信技术有限公司 | Message forwarding method and device |
US20190215190A1 (en) * | 2016-09-20 | 2019-07-11 | Huawei Technologies Co., Ltd. | VXLAN Packet Forwarding Method, Device, and System |
CN106936943A (en) * | 2017-03-21 | 2017-07-07 | 深信服科技股份有限公司 | The distribution method and system of virtual machine address |
WO2018177353A1 (en) * | 2017-03-29 | 2018-10-04 | 中兴通讯股份有限公司 | Multicast data forwarding method and apparatus |
CN109067784A (en) * | 2018-09-19 | 2018-12-21 | 迈普通信技术股份有限公司 | The method and apparatus of anti-fraud in a kind of VXLAN |
WO2020108531A1 (en) * | 2018-11-27 | 2020-06-04 | 新华三技术有限公司 | Packet forwarding |
CN110460684A (en) * | 2019-07-10 | 2019-11-15 | 锐捷网络股份有限公司 | The broadcast domain partition method and device of VXLAN same network segment |
Non-Patent Citations (3)
Title |
---|
刘圣;: "VXLAN技术在数据中心的应用", 金融科技时代, no. 11 * |
王永建;张健;张富根;董真;: "基于VXLAN的云数据中心网络研究", no. 01 * |
蒋伟;: "构建宽带接入服务器高可靠性方案探讨", 通信与信息技术, no. 05 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115348238A (en) * | 2022-08-16 | 2022-11-15 | 中国联合网络通信集团有限公司 | DHCP relay method, VTEP gateway, electronic device and medium |
Also Published As
Publication number | Publication date |
---|---|
CN113286011B (en) | 2023-08-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9641417B2 (en) | Proactive detection of host status in a communications network | |
CN111934969B (en) | Maintenance method and device of MAC forwarding table | |
CN106357542B (en) | The method and software defined network controller of multicast service are provided | |
CN107645433B (en) | Message forwarding method and device | |
CN112769959B (en) | Session synchronization method, device, first node, second node, system and medium | |
CN109936490B (en) | Virtual home network sharing method and system based on VXLAN and OpenFlow | |
CN110691110B (en) | Communication method, device, system, terminal, equipment and medium | |
US20160080318A1 (en) | Dynamic host configuration protocol release on behalf of a user | |
CN113132155B (en) | Virtual switch distributed escape method and device and storage medium | |
CN113364660B (en) | Data packet processing method and device in LVS load balancing | |
US20230336377A1 (en) | Packet forwarding method and apparatus, and network system | |
CN115484232A (en) | DHCP server deployment method, device, equipment and storage medium | |
CN113286011B (en) | IP address allocation method and device based on VXLAN | |
CN113438333B (en) | Network address allocation method, device and equipment | |
CN112511401B (en) | Network connection method, device, equipment and medium | |
CN109728926B (en) | Communication method and network device | |
WO2017219777A1 (en) | Packet processing method and device | |
CN113132506B (en) | Message processing method and device based on super virtual local area network | |
CN113596188B (en) | Multi-device management method and device | |
US20190364461A1 (en) | Method and Device for Obtaining Resources and Information of SDN Networks of Different Operators | |
CN101686265B (en) | Network equipment, network system and method for establishing data communication | |
CN101309154A (en) | Datagram sending method, sending apparatus and transmission system | |
CN107911301B (en) | Message forwarding method and device | |
CN108259292B (en) | Method and device for establishing tunnel | |
CN111740901B (en) | Method and device for establishing BGP peer |
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 |