Message processing method and device, electronic equipment and storage medium

By generating masked NAT server table entries in NAT routing devices and finding the destination IP address of the converted access packets according to the principle of longest IP address matching, the storage space and processing performance problems in NAT routing devices are solved, and processing performance is improved And reduce network latency.

CN119172352AActive Publication Date: 2024-12-20NEW H3C TECH CO LTD
View PDF 13 Cites 0 Cited by

Patent Information

Application Number
CN202411287742.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-13
Publication Date
2024-12-20
Estimated Expiration
2044-09-13

AI Technical Summary

Technical Problem

In NAT routing devices, with the increase of NAT servers, the configured network segment range expands, resulting in an increase in DDR storage space usage and a longer time-consuming search for mapping relationships, affecting processing performance and network latency.

Method used

When receiving configuration commands, a masked NAT server table entry is generated, and the destination IP address of the access packet is found and converted according to the principle of longest IP address matching, reducing storage space usage and time-consuming search.

Benefits of technology

By generating masked NAT server table entries, the time-consuming IP address conversion is shortened, the processing performance of NAT routing devices is improved, and network latency is reduced, especially when deploying NAT servers in large quantities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119172352A_ABST
    Figure CN119172352A_ABST
Patent Text Reader

Abstract

The invention provides a message processing method and device, electronic equipment and a storage medium, and the method is applied to NAT (Network Address Translation) routing equipment, and comprises the steps: when a configuration command input by an administrator is received, according to a target public network segment carried in the configuration command and a corresponding initial IP (Internet Protocol) address, a corresponding target private network segment and a corresponding initial IP address, a message is processed according to the target public network segment and the corresponding initial IP address; generating a plurality of NAT (Network Address Translation) server table items; when an access message which is sent by a target public network host and is used for accessing a target NAT server is received, searching an NAT server table item matched with a target IP address of the message in all NAT server table items according to an IP address longest matching principle; determining a private IP address corresponding to the target NAT server according to the target IP address and the related table item; and converting the destination IP address of the message into a private IP address, and sending the private IP address to a target NAT server for processing. According to the invention, the processing performance of the NAT routing equipment can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a message processing method, device, electronic device and storage medium. Background Art

[0002] In a NAT (Network Address Translation) network, in some practical application scenarios, a public network host needs to access a private network server (also called a NAT server). For example, the NAT server is a File Transfer Protocol (FTP) server. This requires configuring a mapping relationship between the public network IP address and the private network IP address of the NAT server on the NAT routing device so that the public network host can actively access the NAT server through the NAT routing device.

[0003] With the development of network applications, a small number of NAT servers can hardly meet the needs of users, and more NAT servers mean that more mapping relationships need to be configured on the NAT router. Therefore, most users prefer to use the mapping configuration method of public network segments and private network segments to simplify complex configuration.

