A message forwarding method, device, electronic device and storage medium

By receiving packet feature information and replacing network information, the problem that the NAT protocol does not support VXLAN protocol message forwarding is solved, and the forwarding and efficiency of VXLAN protocol messages is improved.

CN114374666BActive Publication Date: 2024-12-24CHINA TELECOM CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111655312.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-30
Publication Date
2024-12-24
Estimated Expiration
2041-12-30

AI Technical Summary

Technical Problem

The existing NAT protocol does not support forwarding of VXLAN protocol packets, resulting in the inability to effectively isolate users and solve the problem of insufficient IP addresses in the VXLAN Underlay/Overlay networking environment.

Method used

By receiving the characteristic information in the message, determining the target value, and determining the forwarding information based on the mapping relationship set, replacing the network information in the message, and forwarding the VXLAN protocol message is realized.

Benefits of technology

It realizes forwarding of VXLAN protocol packets, improves forwarding efficiency, and updates the mapping relationship set in real time to ensure the accuracy and efficiency of subsequent packet forwarding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114374666B_ABST
    Figure CN114374666B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a message forwarding method, device, electronic device and storage medium, which relates to the field of Ethernet data communication, and is used to realize the forwarding of virtual extended local area network VXLAN protocol messages; the method includes: receiving a message sent by a first device, and determining the message characteristic information in the message; determining a target value according to the message characteristic information; the target value is an identifier that characterizes the message; determining forwarding information corresponding to the target value according to a mapping relationship set; the mapping relationship set includes a mapping relationship between the target value and the forwarding information; replacing the second network information in the message with the first network information in the forwarding information, obtaining the target message, and sending the target message to the second device. Since the present application replaces the second network information in the message with the first network information in the forwarding information, after obtaining the target message, the target message is sent to the second device to realize the forwarding of the message, thereby realizing the forwarding of the VXLAN protocol message.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Ethernet data communications, and in particular to a message forwarding method, device, electronic device and storage medium. Background Art

[0002] With the rapid development of network virtualization technology, Network Address Translation (NAT) technology and Virtual Extensible LAN (VXLAN) technology have been widely used. Among them, VXLAN creates a large number of virtual extensible LANs on the existing network architecture by establishing VXLAN tunnels.

[0003] In the VXLAN Underlay / Overlay networking environment, VXLAN is needed for user isolation, and the NAT protocol is used to solve the problem of insufficient Internet Protocol Address (IP) addresses in network transmission and to hide and protect computers inside the network. When the user's terminal needs to access the multi-access edge computing (Mobile Edge Computing, MEC) side network and connect to MEC services, the message needs to be forwarded to the MEC side network through the NAT protocol. However, the current standard NAT protocol does not support the forwarding of VXLAN protocol messages.

[0004] In summary, there is an urgent need for a message forwarding method that supports vxlan protocol message forwarding. Summary of the invention

[0005] The embodiments of the present application provide a message forwarding method, device, electronic device and storage medium, which can realize the forwarding of vxlan protocol messages.

[0006] In a first aspect, an embodiment of the present application provides a message forwarding method, the method comprising:

[0007] receiving a message sent by the first device, and determining message characteristic information in the message;

[0008] Determine a target value according to the message characteristic information; the target value is an identifier that characterizes the message;

[0009] Determine the forwarding information corresponding to the target value according to a mapping relationship set; the mapping relationship set includes a mapping relationship between the target value and the forwarding information;

[0010] The first network information in the forwarding information replaces the second network information in the message to obtain a target message, and the target message is sent to the second device.

[0011] Since the embodiment of the present application determines the target value according to the message characteristic information, determines the forwarding information corresponding to the target value according to the mapping relationship set, replaces the second network information in the message with the first network information in the forwarding information to obtain the target message, and sends the target message to the second device, the message sent by the first device is forwarded to the second device while improving the forwarding efficiency; and, the embodiment of the present application replaces the second network information with the first network information, obtains the target message, and sends the target message to the second device, and realizes the forwarding of the message by converting the network information in the message, thereby realizing the forwarding of the VXLAN protocol message.

[0012] An optional implementation manner is that if the first device is a terminal, the second device is a server; the message is a first message; the target value is a first target value; the first network information is forwarding network information; the second network information is terminal source network information;

[0013] If the first device is the server, the second device is the terminal; the message is the second message; the target value is the second target value; the first network information is the terminal source network information; and the second network information is the server target network information.

[0014] In an optional implementation manner, when the first device is the terminal, the determining the message feature information in the message includes:

[0015] De-encapsulating the tunnel of the first message to obtain a tunnel identifier of the first message;

[0016] Acquire message parameter information, terminal source network information, and service protocol type from the first message;

[0017] Determining link parameter information corresponding to the first message according to the port information for receiving the first message;

[0018] The tunnel identifier, the message parameter information, the terminal source network information, the service protocol type and the link parameter information are used as the first message characteristic information.

[0019] In an optional implementation manner, when the first device is the server, the determining the message feature information in the message includes:

[0020] Acquire server source network information, server target network information and service protocol type from the second message;

[0021] The server source network information, the server target network information and the service protocol type are used as second message characteristic information.

[0022] In an optional implementation manner, the method further comprises:

[0023] If the first device is the terminal and is not in the mapping relationship set, determine the forwarding information corresponding to the first target value, generate new forwarding information, establish a mapping relationship between the first target value and the new forwarding information, and add the mapping relationship to the mapping relationship set;

