Network address translation method and device, electronic equipment and medium

By traversing and detecting the available status of public network addresses in the network address pool of gateway devices and marking them, the problem of network connection failure caused by blocking public network addresses in NAT technology is solved, and the success of network address conversion and connection is improved rate and stability.

CN119496759APending Publication Date: 2025-02-21ZHEJIANG UNIVIEW TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411225091.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-03
Publication Date
2025-02-21

AI Technical Summary

Technical Problem

When using NAT technology to convert network address, the public network address and port may be blocked by the external network server, resulting in intranet users being unable to access the Internet normally.

Method used

By traversing the public network address in the network address pool of the gateway device, sending detection messages to the server, determining its available status, and marking the available status of each public network address, so as to assign the public network address to the client according to the available status of the tag. Convert network address.

Benefits of technology

Without affecting the client's network connection, the available status of the public network address is actively detected and marked, which avoids the problem of network connection failure caused by the unavailability of the public network address, and improves the success rate and stability of network address translation and network connection .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119496759A_ABST
    Figure CN119496759A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a network address translation method and device, electronic equipment and a medium. The method comprises the following steps: traversing a public network address in a network address pool of gateway equipment, and sending a detection message to a server by taking the public network address as a source address; determining the available state of the public network address according to the feedback condition of the server to the detection message; and performing available state marking on each public network address in the network address pool so as to distribute the public network address for the client according to the marked available state to perform network address translation. According to the scheme, under the condition that the network connection of the client side is not influenced, each public network address is actively traversed to carry out available state detection and marking, so that the public network address is allocated to carry out network address translation according to the marked available state when the client side has a networking demand, the problem of network connection failure caused by unavailability of the public network address is avoided, and the network connection efficiency is improved. And the success rate and the stability of network address translation and network connection of the client are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the continuous development of network technology, the speed of global informatization has been advancing by leaps and bounds. The number of IoT devices and Internet users is increasing day by day, and network addresses need to be configured to realize the interconnection of all things. IPv4 can only provide about 4.2 billion addresses, but in fact the number of devices in the world has far exceeded this number. The rapid popularization of smart homes, smart cars, smart industrial equipment, etc. has further compressed the available IPv4 address space.

[0003] In order to solve the problem of network address shortage, many organizations and enterprises have adopted address proxy and network address translation (NAT) technology, allowing multiple devices to access the Internet by sharing a public network address. When performing NAT conversion in actual use, a NAT address pool and port pool will be configured to convert the address and port of the message. After conversion, the network is connected to the public network address for business interaction. In actual use, if the intranet traffic performs illegal operations on the external network server after NAT conversion, the corresponding public network address and the corresponding port may be blocked by the external network server, resulting in other intranet users being unable to use the public network address to access the Internet normally. Summary of the invention

[0004] The embodiments of the present application provide a network address translation method, device, electronic device and medium, which actively traverse, detect and mark the available status of a public network address to allocate a public network address to a client according to the available status.

[0005] According to one aspect of the present application, a network address translation method is provided, the method comprising:

[0006] Traversing the public network addresses in the network address pool of the gateway device, and sending a detection message to the server with the public network address as the source address;

[0007] Determine the availability status of the public network address according to the feedback of the server to the detection message;

[0008] Each public network address in the network address pool is marked as available, so as to allocate a public network address to the client for network address translation according to the marked available status.

[0009] According to one aspect of the present application, a network address translation device is provided, the device comprising:

[0010] A detection message sending module, used to traverse the public network addresses in the network address pool of the gateway device, and send a detection message to the server with the public network address as the source address;

[0011] An available status determination module, used to determine the available status of the public network address according to the feedback of the server to the detection message;

[0012] The available status marking module is used to mark the available status of each public network address in the network address pool, so as to allocate a public network address to the client for network address translation according to the marked available status.

[0013] According to another aspect of the present application, an electronic device is provided, the electronic device comprising:

[0014] at least one processor; and

[0015] A memory connected to at least one processor for data processing; wherein,

