CN115065664A - Internet protocol address recovery method, electronic equipment and storage medium - Google Patents

Internet protocol address recovery method, electronic equipment and storage medium Download PDF

Info

Publication number
CN115065664A
CN115065664A CN202210691448.7A CN202210691448A CN115065664A CN 115065664 A CN115065664 A CN 115065664A CN 202210691448 A CN202210691448 A CN 202210691448A CN 115065664 A CN115065664 A CN 115065664A
Authority
CN
China
Prior art keywords
internet protocol
protocol address
condition
user terminal
address
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210691448.7A
Other languages
Chinese (zh)
Other versions
CN115065664B (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.)
Beijing Topsec Technology Co Ltd
Beijing Topsec Network Security Technology Co Ltd
Beijing Topsec Software Co Ltd
Original Assignee
Beijing Topsec Technology Co Ltd
Beijing Topsec Network Security Technology Co Ltd
Beijing Topsec Software 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 Beijing Topsec Technology Co Ltd, Beijing Topsec Network Security Technology Co Ltd, Beijing Topsec Software Co Ltd filed Critical Beijing Topsec Technology Co Ltd
Priority to CN202210691448.7A priority Critical patent/CN115065664B/en
Publication of CN115065664A publication Critical patent/CN115065664A/en
Application granted granted Critical
Publication of CN115065664B publication Critical patent/CN115065664B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)
  • Small-Scale Networks (AREA)

Abstract

The present disclosure provides a method for recovering an internet protocol address, an electronic device, and a storage medium, including: acquiring and responding to a recovery instruction, and sending a plurality of detection messages to each Internet protocol address according to time intervals; determining whether a response message returned by a user terminal corresponding to each internet protocol address meets a first condition or not, wherein the response message is obtained by the user terminal responding to a detection message, and the first condition is that the ratio of the first quantity of the response messages to the second quantity of the detection messages is smaller than a preset threshold value; under the condition that a response message returned by the user terminal corresponding to the Internet protocol address meets a first condition, updating a current identifier of the Internet protocol address, wherein the current identifier represents the times that the response message returned by the user terminal corresponding to the Internet protocol address continuously meets the first condition; and determining whether to recycle the corresponding internet protocol address based on the updated identification. The present disclosure can improve the accuracy of recovery.

Description