[0024] If the first device is the server and is not in the mapping relationship set, the forwarding information corresponding to the second target value is determined, and the second message is deleted.

[0025] Since the embodiment of the present application generates new forwarding information after determining that the forwarding information corresponding to the first target value is not determined in the mapping relationship set, establishes a mapping relationship between the first target value and the new forwarding information, adds it to the mapping relationship set, and updates the mapping relationship set in real time, after subsequently receiving the first message, it is possible to determine the forwarding information corresponding to the first message and realize forwarding of the first message, thereby improving the efficiency of message forwarding.

[0026] In an optional implementation manner, the generating new forwarding information includes:

[0027] Determine the conversion network information corresponding to the first target value according to the mapping relationship between the first target value and the conversion network information;

[0028] Determine the terminal address information and the terminal target network information according to the first message;

[0029] The new forwarding information is generated according to the conversion network information, the terminal address information, the first message feature information and the terminal target network information.

[0030] An optional implementation manner is that when the first device is the terminal, the second device is the server;

[0031] After generating the new forwarding information, the method further includes:

[0032] Determine a second target value corresponding to the new forwarding information according to the conversion network information, the terminal target network information and the service protocol type in the new forwarding information; the conversion network information is the same as the server target network information in the second message; the terminal target network information is the same as the server source network information in the second message;

[0033] A mapping relationship between the new second target value and the new forwarding information is established, and the mapping relationship is added to the mapping relationship set.

[0034] Since the embodiment of the present application establishes a mapping relationship between the new forwarding information and the new second target value after generating the new forwarding information, the corresponding forwarding information can be determined directly according to the mapping relationship after the second target value is subsequently determined, thereby improving the message forwarding efficiency.

[0035] In a second aspect, an embodiment of the present application provides a message forwarding device, the device comprising:

[0036] A receiving unit, configured to receive a message sent by the first device, and determine message characteristic information in the message;

[0037] A first determining unit is used to determine a target value according to the message characteristic information; the target value is an identifier that characterizes the message;

[0038] A second determining unit, configured to determine the forwarding information corresponding to the target value according to a mapping relationship set; the mapping relationship set includes a mapping relationship between the target value and the forwarding information;

[0039] The sending unit is used to replace the second network information in the message with the first network information in the forwarding information, obtain a target message, and send the target message to the second device.

[0040] An optional implementation manner is that if the first device is a terminal, the second device is a server; the message is a first message; the target value is a first target value; the first network information is forwarding network information; the second network information is terminal source network information;

[0041] If the first device is the server, the second device is the terminal; the message is the second message; the target value is the second target value; the first network information is the terminal source network information; and the second network information is the server target network information.

[0042] In an optional implementation manner, when the first device is the terminal, the receiving unit is specifically configured to:

[0043] De-encapsulating the tunnel of the first message to obtain a tunnel identifier of the first message;

[0044] Acquire message parameter information, terminal source network information, and service protocol type from the first message;

[0045] Determining link parameter information corresponding to the first message according to the port information for receiving the first message;

[0046] The tunnel identifier, the message parameter information, the terminal source network information, the service protocol type and the link parameter information are used as the first message characteristic information.

[0047] In an optional implementation manner, when the first device is the server, the receiving unit is specifically configured to:

[0048] Acquire server source network information, server target network information and service protocol type from the second message;

[0049] The server source network information, the server target network information and the service protocol type are used as second message characteristic information.

[0050] In an optional implementation manner, the second determining unit is further configured to:

[0051] If the first device is the terminal and is not in the mapping relationship set, determine the forwarding information corresponding to the first target value, generate new forwarding information, establish a mapping relationship between the first target value and the new forwarding information, and add the mapping relationship to the mapping relationship set;

[0052] If the first device is the server and is not in the mapping relationship set, the forwarding information corresponding to the second target value is determined, and the second message is deleted.

[0053] In an optional implementation manner, the second determining unit is specifically configured to:

[0054] Determine the conversion network information corresponding to the first target value according to the mapping relationship between the first target value and the conversion network information;

[0055] Determine the terminal address information and the terminal target network information according to the first message;

[0056] The new forwarding information is generated according to the conversion network information, the terminal address information, the first message feature information and the terminal target network information.

[0057] An optional implementation manner is that when the first device is the terminal, the second device is the server;

[0058] After generating the new forwarding information, the second determining unit is further configured to:

[0059] Determine a second target value corresponding to the new forwarding information according to the conversion network information, the terminal target network information and the service protocol type in the new forwarding information; the conversion network information is the same as the server target network information in the second message; the terminal target network information is the same as the server source network information in the second message;

[0060] A mapping relationship between the new second target value and the new forwarding information is established, and the mapping relationship is added to the mapping relationship set.

[0061] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the computer program is executed by the processor, the steps of any one of the message forwarding methods of the first aspect are implemented.

[0062] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the message forwarding methods in the first aspect are implemented.

[0063] The technical effects brought about by any one of the implementation methods in the second to fourth aspects can refer to the technical effects brought about by the corresponding implementation method in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0065] Figure 1 A schematic diagram of an application scenario of a message forwarding method provided in an embodiment of the present application;

[0066] Figure 2 A flowchart of a message forwarding method provided in an embodiment of the present application;

[0067] Figure 3 A schematic diagram of a data structure of a mapping relationship set provided in an embodiment of the present application;

[0068] Figure 4 A schematic diagram of capacity expansion of an electronic device provided in an embodiment of the present application;

[0069] Figure 5 A schematic diagram of a message forwarding process provided in an embodiment of the present application;