[0016] The memory stores a computer program that can be executed by at least one processor, and the computer program is executed by at least one processor so that the at least one processor can execute the network address translation method of any embodiment of the present application.

[0017] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the network address translation method of any embodiment of the present application when executed.

[0018] The technical solution of the embodiment of the present application traverses the public network addresses in the network address pool of the gateway device, and sends a detection message to the server with the public network address as the source address; determines the available status of the public network address according to the feedback of the server to the detection message; and marks the available status of each public network address in the network address pool, so as to allocate a public network address to the client for network address conversion according to the marked available status. The above scheme can actively traverse each public network address for available status detection and mark it without affecting the client's network connection, so as to allocate a public network address for network address conversion according to the marked available status when the client has a networking demand, avoids the problem of network connection failure caused by unavailable public network address, and improves the success rate and stability of network address conversion and network connection of the client.

[0019] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] 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 application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0021] Figure 1 A flowchart of a network address translation method provided in an embodiment of the present application;

[0022] Figure 2 A flowchart of a network address translation method provided by another embodiment of the present application;

[0023] Figure 3 A flowchart of a network address translation method provided in another embodiment of the present application;

[0024] Figure 4 A specific implementation flow chart provided for another embodiment of the present application;

[0025] Figure 5 A schematic diagram of the structure of a network address translation device provided in an embodiment of the present application;

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

[0027] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0028] It should be noted that the terms "first", "second", "third", "fourth", "actual", "preset", 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 interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0029] Figure 1 A flowchart of a network address translation method provided in an embodiment of the present application, the embodiment of the present application can be applied to situations where network address translation is performed. Typically, it can be applied to situations where the availability status of a public network address is detected in advance, and a public network address is allocated according to the availability status for network address translation. The method can be executed by a network address translation device, which can be implemented in the form of hardware and / or software, and the network address translation device can be configured in an electronic device, which can be a gateway device, such as a router, switch, firewall, access server, gateway server, etc. Figure 1 As shown, the method includes:

[0030] S110, traversing the public network addresses in the network address pool of the gateway device, and sending a detection message to the server with the public network address as the source address.

[0031] The network address pool is a collection of all public network addresses assigned by the server to the client. The public network addresses in the network address pool can be configured by the user in advance. In addition to configuring the public network addresses, the user also configures the port range during the configuration process. The public network address in the network address pool can contain at least one.

[0032] Generally, when performing network address translation, the gateway device selects a public network address from the network address pool and selects a port to allocate to the client for network address translation. However, if the client repeatedly disconnects from the network or performs other abnormal operations, the server will regard it as an abnormal operation and block the corresponding public network address and port. If other clients continue to connect to the network based on the public network address, the network connection will fail. In an embodiment of the present application, the gateway device actively performs detection to determine the available status of each public network address in the network address pool. Specifically, the gateway device traverses each public network address in the network address pool, and during the traversal process, uses the public network address as the source address to send a detection message to the server to pre-detect the available status of each public network address.

[0033] In the embodiment of the present application, the process of constructing the detection message includes:

[0034] The detection message is constructed based on a control message protocol; wherein the control message protocol is used to transmit control messages between the gateway device and the server, and the control message is used to detect the communication connection status between the gateway device and the server.

[0035] Among them, the control message protocol is the ICMP protocol, and the control message protocol is used to transmit control messages between the gateway device and the server, and the control message is used to detect the communication connection between the gateway device and the server, such as whether the network is connected, whether the host is reachable, whether the route is available, etc. In the embodiment of the present application, the detection is not performed only when the client network connection fails or is abnormal, but regardless of whether there is a client currently connecting to the network, the gateway device traverses the public network address, constructs a detection message based on the control message protocol, sends a detection message to the server with the public network address as the source address, and detects the availability of the public network address.

[0036] In an embodiment of the present application, any request message can also be sent to the server as a detection message based on the network protocol to determine the feedback of the server in response to the request message. For example, for some handshake connection protocols, such as the TCP protocol, no matter what the detection message contains, as long as the gateway device and the server are connected in communication, the server will have feedback. Therefore, any request message can be sent to the server as a detection message based on the protocol to determine the feedback of the server. For protocols with no feedback on message errors, such as the UDP protocol, it is necessary to adaptively construct the detection message according to the structure and content required by the server.

