CN110099139B - Address detection method and device - Google Patents

Address detection method and device Download PDF

Info

Publication number
CN110099139B
CN110099139B CN201910346348.9A CN201910346348A CN110099139B CN 110099139 B CN110099139 B CN 110099139B CN 201910346348 A CN201910346348 A CN 201910346348A CN 110099139 B CN110099139 B CN 110099139B
Authority
CN
China
Prior art keywords
address
detection
nat
priority
duration
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910346348.9A
Other languages
Chinese (zh)
Other versions
CN110099139A (en
Inventor
解永娟
张恒
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
New H3C Security Technologies Co Ltd
Original Assignee
New H3C Security Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by New H3C Security Technologies Co Ltd filed Critical New H3C Security Technologies Co Ltd
Priority to CN201910346348.9A priority Critical patent/CN110099139B/en
Publication of CN110099139A publication Critical patent/CN110099139A/en
Application granted granted Critical
Publication of CN110099139B publication Critical patent/CN110099139B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/256NAT traversal

Abstract

The embodiment of the application provides an address detection method and device, which are applied to NAT equipment and comprise the following steps: when detecting that the current detection period reaches a first address in an NAT address pool, sending a detection message with the first address as a source address to a server; and the duration of a detection period of a second address with the priority higher than the preset priority in the source addresses of the detection messages in the NAT address pool is reduced by the first duration, the duration of a detection period of a third address with the priority lower than or equal to the preset priority in the source addresses of the detection messages in the NAT address pool is increased by the second duration, and the adjusted detection period is used as the current detection period. The historical change times of the detection results of the addresses with high priority are larger than the historical change times of the detection results of the addresses with low priority. By applying the technical scheme provided by the embodiment of the application, the address detection duration can be reduced, and the NAT forwarding influence on the user service message is reduced.

Description

Address detection method and device
Technical Field
The present application relates to the field of communications technologies, and in particular, to an address detection method and apparatus.
Background
In order to adapt to a networking environment in which a large number of users in an internal Network access an external Network, a Network Address Translation (NAT) Address pool is stored in a NAT device. When a user accesses an external network, the NAT equipment randomly selects an address from the address pool, and converts the source address of the data message into the selected address. However, if an address in the NAT address pool is masked by a server of the external network, the NAT device converts the source address of the message sent by the internal network user into the address, and sends the address to the server of the external network, and the server discards the message, so that the internal network user cannot normally access the server of the external network using the address.
In order to ensure that an internal network user normally accesses a server of an external network, the NAT device periodically detects each address in the NAT address pool, that is, periodically sends a detection message for each address in the NAT address pool. For an address, if the corresponding probe response message is not received, the NAT device excludes the address from the NAT address pool, and temporarily prohibits the use of the address.
Multiple NAT address pools may be stored in a NAT device, with each NAT address pool including hundreds of thousands or millions of addresses. If the NAT device periodically detects hundreds of thousands or millions of addresses included in the NAT address pool, the time for detecting the addresses will be long, and NAT forwarding of user service messages is affected.
Disclosure of Invention
An object of the embodiments of the present application is to provide an address detection method and apparatus, so as to reduce the address detection duration and reduce the NAT forwarding impact on a user service packet. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application provides an address detection method, which is applied to a NAT device, and the method includes:
when detecting that a current detection period of a first address in an NAT address pool is reached, sending a detection message with the first address as a source address to a server;
reducing the duration of a detection period of a second address with a priority higher than a preset priority in the source addresses serving as the detection messages in the NAT address pool by a first duration, and increasing the duration of a detection period of a third address with a priority lower than or equal to the preset priority in the source addresses serving as the detection messages in the NAT address pool by a second duration, wherein the historical change times of detection results of addresses with high priorities are greater than the historical change times of detection results of addresses with low priorities;
and taking the adjusted detection period as the current detection period, and returning to execute the step when the current detection period reaching the first address in the NAT address pool is detected.
In a second aspect, an embodiment of the present application provides an address detection apparatus, which is applied to a NAT device, and the apparatus includes:
the detection unit is used for sending a detection message with a first address as a source address to the server when detecting that the current detection period reaches the first address in the NAT address pool;
an adjusting unit, configured to decrease a duration of a detection period of a second address having a higher priority than a preset priority in source addresses serving as detection messages in the NAT address pool by a first duration, increase a duration of a detection period of a third address having a lower priority than or equal to the preset priority in source addresses serving as detection messages in the NAT address pool by a second duration, take the adjusted detection period as a current detection period, and trigger the detecting unit to send a detection message with the first address as the source address to a server when it is detected that the current detection period of the first address in the NAT address pool is reached; the historical change times of the detection results of the addresses with high priority are larger than the historical change times of the detection results of the addresses with low priority.
In a third aspect, embodiments of the present application provide a NAT device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being caused by the machine-executable instructions to: implementing any of the steps of the address detection method described above.
In a fourth aspect, embodiments of the present application provide a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being caused by the machine-executable instructions to: implementing any of the steps of the address detection method described above.
In the technical scheme provided by the embodiment of the application, the NAT equipment sets the priority of the address with more detection result historical change times in the NAT address pool to be higher than the priority of the address with less detection result historical change times. In addition, the NAT equipment reduces the time length of the detection period of the address with high priority by a first time length, and increases the time length of the detection period of the address with low priority by a second time length, namely, the detection of the address with high priority is shortened, the detection of the address with low priority is increased, the number of the detected addresses at the same time is reduced, the time length of each address detection is reduced, and the NAT forwarding influence on the user service message is reduced.
Of course, it is not necessary for any product or method of the present application to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a first flowchart of an address detection method according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of a second address detection method according to an embodiment of the present disclosure;
fig. 3 is a third flowchart illustrating an address detection method according to an embodiment of the present application;
fig. 4 is a fourth flowchart illustrating an address detection method according to an embodiment of the present application;
fig. 5 is a schematic flowchart of a fifth address detection method according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an address detection apparatus according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a NAT device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Currently, multiple NAT address pools may be stored in a NAT device, and each NAT address pool includes hundreds of thousands or millions of addresses. If the NAT device periodically detects hundreds of thousands or millions of addresses included in the NAT address pool, the time for detecting the addresses will be long, and NAT forwarding of user service messages is affected.
In order to reduce the address detection duration and reduce the NAT forwarding influence on the user service packet, the embodiment of the present application provides an address detection method. The method is applied to the NAT equipment. Specifically, in the method, the NAT device sets the priority of the address with the high number of historical changes of the detection result in the NAT address pool to be higher than the priority of the address with the low number of historical changes of the detection result. In addition, the NAT equipment reduces the time length of the detection period of the address with high priority by a first time length, and increases the time length of the detection period of the address with low priority by a second time length, namely, the detection of the address with high priority is shortened, the detection of the address with low priority is increased, the number of the detected addresses at the same time is reduced, the time length of each address detection is reduced, and the NAT forwarding influence on the user service message is reduced.
The address detection method provided in the embodiments of the present application is described below with specific embodiments.
Referring to fig. 1, fig. 1 is a schematic flowchart of a first address detection method according to an embodiment of the present disclosure. The method is applied to the NAT equipment and comprises the following steps.
Step 101, when detecting a current detection period reaching a first address in an NAT address pool, sending a detection message with the first address as a source address to a server.
The NAT device may include one or more pools of NAT addresses. The NAT device periodically detects whether there is a probe period duration to reach one or more addresses (hereinafter referred to as first addresses) at the current time. If the address exists, the NAT device sends a detection message with the first address as a source address to the server, and obtains the detection result of the first address.
For example, the NAT address pool includes addresses 1-10. The NAT equipment sets the duration of the detection period of the addresses 1-5 to be 10 minutes and the duration of the detection period of the addresses 6-10 to be 15 minutes at 10: 00. Addresses 1-5 arrive at the probe cycle when 10:10 is reached. At this time, the first address includes addresses 1-5, and the NAT device sends a detection message to the server with the addresses 1-5 as source addresses, and obtains the detection result of the addresses 1-5. Addresses 6-10 are detected to reach the probe period when 10:15 is reached. At this time, the first address includes addresses 6-10, and the NAT device sends a detection message to the server with the addresses 6-10 as source addresses, and obtains the detection result of the addresses 6-10 this time.
For each first address, the process of detecting the NAT device is as follows: and sending a detection message to the server by taking the first address as a source address. And after receiving the detection message, the server sends a detection response message with the destination address of the first address to the NAT equipment. Based on the detection response message, the NAT equipment determines the detection result taking the first address as a source address and the server address as a destination address. For example, if the NAT device receives a probe response packet whose destination address is a first address (assuming address a), it is determined that the server does not shield the address a, and the current probe result of the address a is: the use state of the address a is a usable state. If the NAT device does not receive the probe response message with the destination address being the first address (assuming address B), it is determined that the server shields the address B, and the current probe result of the address B is: the use state of the address B is a use prohibition state.
102, reducing the duration of a detection period of a second address with the priority higher than the preset priority in the source addresses of the detection messages in the NAT address pool by a first duration, and increasing the duration of a detection period of a third address with the priority lower than or equal to the preset priority in the source addresses of the detection messages in the NAT address pool by a second duration. The historical change times of the detection results of the addresses with high priority are larger than the historical change times of the detection results of the addresses with low priority.
In the embodiment of the application, the first time length and the second time length can be set according to actual needs. The first duration and the second duration may be the same or different. In one embodiment, the first duration and the second duration may be the same as a period duration for detecting whether a probing result of each address in the NAT address pool changes by the NAT device.
After the NAT equipment determines the first address, the duration of a detection period of a second address with the priority higher than the preset priority in the source address serving as the detection message in the NAT address pool is reduced by the first duration, and the duration of a detection period of a third address with the priority lower than or equal to the preset priority in the source address serving as the detection message in the NAT address pool is increased by the second duration. In this embodiment of the present application, the use of the source address as the detection packet in the NAT address pool may include: an address in the NAT address pool, and/or the first address.
If the priority of an address is higher than the preset priority, the historical detection result of the address can be determined to change frequently, the server occasionally masks the address, the address can be occasionally used, and the duration of the detection period of the address is reduced in order to accurately determine the use state of the address. If the priority of an address is lower than or equal to the preset priority, the historical detection result of the address is determined not to change very frequently, and in order to reduce the burden of the NAT equipment, the duration of the detection period of the address is increased.
The example in step 101 is still used as an example for explanation. The first and second time periods are both 5 minutes. When 10:10 is reached, addresses 1-5 reach the probe cycle, with addresses 1-5 being the first addresses. Wherein, addresses 1-5 in the NAT address pool are used as the source address of the detection message. If the priority of the address 1-3 is higher than the preset priority and the priority of the address 4-5 is lower than or equal to the preset priority, the NAT device decreases the duration of the probing period of the address 1-3 by 5 minutes, that is, sets the duration of the probing period of the address 1-3 to 10-5 minutes; the duration of the probe period for the addresses 4-5 is increased by 5 minutes, that is, the duration of the probe period for the addresses 4-5 is set to 15 minutes, which is 10+ 5. In this case, addresses 1-3 arrive at the probe cycle when 10:15 is reached. Addresses 4-5 arrive at the probe cycle when 10:25 is reached.
In an embodiment of the present application, when adjusting the duration of the probing period, the NAT device may further implement the duration of the probing period of the address with a higher priority, where the decreased duration is longer, and the increased duration is longer for the duration of the probing period of the address with a lower priority. Specifically, the NAT device stores a duration adjustment policy in advance: the time duration of the decrease corresponding to the first priority higher than the preset priority and the time duration of the increase corresponding to the second priority lower than the preset priority. In one example, the first priority corresponds to a decreasing duration (i.e., a first duration) and the second priority corresponds to an increasing duration (i.e., a second duration). The NAT equipment determines that the priority of an address is higher than a preset priority, determines a first time length corresponding to the priority of the address according to a corresponding relation between the pre-stored priority and the first time length, and reduces the time length of a detection period of the address by the first time length corresponding to the priority of the address. The NAT equipment determines that the priority of an address is lower than or equal to a preset priority, determines a second time length corresponding to the priority of the address according to a corresponding relation between the pre-stored priority and the first time length, and increases the time length of the detection period of the address by the second time length corresponding to the priority of the address.
In an embodiment of the present application, in order to avoid increasing the load of the NAT device due to the excessive frequency of address detection, the shortest duration T of the detection period may be setmin. If the duration of a detection period of a second address with the priority higher than the preset priority in the source address serving as the detection message in the NAT address pool is reduced by the preset duration, the duration is less than TminIf the priority of the source address serving as the detection message in the NAT address pool is higher than the preset priority, the NAT device sets the duration of the detection period of a second address with the priority higher than the preset priority in the source address serving as the detection message in the NAT address pool as Tmin
In this embodiment, the NAT device may set the initial duration of the detection period of the address in the NAT address pool to TminThe first duration and the second duration may be based on TminThe setting is performed. For example, the first time period and the second time period may be TminOr 1/2Tmin
In an embodiment of the present application, in order to avoid that the NAT device cannot obtain the use state of the address in time due to the too low frequency of address detection, the longest duration T of the detection period may be setmax. If the duration of the detection period of the third address with the priority lower than or equal to the preset priority in the source address serving as the detection message in the NAT address pool is increased by the second duration, the duration is greater than TmaxIf the priority of the source address serving as the detection message in the NAT address pool is lower than or equal to the preset priority, the NAT device detects the period of the third address with the priority lower than or equal to the preset priorityLength is set to Tmax
In an alternative embodiment, in order to facilitate management of the priorities of the addresses in the NAT address pool and the durations of the probing periods, the following table may be used to record the priorities of the addresses and the durations of the probing periods.
Figure BDA0002042394500000061
Figure BDA0002042394500000071
In the embodiment of the application, the NAT device may send the detection message to the plurality of servers at the same time to detect the address in the NAT address pool. For each server, the above table for recording the priority of each address and the duration of the probing period can be set.
In the embodiment of the application, the NAT device may send the detection message to the plurality of servers at the same time to detect the address in the NAT address pool. For each server, the NAT device may use the process of step 101 to detect addresses in the NAT address pool.
And 103, taking the adjusted detection period as the current detection period, and returning to execute the step 101.
In the address detection method provided by the embodiment of the application, the NAT device sets the priority of the address with the high detection result history change frequency in the NAT address pool to be higher than the priority of the address with the low detection result history change frequency. In addition, the NAT equipment reduces the time length of the detection period of the address with high priority by a first time length, and increases the time length of the detection period of the address with low priority by a second time length, namely, the detection of the address with high priority is shortened, the detection of the address with low priority is increased, the number of the detected addresses at the same time is reduced, the time length of each address detection is reduced, and the NAT forwarding influence on the user service message is reduced. And because the historical change times of the detection results of the addresses with high priority are greater than the historical change times of the detection results of the addresses with low priority, the detection times of the members of the address pool with long-term unchanged detection results can be reduced, the addresses with frequent change of the detection results are preferentially detected, the equipment pressure can be relieved to a greater extent, the detection efficiency of the whole address pool is improved, and the problem that the detection results of the address pool are slow to update is effectively avoided.
Based on the above embodiment of the address detection method shown in fig. 1, the embodiment of the present application further provides an address detection method. Referring to fig. 2, fig. 2 is a schematic flowchart of a second address detection method according to an embodiment of the present disclosure. The method is applied to the NAT equipment and can comprise the following steps.
Step 201, when detecting the current detection period reaching the first address in the NAT address pool, sending a detection message with the first address as a source address to the server. Step 201 is the same as step 101.
Step 202, judging whether the number of the addresses included in the NAT address pool is greater than a first preset number threshold value. If yes, step 203. If not, go to step 201.
The first preset number threshold value can be set according to actual requirements.
The NAT equipment judges whether the number of the addresses in the NAT address pool is larger than a first preset number threshold value or not. If the number of the addresses included in the NAT address pool is greater than the first preset number threshold, the NAT device may determine that the number of the addresses included in the NAT address pool is large, and detect the addresses included in the NAT address pool at the same time, which may result in a problem that the time for detecting the addresses is long and the NAT forwarding of the user service packet is greatly affected, step 203 may be executed to detect each first address, and adjust the duration of the detection period of each address in the NAT address pool. If the number of the addresses included in the NAT address pool is less than or equal to the first preset number threshold, the NAT device may determine that the number of the addresses included in the NAT address pool is small, and detect the addresses included in the NAT address pool at the same time, which may not cause the problem that the address detection time is long and the NAT forwarding of the user service packet is greatly affected, step 201 may be executed to detect each first address, but the duration of the detection period of each address included in the NAT address pool is not adjusted.
In the embodiment of the present application, the execution order of step 201 and step 202 is not limited.
Step 203, decreasing the duration of the detection period of the second address with the priority higher than the preset priority in the NAT address pool by the first duration, and increasing the duration of the detection period of the third address with the priority lower than or equal to the preset priority in the NAT address pool by the second duration. The historical change times of the detection results of the addresses with high priority are larger than the historical change times of the detection results of the addresses with low priority. Step 203 is the same as step 102.
And step 204, taking the adjusted detection period as the current detection period, and returning to execute the step 201. Step 204 is the same as step 103.
In the embodiment of the application, if the number of the addresses included in the NAT address pool is greater than the first preset number threshold, the NAT device adjusts the duration of the detection period of each address in the NAT address pool. And if the number of the addresses included in the NAT address pool is not greater than the first preset number threshold, the NAT equipment does not adjust the duration of the detection period of each address in the NAT address pool. That is, the NAT device can determine whether to adjust the duration of the detection period of each address in the NAT address pool according to the actual situation, thereby improving the flexibility of the address detection method.
Based on the above embodiment of the address detection method shown in fig. 1, the embodiment of the present application further provides an address detection method. Referring to fig. 3, fig. 3 is a third flowchart illustrating an address detection method according to an embodiment of the present application. The method is applied to the NAT equipment and can comprise the following steps.
Step 301, when detecting that the current detection period reaches the first address in the NAT address pool, sending a detection message with the first address as a source address to the server. Step 301 is the same as step 101.
Step 302, determine whether the number of the first addresses is greater than a second predetermined number threshold. If yes, step 303. If not, go to step 301.
The second preset number threshold value can be set according to actual requirements.
And the NAT equipment judges whether the number of the first addresses is larger than a second preset number threshold value or not. If the number of the detected addresses is greater than the second preset number threshold, the NAT device may determine that the number of the detected addresses is large, and simultaneously send a detection message using the first address as the source address, which may result in a problem that the time for detecting the addresses is long and the NAT forwarding of the user service message is greatly affected, step 303 may be executed to detect each first address, and adjust the duration of the detection period of each first address, so as to reduce the number of the detected addresses at one time in the next detection. If the number is smaller than or equal to the second preset number threshold, the NAT device may determine that the number of detected addresses is small, and detect each first address at the same time, which may not cause the problem that the time for detecting the address is long and the NAT forwarding of the user service packet is greatly affected, and may execute step 301, detect each first address, but not adjust the duration of the detection period of each first address.
Step 303, decreasing the duration of the detection period of the second address with the priority higher than the preset priority in the first address by the first duration, and increasing the duration of the detection period of the third address with the priority lower than or equal to the preset priority in the first address by the second duration. The historical change times of the detection results of the addresses with high priority are larger than the historical change times of the detection results of the addresses with low priority. Step 303 is the same as step 102.
And step 304, taking the adjusted detection period as the current detection period, and returning to execute the step 301. Step 304 is the same as step 103.
In the embodiment of the application, if the number of the first addresses is greater than the second preset number threshold, the NAT device adjusts the duration of the detection period of the addresses. And if the determined number of the addresses is not greater than the second preset number threshold, the NAT equipment does not adjust the duration of the detection period of the addresses. That is, the NAT device can determine whether to adjust the duration of the address detection period according to the actual situation, thereby improving the flexibility of the address detection method.
In an embodiment of the present application, the duration of the detection period of each address can be adjusted by combining the embodiments shown in fig. 2 and fig. 3, and refer to the flowchart shown in fig. 4. The method may include the following steps.
Step 401, when detecting that the current detection period reaches the first address in the NAT address pool, sending a detection message with the first address as a source address to the server.
Step 402, judging whether the number of the addresses included in the NAT address pool is greater than a first preset number threshold value. If yes, step 403. If not, go to step 401.
In step 403, it is determined whether the number of the first addresses is greater than a second preset number threshold. If yes, step 404. If not, go to step 401.
It should be understood that in other examples, step 402 may be performed after step 403, where step 403 is performed when the first number of addresses is determined to be greater than the second preset number threshold, and step 402 is performed when the number of addresses included in the NAT address pool is determined to be greater than the first preset number threshold, and step 404 is performed when step 402 is determined to be greater than the first preset number threshold.
Step 404, decreasing the duration of the detection period of the second address with the priority higher than the preset priority in the source addresses of the detection messages in the NAT address pool by the first duration, and increasing the duration of the detection period of the third address with the priority lower than or equal to the preset priority in the source addresses of the detection messages in the NAT address pool by the second duration. The historical change times of the detection results of the addresses with high priority are larger than the historical change times of the detection results of the addresses with low priority.
Here, step 404 may select to adjust the duration of the probing period of each address in the NAT address pool, or may select to adjust the duration of the probing period of the first address.
Step 405, taking the adjusted detection period as the current detection period, and returning to execute step 401.
The above description of step 401 and step 405 is relatively simple, and reference may be made to the description of fig. 1-3.
In an embodiment of the present application, after obtaining the current detection result of each address, since the durations of the detection cycles of the addresses in the NAT address pool are not necessarily completely the same, there may be some addresses in the NAT address pool in one detection and the detection is not performed, that is, the current detection result of the some addresses cannot be obtained. In order to facilitate the NAT device to analyze the use state of each address in the NAT address pool, after receiving the current detection result sent by the server for the detection message with the first address as the source address, the NAT device regards each address in the NAT address pool except the first address, that is, each address in the NAT address pool for which the detection result is not obtained this time, and the NAT device uses the last detection result of the address as the current detection result of the address.
In an optional embodiment, after determining the current probing result of each address in the NAT address pool, for each address in the NAT address pool, the NAT device determines whether the current probing result of the address is the same as the last probing result of the address. If not, the priority of the address is increased by a first preset value. Wherein, the first preset value is set as a positive integer, such as 1, 2, 3, etc.
In one example, for each first address, the NAT device determines whether the current probing result of the first address is the same as the last probing result of the address. If not, the NAT equipment increases the priority of the first address by a first preset value. For the addresses except the first address in the NAT address pool, the NAT device determines that the current detection result of the address is the same as the last detection result of the address, and does not modify the priority of the address. Through this scheme, can reduce the detection number of times to the long-term unchangeable address pool member of probing result, preferentially survey the frequent address of probing result change, can alleviate equipment pressure to a great extent, improve the detection efficiency in whole address pool to the slow problem of address pool probing result update is effectually avoided.
In an embodiment of the present application, the NAT device may set a statistical duration, and reset the statistical duration if the statistical duration is reached, and set a priority of each address included in the NAT address pool as an initial priority, where the initial priority is lower than a preset priority. Wherein the initial priority may be set to 0, 1, etc.
For example, the statistical duration is 1 hour, and at 10:00, the NAT device starts address detection. And when the address reaches 11:00, the statistical time duration is reached, the statistical time duration is reset, and the priority of each address included in the NAT address pool is set as the initial priority. And when the 12:00 is reached, the statistical time length is reached again, the statistical time length is reset, and the priority of each address included in the NAT address pool is set as the initial priority.
The address detection method provided in the embodiment of the present application is described below with reference to fig. 5. The NAT address pool of the NAT device comprises addresses 1-10. The following is address probing for one server.
In step 51, the NAT device starts probing for addresses 1-10.
And step 52, the NAT equipment acquires the detection result of the addresses 1-10.
In step 53, the NAT device determines a probing period to reach the first address in the NAT address pool.
And step 54, the NAT device determines whether the number of addresses in the NAT address pool is greater than a first preset number threshold. If yes, go to step 55. If not, go to step 58.
And step 55, aiming at each address in the NAT address pool, the NAT equipment judges whether the priority of the address is higher than the preset priority or not. If so, step 56 is performed. If not, step 57 is performed.
Step 56, the NAT device decreases the duration of the probe period in the address by the first duration.
And 57, the NAT device increases the duration of the detection period of the address by a second duration.
In one embodiment, to conserve device resources, the NAT device may adjust the duration of the probing period for the first address. That is, the NAT device decreases the duration of the detection period of the second address having the priority higher than the preset priority among the first addresses by the first duration, and increases the duration of the detection period of the third address having the priority lower than or equal to the preset priority among the first addresses by the second duration.
And step 58, the NAT device sends a detection message to the server respectively with each first address as a source address to obtain the current detection result of each first address, and takes the last detection result of each address except the first address in the NAT address pool as the current detection result of the address.
Step 59, aiming at each address in the NAT address pool, the NAT device determines whether the current detection result of the address is the same as the last detection result of the address. If not, go to step 50. If the address detection result is the same, the address detection is not finished.
And step 50, the NAT equipment increases the priority of the address by a first preset value.
Reference is made to the embodiments shown in fig. 1-4 above for steps 51-50 above.
According to the address detection method, the embodiment of the application also provides an address detection device. Referring to fig. 6, fig. 6 is a schematic structural diagram of an address detection apparatus according to an embodiment of the present disclosure. The device is applied to NAT equipment, and comprises: detection unit 601 and adjustment unit 602.
A detecting unit 601, configured to send a detection packet with a first address as a source address to a server when detecting a current detection period of reaching the first address in an NAT address pool;
an adjusting unit 602, configured to decrease a duration of a detection period of a second address having a higher priority than a preset priority in source addresses serving as detection messages in the NAT address pool by a first duration, increase a duration of a detection period of a third address having a lower priority than or equal to the preset priority in source addresses serving as detection messages in the NAT address pool by a second duration, take the adjusted detection period as a current detection period, and trigger the detecting unit to send a detection message with the first address as the source address to a server when it is detected that the current detection period of the first address in the NAT address pool is reached; the historical change times of the detection results of the addresses with high priority are larger than the historical change times of the detection results of the addresses with low priority.
In an embodiment of the application, the address detection apparatus may further include: the judging unit is used for judging whether the number of the source addresses serving as the detection messages in the NAT address pool meets a period adjustment condition or not, and triggering the adjusting unit to adjust the duration of the detection period under the condition that the number of the source addresses meets the period adjustment condition;
wherein, the source address as the detection message in the NAT address pool comprises: addresses in the NAT address pool, and/or the first address; the period adjustment condition includes any one or a combination of:
the number of the addresses in the NAT address pool is larger than a first preset number threshold;
the number of the first addresses is larger than a second preset number threshold
In an embodiment of the application, the adjusting unit 602 may specifically be configured to:
determining a first time length corresponding to a second address with the priority higher than a preset priority in source addresses serving as detection messages in the NAT address pool according to a corresponding relation between the pre-stored priority and the first time length, and determining a second time length corresponding to a third address with the priority lower than or equal to the preset priority in the source addresses serving as the detection messages in the NAT address pool according to a corresponding relation between the pre-stored priority and the second time length;
and reducing the duration of the detection period of the second address by a first duration corresponding to the second address, and increasing the duration of the detection period of the third address by a second duration corresponding to the third address.
In an embodiment of the present application, the detecting unit 603 may further be configured to:
receiving a current detection result which is sent by the server and aims at the detection message with the first address as a source address; and aiming at each address except the first address in the NAT address pool, taking the last detection result of the address as the current detection result of the address.
In an embodiment of the present application, the detecting unit 603 may further be configured to:
determining the detection result of each address in the NAT address pool; aiming at each address in the NAT address pool, judging whether the current detection result of the address is the same as the last detection result of the address; if not, the priority of the address is increased by a first preset value.
In an embodiment of the application, the address detection apparatus may further include:
and the resetting unit is used for resetting the counting time length if the counting time length is reached, and setting the priority of each address included in the NAT address pool as an initial priority, wherein the initial priority is lower than the preset priority.
In the address detection apparatus provided in the embodiment of the present application, the NAT device sets the priority of the address with the high detection result change number in the NAT address pool to be higher than the priority of the address with the low detection result change number. In addition, the NAT equipment reduces the duration of the detection period of the address with high priority by the preset duration, and increases the duration of the detection period of the address with low priority by the preset duration, namely, the detection of the address with high priority is shortened, the detection of the address with low priority is increased, the number of the detection addresses at the same time is reduced, the duration of each address detection is reduced, and the NAT forwarding influence on the user service message is reduced.
According to the address detection method, an embodiment of the present application further provides a NAT device, as shown in fig. 7, including a processor 701 and a machine-readable storage medium 702, where the machine-readable storage medium 702 stores machine-executable instructions that can be executed by the processor 701. The processor 701 is caused by machine executable instructions to implement:
when detecting that a current detection period of a first address in an NAT address pool is reached, sending a detection message with the first address as a source address to a server;
reducing the duration of a detection period of a second address with a priority higher than a preset priority in the source addresses serving as the detection messages in the NAT address pool by a first duration, and increasing the duration of a detection period of a third address with a priority lower than or equal to the preset priority in the source addresses serving as the detection messages in the NAT address pool by a second duration, wherein the historical change times of detection results of addresses with high priorities are greater than the historical change times of detection results of addresses with low priorities;
and taking the adjusted detection period as the current detection period, and returning to execute the step when the current detection period reaching the first address in the NAT address pool is detected.
In the NAT device provided in the embodiment of the present application, the NAT device sets the priority of the address with the high change number of detection results in the NAT address pool to be higher than the priority of the address with the low change number of detection results. In addition, the NAT equipment reduces the duration of the detection period of the address with high priority by the preset duration, and increases the duration of the detection period of the address with low priority by the preset duration, namely, the detection of the address with high priority is shortened, the detection of the address with low priority is increased, the number of the detection addresses at the same time is reduced, the duration of each address detection is reduced, and the NAT forwarding influence on the user service message is reduced.
In an optional embodiment, as shown in fig. 7, the NAT device may further include: a communication interface 703 and a communication bus 704; the processor 701, the machine-readable storage medium 702, and the communication interface 703 complete mutual communication via the communication bus 704, and the communication interface 703 is used for communication between the NAT device and other devices.
The communication bus 704 may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The communication bus 704 may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 7, but this is not intended to represent only one bus or type of bus.
The machine-readable storage medium 702 may include a RAM (Random Access Memory) and a NVM (Non-Volatile Memory), such as at least one disk Memory. Additionally, the machine-readable storage medium 702 may also be at least one memory device located remotely from the aforementioned processor.
The Processor 701 may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also DSPs (Digital Signal Processing), ASICs (Application Specific Integrated circuits), FPGAs (Field Programmable Gate arrays) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
According to the address detection method, the embodiment of the present application further provides a machine-readable storage medium, which stores machine executable instructions capable of being executed by a processor, and the processor is caused by the machine executable instructions to implement any of the address detection method steps shown in fig. 1 to 5.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the embodiments of the address detection apparatus, the NAT device and the machine-readable storage medium, since they are substantially similar to the embodiments of the address detection method, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the embodiments of the address detection method.
The above description is only for the preferred embodiment of the present application, and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims (14)

1. An address detection method applied to a Network Address Translation (NAT) device, the method comprising:
when detecting that a current detection period of a first address in an NAT address pool is reached, sending a detection message with the first address as a source address to a server;
reducing the duration of a detection period of a second address with a priority higher than a preset priority in the source addresses serving as the detection messages in the NAT address pool by a first duration, and increasing the duration of a detection period of a third address with a priority lower than or equal to the preset priority in the source addresses serving as the detection messages in the NAT address pool by a second duration, wherein the historical change times of detection results of addresses with high priorities are greater than the historical change times of detection results of addresses with low priorities;
and taking the adjusted detection period as the current detection period, and returning to execute the step when the current detection period reaching the first address in the NAT address pool is detected.
2. The method of claim 1, further comprising:
judging whether the number of the source addresses serving as the detection messages in the NAT address pool meets a period adjustment condition, if so, reducing the time length of a detection period of a second address with the priority higher than the preset priority in the source addresses serving as the detection messages in the NAT address pool by a first time length, and increasing the time length of a detection period of a third address with the priority lower than or equal to the preset priority in the source addresses serving as the detection messages in the NAT address pool by a second time length;
wherein, the source address as the detection message in the NAT address pool includes: addresses in the NAT address pool, and/or the first address; the period adjustment condition includes any one or a combination of:
the number of the addresses in the NAT address pool is larger than a first preset number threshold;
the number of the first addresses is larger than a second preset number threshold.
3. The method according to claim 1, wherein the step of decreasing the duration of the probing cycle of the second address with the priority higher than the preset priority among the source addresses of the probing messages in the NAT address pool by the first duration, and increasing the duration of the probing cycle of the third address with the priority lower than or equal to the preset priority among the source addresses of the probing messages in the NAT address pool by the second duration comprises:
determining a first time length corresponding to a second address with the priority higher than a preset priority in source addresses serving as detection messages in the NAT address pool according to a corresponding relation between the pre-stored priority and the first time length, and determining a second time length corresponding to a third address with the priority lower than or equal to the preset priority in the source addresses serving as the detection messages in the NAT address pool according to a corresponding relation between the pre-stored priority and the second time length;
and reducing the duration of the detection period of the second address by a first duration corresponding to the second address, and increasing the duration of the detection period of the third address by a second duration corresponding to the third address.
4. The method of claim 1, further comprising:
receiving a current detection result which is sent by the server and aims at the detection message with the first address as a source address;
and aiming at each address except the first address in the NAT address pool, taking the last detection result of the address as the current detection result of the address.
5. The method of claim 1, further comprising:
determining the detection result of each address in the NAT address pool;
aiming at each address in the NAT address pool, judging whether the current detection result of the address is the same as the last detection result of the address;
if not, the priority of the address is increased by a first preset value.
6. The method according to any one of claims 1-5, further comprising:
if the statistical time length is reached, resetting the statistical time length, and setting the priority of each address in the NAT address pool as an initial priority, wherein the initial priority is lower than the preset priority.
7. An address detection apparatus, applied to a Network Address Translation (NAT) device, the apparatus comprising:
the detection unit is used for sending a detection message with a first address as a source address to the server when detecting that the current detection period reaches the first address in the NAT address pool;
an adjusting unit, configured to reduce a duration of a detection period of a second address, of which priority is higher than a preset priority, in a source address serving as a detection message in the NAT address pool by a first duration, increase a duration of a detection period of a third address, of which priority is lower than or equal to the preset priority, in a source address serving as a detection message in the NAT address pool by a second duration, take the adjusted detection period as a current detection period, and trigger the detecting unit to send the detection message with the first address as the source address to a server when it is detected that the current detection period of the first address in the NAT address pool is reached; the historical change times of the detection results of the addresses with high priority are larger than the historical change times of the detection results of the addresses with low priority.
8. The apparatus of claim 7, further comprising: the judging unit is used for judging whether the number of the source addresses serving as the detection messages in the NAT address pool meets a period adjustment condition or not, and triggering the adjusting unit to adjust the duration of the detection period under the condition that the number of the source addresses meets the period adjustment condition;
wherein, the source address as the detection message in the NAT address pool includes: addresses in the NAT address pool, and/or the first address; the period adjustment condition includes any one or a combination of:
the number of the addresses in the NAT address pool is larger than a first preset number threshold;
the number of the first addresses is larger than a second preset number threshold.
9. The apparatus according to claim 7, wherein the adjusting unit is specifically configured to:
determining a first time length corresponding to a second address with the priority higher than a preset priority in source addresses serving as detection messages in the NAT address pool according to a corresponding relation between the pre-stored priority and the first time length, and determining a second time length corresponding to a third address with the priority lower than or equal to the preset priority in the source addresses serving as the detection messages in the NAT address pool according to a corresponding relation between the pre-stored priority and the second time length;
and reducing the duration of the detection period of the second address by a first duration corresponding to the second address, and increasing the duration of the detection period of the third address by a second duration corresponding to the third address.
10. The apparatus of claim 7, wherein the detection unit is further configured to:
receiving a current detection result which is sent by the server and aims at the detection message with the first address as a source address; and aiming at each address except the first address in the NAT address pool, taking the last detection result of the address as the current detection result of the address.
11. The apparatus of claim 7, wherein the detection unit is further configured to:
determining the detection result of each address in the NAT address pool; aiming at each address in the NAT address pool, judging whether the current detection result of the address is the same as the last detection result of the address; if not, the priority of the address is increased by a first preset value.
12. The apparatus according to any one of claims 7-11, further comprising:
and the resetting unit is used for resetting the statistical time length if the statistical time length is reached, and setting the priority of each address in the NAT address pool as an initial priority, wherein the initial priority is lower than the preset priority.
13. A network address translation, NAT, device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor caused by the machine-executable instructions to: carrying out the method steps of any one of claims 1 to 6.
14. A machine-readable storage medium having stored thereon machine-executable instructions executable by a processor, the processor being caused by the machine-executable instructions to: carrying out the method steps of any one of claims 1 to 6.
CN201910346348.9A 2019-04-26 2019-04-26 Address detection method and device Active CN110099139B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910346348.9A CN110099139B (en) 2019-04-26 2019-04-26 Address detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910346348.9A CN110099139B (en) 2019-04-26 2019-04-26 Address detection method and device

Publications (2)

Publication Number Publication Date
CN110099139A CN110099139A (en) 2019-08-06
CN110099139B true CN110099139B (en) 2021-09-10

Family

ID=67446116

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910346348.9A Active CN110099139B (en) 2019-04-26 2019-04-26 Address detection method and device

Country Status (1)

Country Link
CN (1) CN110099139B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106230726A (en) * 2016-07-26 2016-12-14 杭州迪普科技有限公司 The detection method of forward-path and device
CN108965066A (en) * 2018-10-17 2018-12-07 网宿科技股份有限公司 The method and apparatus that a kind of pair of transmission path is detected
CN109495352A (en) * 2018-12-27 2019-03-19 新华三技术有限公司 A kind of determination method and apparatus of transmission path
CN109639580A (en) * 2019-02-03 2019-04-16 新华三信息安全技术有限公司 A kind of message forwarding method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7706373B2 (en) * 2006-11-01 2010-04-27 Nuvoiz, Inc. Session initiation and maintenance while roaming

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106230726A (en) * 2016-07-26 2016-12-14 杭州迪普科技有限公司 The detection method of forward-path and device
CN108965066A (en) * 2018-10-17 2018-12-07 网宿科技股份有限公司 The method and apparatus that a kind of pair of transmission path is detected
CN109495352A (en) * 2018-12-27 2019-03-19 新华三技术有限公司 A kind of determination method and apparatus of transmission path
CN109639580A (en) * 2019-02-03 2019-04-16 新华三信息安全技术有限公司 A kind of message forwarding method and device

Also Published As

Publication number Publication date
CN110099139A (en) 2019-08-06

Similar Documents

Publication Publication Date Title
US8059570B2 (en) Mobile network device battery conservation system and methods
US9860147B2 (en) Method and device for generating CNM
CN106385459B (en) Method and device for distributing connection request message
US9621383B1 (en) Digital isolator and the method thereof
US7821937B1 (en) Network protocol with damage loss resilient congestion control algorithm
WO2015032318A1 (en) Exceptional account determination method and device
CN109525500B (en) Information processing method and information processing device capable of automatically adjusting threshold
CN109639580B (en) Message forwarding method and device
US20170270064A1 (en) Low latency interrupt with existence of interrupt moderation
CN107623644B (en) Bandwidth speed limiting method, device and equipment
WO2020168933A1 (en) Network request processing method, device, terminal and storage medium
JP7109391B2 (en) Unauthorized communication detection device and unauthorized communication detection program
WO2019104911A1 (en) High concurrency preventive information packet downloading method, electronic device, and storage medium
CN108965066B (en) Method and device for detecting transmission path
US11025709B2 (en) Load processing method and apparatus
CN110099139B (en) Address detection method and device
US9195805B1 (en) Adaptive responses to trickle-type denial of service attacks
CN108156247B (en) Data communication method, device, system, terminal and readable storage medium
US9654837B2 (en) Method and device for providing video of IPTV service
CN110740100B (en) Transmission rate determining method, device, network equipment and storage medium
CN103078799B (en) The processing method of neighbor entry and device
US9781769B2 (en) Method and apparatus for controlling wireless network connection
WO2016029698A1 (en) Policy control method and system and gateway
CN115576698A (en) Network card interrupt aggregation method, device, equipment and medium
CN107547533B (en) Feature rule opening method and device

Legal Events

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