[0070] Figure 6 A flowchart of a method for adding a mapping relationship to a mapping relationship set provided in an embodiment of the present application;

[0071] Figure 7 A complete flow chart of a message forwarding method provided in an embodiment of the present application;

[0072] Figure 8 A complete flowchart of another message forwarding method provided in an embodiment of the present application;

[0073] Fig. 9 A schematic diagram of the structure of a message forwarding device provided in an embodiment of the present application;

[0074] Fig.10 A structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0075] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0076] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.

[0077] The following are explanations of some of the terms that appear in this article:

[0078] (1) VXLAN: It is a network virtualization technology that can improve the scalability of large-scale cloud computing deployments. It is an extension of the Virtual Local Area Network (VLAN). VXLAN is a powerful tool that can penetrate the Layer 3 network to extend the Layer 2 network. It can address the portability limitations of VMS (Virtual Memory System) by encapsulating traffic and extending it to the Layer 3 gateway, making it possible to access servers on external IP subnets.

[0079] (2) NAT technology: It is a network address translation technology. When some terminals in the private network have been assigned local IP addresses (that is, dedicated addresses used only in the private network), but want to communicate with terminals or servers on the public network (encryption is not required), the NAT method can be used. This method requires the installation of NAT software on the router that connects the private IP to the public IP. A router equipped with NAT software is called a NAT router, and it has at least one valid public IP address. In this way, all terminals using local addresses (private IP addresses) must convert their local addresses into public IP addresses on the NAT router when communicating with the outside world before they can connect to the public network.

[0080] (3) MEC: It is the product of the integration of information and communications technology (ICT), providing cloud computing functions and IT service capabilities at the edge of the network for application developers and content operators.

[0081] (4) Hash algorithm: The keyword of a data element is used as the independent variable, and the value calculated through a certain functional relationship (called a hash function) is the storage address of the element.

[0082] In the embodiments of the present application, the term "and / or" describes the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0083] In the prior art, in a VXLAN Underlay / Overlay networking environment, it is necessary to use VXLAN for user isolation, and use the NAT protocol to solve the problem of insufficient IP addresses in network transmission and to hide and protect computers inside the network. When the user's terminal needs to access the multi-access edge computing (Mobile Edge Computing, MEC) side network and connect to the MEC service, it is necessary to forward the message to the MEC side network through the NAT protocol. However, the current standard NAT protocol does not support the forwarding of VXLAN protocol messages. In summary, there is an urgent need for a message forwarding method that supports the forwarding of vxlan protocol messages.

[0084] Based on the above problems, the embodiments of the present application provide a message forwarding method, device, electronic device and storage medium. The method includes: receiving a message sent by a first device and obtaining message feature information of the message; then, determining a target value based on the message feature information, and determining forwarding information corresponding to the target value based on a mapping relationship set; replacing the second network information in the message with the first network information in the forwarding information to obtain a target message, and sending the target message to the second device, and forwarding the message by changing the network information in the message, thereby forwarding the VXLAN protocol message.

[0085] like Figure 1 As shown, the embodiment of the present application provides an application scenario of a message forwarding method. Figure 1 As shown, the scenario includes: a first device 10, an electronic device 20, and a second device 30. The first device 10 and the electronic device 20 can be connected and transmit data through a wired connection or a wireless connection. The second device 30 and the electronic device 20 can be connected and transmit data through a wired connection or a wireless connection. For example, the first device 10 and the electronic device 20 can be connected through a data cable or through a wired network; the first device 10 and the electronic device 20 can also be connected through a radio frequency module, a Bluetooth module, or a wireless network. The second device 30 and the electronic device 20 can be connected through a data cable or through a wired network; the second device 30 and the electronic device 20 can also be connected through a radio frequency module, a Bluetooth module, or a wireless network.

[0086] The first device 10 may be a terminal or a server; the second device 30 may be a server or a terminal. Specifically, when the first device 10 is a terminal, the second device 30 is a server; when the first device 10 is a server, the second device 30 is a terminal. The terminal may be a mobile phone, a PDA (Personal Digital Assistant), a computer, a notebook, a tablet computer, etc. The electronic device 20 may be a router, a NAT device, or a switch. For example, an application related to message forwarding may be installed on the electronic device 20.

[0087] When a user can send a message to the server 30 through the first device 10, the first device 10 sends the message to the electronic device 20; after receiving the message, the electronic device 20 determines the message characteristic information in the message; the electronic device 20 determines the target value based on the message characteristic information, and then determines the forwarding information corresponding to the target value based on the mapping relationship set; then, the electronic device 20 replaces the second network information in the message with the first network information in the forwarding information, obtains the target message, and sends the target message to the second device 30.

[0088] like Figure 2As shown, the embodiment of the present application provides a message forwarding method, comprising the following steps:

[0089] Step S201: receiving a message sent by a first device, and determining message characteristic information in the message.

[0090] It should be noted that the first device may be a terminal or a server.

[0091] When the first device is a terminal, the message is a first message; or, when the first device is a server, the message is a second message.

[0092] In some embodiments, the message characteristic information obtained by the embodiments of the present application may include the following information: tunnel identifier, message parameter information, source network information, target network information, protocol type; it may also include other characteristic information in the message, which is not limited here.

[0093] Step S202, determining a target value according to the message characteristic information.

[0094] It should be noted that the target value is an identifier that represents the message.

[0095] In some embodiments, when the first device is a terminal, the target value is a first target value; or, when the first device is a server, the target value is a second target value.