[0037] In the embodiment of the present application, the process of constructing the detection message includes:

[0038] determining the services provided by the server;

[0039] A request is initiated to which the service can respond, and a detection message is established according to the request.

[0040] Exemplarily, the service provided by the server can be determined in advance, a request that the service can respond to can be initiated, and a detection message can be established based on the request to avoid the server not responding due to the request in the detection message not corresponding to the server's service, thereby affecting the judgment of the communication connection status.

[0041] Exemplarily, assuming that the server can provide a query service, a query request can be initiated and a detection message can be established according to the query request.

[0042] S120: Determine the availability status of the public network address according to the feedback of the server to the detection message.

[0043] Exemplarily, if the public network address is not blocked by the server and the current available state is available, the server should be able to receive the detection message sent by the gateway device and give feedback. If the public network address is blocked by the server and the current available state is unavailable, the server cannot receive the detection message sent by the gateway device and cannot give feedback. The available state of the public network address can be determined based on the feedback of the server to the detection message. If the gateway device receives a message from the server in response to the detection message feedback, the available state of the public network address is determined to be available. If the gateway device does not receive the message fed back by the server, the available state of the public network address is determined to be unavailable.

[0044] S130: Mark the availability status of each public network address in the network address pool, so as to allocate a public network address to the client for network address translation according to the marked availability status.

[0045] Exemplarily, each public network address in the network address pool is traversed, and a detection message is sent to the server with each public network address as the source address. The available status of each public network address is determined according to the feedback from the server. In order to facilitate the intuitive determination of the available status of each public network address, each public network address is marked with an available status. Therefore, when the gateway device receives the network connection request from the client, a public network address is allocated to the client for network address conversion according to the marked available status. That is, an available public network address is selected from each public network address according to the marked available status and allocated to the client for network address conversion, so that the client can successfully connect to the network after the network conversion, avoiding the problem of network failure caused by unavailable public network address, which affects the user experience.

[0046] The technical solution of the embodiment of the present application traverses the public network addresses in the network address pool of the gateway device, and sends a detection message to the server with the public network address as the source address; determines the available status of the public network address according to the feedback of the server to the detection message; and marks the available status of each public network address in the network address pool, so as to allocate a public network address to the client for network address conversion according to the marked available status. The above scheme can actively traverse each public network address for available status detection and mark it without affecting the client's network connection, so as to allocate a public network address for network address conversion according to the marked available status when the client has a networking demand, avoids the problem of network connection failure caused by unavailable public network address, and improves the success rate and stability of network address conversion and network connection of the client.

[0047] It should be noted that although the server will block the public network address and port at the same time when it detects abnormal client access, the range of logical ports is large, there are more available logical ports, and a new port is generally randomly assigned each time a network conversion is performed. By the time the port blocked by the server is selected again, a certain period of time has passed and the server has unblocked the port. Therefore, there is no need to traverse the ports in the port pool to detect the available status and mark them, and the problem of client networking failure due to port blocking will not occur.

[0048] Figure 2 This is a flowchart of a network address translation method provided by another embodiment of the present application. The present embodiment is optimized based on the above embodiment. For solutions not described in detail in the present embodiment, please refer to the above embodiment. Figure 2 As shown, the method of the embodiment of the present application specifically includes the following steps:

[0049] S210, traversing the public network addresses in the network address pool of the gateway device, and sending a detection message to the server with the public network address as the source address.

[0050] In an embodiment of the present application, traversing the public network addresses in the network address pool of the gateway device and sending a detection message to the server with the public network address as the source address includes:

[0051] Determine the network connection status of the client, and adjust the preset frequency according to the network connection status;

[0052] The public network addresses in the network address pool of the gateway device are traversed based on a preset frequency, and a detection message is sent to the server with the public network address as the source address.