Internet protocol address recovery method, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of network configuration technologies, and in particular, to a method for recovering an internet protocol address, an electronic device, and a storage medium.
Background
With the continuous expansion of network scale and the continuous improvement of network complexity, network Configuration becomes more and more complex, therefore, more and more enterprises and households obtain Internet Protocol addresses (IP addresses) through a Dynamic Host Configuration Protocol (DHCP), and the DHCP is a method in which a client can obtain required network Configuration information from a DHCP server through DHCP message interaction to allocate IP addresses to user terminals temporarily accessing the network, or allocate IP addresses to user terminals in a Dynamic allocation manner under the condition that a group of user terminals not requiring permanent IP addresses share a limited set of IP addresses.
The number of IP addresses of each network is fixed, and as a new user terminal requests to access the network, the number of available IP addresses of the network gradually decreases, and therefore, the IP address of the network needs to be recovered to enable the new user terminal to access the network. Currently, the method for recovering IP addresses is as follows: the server sends detection messages to all IP addresses in a lease period, if the response of the user terminal corresponding to the address is not received, the address is recovered, but the response of the user terminal cannot be received under the condition that the network is temporarily disconnected or the user terminal is not started and is not connected with the network, so that the IP addresses are recovered by mistake, namely the accuracy of detection results is low; moreover, after the IP address is recovered by mistake, the original user terminal corresponding to the recovered IP address cannot access the network, which results in resource waste.
Disclosure of Invention
In view of this, an object of the embodiments of the present disclosure is to provide a method, an electronic device, and a storage medium for recovering an IP address, which are used to solve the problem in the prior art that when a network is temporarily disconnected or a user terminal is not started and connected to the network, an IP address is recovered by mistake, so that accuracy of a detection result is low, and after the IP address is recovered by mistake, an original user terminal corresponding to the recovered IP address cannot access the network, so that resource waste is caused.
In a first aspect, an embodiment of the present disclosure provides a method for recovering an internet protocol address, where the method includes:
acquiring and responding to a recovery instruction, and sending a plurality of detection messages to each Internet protocol address according to time intervals;
determining whether a response message returned by a user terminal corresponding to each internet protocol address meets a first condition or not, wherein the response message is obtained by the user terminal responding to the detection message, and the first condition is that the ratio of the first quantity of the response messages to the second quantity of the detection messages is smaller than a preset threshold value;
under the condition that a response message returned by the user terminal corresponding to the Internet protocol address meets the first condition, updating a current identifier of the Internet protocol address, wherein the current identifier represents the number of times that the response message returned by the user terminal corresponding to the Internet protocol address continuously meets the first condition;
and determining whether to recycle the corresponding Internet protocol address based on the updated identification.
In one possible implementation, fetching a recycle instruction includes:
determining whether a preset period is reached;
and generating the recovery instruction under the condition that the preset period is reached.
In one possible implementation, obtaining the recycle instruction further includes:
determining whether an address allocation request is received, wherein the address allocation request is sent by a new user terminal which does not access the current network;
generating the recycle instruction in a case where the address allocation request is received.
In a possible implementation, in a case where the address allocation request is received, generating the recycle instruction includes:
under the condition that the address allocation request is received, determining whether the unallocated internet protocol address in the current network meets a second condition, wherein the second condition is that the proportion of the unallocated internet protocol address in all the internet protocol addresses is smaller than a preset proportion;
generating the recycle instruction if the unallocated internet protocol address satisfies the second condition.
In a possible embodiment, the updating the current identification of the internet protocol address includes:
and adding 1 to the current identifier to update the current identifier of the internet protocol address.
In a possible implementation, the determining whether to reclaim its corresponding internet protocol address based on the updated identification includes:
and recovering the preset number of internet protocol addresses according to the descending order of the times that response messages returned by the user terminal corresponding to the internet protocol addresses continuously meet the first condition.
In a possible implementation, the determining whether to reclaim its corresponding internet protocol address based on the updated identification further includes:
determining the request number of the received address allocation requests;
and recovering the Internet protocol addresses of the request quantity according to the descending order of the times that response messages returned by the user terminal corresponding to the Internet protocol addresses continuously meet the first condition.
In one possible embodiment, the recycling method further comprises:
under the condition that a response message returned by the user terminal corresponding to the Internet protocol address does not meet the first condition, determining whether the current identifier of the Internet protocol address is a preset identifier or not;
if not, changing the current identification of the internet protocol address into the preset identification, wherein the preset identification represents that the internet protocol address is distributed.
In one possible embodiment, the recycling method further comprises:
and responding to an address allocation request, and reallocating the recovered Internet protocol address.
In a second aspect, an embodiment of the present disclosure further provides an electronic device, including:
the sending module is configured to acquire and respond to the recovery instruction and send a plurality of detection messages to each Internet protocol address according to time intervals;
a first determining module, configured to determine, for each internet protocol address, whether a response packet returned by a user terminal corresponding to the internet protocol address satisfies a first condition, where the response packet is obtained by the user terminal in response to the detection packet, and the first condition is that a ratio of a first number of the response packets to a second number of the detection packets is smaller than a preset threshold;
the updating module is configured to update the current identifier of the internet protocol address under the condition that a response message returned by the user terminal corresponding to the internet protocol address meets the first condition, wherein the current identifier represents the number of times that the response message returned by the user terminal corresponding to the internet protocol address continuously meets the first condition;
a reclamation module configured to determine whether to reclaim its corresponding Internet protocol address based on the updated identification.
In a third aspect, an embodiment of the present disclosure further provides a storage medium, where the computer readable storage medium has a computer program stored thereon, and the computer program, when executed by a processor, performs the following steps:
acquiring and responding to a recovery instruction, and sending a plurality of detection messages to each Internet protocol address according to time intervals;
determining whether a response message returned by a user terminal corresponding to each internet protocol address meets a first condition or not, wherein the response message is obtained by the user terminal responding to the detection message, and the first condition is that the ratio of the first quantity of the response messages to the second quantity of the detection messages is smaller than a preset threshold value;
under the condition that a response message returned by the user terminal corresponding to the Internet protocol address meets the first condition, updating a current identifier of the Internet protocol address, wherein the current identifier represents the times that the response message returned by the user terminal corresponding to the Internet protocol address continuously meets the first condition;
and determining whether to recycle the corresponding Internet protocol address based on the updated identification.
In a fourth aspect, an embodiment of the present disclosure further provides an electronic device, where the electronic device includes: a processor and a memory, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating over a bus when an electronic device is operating, the machine-readable instructions when executed by the processor performing the steps of:
acquiring and responding to a recovery instruction, and sending a plurality of detection messages to each Internet protocol address according to time intervals;
determining whether a response message returned by a user terminal corresponding to each internet protocol address meets a first condition or not, wherein the response message is obtained by the user terminal responding to the detection message, and the first condition is that the ratio of the first quantity of the response messages to the second quantity of the detection messages is smaller than a preset threshold value;
under the condition that a response message returned by the user terminal corresponding to the Internet protocol address meets the first condition, updating a current identifier of the Internet protocol address, wherein the current identifier represents the times that the response message returned by the user terminal corresponding to the Internet protocol address continuously meets the first condition;
and determining whether to recycle the corresponding Internet protocol address based on the updated identification.
After the recovery instruction is obtained, the recovery instruction is responded, a plurality of detection messages are sent to each internet protocol address according to time intervals, so that one detection on each internet protocol address is completed, whether a response message returned by a user terminal corresponding to each internet protocol address meets a first condition is further determined, if yes, a current identification of the internet protocol address is updated to obtain an updated identification, whether the corresponding internet protocol address is recovered is determined based on the updated identification, the problem of mistaken recovery of the internet protocol address caused by temporary network disconnection of a network or non-starting and non-connection of the user terminal is avoided, and the accuracy of recovery of a detection result is improved; and moreover, the original user terminal corresponding to the Internet protocol address can normally use the network, and resource waste is avoided.
In order to make the aforementioned objects, features and advantages of the present disclosure more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the present disclosure or the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only some embodiments described in the present disclosure, and other drawings can be obtained by those skilled in the art without inventive exercise.
Fig. 1 is a flowchart illustrating a method for reclaiming an ip address provided by the present disclosure;
fig. 2 shows a schematic structural diagram of an electronic device provided by the present disclosure;
fig. 3 shows a schematic structural diagram of another electronic device provided by the present disclosure.
Detailed Description
Various aspects and features of the disclosure are described herein with reference to the drawings.
It will be understood that various modifications may be made to the embodiments of the present application. Accordingly, the foregoing description should not be considered as limiting, but merely as exemplifications of embodiments. Other modifications will occur to those skilled in the art within the scope and spirit of the disclosure.
The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the disclosure and, together with a general description of the disclosure given above, and the detailed description of the embodiments given below, serve to explain the principles of the disclosure.
These and other characteristics of the present disclosure will become apparent from the following description of preferred forms of embodiment, given as non-limiting examples, with reference to the attached drawings.
It should also be understood that, although the present disclosure has been described with reference to some specific examples, a person of skill in the art shall certainly be able to achieve many other equivalent forms of the disclosure, having the characteristics as set forth in the claims and hence all coming within the field of protection defined thereby.
The above and other aspects, features and advantages of the present disclosure will become more apparent in view of the following detailed description when taken in conjunction with the accompanying drawings.
Specific embodiments of the present disclosure are described hereinafter with reference to the accompanying drawings; however, it is to be understood that the disclosed embodiments are merely exemplary of the disclosure that may be embodied in various forms. Well-known and/or repeated functions and structures have not been described in detail so as not to obscure the present disclosure with unnecessary or unnecessary detail. Therefore, specific structural and functional details disclosed herein are not to be interpreted as limiting, but merely as a basis for the claims and as a representative basis for teaching one skilled in the art to variously employ the present disclosure in virtually any appropriately detailed structure.
The specification may use the phrases "in one embodiment," "in another embodiment," "in yet another embodiment," or "in other embodiments," which may each refer to one or more of the same or different embodiments in accordance with the disclosure.
In a first aspect, to facilitate understanding of the present disclosure, a method for recovering an ip address provided by the present disclosure is first described in detail. As shown in fig. 1, for the recovery method provided by the embodiment of the present disclosure, according to the method steps shown in fig. 1, the problem that in the prior art, when a network is temporarily disconnected or a user terminal is not started and connected to the network, an IP address is recovered by mistake, so that accuracy of a detection result is low, and after the IP address is recovered by mistake, an original user terminal corresponding to the recovered IP address cannot access the network, so that resource waste is caused can be solved. The method comprises the specific steps of S101-S104.
S101, acquiring and responding to a recovery instruction, and sending a plurality of detection messages to each Internet protocol address according to time intervals.
In a specific implementation, a recovery instruction is obtained in real time and/or periodically, and after the recovery instruction is obtained, the recovery instruction is responded, that is, the detection of the internet protocol address is started. Optionally, after the recovery instruction is obtained, multiple probe messages are sent to each internet protocol address at time intervals. That is to say, a plurality of detection messages are sent for each internet protocol address, and a certain time interval exists between the sending times of two adjacent detection messages, so that the problem that when only one detection message is sent, the response message of the user terminal cannot be received due to the fact that the current network is temporarily disconnected or the user terminal is not started and connected with the current network is avoided, and the problem that the internet protocol address is recovered by mistake subsequently is avoided.
It should be noted that, in the case where the recycle instruction is not acquired, the probing of the ip address is not performed.
Optionally, the embodiment of the present disclosure provides the following two ways to generate the recycle instruction, where the first way is: and determining whether a preset period is reached, and generating a recovery instruction under the condition that the preset period is reached, namely setting a preset period aiming at the current network, wherein the preset period is used for indicating and detecting the Internet protocol address in the current network. The preset period may be set to be one week, three days, one month, or the like, and as an example, the preset period is set based on the attribute of the current network, the number of the accessed user terminals, or the like, for example, in a scenario where the current network is an internal network of a company and the number of the accessed user terminals is relatively fixed, the preset period may be set to be longer, such as one month; in a scene that the current network is a public network and the change frequency of the accessed user terminal is high, the preset period can be set to be short, such as three days.
The second way of generating the recycle instruction provided by the embodiment of the present disclosure is: it is determined whether an address assignment request is received, wherein the address assignment request is sent by a new user terminal that does not access the current network, that is, a new user terminal requests to access the current network. Further, in a case where an address allocation request is received, a recycle instruction is generated, as an example, in a case where an address allocation request is received, it may be further determined whether an unallocated internet protocol address in a current network meets a second condition, where the second condition is that a ratio of the unallocated internet protocol address to all internet protocol addresses is smaller than a preset ratio, the preset ratio is a ratio of an internet protocol address which is unallocated to a new user terminal in the current network to all internet protocol addresses, the preset ratio is also determined based on an attribute of the current network, for example, in a scenario where a bandwidth of the current network is large, the preset ratio may be set to be smaller; in the current scene of small network bandwidth, a preset proportion can be set to be large, and the like. And then, after determining that the unallocated internet protocol address meets a second condition, that is, determining that the allocable internet protocol address in the current network is insufficient, at this time, generating a recycling instruction.
Of course, in the same network, the recovery instruction may be generated only by the first manner or the second manner, or the recovery instruction may be generated by the first manner and the second manner, which is not specifically limited in this embodiment of the present disclosure.
S102, determining whether a response message returned by the user terminal corresponding to each Internet protocol address meets a first condition or not, wherein the response message is obtained by the user terminal responding to the detection message, and the first condition is that the ratio of the first quantity of the response message to the second quantity of the detection message is smaller than a preset threshold value.
After a plurality of detection messages are sent to each internet protocol address according to time intervals, a response message returned by a user terminal corresponding to the internet protocol address is received in real time aiming at each internet protocol address.
After receiving a response message returned by the user terminal corresponding to the internet protocol address, determining whether the response message returned by the user terminal corresponding to the internet protocol address meets a first condition, where the response message is obtained by the user terminal responding to the detection message, and the first condition is that a ratio of a first number of the response messages to a second number of the detection messages is smaller than a preset threshold, for example, 5 detection messages sent to the internet protocol address are set, and the preset threshold is 0.6, and if the number of the received response messages is 4, a ratio of the first number to the second number is 4/5 ═ 0.8, which is larger than the preset threshold 0.6, and further determining that the response message returned by the user terminal corresponding to the internet protocol address does not meet the first condition; if the number of the received response messages is 2, the ratio of the first number to the second number is 2/5-0.4, which is smaller than the preset threshold value 0.6, and it is further determined that the response message returned by the user terminal corresponding to the internet protocol address satisfies the first condition.
S103, under the condition that a response message returned by the user terminal corresponding to the Internet protocol address meets a first condition, updating the current identifier of the Internet protocol address, wherein the current identifier represents the times that the response message returned by the user terminal corresponding to the Internet protocol address continuously meets the first condition.
And under the condition that a response message returned by the user terminal corresponding to the Internet protocol address meets a first condition, indicating that the user terminal corresponding to the Internet protocol address does not use the Internet protocol address, and updating the current identifier of the Internet protocol address at the moment. The current identification represents the times that a response message returned by the user terminal corresponding to the Internet protocol address continuously meets the first condition.
As an example, the current identifier is a numerical value, and at this time, when the current identifier of the internet protocol address is updated to obtain an updated identifier, the current identifier may be directly subjected to the processing of adding 1 to obtain the updated identifier, and then the current identifier is updated by using the updated identifier, that is, the current identifier is modified into the updated identifier.
And S104, determining whether to recycle the corresponding Internet protocol address based on the updated identifier.
After the updated identifier is obtained, determining whether to recycle the corresponding internet protocol address according to the updated identifier, as one example, a preset number of internet protocol addresses can be recycled according to a descending order of the number of times that a response message returned by the user terminal corresponding to the internet protocol address continuously meets the first condition; optionally, the number of requests of the received address allocation requests may be determined first, and then the internet protocol addresses of the number of requests are recovered according to a descending order of the number of times that response messages returned by the user terminals corresponding to the internet protocol addresses continuously satisfy the first condition, so as to achieve the purpose that the new user terminals access the current network.
In specific implementation, under the condition that a response message returned by a user terminal corresponding to an internet protocol address does not satisfy a first condition, that is, a ratio of a first number of the response messages to a second number of the detection messages is greater than or equal to a preset threshold, that is, the user terminal corresponding to the internet protocol address uses the internet protocol address, at this time, it is determined whether a current identifier of the internet protocol address is a preset identifier. If the current identification of the internet protocol address is determined not to be the preset identification, changing the current identification of the internet protocol address to be the preset identification, wherein the preset identification represents that the internet protocol address is allocated, for example, setting the preset identification to 0.
And after the updated identifier is obtained, receiving an address allocation request in real time, responding to the address allocation request, namely reallocating the recovered internet protocol address so as to meet the request of a new user terminal for accessing the current network.
After the recovery instruction is obtained, the recovery instruction is responded, a plurality of detection messages are sent to each internet protocol address according to time intervals, so that one detection on each internet protocol address is completed, whether a response message returned by a user terminal corresponding to each internet protocol address meets a first condition is further determined, if yes, a current identification of the internet protocol address is updated to obtain an updated identification, whether the corresponding internet protocol address is recovered is determined based on the updated identification, the problem of mistaken recovery of the internet protocol address caused by temporary network disconnection of a network or non-starting and non-connection of the user terminal is avoided, and the accuracy of recovery of a detection result is improved; and moreover, the original user terminal corresponding to the Internet protocol address can normally use the network, and resource waste is avoided.
Based on the same inventive concept, the second aspect of the present disclosure further provides an electronic device corresponding to the recycling method, and since the principle of solving the problem of the electronic device in the present disclosure is similar to that of the recycling method in the present disclosure, reference may be made to the implementation of the method for implementing the electronic device, and repeated parts are not described again.
Fig. 2 shows a schematic diagram of an electronic device provided in an embodiment of the present disclosure, which specifically includes:
a sending module 201, configured to obtain and respond to the recovery instruction, and send a plurality of detection messages to each internet protocol address according to a time interval;
a first determining module 202, configured to determine, for each internet protocol address, whether a response packet returned by a user terminal corresponding to the internet protocol address satisfies a first condition, where the response packet is obtained by the user terminal in response to the detection packet, and the first condition is that a ratio of a first number of the response packets to a second number of the detection packets is smaller than a preset threshold;
an updating module 203 configured to update a current identifier of the internet protocol address when a response packet returned by the user terminal corresponding to the internet protocol address satisfies the first condition, where the current identifier represents the number of times that the response packet returned by the user terminal corresponding to the internet protocol address continuously satisfies the first condition;
a reclamation module 204 configured to determine whether to reclaim its corresponding internet protocol address based on the updated identification.
In yet another embodiment, the electronic device further comprises a second determination module 205 configured to:
determining whether a preset period is reached;
and generating the recovery instruction under the condition that the preset period is reached.
In yet another embodiment, the second determination module 205 is further configured to:
determining whether an address allocation request is received, wherein the address allocation request is sent by a new user terminal which does not access the current network;
generating the recycle instruction in a case where the address allocation request is received.
In yet another embodiment, the second determination module 205 is further configured to:
under the condition that the address allocation request is received, determining whether the unallocated internet protocol address in the current network meets a second condition, wherein the second condition is that the proportion of the unallocated internet protocol address in all the internet protocol addresses is smaller than a preset proportion;
generating the recycle instruction if the unallocated internet protocol address satisfies the second condition.
In another embodiment, the updating module 203 is specifically configured to:
adding 1 to the current identifier to update the current identifier of the internet protocol address;
and updating the current identifier by using the updated identifier.
In another embodiment, the recycling module 204 is specifically configured to:
and recovering the preset number of Internet protocol addresses according to the descending order of the times that response messages returned by the user terminal corresponding to the Internet protocol addresses continuously meet the first condition.
In yet another embodiment, the recovery module 204 is further configured to:
determining the request number of the received address allocation requests;
and recycling the Internet protocol addresses with the requested number according to the descending order of the times that response messages returned by the user terminal corresponding to the Internet protocol addresses continuously meet the first condition.
In yet another embodiment, the electronic device further includes a third determination module 206 configured to:
under the condition that a response message returned by the user terminal corresponding to the Internet protocol address does not meet the first condition, determining whether the current identifier of the Internet protocol address is a preset identifier or not;
if not, changing the current identification of the internet protocol address into the preset identification, wherein the preset identification represents that the internet protocol address is distributed.
In yet another embodiment, the electronic device further comprises an assignment module 207 configured to:
and responding to an address allocation request, and reallocating the recovered Internet protocol address.
After the recovery instruction is obtained, the recovery instruction is responded, a plurality of detection messages are sent to each internet protocol address according to time intervals, so that one detection on each internet protocol address is completed, whether a response message returned by a user terminal corresponding to each internet protocol address meets a first condition is further determined, if yes, a current identification of the internet protocol address is updated to obtain an updated identification, whether the corresponding internet protocol address is recovered is determined based on the updated identification, the problem of mistaken recovery of the internet protocol address caused by temporary network disconnection of a network or non-starting and non-connection of the user terminal is avoided, and the accuracy of recovery of a detection result is improved; and moreover, the original user terminal corresponding to the Internet protocol address can normally use the network, and resource waste is avoided.
The storage medium is a computer-readable medium, and stores a computer program, and when the computer program is executed by a processor, the method provided by any embodiment of the disclosure is implemented, including the following steps S11 to S14:
s11, acquiring and responding to the recovery instruction, and sending a plurality of detection messages to each Internet protocol address according to time intervals;
s12, determining, for each internet protocol address, whether a response packet returned by the user terminal corresponding to the internet protocol address satisfies a first condition, where the response packet is obtained by the user terminal responding to the detection packet, and the first condition is that a ratio of a first number of the response packets to a second number of the detection packets is smaller than a preset threshold;
s13, updating the current identifier of the internet protocol address when the response packet returned by the user terminal corresponding to the internet protocol address satisfies the first condition, where the current identifier represents the number of times that the response packet returned by the user terminal corresponding to the internet protocol address continuously satisfies the first condition;
s14, determining whether to recycle the corresponding Internet protocol address based on the updated identification.
When the computer program is executed by the processor to obtain the recycling instruction, the following steps are specifically executed by the processor: determining whether a preset period is reached; and generating the recycling instruction under the condition that the preset period is reached.
When the computer program is executed by the processor to obtain the recycling instruction, the processor further executes the following steps: determining whether an address allocation request is received, wherein the address allocation request is sent by a new user terminal which does not access the current network; generating the recycle instruction in a case where the address allocation request is received.
When the computer program is executed by the processor and the recycle instruction is generated when the address allocation request is received, the computer program is further executed by the processor to: under the condition that the address allocation request is received, determining whether the unallocated internet protocol addresses in the current network meet a second condition, wherein the second condition is that the proportion of the unallocated internet protocol addresses to all the internet protocol addresses is smaller than a preset proportion; generating the recycle instruction if the unallocated internet protocol address satisfies the second condition.
The computer program is executed by the processor with the current identification as a numerical value, and when the current identification of the internet protocol address is updated, the computer program is further executed by the processor with the following steps: and adding 1 to the current identifier to update the current identifier of the internet protocol address.
When the computer program is executed by the processor to determine whether to recycle the corresponding internet protocol address based on the updated identification, the following steps are also executed by the processor: and recovering the preset number of internet protocol addresses according to the descending order of the times that response messages returned by the user terminal corresponding to the internet protocol addresses continuously meet the first condition.
When the computer program is executed by the processor to determine whether to recycle the corresponding internet protocol address based on the updated identification, the following steps are also executed by the processor: determining the request number of the received address allocation requests; and recovering the Internet protocol addresses of the request quantity according to the descending order of the times that response messages returned by the user terminal corresponding to the Internet protocol addresses continuously meet the first condition.
When the computer program is executed by the processor to execute the recycling method, the processor further executes the following steps: under the condition that a response message returned by the user terminal corresponding to the Internet protocol address does not meet the first condition, determining whether the current identifier of the Internet protocol address is a preset identifier or not; if not, changing the current identification of the internet protocol address into the preset identification, wherein the preset identification represents that the internet protocol address is distributed.
When the computer program is executed by the processor to execute the recovery method, the processor further executes the following steps: and responding to an address allocation request, and reallocating the recovered Internet protocol address.
After the recovery instruction is obtained, the recovery instruction is responded, a plurality of detection messages are sent to each internet protocol address according to time intervals, so that one detection on each internet protocol address is completed, whether a response message returned by a user terminal corresponding to each internet protocol address meets a first condition is further determined, if yes, a current identification of the internet protocol address is updated to obtain an updated identification, whether the corresponding internet protocol address is recovered is determined based on the updated identification, the problem of mistaken recovery of the internet protocol address caused by temporary network disconnection of a network or non-starting and non-connection of the user terminal is avoided, and the accuracy of recovery of a detection result is improved; and moreover, the original user terminal corresponding to the Internet protocol address can normally use the network, and resource waste is avoided.
Optionally, in this embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes. Optionally, in this embodiment, the processor executes the method steps described in the above embodiments according to the program code stored in the storage medium. Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation manners, and this embodiment is not described herein again. It will be apparent to those skilled in the art that the modules or steps of the present disclosure described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. As such, the present disclosure is not limited to any specific combination of hardware and software.
An embodiment of the present disclosure further provides an electronic device, a schematic structural diagram of the electronic device may be as shown in fig. 3, and the electronic device at least includes a memory 301 and a processor 302, where the memory 301 stores a computer program, and the processor 302 implements the method provided in any embodiment of the present disclosure when executing the computer program on the memory 301. Illustratively, the electronic device computer program steps are as follows S21-S24:
s21, acquiring and responding to the recovery instruction, and sending a plurality of detection messages to each Internet protocol address according to time intervals;
s22, determining, for each internet protocol address, whether a response packet returned by the user terminal corresponding to the internet protocol address satisfies a first condition, where the response packet is obtained by the user terminal responding to the detection packet, and the first condition is that a ratio of a first number of the response packets to a second number of the detection packets is smaller than a preset threshold;
s23, updating the current identifier of the internet protocol address when the response packet returned by the user terminal corresponding to the internet protocol address satisfies the first condition, where the current identifier represents the number of times that the response packet returned by the user terminal corresponding to the internet protocol address continuously satisfies the first condition;
s24, determining whether to recycle the corresponding Internet protocol address based on the updated identification.
The processor, when executing the get recycle instruction stored on the memory, further executes the computer program: determining whether a preset period is reached; and generating the recovery instruction under the condition that the preset period is reached.
The processor, when executing the get recycle instruction stored on the memory, further executes the computer program: determining whether an address allocation request is received, wherein the address allocation request is sent by a new user terminal which does not access the current network; generating the recycle instruction in a case where the address allocation request is received.
The processor, when executing the eviction instruction stored on the memory and generated upon receiving the address allocation request, further executes the computer program: under the condition that the address allocation request is received, determining whether the unallocated internet protocol address in the current network meets a second condition, wherein the second condition is that the proportion of the unallocated internet protocol address in all the internet protocol addresses is smaller than a preset proportion; generating the recycle instruction if the unallocated internet protocol address satisfies the second condition.
The processor, when executing the current identifier stored in the memory as a numerical value and updating the current identifier of the ip address, further executes the following computer program: and adding 1 to the current identifier to update the current identifier of the internet protocol address.
The processor, in executing the computer program stored on the memory that determines whether to reclaim its corresponding internet protocol address based on the updated identification, further executes: and recovering the preset number of internet protocol addresses according to the descending order of the times that response messages returned by the user terminal corresponding to the internet protocol addresses continuously meet the first condition.
The processor, in executing the computer program stored on the memory that determines whether to reclaim its corresponding internet protocol address based on the updated identification, further executes: determining the request number of the received address allocation requests; and recovering the Internet protocol addresses of the request quantity according to the descending order of the times that response messages returned by the user terminal corresponding to the Internet protocol addresses continuously meet the first condition.
The processor, when executing the reclamation method stored on the memory, further executes the computer program: under the condition that a response message returned by the user terminal corresponding to the Internet protocol address does not meet the first condition, determining whether the current identifier of the Internet protocol address is a preset identifier or not; if not, changing the current identification of the internet protocol address into the preset identification, wherein the preset identification represents that the internet protocol address is distributed.
The processor, when executing the reclamation method stored on the memory, further executes the computer program: and responding to an address allocation request, and reallocating the recovered Internet protocol address.
After the recovery instruction is obtained, the recovery instruction is responded, a plurality of detection messages are sent to each internet protocol address according to time intervals, so that one detection on each internet protocol address is completed, whether a response message returned by a user terminal corresponding to each internet protocol address meets a first condition is further determined, if yes, a current identification of the internet protocol address is updated to obtain an updated identification, whether the corresponding internet protocol address is recovered is determined based on the updated identification, the problem of mistaken recovery of the internet protocol address caused by temporary network disconnection of a network or non-starting and non-connection of the user terminal is avoided, and the accuracy of recovery of a detection result is improved; and moreover, the original user terminal corresponding to the Internet protocol address can normally use the network, and resource waste is avoided.
Moreover, although exemplary embodiments have been described herein, the scope thereof includes any and all embodiments based on the disclosure with equivalent elements, modifications, omissions, combinations (e.g., of various embodiments across), adaptations or alterations. The elements in the claims are to be interpreted broadly based on the language employed in the claims and not limited to examples described in the specification or during the prosecution of the disclosure, which examples are to be construed as non-exclusive. It is intended, therefore, that the specification and examples be considered as exemplary only, with a true scope and spirit being indicated by the following claims and their full scope of equivalents.
The above description is intended to be illustrative and not restrictive. For example, the above-described examples (or one or more versions thereof) may be used in combination with each other. For example, other embodiments may be used by those of ordinary skill in the art upon reading the above description. In addition, in the foregoing detailed description, various features may be grouped together to streamline the disclosure. This should not be interpreted as an intention that a disclosed feature not claimed is essential to any claim. Rather, the subject matter of the present disclosure may lie in less than all features of a particular disclosed embodiment. Thus, the following claims are hereby incorporated into the detailed description as examples or embodiments, with each claim standing on its own as a separate embodiment, and it is contemplated that these embodiments may be combined with each other in various combinations or permutations. The scope of the disclosure should be determined with reference to the appended claims, along with the full scope of equivalents to which such claims are entitled.
While the present disclosure has been described in detail with reference to the embodiments, the present disclosure is not limited to the specific embodiments, and those skilled in the art can make various modifications and alterations based on the concept of the present disclosure, and the modifications and alterations should fall within the scope of the present disclosure as claimed.