[0096] The embodiment of the present application can process the message feature information through a hash algorithm to obtain a target value.

[0097] Step S203: Determine forwarding information corresponding to the target value according to the mapping relationship set.

[0098] It should be noted that the mapping relationship set includes a mapping relationship between a target value and forwarding information.

[0099] Step S204: Replace the second network information in the message with the first network information in the forwarding information to obtain a target message, and send the target message to the second device.

[0100] It should be noted that the second device may be a terminal or a server.

[0101] In some embodiments, when the first device is a terminal, the second device is a server; the first network information is forwarding network information; and the second network information is terminal source network information.

[0102] In other embodiments, when the first device is a server, the second device is a terminal, and the first network information is terminal source network information, and the second network information is server target network information.

[0103] Since the embodiment of the present application determines the target value according to the message characteristic information, determines the forwarding information corresponding to the target value according to the mapping relationship set, replaces the second network information in the message with the first network information in the forwarding information to obtain the target message, and sends the target message to the second device, the message sent by the first device is forwarded to the second device while improving the forwarding efficiency; and, the embodiment of the present application replaces the second network information with the first network information, obtains the target message, and sends the target message to the second device, and realizes the forwarding of the message by converting the network information in the message, thereby realizing the forwarding of the VXLAN protocol message.

[0104] The message forwarding process is described below based on the two situations of the first device and the second device.

[0105] Scenario 1: The first device is a terminal, and the second device is a server.

[0106] In the embodiment of the present application, after receiving the first message sent by the terminal, first message characteristic information in the first message is obtained.

[0107] In a specific implementation, the embodiment of the present application can obtain the first message characteristic information in the first message through the following method.

[0108] After receiving the first message, the embodiment of the present application removes the tunnel encapsulation of the first message and obtains the tunnel identifier of the first message; after removing the tunnel encapsulation, obtains message parameter information, terminal source network information and service protocol type from the first message; and, based on the port information for receiving the first message, determines the link parameter information corresponding to the first message; and adds the tunnel identifier, message parameter information, terminal source network information, service protocol type and link parameter information.

[0109] It should be noted that the message parameter information includes pvid and cvid; the terminal source network information includes the source IP address information and source port information of the terminal. The link parameter information is the index of the L3 forwarding table. The first message feature information is a seven-tuple information.

[0110] In a specific implementation, the embodiment of the present application obtains message parameter information, terminal source network information and service protocol type from the first message through an offset.

[0111] After acquiring the first message characteristic information, the embodiment of the present application obtains the first target value according to the first message characteristic information.

[0112] In a specific implementation, the embodiment of the present application can process the first message feature information through a hash function to generate a first target value.

[0113] For example, the seven-tuple information obtained in the embodiment of the present application is used to generate a first target value hashkey through a hash function.

[0114] In some embodiments, the embodiments of the present application may also create a hash model, input the obtained seven-tuple information into the hash model, and output the first target value based on the hash function in the hash model.

[0115] After determining the first target value, the embodiment of the present application determines the forwarding information corresponding to the target value according to the mapping relationship set.

[0116] In some embodiments, the mapping relationship set in the embodiments of the present application is stored in a two-level data structure, the first level is bucket, and the second level is page. A bucket corresponds to multiple pages, and four mapping relationships are stored in one page.

[0117] Bucket represents a user, for example, a broadband account, and page represents a terminal. One broadband account corresponds to one user, and one broadband account can correspond to multiple terminals. Specifically, the number of buckets in the mapping relationship set can be the total computing amount of users to be planned / 4.

[0118] In some embodiments, the embodiments of the present application divide buckets according to tunnel identifiers and message parameter information.

[0119] The data structure of the mapping relationship set in the embodiment of the present application, that is, the data structure of the hash table allows hash conflicts, and the hash table can be dynamically expanded; the embodiment of the present application has the ability to dynamically expand the capacity of the hash table according to the current hash conflict event, thereby saving storage space while reducing the probability of hash conflicts.

[0120] In a specific implementation, the embodiment of the present application can determine the forwarding information corresponding to the first target value in the following manner.

[0121] After obtaining the first target value, the embodiment of the present application indexes the bucket array according to the lowest several bits of the first target value to determine the bucket corresponding to the first target value in the hash table, and then indexes the page value according to several secondary bits of the first target value to determine the page corresponding to the first target value; then, compares the key value contained in the page, determines the key value that is the same as the first target value, and determines the value corresponding to the key value, and determines the forwarding information corresponding to the first target value according to the value.

[0122] For example, Figure 3As shown, an embodiment of the present application provides a schematic diagram of the data structure of a mapping relationship set, which includes N buckets, each bucket includes N pages, and each page stores 4 mapping relationships which can be key-value pairs key / value pairs; key is the target value, and value is the index of forwarding information.

[0123] In some embodiments, the embodiment of the present application may establish a mapping relationship set while receiving a first message; or may first establish a mapping relationship set, and then update the mapping relationship set successively when the first message is subsequently received.

[0124] After determining the forwarding information corresponding to the first target value, the embodiment of the present application replaces the terminal source network information in the first message with the forwarding network information in the forwarding information.

[0125] It should be noted that the forwarding network information includes NAT IP information and terminal port information after NAT conversion.

[0126] In some embodiments, the embodiments of the present application assign the same NAT IP to the first message with the same tunnel identifier and message parameter information; that is, the messages with the same tunnel identifier and message parameter information are regarded as sent by the same user.