[0004] At present, for a NAT routing device, when receiving a configuration command input by an administrator for configuring a NAT server to map a public network segment to a private network segment (which carries a target public network segment (for example, A to A+N), a starting IP address of the target public network segment (for example, A), a target private network segment corresponding to the target public network segment (for example, a to a+N) and its corresponding starting IP address (for example, a), the NAT routing device will sequentially configure a mapping relationship of A to a, a mapping relationship of A+1 to a+1, until a mapping relationship of A+N to a+N is configured, and the N+1 mapping relationships are stored in a double data rate synchronous dynamic random access memory (DDR).

[0005] When the NAT routing device receives an access message sent by the target public host in the target public network for accessing the target NAT server in the target private network (the destination IP address of the access message is the public IP address of the target NAT server), it searches for the mapping relationship including the destination IP address of the access message in N+1 mapping relationships; converts the destination IP address of the access message into the private IP address in the found mapping relationship, and sends the converted access message to the target NAT server for processing.

[0006] It can be seen that as the number of NAT servers gradually increases, the network segment range configured on the NAT routing device will also continue to increase, which requires a larger DDR storage space and takes longer to find the mapping relationship, greatly affecting the processing performance of the NAT routing device and increasing network latency. Summary of the invention

[0007] In order to overcome the problems existing in the related art, the present application provides a message processing method, device, electronic device and storage medium.

[0008] According to a first aspect of an embodiment of the present application, a message processing method is provided, the method being applied to a NAT routing device, the method comprising:

[0009] When receiving a configuration command input by an administrator for configuring a NAT server to map a public network segment to a private network segment, generating multiple NAT server table entries according to the target public network segment carried in the configuration command, the starting IP address of the target public network segment, the target private network segment corresponding to the target public network segment and the starting IP address corresponding to the target public network segment, wherein each NAT server table entry includes a binary number with a mask;

[0010] When receiving an access message sent by a target public network host in a target public network for accessing a target NAT server in a target private network, searching for a target NAT server table entry that matches a destination IP address of the access message in all NAT server table entries according to the longest match principle of the IP address, wherein the destination IP address is a public network IP address of the target NAT server;

[0011] Determine the private IP address corresponding to the target NAT server according to the destination IP address and the starting IP addresses of the public network segment and the private network segment included in the target NAT server table entry;

[0012] The destination IP address of the access message is converted into the private IP address, and the converted access message is sent to the target NAT server for processing.

[0013] According to a second aspect of an embodiment of the present application, a message processing device is provided, the device being applied to a NAT routing device, the device comprising:

[0014] A generation module, configured to, upon receiving a configuration command input by an administrator for configuring a NAT server to map a public network segment to a private network segment, generate a plurality of NAT server table entries according to a target public network segment carried in the configuration command, a starting IP address of the target public network segment, a target private network segment corresponding to the target public network segment and a starting IP address corresponding thereto, wherein each NAT server table entry includes a binary number with a mask;

[0015] A search module, configured to, upon receiving an access message sent by a target public network host in a target public network for accessing a target NAT server in a target private network, search for a target NAT server table entry that matches a destination IP address of the access message in all NAT server table entries according to a longest match principle of an IP address, wherein the destination IP address is a public network IP address of the target NAT server;

[0016] A determination module, used to determine the private IP address corresponding to the target NAT server according to the destination IP address and the starting IP addresses of the public network segment and the private network segment included in the target NAT server table entry;

[0017] The processing module is used to convert the destination IP address of the access message into the private IP address, and send the converted access message to the target NAT server for processing.

[0018] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to implement the method steps of the above-mentioned message processing method.

[0019] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method steps of the above-mentioned message processing method are implemented.

[0020] The technical solution provided by the embodiments of the present application may have the following beneficial effects:

[0021] In the embodiment of the present application, the NAT server table item generated by the NAT routing device includes a binary number with a mask, which reduces the occupation of the DDR storage space; and when the NAT routing device receives an access message sent by a target public network host in the target public network for accessing a target NAT server in a target private network, it can quickly find the target NAT server table item that matches the access message according to the longest match principle of the IP address, and quickly convert the destination IP address of the access message based on the NAT server table item, which greatly shortens the time consumption of finding the NAT server table item, improves the processing performance of the NAT routing device, and also reduces the network delay. Especially in the case of large-scale deployment of NAT servers, these technical effects are more obvious.

[0022] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The accompanying drawings, which are incorporated in the specification and constitute a part of this application, illustrate embodiments consistent with the application and, together with the description, serve to explain the principles of the application.

[0024] Figure 1 A flowchart of a message processing method provided in an embodiment of the present application;

[0025] Figure 2 A schematic diagram of the structure of a message processing device provided in an embodiment of the present application;

[0026] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0028] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0029] It should be understood that, although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" or "if" as used herein may be interpreted as "at the time of" or "when...".

[0030] Next, the embodiments of the present application are described in detail.

[0031] The present application embodiment provides a message processing method, which is applied to a NAT routing device, such as Figure 1 As shown, the method may include the following steps:

[0032] S11. When receiving a configuration command input by an administrator for configuring a NAT server to map a public network segment to a private network segment, generate multiple NAT server table entries according to the target public network segment, the starting IP address of the target public network segment, the target private network segment corresponding to the target public network segment and its corresponding starting IP address carried in the configuration command.