Claims (11)

1. A method for reclaiming internet protocol addresses, comprising:
acquiring and responding to a recovery instruction, and sending a plurality of detection messages to each Internet protocol address according to time intervals;
determining whether a response message returned by a user terminal corresponding to each internet protocol address meets a first condition or not, wherein the response message is obtained by the user terminal responding to the detection message, and the first condition is that the ratio of the first quantity of the response messages to the second quantity of the detection messages is smaller than a preset threshold value;
under the condition that a response message returned by the user terminal corresponding to the Internet protocol address meets the first condition, updating a current identifier of the Internet protocol address, wherein the current identifier represents the times that the response message returned by the user terminal corresponding to the Internet protocol address continuously meets the first condition;
and determining whether to recycle the corresponding Internet protocol address based on the updated identification.
2. The recycling method of claim 1, wherein obtaining a recycling instruction comprises:
determining whether a preset period is reached;
and generating the recycling instruction under the condition that the preset period is reached.
3. The recycling method of claim 1, wherein obtaining a recycling instruction further comprises:
determining whether an address allocation request is received, wherein the address allocation request is sent by a new user terminal which does not access the current network;
generating the recycle instruction in a case where the address allocation request is received.
4. The recycling method according to claim 3, wherein generating the recycling instruction in case of receiving the address allocation request comprises:
under the condition that the address allocation request is received, determining whether the unallocated internet protocol address in the current network meets a second condition, wherein the second condition is that the proportion of the unallocated internet protocol address in all the internet protocol addresses is smaller than a preset proportion;
generating the recycle instruction if the unallocated internet protocol address satisfies the second condition.
5. The recycling method according to claim 1, wherein the current id is a numerical value, and the updating the current id of the ip address comprises:
and adding 1 to the current identifier to update the current identifier of the internet protocol address.
6. The method of claim 1, wherein determining whether to reclaim its corresponding internet protocol address based on the updated identity comprises:
and recovering the preset number of internet protocol addresses according to the descending order of the times that response messages returned by the user terminal corresponding to the internet protocol addresses continuously meet the first condition.
7. The method of claim 1, wherein determining whether to reclaim its corresponding internet protocol address based on the updated identification further comprises:
determining the request number of the received address allocation requests;
and recovering the Internet protocol addresses of the request quantity according to the descending order of the times that response messages returned by the user terminal corresponding to the Internet protocol addresses continuously meet the first condition.
8. The recycling method according to claim 1, further comprising:
under the condition that a response message returned by the user terminal corresponding to the Internet protocol address does not meet the first condition, determining whether the current identifier of the Internet protocol address is a preset identifier or not;
if not, changing the current identification of the internet protocol address into the preset identification, wherein the preset identification represents that the internet protocol address is distributed.
9. The recycling method according to claim 1, further comprising:
and responding to an address allocation request, and reallocating the recovered Internet protocol address.
10. An electronic device, comprising:
the sending module is configured to acquire and respond to the recovery instruction and send a plurality of detection messages to each Internet protocol address according to time intervals;
a first determining module, configured to determine, for each internet protocol address, whether a response packet returned by a user terminal corresponding to the internet protocol address satisfies a first condition, where the response packet is obtained by the user terminal in response to the detection packet, and the first condition is that a ratio of a first number of the response packets to a second number of the detection packets is smaller than a preset threshold;
the updating module is configured to update the current identifier of the internet protocol address under the condition that a response message returned by the user terminal corresponding to the internet protocol address meets the first condition, wherein the current identifier represents the number of times that the response message returned by the user terminal corresponding to the internet protocol address continuously meets the first condition;
a reclamation module configured to determine whether to reclaim its corresponding Internet protocol address based on the updated identification.
11. A storage medium, having a computer program stored thereon, the computer program when executed by a processor performing the steps of:
acquiring and responding to a recovery instruction, and sending a plurality of detection messages to each Internet protocol address according to time intervals;
determining whether a response message returned by a user terminal corresponding to each internet protocol address meets a first condition or not, wherein the response message is obtained by the user terminal responding to the detection message, and the first condition is that the ratio of the first quantity of the response messages to the second quantity of the detection messages is smaller than a preset threshold value;
under the condition that a response message returned by the user terminal corresponding to the Internet protocol address meets the first condition, updating a current identifier of the Internet protocol address, wherein the current identifier represents the times that the response message returned by the user terminal corresponding to the Internet protocol address continuously meets the first condition;
and determining whether to recycle the corresponding Internet protocol address based on the updated identification.
CN202210691448.7A 2022-06-17 2022-06-17 Internet protocol address recycling method, electronic equipment and storage medium Active CN115065664B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210691448.7A CN115065664B (en) 2022-06-17 2022-06-17 Internet protocol address recycling method, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210691448.7A CN115065664B (en) 2022-06-17 2022-06-17 Internet protocol address recycling method, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115065664A true CN115065664A (en) 2022-09-16
CN115065664B CN115065664B (en) 2024-01-26