[0127] The mapping relationship set generated by the embodiment of the present application includes N buckets, storing N NAT IPs, which is equivalent to virtualizing the embodiment of the present application into N devices, which is equivalent to expanding the capacity of N network virtualized NAT devices in the embodiment of the present application.

[0128] For example, Figure 4 As shown, the electronic device receives a message M sent by a terminal in different broadband accounts 1 in a cell and a message N sent by a terminal in broadband account 2, determines forwarding information corresponding to the message M and the message N according to target values ​​corresponding to the message M and the message N, and determines the NAT IP of the message M and the message N in the electronic device according to the forwarding information; wherein one NAT IP is equivalent to a virtual NAT device.

[0129] After obtaining the first target message, the embodiment of the present application completes the NAT operation on the first message, and then sends the first target message to the server.

[0130] In a specific implementation, after obtaining the first target message, the embodiment of the present application re-encapsulates the first target message via UDP, and sends the encapsulated first target message to the server.

[0131] In some embodiments, after the first target message is sent to the server in the embodiment of the present application, the server returns the second message according to the received first target message. The terminal source network information and the terminal target network information in the first target message are located in the opposite positions to the server source network information and the server target network information in the second message, but the information is the same, so that one port in the electronic device can be used for transmission and reception.

[0132] like Figure 5 As shown, the embodiment of the present application provides a schematic diagram of a message forwarding process, including the following steps:

[0133] Step S501, receiving a first message sent by a terminal;

[0134] Step S502, de-encapsulating the tunnel of the first message, and obtaining the tunnel identifier of the first message;

[0135] Step S503, obtaining message parameter information, terminal source network information and service protocol type from the first message;

[0136] Step S504, determining link parameter information corresponding to the first message according to the port information for receiving the first message;

[0137] Step S505, taking the tunnel identifier, message parameter information, terminal source network information, service protocol type and the link parameter information as first message characteristic information;

[0138] Step S506, determining a first target value according to the first message characteristic information;

[0139] Step S507, determining forwarding information corresponding to the first target value according to the mapping relationship set;

[0140] Step S508, replacing the terminal source network information in the first message with the forwarding network information in the forwarding information to obtain a first target message;

[0141] Step S509: re-encapsulate the first target message and send the first target message to the server.

[0142] In other embodiments, when the forwarding information corresponding to the first target value is determined in the mapping relationship set, the embodiments of the present application generate new forwarding information, establish a mapping relationship between the first target value and the new forwarding information, and add the mapping relationship to the mapping relationship set.

[0143] In a specific implementation, the embodiment of the present application can generate new forwarding information in the following manner.

[0144] The embodiment of the present application determines the conversion network information corresponding to the first target value according to the mapping relationship between the set first target value and the conversion network information; determines the terminal address information and the terminal target network information according to the first message. The embodiment of the present application generates new forwarding information according to the conversion network information, the terminal address information, the first message feature information and the terminal target network information.

[0145] In some embodiments, the embodiments of the present application fill the first message characteristic information and the determined terminal address information and terminal target network information into the corresponding table entry position of the forwarding information table.

[0146] In the embodiment of the present application, after determining the conversion network information corresponding to the first target value according to the first target value, the conversion network information is filled into the corresponding table entry position in the forwarding information table to obtain new forwarding information.

[0147] For example, the table items corresponding to the forwarding information in the embodiment of the present application are shown in Table 1 below:

[0148]

[0149] Among them, MAC addr: indicates the terminal address information;

[0150] VNI: indicates the tunnel identifier, that is, the vxlan tunnel id of the vxlan message;

[0151] QinQ: indicates packet parameter information, including pvid and cvid;

[0152] Src IP: indicates the terminal source IP address information;

[0153] Src Port: indicates the terminal source port information;

[0154] NAT IP: indicates the NAT IP information in the forwarding network information;

[0155] NAT port: indicates the port information after NAT conversion of the terminal in the forwarding network information;

[0156] Dst IP: indicates the terminal target IP address information in the terminal target network information;

[0157] Dst port: indicates the terminal destination port information in the terminal destination network information;

[0158] Proto: service protocol type of the first message.

[0159] In other embodiments, after generating new forwarding information, the embodiments of the present application determine the second target value corresponding to the new forwarding information based on the conversion network information, terminal target network information and service protocol type in the new forwarding information.

[0160] It should be noted that the conversion network information is the same as the server target network information in the second message, and the terminal target network information is the same as the server source network information in the second message. The second message is the message returned by the server after receiving the first target message corresponding to the first target value.

[0161] The embodiment of the present application establishes a mapping relationship between a new second target value and new forwarding information, and adds the mapping relationship to a mapping relationship set.

[0162] like Figure 6 As shown, the embodiment of the present application provides a method for adding a mapping relationship in a mapping relationship set, comprising the following steps:

[0163] Step S601, receiving a first message sent by a terminal;

[0164] Step S602, obtaining first message characteristic information of the first message;

[0165] Step S603, determining a first target value according to the first message characteristic information;

[0166] Step S604, determining forwarding information corresponding to the first target value that is not in the mapping relationship set;

[0167] Step S605, determining the conversion network information corresponding to the first target value according to the set mapping relationship between the first target value and the conversion network information;

[0168] Step S606, determining the terminal address information and the terminal target network information according to the first message;

[0169] Step S607, generating new forwarding information according to the conversion network information, the terminal address information, the first message characteristic information and the terminal target network information;