[0033] In this step, each NAT server entry includes a binary number with a mask.

[0034] S12: upon receiving an access message sent by a target public network host in a target public network for accessing a target NAT server in a target private network, searching for a target NAT server entry that matches the destination IP address of the access message in all NAT server entries according to the longest match principle of the IP address.

[0035] In this step, the destination IP address is the public IP address of the target NAT server.

[0036] S13, according to the destination IP address, and the starting IP addresses of the public network segment and the private network segment included in the target NAT server table entry, determine the private IP address corresponding to the target NAT server;

[0037] S14: Convert the destination IP address of the access message into a private IP address, and send the converted access message to the target NAT server for processing.

[0038] Specifically, in the above step S11, the NAT routing device may generate multiple NAT server table entries in the following manner:

[0039] Divide the target public network segment into multiple binary numbers with masks;

[0040] For each masked binary number, a message is generated that includes the masked binary number, the starting IP address of the target public network segment, and the starting IP address of the target private network segment.

[0041] By generating multiple NAT server entries in this way, the DDR storage space occupied can be reduced.

[0042] It should be noted that, for any public network segment, the process of dividing the masked binary number by the NAT routing device is a prior art and will not be described in detail here.

[0043] Specifically, in the above step S12, the NAT routing device searches for a NAT server entry with the longest network prefix that matches the destination IP address in all NAT server entries.

[0044] It should be noted that, since the number of NAT server entries is reduced compared with the prior art, the time consumed in searching for relevant NAT server entries is greatly shortened.

[0045] Here, the found NAT server table entry is called a target NAT server table entry.

[0046] Specifically, in the above step S13, the NAT routing device can determine the private IP address corresponding to the target NAT server in the following manner:

[0047] Calculate the private IP address of the target NAT server using the following formula:

[0048] Formula 1: IP y = X – A + a;

[0049] Among them, X is the destination IP address;

[0050] A is the starting IP address of the public network segment included in the target NAT server entry;

[0051] a is the starting IP address of the private network segment included in the target NAT server entry;

[0052] IP y is the private IP address corresponding to the target NAT server.

[0053] It should be noted that, in this determination method, X, A and a may all be binary numbers, may all be decimal numbers, or may all be hexadecimal numbers.

[0054] It should be further explained that, through this determination method, the private IP address corresponding to the target NAT server can be quickly determined to quickly convert the destination IP address, thereby improving the processing performance of the NAT routing device and reducing network delay.

[0055] The above message processing method is described in detail below in conjunction with specific embodiments.

[0056] Assume that in a certain NAT network, at time 1, a NAT routing device in the NAT network receives a configuration command 1 input by an administrator for configuring a NAT server to map a public network segment to a private network segment. Assume that the configuration command 1 carries a public network segment 1 (for example, 1.1.1.16 to 1.1.1.31 (D), where D represents decimal), a starting IP address of the public network segment 1 (that is, 1.1.1.16), a private network segment 1 corresponding to the public network segment 1 (for example, a1 to a1+N), and its corresponding The corresponding starting IP address (i.e., a1) is obtained. At this time, the NAT routing device divides the public network segment 1 into a binary number with a mask (i.e., 1.1.1.1xxxx(B), where B represents a binary number, x represents the mask, 1 x represents the specific value of 1 bit masked, and xxxx represents the specific value of the last 4 bits masked), and generates a NAT server table entry (referred to as NAT server table entry 1) including 1.1.1.1xxxx(B), 1.1.1.16, and a.

[0057] Assume that at time 2, the NAT routing device receives access message 1 sent by public network host 1 in public network 1 for accessing NAT server 1 in private network 1. The NAT routing device searches for a NAT server table entry that matches the destination IP address of the access message (for example, 1.1.1.17 (D), the corresponding binary number is 1.1.1.10001 (B)) in all NAT server table entries according to the longest match principle of the IP address, and thus finds NAT server table entry 1.

[0058] Next, the NAT routing device determines the private IP address of NAT server 1 as 1.1.1.17-1.1.1.16+a1 according to the above formula 1, and then converts the destination IP address of access message 1 into the private IP address, and sends the converted access message to NAT server 1 for processing.