[0053] Exemplarily, the process of detecting the available status of the public network address can be performed at a preset frequency. For example, it can be set to perform the detection process every 3 seconds, and update the available status of each public network address tag in the network address pool. The preset frequency can be adjusted according to the network connection status of the client. For example, if the client can successfully connect multiple times and the network is stable, the preset frequency can be adaptively reduced. If the client fails to connect or the network is unstable, the preset frequency can be adaptively increased to timely detect the available status of each public network address to avoid problems with the client network connection due to the unavailability of the public network address.

[0054] S220: If a feedback message from the server in response to the detection message is received within a preset time, it is determined that the availability status of the public network address is available.

[0055] The preset time can be determined according to actual conditions, for example, the time from sending the detection message to receiving the message fed back by the server when the network is normally connected. If a feedback message from the server in response to the detection message is received within the preset time, it is determined that the gateway device and the server can communicate normally, and the availability status of the public network address is determined to be available.

[0056] S230. If no feedback message from the server in response to the detection message is received within a preset time, or if no feedback message from the server in response to the detection message is received after the detection message is sent to the server based on the public network address for a preset number of consecutive times, then it is determined that the available status of the public network address is unavailable.

[0057] The preset number can be set according to the actual situation. For example, it can be set to 3 times to confirm multiple times whether the feedback from the server is consistent, so as to avoid accidental events affecting the judgment of the final result.

[0058] Exemplarily, if no feedback message from the server in response to the detection message is received within a preset time, it means that the gateway device and the server are not communicating normally, and the availability status of the public network address is determined to be unavailable. Alternatively, if no feedback message from the server in response to the detection message is received within a preset time, the detection message continues to be sent to the server using the public network address as the source address. If the detection message is sent to the server based on the public network address for a preset number of consecutive times, and no feedback message from the server is received within the preset time, the availability status of the public network address is determined to be unavailable. The above-mentioned detection method is used to determine the availability status of each public network address in the network address pool.

[0059] S240: Mark the available status of each public network address in the network address pool, so as to allocate a public network address to the client for network address translation according to the marked available status.

[0060] The embodiment of the present application provides a network address translation method, if the feedback message of the server in response to the detection message is received within a preset time, the availability status of the public network address is determined to be available; if the feedback message of the server in response to the detection message is not received within the preset time, or the detection message is sent to the server based on the public network address for a preset number of consecutive times without receiving the feedback message of the server in response to the detection message, the availability status of the public network address is determined to be unavailable. The above scheme can determine the availability status of each public network address in a timely manner according to the feedback of the server, so as to facilitate the subsequent targeted selection of available public network addresses to be allocated to the client for network address translation, and avoid the problem that the client cannot connect to the Internet due to the use of unavailable public network addresses for network address translation.

[0061] Figure 3This is a flowchart of a network address translation method provided by another embodiment of the present application. The present embodiment is optimized based on the above embodiment. For solutions not described in detail in the present embodiment, please refer to the above embodiment. Figure 3 As shown, the method of the embodiment of the present application specifically includes the following steps:

[0062] S310, traversing the public network addresses in the network address pool of the gateway device, and sending a detection message to the server with the public network address as the source address.

[0063] S320: Determine the availability status of the public network address according to the feedback of the server to the detection message.

[0064] S330: If it is determined that the current available state of the public network address is inconsistent with the originally marked available state, modify the originally marked available state of the public network address to the current available state.

[0065] Exemplarily, if it is determined that the current available state of the public network address is available and the original marked available state is unavailable, the marked available state is modified to available. If it is determined that the current available state of the public network address is unavailable and the original marked available state is available, the marked available state is modified to unavailable. That is, based on the latest determined available state of the public network address, the marked available state is updated to reflect the current available state of the public network address. The marked available state can be recorded in a table.

[0066] S340: Otherwise, keep the original marked state available.

[0067] Exemplarily, if the current available state of the public network address is available and the available state of the original mark is also available, the available state of the original mark is not changed. If the current available state of the public network address is unavailable and the available state of the original mark is unavailable, the available state of the original mark is not changed.

[0068] S350: If a network connection request from a client is received, a public network address marked as available is selected from the public network addresses in the network address pool.