Family

ID=83202518

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210691448.7A Active CN115065664B (en) 2022-06-17 2022-06-17 Internet protocol address recycling method, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115065664B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101146029A (en) * 2006-09-13 2008-03-19 华为技术有限公司 A packet resorting method and system
CN104486452A (en) * 2014-09-23 2015-04-01 华为技术有限公司 Address processing method and related equipment and system
CN106331190A (en) * 2015-06-19 2017-01-11 中兴通讯股份有限公司 IP address withdrawing method and device, and dynamic host configuration protocol server
CN106470253A (en) * 2016-11-21 2017-03-01 杭州迪普科技股份有限公司 IP address recovery method and device
WO2017054526A1 (en) * 2015-09-28 2017-04-06 中兴通讯股份有限公司 Arp entry generation method and device
CN109086219A (en) * 2017-06-14 2018-12-25 北京忆恒创源科技有限公司 It removes distribution command handling method and its stores equipment
CN109284234A (en) * 2018-09-05 2019-01-29 珠海昇生微电子有限责任公司 A kind of memory address allocation method and system
CN110502451A (en) * 2019-07-10 2019-11-26 深圳市金泰克半导体有限公司 Solid state hard disk rubbish recovering method, device, solid state hard disk and storage medium
US20200145369A1 (en) * 2018-11-02 2020-05-07 EMC IP Holding Company LLC Rebalancing internet protocol (ip) addresses using distributed ip management

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101146029A (en) * 2006-09-13 2008-03-19 华为技术有限公司 A packet resorting method and system
CN104486452A (en) * 2014-09-23 2015-04-01 华为技术有限公司 Address processing method and related equipment and system
CN106331190A (en) * 2015-06-19 2017-01-11 中兴通讯股份有限公司 IP address withdrawing method and device, and dynamic host configuration protocol server
WO2017054526A1 (en) * 2015-09-28 2017-04-06 中兴通讯股份有限公司 Arp entry generation method and device
CN106470253A (en) * 2016-11-21 2017-03-01 杭州迪普科技股份有限公司 IP address recovery method and device
CN109086219A (en) * 2017-06-14 2018-12-25 北京忆恒创源科技有限公司 It removes distribution command handling method and its stores equipment
CN109284234A (en) * 2018-09-05 2019-01-29 珠海昇生微电子有限责任公司 A kind of memory address allocation method and system
US20200145369A1 (en) * 2018-11-02 2020-05-07 EMC IP Holding Company LLC Rebalancing internet protocol (ip) addresses using distributed ip management
CN110502451A (en) * 2019-07-10 2019-11-26 深圳市金泰克半导体有限公司 Solid state hard disk rubbish recovering method, device, solid state hard disk and storage medium