[0059] It can be seen from the above technical scheme that in the embodiment of the present application, the NAT server table item generated by the NAT routing device includes a binary number with a mask, which reduces the occupation of the DDR storage space; and when the NAT routing device receives an access message sent by the target public network host in the target public network for accessing the target NAT server in the target private network, it can quickly find the NAT server table item that matches the access message according to the longest match principle of the IP address, and quickly convert the destination IP address of the access message based on the NAT server table item, which greatly shortens the time consumption of IP address conversion, improves the processing performance of the NAT routing device, and also reduces network delay. Especially in the case of large-scale deployment of NAT servers, these technical effects are more obvious.

[0060] Based on the same inventive concept, the present application also provides a message processing device, which is applied to a NAT routing device, and its structural diagram is as follows: Figure 2 As shown, specifically including:

[0061] The generating module 21 is used for, when receiving a configuration command input by an administrator for configuring the mapping of a public network segment of a NAT server to a private network segment, generating a plurality of NAT server table entries according to the target public network segment carried in the configuration command, the starting IP address of the target public network segment, the target private network segment corresponding to the target public network segment and the starting IP address corresponding thereto, wherein each NAT server table entry includes a binary number with a mask;

[0062] A search module 22 is used for, when receiving an access message sent by a target public network host in a target public network for accessing a target NAT server in a target private network, searching for a target NAT server table entry that matches a destination IP address of the access message in all NAT server table entries according to the longest match principle of the Internet Protocol IP address, wherein the destination IP address is a public network IP address of the target NAT server;

[0063] A determination module 23, configured to determine the private IP address corresponding to the target NAT server according to the destination IP address and the starting IP addresses of the public network segment and the private network segment included in the target NAT server table entry;

[0064] The processing module 24 is used to convert the destination IP address of the access message into the private IP address, and send the converted access message to the target NAT server for processing.

[0065] Preferably, the generating module 21 is specifically configured to generate multiple NAT server entries in the following manner:

[0066] Dividing the target public network segment into a plurality of masked binary numbers;

[0067] For each masked binary number, a message is generated that includes the masked binary number, the starting IP address of the target public network segment, and the starting IP address of the target private network segment.

[0068] Preferably, the determination module 23 is specifically configured to determine the private IP address corresponding to the target NAT server in the following manner:

[0069] The private IP address corresponding to the target NAT server is calculated by the following formula:

[0070] Formula 1: IP y = X – A + a;

[0071] Wherein, X is the destination IP address;

[0072] A is the starting IP address of the public network segment included in the target NAT server table entry;

[0073] a is the starting IP address of the private network segment included in the target NAT server table entry;

[0074] IP y is the private IP address corresponding to the target NAT server.

[0075] Preferably, X, A and a are all binary numbers, decimal numbers or hexadecimal numbers.

[0076] It can be seen from the above technical scheme that in the embodiment of the present application, the NAT server table item generated by the NAT routing device includes a binary number with a mask, which reduces the occupation of the DDR storage space; and when the NAT routing device receives an access message sent by the target public network host in the target public network for accessing the target NAT server in the target private network, it can quickly find the NAT server table item that matches the access message according to the longest match principle of the IP address, and quickly convert the destination IP address of the access message based on the NAT server table item, which greatly shortens the time consumption of IP address conversion, improves the processing performance of the NAT routing device, and also reduces network delay. Especially in the case of large-scale deployment of NAT servers, these technical effects are more obvious.

[0077] The present application also provides an electronic device, such as Figure 3 As shown, it includes a processor 31 and a machine-readable storage medium 32, the machine-readable storage medium 32 stores machine-executable instructions that can be executed by the processor 31, and the processor 1401 is prompted by the machine-executable instructions to implement the steps of the above-mentioned message processing method.

[0078] The machine-readable storage medium may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk storage. Optionally, the machine-readable storage medium may also be at least one storage device located away from the processor.

[0079] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0080] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned message processing method are implemented.