[0170] Step S608, establishing a mapping relationship between the first target value and the new forwarding information, and adding the mapping relationship to the mapping relationship set;

[0171] Step S609, determining a second target value corresponding to the new forwarding information according to the conversion network information, the terminal target network information and the service protocol type in the new forwarding information;

[0172] It should be noted that the conversion network information is the same as the server target network information in the second message; the terminal target network information is the same as the server source network information in the second message;

[0173] There is no particular order in which step S608 and step S609 are executed.

[0174] Step S610: establish a mapping relationship between a new second target value and new forwarding information, and add the mapping relationship to a mapping relationship set.

[0175] like Figure 7 As shown, the embodiment of the present application provides a complete flow chart of a message forwarding method, including the following steps:

[0176] Step S701, receiving a first message sent by a terminal, and determining first message characteristic information in the first message;

[0177] Step S702, determining a first target value according to the first message characteristic information;

[0178] Step S703, determining whether forwarding information corresponding to the first target value is determined in the mapping relationship set; if so, executing step S704; if not, executing step S706;

[0179] Step S704, replacing the terminal source network information in the first message with the forwarding network information in the forwarding information to obtain a first target message;

[0180] Step S705, sending the first target message to the server;

[0181] Step S706, generating new forwarding information;

[0182] Step S707, establishing a mapping relationship between the first target value and the new forwarding information, and adding the mapping relationship to the mapping relationship set;

[0183] Step S708, determining a second target value corresponding to the new forwarding information according to the conversion network information, the terminal target network information and the service protocol type in the new forwarding information;

[0184] It should be noted that there is no particular order between step S707 and step S708.

[0185] Step S709: establish a mapping relationship between a new second target value and new forwarding information, and add the mapping relationship to the mapping relationship set.

[0186] Scenario 2: The first device is a server, and the second device is a terminal.

[0187] The embodiment of the present application receives a second message sent by a server and determines second message characteristic information in the second message.

[0188] In a specific implementation, the embodiment of the present application determines the second message characteristic information in the following manner.

[0189] The embodiment of the present application obtains server source network information, server target network information and service protocol type from the second message; and uses the server source network information, server target network information and service protocol type as second message characteristic information.

[0190] It should be noted that the server source network information includes the server source IP address information and source port information. The server target network information is the same as the forwarding network information.

[0191] After acquiring the second message characteristic information, the embodiment of the present application determines the second target value according to the second message characteristic information.

[0192] Specifically, the embodiment of the present application can process the second message characteristic information through a hash algorithm to obtain the second target value. The process of determining the second target value in the embodiment of the present application is the same as the process of determining the first target value, which will not be repeated here.

[0193] After obtaining the second target value, the embodiment of the present application determines the forwarding information corresponding to the second target value according to the mapping relationship set; then, the terminal source network information in the forwarding information replaces the server target network information in the second message to obtain the second target message.

[0194] In some embodiments, after the embodiment of the present application replaces the server target network information in the second message with the terminal source network information in the forwarding information, the server source network information and the server target network information in the obtained second target message are in opposite positions to the terminal source network information and the terminal target network information in the first message, but the information is the same, thus realizing local transmission and local input.

[0195] After obtaining the second target message, the embodiment of the present application encapsulates the second target message into VXLAN and sends it to the terminal.

[0196] In some other embodiments, the embodiments of the present application do not delete the second message after determining the forwarding information corresponding to the second target value in the mapping relationship set.

[0197] If the forwarding information corresponding to the second target value is not determined in the mapping relationship set in the embodiment of the present application, that is, the second message is not a message generated by the server after receiving the first target message, it can be determined that the second message is an erroneously received message.

[0198] In a specific implementation, the embodiment of the present application deletes the second message according to the L3 forwarding rule.

[0199] like Figure 8The embodiment of the present application also provides a complete flow chart of another message forwarding method, including the following steps:

[0200] Step S801, receiving a second message sent by a server, and determining second message characteristic information in the second message;

[0201] Step S802, determining a second target value according to the second message characteristic information;

[0202] Step S803, determining whether forwarding information corresponding to the second target value is determined in the mapping relationship set; if so, executing step S804; if not, executing step S806;

[0203] Step S804, replacing the server target network information in the second message with the terminal source network information in the forwarding information to obtain a second target message;

[0204] Step S805, encapsulating the second target message into a VXLAN message and sending it to the terminal;

[0205] Step S806: delete the second message.

[0206] Based on the same inventive concept, a message forwarding device is also provided in an embodiment of the present application. Since the principle of solving the problem by the device is similar to that of the above-mentioned message forwarding method, the device can be implemented with reference to the above-mentioned method embodiment, and the repeated parts will not be repeated.

[0207] like Fig. 9 As shown, a structural block diagram of a message forwarding device provided in an embodiment of the present application, the device includes:

[0208] The receiving unit 901 is used to receive a message sent by the first device and determine message characteristic information in the message;

[0209] The first determining unit 902 is used to determine a target value according to the message characteristic information; the target value is an identifier that characterizes the message;

[0210] A second determining unit 903 is used to determine the forwarding information corresponding to the target value according to the mapping relationship set; the mapping relationship set includes a mapping relationship between the target value and the forwarding information;

[0211] The sending unit 904 is used to replace the second network information in the message with the first network information in the forwarding information, obtain the target message, and send the target message to the second device.

[0212] An optional implementation manner is that if the first device is a terminal, the second device is a server; the message is a first message; the target value is a first target value; the first network information is forwarding network information; the second network information is terminal source network information;