Also Published As

Publication number Publication date
CN115065664B (en) 2024-01-26

Similar Documents

Publication Publication Date Title
US11586673B2 (en) Data writing and reading method and apparatus, and cloud storage system
CN108881448B (en) API request processing method and device
CN107679718B (en) List allocation method, apparatus and computer-readable storage medium
CN110519183B (en) Node speed limiting method and device, electronic equipment and storage medium
CN110795244B (en) Task allocation method, device, equipment and medium
CN110677492B (en) Access request processing method and device, electronic equipment and storage medium
CN109150745B (en) Message processing method and device
CN112153170B (en) Method, device and equipment for accessing server and storage medium
CN110674095B (en) CTDB cluster expansion method, device and equipment and readable storage medium
CN110868339A (en) Node distribution method and device, electronic equipment and readable storage medium
CN111163072A (en) Method and device for determining characteristic value in machine learning model and electronic equipment
CN112380072A (en) Multi-data center access method and system
CN108769118B (en) Method and device for selecting master nodes in distributed system
CN113361913A (en) Communication service arranging method, device, computer equipment and storage medium
CN112087401A (en) Method and device for realizing service quality in distributed storage
CN111092956A (en) Resource synchronization method, device, storage medium and equipment
CN115065664A (en) Internet protocol address recovery method, electronic equipment and storage medium
CN111198756A (en) Application scheduling method and device of kubernets cluster
CN111541799A (en) Domain name resolution method, system, terminal and storage medium
CN111092966B (en) Domain name system, domain name access method and device
CN113645292A (en) Distribution method of Internet of things equipment
CN108183977B (en) Method and device for dynamically distributing IPv4 public address through IPv6 Internet
CN110661902A (en) Method for monitoring client renewal
CN112100017A (en) Memory resource monitoring method and device
CN114172864B (en) Internet of things terminal address allocation 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