[0081] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A message processing method, It is characterized in that The method is applied to a NAT routing device, and the method comprises: When receiving a configuration command input by an administrator for configuring a NAT server to map a public network segment to a private network segment, generating multiple NAT server table entries according to the target public network segment carried in the configuration command, the starting IP address of the target public network segment, the target private network segment corresponding to the target public network segment and the starting IP address corresponding to the target public network segment, wherein each NAT server table entry includes a binary number with a mask; When receiving an access message sent by a target public network host in a target public network for accessing a target NAT server in a target private network, searching for a target NAT server table entry that matches a destination IP address of the access message in all NAT server table entries according to the longest match principle of the IP address, wherein the destination IP address is a public network IP address of the target NAT server; Determine the private IP address corresponding to the target NAT server according to the destination IP address and the starting IP addresses of the public network segment and the private network segment included in the target NAT server table entry; The destination IP address of the access message is converted into the private IP address, and the converted access message is sent to the target NAT server for processing.

2. The method according to claim 1, It is characterized in that Generate multiple NAT server entries in the following ways: Dividing the target public network segment into a plurality of masked binary numbers; For each masked binary number, a message is generated that includes the masked binary number, the starting IP address of the target public network segment, and the starting IP address of the target private network segment.

3. The method according to claim 1, It is characterized in that Determine the private IP address corresponding to the target NAT server in the following manner: The private IP address corresponding to the target NAT server is calculated by the following formula: Formula 1: IP y = X – A + a; Wherein, X is the destination IP address; A is the starting IP address of the public network segment included in the target NAT server table entry; a is the starting IP address of the private network segment included in the target NAT server table entry; IP y is the private IP address corresponding to the target NAT server.

4. The method according to claim 3, It is characterized in that X, A and a are all binary numbers, decimal numbers or hexadecimal numbers.

5. A message processing device, It is characterized in that The device is applied to a NAT routing device, and the device comprises: A generation module, configured to, upon receiving a configuration command input by an administrator for configuring a NAT server to map a public network segment to a private network segment, generate a plurality of NAT server table entries according to a target public network segment carried in the configuration command, a starting IP address of the target public network segment, a target private network segment corresponding to the target public network segment and a starting IP address corresponding thereto, wherein each NAT server table entry includes a binary number with a mask; A search module, configured to, upon receiving an access message sent by a target public network host in a target public network for accessing a target NAT server in a target private network, search for a target NAT server table entry that matches a destination IP address of the access message in all NAT server table entries according to a longest match principle of an IP address, wherein the destination IP address is a public network IP address of the target NAT server; A determination module, used to determine the private IP address corresponding to the target NAT server according to the destination IP address and the starting IP addresses of the public network segment and the private network segment included in the target NAT server table entry; The processing module is used to convert the destination IP address of the access message into the private IP address, and send the converted access message to the target NAT server for processing.

6. The device according to claim 5, It is characterized in that The generating module is specifically used to generate multiple NAT server table entries in the following manner: Dividing the target public network segment into a plurality of masked binary numbers; For each masked binary number, a message is generated that includes the masked binary number, the starting IP address of the target public network segment, and the starting IP address of the target private network segment.

7. The device according to claim 5, It is characterized in that The determining module is specifically used to determine the private IP address corresponding to the target NAT server in the following manner: The private IP address corresponding to the target NAT server is calculated by the following formula: Formula 1: IP y = X – A + a; Wherein, X is the destination IP address; A is the starting IP address of the public network segment included in the target NAT server table entry; a is the starting IP address of the private network segment included in the target NAT server table entry; IP y is the private IP address corresponding to the target NAT server.

8. The device according to claim 7, It is characterized in that X, A and a are all binary numbers, decimal numbers or hexadecimal numbers.

9. An electronic device, It is characterized in that The method comprises a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to implement the method steps described in any one of claims 1 to 4.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps of any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Packet forwarding method and device and service provider network edge PE equipment

    CN106034072A

  • Maintenance method and device of route entry

    CN107147581A

  • Network address translation management method and device

    CN108124022A

  • Method and device for searching network logic path and storage medium

    CN110855721A

  • Data message forwarding method and system with multi-network-card computing device

    CN111245728A