[0213] If the first device is a server, the second device is a terminal; the message is a second message; the target value is a second target value; the first network information is the terminal source network information; and the second network information is the server target network information.

[0214] In an optional implementation manner, when the first device is a terminal, the receiving unit 901 is specifically configured to:

[0215] De-encapsulating the tunnel of the first message to obtain a tunnel identifier of the first message;

[0216] Acquire message parameter information, terminal source network information, and service protocol type from the first message;

[0217] Determining link parameter information corresponding to the first message according to the port information for receiving the first message;

[0218] The tunnel identifier, message parameter information, terminal source network information, service protocol type and link parameter information are used as the first message characteristic information.

[0219] In an optional implementation manner, when the first device is a server, the receiving unit 901 is specifically configured to:

[0220] Obtaining server source network information, server target network information, and service protocol type from the second message;

[0221] The server source network information, the server target network information and the service protocol type are used as the second message characteristic information.

[0222] In an optional implementation manner, the second determining unit 903 is further configured to:

[0223] If the first device is a terminal and is not in the mapping relationship set, determine the forwarding information corresponding to the first target value, generate new forwarding information, establish a mapping relationship between the first target value and the new forwarding information, and add the mapping relationship to the mapping relationship set;

[0224] If the first device is a server and is not in the mapping relationship set, the forwarding information corresponding to the second target value is determined, and the second message is deleted.

[0225] In an optional implementation manner, the second determining unit 903 is specifically configured to:

[0226] Determine the conversion network information corresponding to the first target value according to the mapping relationship between the set first target value and the conversion network information;

[0227] Determine the terminal address information and the terminal target network information according to the first message;

[0228] New forwarding information is generated according to the conversion network information, the terminal address information, the first message characteristic information and the terminal target network information.

[0229] An optional implementation manner is that when the first device is a terminal, the second device is a server;

[0230] After generating the new forwarding information, the second determining unit 903 is further configured to:

[0231] Determine a second target value corresponding to the new forwarding information according to the conversion network information, the terminal target network information and the service protocol type in the new forwarding information; the conversion network information is the same as the server target network information in the second message; the terminal target network information is the same as the server source network information in the second message;

[0232] A mapping relationship between a new second target value and new forwarding information is established, and the mapping relationship is added to the mapping relationship set.

[0233] Corresponding to the embodiment of the message forwarding method described above, the embodiment of the present application further provides an electronic device, which may be a NAT device.

[0234] In this embodiment, the structure of the electronic device can be as follows Fig.10 As shown, it includes a memory 131 , a communication module 133 and one or more processors 132 .

[0235] The memory 131 is used to store computer programs executed by the processor 132. The memory 131 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and programs required for running the instant messaging function, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.

[0236] The processor 132 may include one or more central processing units (CPU) or a digital processing unit, etc. The processor 132 is used to implement the above-mentioned message forwarding method when calling the computer program stored in the memory 131 .

[0237] The communication module 133 is used to communicate, obtain messages and send target messages.

[0238] The specific connection medium between the memory 131, the communication module 133 and the processor 132 is not limited in the embodiment of the present application. Fig.10 The memory 131 and the processor 132 are connected via a bus 134. Fig.10The connections between other components are shown in bold lines, and are not intended to be limiting. The bus 134 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.10 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0239] An embodiment of the present application further provides a computer storage medium, in which computer executable instructions are stored. The computer executable instructions are used to implement the message forwarding method recorded in any embodiment of the present application.

[0240] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0241] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0242] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0243] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0244] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A message forwarding method, characterized in that: The method comprises: Receive a message sent by a first device, and determine message characteristic information in the message; the message is a vxlan protocol message, and when the first device is a terminal, the message characteristic information in the message includes a tunnel identifier, message parameter information, and link parameter information; Determine a target value according to the message characteristic information; the target value is an identifier that characterizes the message; Determine the forwarding information corresponding to the target value according to a mapping relationship set; the mapping relationship set includes a mapping relationship between the target value and the forwarding information; Replacing the second network information in the message with the first network information in the forwarding information to obtain a target message, and sending the target message to the second device; If the first device is the terminal, the second device is a server; the target value is a first target value; the message is a first message; the mapping relationship set is stored in a secondary data structure, the primary data structure is a bucket, the secondary data structure is a page, each bucket includes multiple pages, and each page stores multiple mapping relationships between the target values ​​and the indexes of the forwarding information; wherein, determining the forwarding information corresponding to the target value according to the mapping relationship set includes: indexing the bucket array according to the lowest several bits of the first target value to determine the bucket corresponding to the first target value in the hash table; indexing the page value according to several secondary bits of the first target value to determine the page corresponding to the first target value from the bucket corresponding to the first target value; determining the index of the forwarding information corresponding to the target value same as the first target value from the page corresponding to the first target value, and determining the forwarding information according to the index of the forwarding information; If the first device is the terminal and is not in the mapping relationship set, determine the forwarding information corresponding to the first target value, generate new forwarding information, establish a mapping relationship between the first target value and the new forwarding information, and add the mapping relationship to the mapping relationship set; The generating of new forwarding information includes: Determine the conversion network information corresponding to the first target value according to the mapping relationship between the first target value and the conversion network information; Determine the terminal address information and the terminal target network information according to the first message; Fill the first message characteristic information, the terminal address information, and the terminal target network information in the first message into the corresponding table entry position of the forwarding information table; Fill the converted network information into the corresponding table entry position in the forwarding information table to obtain the new forwarding information.