[0069] Exemplarily, after determining the available status of each public network address and marking them, if a network connection request from a client is received, a public network address marked as available is selected from the public network addresses in the network address pool to avoid selecting an unavailable public network address when randomly selecting a public network address, resulting in the client's network connection failure.

[0070] S370: Based on the public network address, perform network address translation on the private address of the client.

[0071] Exemplarily, the gateway device performs network address translation on the private address of the client based on the available public network address, so that the client can connect to the network normally, avoiding the problem that the client cannot access the Internet after using an unavailable public network address for network address translation.

[0072] The embodiment of the present application provides a network address conversion method. If it is determined that the current available state of the public network address is inconsistent with the available state of the original mark, the available state of the original mark of the public network address is modified to the current available state; otherwise, the available state of the original mark is maintained. If a network connection request from the client is received, a public network address with an available state marked as available is selected from each public network address in the network address pool; based on the public network address, the private address of the client is converted to a network address. The above scheme can intuitively mark the available state of the public network address, which is convenient for the gateway device to select an available public network address based on the available state of the mark to perform network conversion on the private address of the client, solving the problem that the client cannot connect to the Internet after the network conversion when the public network address is unavailable.

[0073] Figure 4 A specific implementation flow chart provided for another embodiment of the present application. Traverse the network address pool, and in each traversal process, send a detection message to the server with the currently traversed public network address as the source address. If a feedback message from the server is received within a preset time, determine whether the available state of the original mark of the public network address is available. If yes, do not modify it. If not, modify the available state of the public network address to available. If no feedback message from the server is received within the preset time, and the detection message is sent to the server with the public network address as the source address for three consecutive times without receiving a feedback message within the preset time, mark the public network address as unavailable.

[0074] Figure 5 This is a schematic diagram of the structure of a network address translation device provided in an embodiment of the present application. The device can execute the network address translation method provided in any embodiment of the present application and has the corresponding functional modules and beneficial effects of the execution method. Figure 5 As shown, the device comprises:

[0075] A detection message sending module 410, used to traverse the public network addresses in the network address pool of the gateway device, and send a detection message to the server with the public network address as the source address;

[0076] An available status determination module 420, configured to determine the available status of the public network address according to feedback from the server on the detection message;

[0077] The availability status marking module 430 is used to mark the availability status of each public network address in the network address pool, so as to allocate a public network address to the client for network address translation according to the marked availability status.

[0078] In an embodiment of the present application, the device comprises:

[0079] The first detection message construction module is used to construct the detection message based on the control message protocol; wherein the control message protocol is used to transmit control messages between the gateway device and the server, and the control message is used to detect the communication connection between the gateway device and the server.

[0080] In an embodiment of the present application, the device comprises:

[0081] The second building block of the detection message is used to:

[0082] determining the services provided by the server;

[0083] A request is initiated to which the service can respond, and a detection message is established according to the request.

[0084] In the embodiment of the present application, the available status determination module 420 determines the available status of the public network address according to the feedback of the server to the detection message, including:

[0085] If a feedback message from the server in response to the detection message is received within a preset time, determining that the availability status of the public network address is available;

[0086] If no feedback message from the server in response to the detection message is received within a preset time, or if no feedback message from the server in response to the detection message is received after the detection message is sent to the server based on the public network address for a preset number of consecutive times, then the available status of the public network address is determined to be unavailable.

[0087] In the embodiment of the present application, the available status marking module 430 marks the available status of each public network address in the network address pool, including:

[0088] If it is determined that the current available state of the public network address is inconsistent with the originally marked available state, modifying the originally marked available state of the public network address to the current available state;

[0089] Otherwise, keep the original markup enabled.

[0090] In the embodiment of the present application, the device further includes:

[0091] A public network address selection module, configured to select a public network address with a marked available status from each public network address in the network address pool if a network connection request from a client is received;

[0092] The network address translation module is used to perform network address translation on the private address of the client based on the public network address.

[0093] In the embodiment of the present application, the detection message sending module 410 traverses the public network addresses in the network address pool of the gateway device, and sends the detection message to the server with the public network address as the source address, including:

[0094] Determine the network connection status of the client, and adjust the preset frequency according to the network connection status;

[0095] The public network addresses in the network address pool of the gateway device are traversed based on a preset frequency, and a detection message is sent to the server with the public network address as the source address.

[0096] A network address translation device provided in an embodiment of the present application can execute a network address translation method provided in any embodiment of the present application, and has functional modules and beneficial effects corresponding to the execution method.

[0097] Figure 6 A schematic diagram of an electronic device 10 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.

[0098] like Figure 6As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the data processing of the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0099] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a data processing unit 19, such as a network card, a modem, a wireless data processing transceiver, etc. The data processing unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0100] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as a network address translation method.

[0101] In some embodiments, the network address translation method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the data processing unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the network address translation method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the network address translation method in any other appropriate manner (e.g., by means of firmware).

[0102] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0103] The computer programs for implementing the methods of the present application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable network address translation device, so that when the computer programs are executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer programs may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0104] In the context of the present application, a computer readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device or equipment. A computer readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer readable storage medium may be a machine readable signal medium. A more specific example of a machine readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0105] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0106] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data processing (e.g., a data processing network). Examples of data processing networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0107] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a data processing network. The client and server relationship is generated by computer programs running on the respective computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0108] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the information expected by the technical solution of this application can be achieved, and this document is not limited here.

[0109] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.

Claims

1. A network address translation method, characterized in that: The method comprises: Traversing the public network addresses in the network address pool of the gateway device, and sending a detection message to the server with the public network address as the source address; Determine the availability status of the public network address according to the feedback of the server to the detection message; Each public network address in the network address pool is marked as available, so as to allocate a public network address to the client for network address translation according to the marked available status.

2. The method according to claim 1, characterized in that The construction process of the detection message includes: The detection message is constructed based on a control message protocol; wherein the control message protocol is used to transmit control messages between the gateway device and the server, and the control message is used to detect the communication connection status between the gateway device and the server.

3. The method according to claim 1, characterized in that The construction process of the detection message includes: determining the services provided by the server; A request is initiated to which the service can respond, and a detection message is established according to the request.

4. The method according to claim 1, characterized in that: Determining the availability status of the public network address according to the feedback of the server to the detection message includes: If a feedback message from the server in response to the detection message is received within a preset time, determining that the availability status of the public network address is available; If no feedback message from the server in response to the detection message is received within a preset time, or if no feedback message from the server in response to the detection message is received after the detection message is sent to the server based on the public network address for a preset number of consecutive times, then the available status of the public network address is determined to be unavailable.

5. The method according to claim 1, characterized in that Marking each public network address in the network address pool as available includes: If it is determined that the current available state of the public network address is inconsistent with the originally marked available state, modifying the originally marked available state of the public network address to the current available state; Otherwise, keep the original markup enabled.

6. The method according to any one of claims 1 to 5, characterized in that After marking each public network address in the network address pool as available, the method further includes: If a network connection request from a client is received, selecting a public network address with an available status marked as available from each public network address in the network address pool; Based on the public network address, the private address of the client is converted to a network address.

7. The method according to claim 1, characterized in that Traversing the public network addresses in the network address pool of the gateway device, and sending a detection message to the server with the public network address as the source address, including: Determine the network connection status of the client, and adjust the preset frequency according to the network connection status; The public network addresses in the network address pool of the gateway device are traversed based on a preset frequency, and a detection message is sent to the server with the public network address as the source address.

8. A network address translation device, characterized in that: The device comprises: A detection message sending module, used to traverse the public network addresses in the network address pool of the gateway device, and send a detection message to the server with the public network address as the source address; An available status determination module, used to determine the available status of the public network address according to the feedback of the server to the detection message; The available status marking module is used to mark the available status of each public network address in the network address pool, so as to allocate a public network address to the client for network address translation according to the marked available status.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and A memory connected to the at least one processor for data processing; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the network address translation method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the network address translation method according to any one of claims 1 to 7 when executed.