2. The method according to claim 1, characterized in that If the first device is the terminal, the second device is a server; the first network information is forwarding network information; the second network information is terminal source network information; If the first device is the server, the second device is the terminal; the message is the second message; the target value is the second target value; the first network information is the terminal source network information; and the second network information is the server target network information.

3. The method according to claim 2, characterized in that When the first device is the terminal, the determining the message characteristic information in the message includes: De-encapsulating the tunnel of the first message to obtain a tunnel identifier of the first message; Acquire message parameter information, terminal source network information, and service protocol type from the first message; Determining link parameter information corresponding to the first message according to the port information for receiving the first message; The tunnel identifier, the message parameter information, the terminal source network information, the service protocol type and the link parameter information are used as the first message characteristic information.

4. The method according to claim 2, characterized in that: When the first device is the server, the determining the message characteristic information in the message includes: Acquire server source network information, server target network information and service protocol type from the second message; The server source network information, the server target network information and the service protocol type are used as second message characteristic information.

5. The method according to claim 4, characterized in that The method further comprises: If the first device is the server and is not in the mapping relationship set, the forwarding information corresponding to the second target value is determined, and the second message is deleted.

6. The method according to claim 5, characterized in that When the first device is the terminal, the second device is the server; After generating the new forwarding information, the method further includes: Determine a second target value corresponding to the new forwarding information according to the conversion network information, the terminal target network information and the service protocol type in the new forwarding information; the conversion network information is the same as the server target network information in the second message; the terminal target network information is the same as the server source network information in the second message; A mapping relationship between the new second target value and the new forwarding information is established, and the mapping relationship is added to the mapping relationship set.

7. A message forwarding device, characterized in that: The device comprises: A receiving unit, configured to receive a message sent by a first device, and determine message characteristic information in the message; the message is a vxlan protocol message, and when the first device is a terminal, the message characteristic information in the message includes a tunnel identifier, message parameter information, and link parameter information; A first determining unit is used to determine a target value according to the message characteristic information; the target value is an identifier that characterizes the message; A second determining unit, configured to determine the forwarding information corresponding to the target value according to a mapping relationship set; the mapping relationship set includes a mapping relationship between the target value and the forwarding information; A sending unit, configured to replace the second network information in the message with the first network information in the forwarding information, obtain a target message, and send the target message to the second device; Wherein, if the first device is the terminal, the second device is a server; the target value is a first target value; the message is a first message; the mapping relationship set is stored in a secondary data structure, the primary data structure is a bucket, the secondary data structure is a page, each bucket includes multiple pages, and each page stores a plurality of mapping relationships between the target values ​​and the index of the forwarding information; the second determination unit is specifically used to: According to the lowest several bits of the first target value, the bucket array is indexed to determine the bucket corresponding to the first target value in the hash table; according to the several secondary bits of the first target value, the page corresponding to the first target value is determined from the bucket corresponding to the first target value; from the page corresponding to the first target value, the index of the forwarding information corresponding to the target value same as the first target value is determined, and the forwarding information is determined according to the index of the forwarding information; The second determining unit is further configured to, if the first device is the terminal and is not in the mapping relationship set, determine the forwarding information corresponding to the first target value, generate new forwarding information, establish a mapping relationship between the first target value and the new forwarding information, and add the mapping relationship to the mapping relationship set; Wherein, the second determining unit is specifically used for: Determine the conversion network information corresponding to the first target value according to the mapping relationship between the first target value and the conversion network information; Determine the terminal address information and the terminal target network information according to the first message; Fill the first message characteristic information, the terminal address information, and the terminal target network information in the first message into the corresponding table entry position of the forwarding information table; Fill the converted network information into the corresponding table entry position in the forwarding information table to obtain the new forwarding information.

8. The device according to claim 7, characterized in that If the first device is the terminal, the second device is a server; the first network information is forwarding network information; the second network information is terminal source network information; If the first device is the server, the second device is the terminal; the message is the second message; the target value is the second target value; the first network information is the terminal source network information; and the second network information is the server target network information.

9. The device according to claim 8, characterized in that When the first device is the terminal, the receiving unit is specifically configured to: De-encapsulating the tunnel of the first message to obtain a tunnel identifier of the first message; Acquire message parameter information, terminal source network information, and service protocol type from the first message; Determining link parameter information corresponding to the first message according to the port information for receiving the first message; The tunnel identifier, the message parameter information, the terminal source network information, the service protocol type and the link parameter information are used as the first message characteristic information.

10. The device according to claim 8, characterized in that When the first device is the server, the receiving unit is specifically configured to: Acquire server source network information, server target network information and service protocol type from the second message; The server source network information, the server target network information and the service protocol type are used as second message characteristic information.

11. The device according to claim 10, characterized in that The second determining unit is further configured to: If the first device is the server and is not in the mapping relationship set, the forwarding information corresponding to the second target value is determined, and the second message is deleted.

12. The device according to claim 11, characterized in that When the first device is the terminal, the second device is the server; After generating the new forwarding information, the second determining unit is further configured to: Determine a second target value corresponding to the new forwarding information according to the conversion network information, the terminal target network information and the service protocol type in the new forwarding information; the conversion network information is the same as the server target network information in the second message; the terminal target network information is the same as the server source network information in the second message; A mapping relationship between the new second target value and the new forwarding information is established, and the mapping relationship is added to the mapping relationship set.

13. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program executable on the processor, and when the computer program is executed by the processor, the method according to any one of claims 1 to 6 is implemented.

14. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.