CN106470253B - IP address recovery method and device - Google Patents

IP address recovery method and device Download PDF

Info

Publication number
CN106470253B
CN106470253B CN201611040872.6A CN201611040872A CN106470253B CN 106470253 B CN106470253 B CN 106470253B CN 201611040872 A CN201611040872 A CN 201611040872A CN 106470253 B CN106470253 B CN 106470253B
Authority
CN
China
Prior art keywords
address
addresses
detection
storage amount
user host
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
CN201611040872.6A
Other languages
Chinese (zh)
Other versions
CN106470253A (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.)
Hangzhou DPTech Technologies Co Ltd
Original Assignee
Hangzhou DPTech 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 Hangzhou DPTech Technologies Co Ltd filed Critical Hangzhou DPTech Technologies Co Ltd
Priority to CN201611040872.6A priority Critical patent/CN106470253B/en
Publication of CN106470253A publication Critical patent/CN106470253A/en
Application granted granted Critical
Publication of CN106470253B publication Critical patent/CN106470253B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • H04L61/5014Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Small-Scale Networks (AREA)

Abstract

The application provides an IP address recovery method and device, which are applied to a DHCP server and comprise the following steps: detecting whether the number of IP addresses available for allocation in an address pool is less than or equal to the IP address pre-storage amount; when the number of the IP addresses is less than or equal to the IP address pre-storage amount, sending a detection message to the user host with the IP address within the lease term, and starting a detection timer; if the response message returned by the user host is not received, recovering the IP address distributed for the user host; and when the timing of the detection timer reaches a detection time point, sending the detection message to the user host with the IP address within the lease term again. According to the technical scheme, the IP address allocated to the fault user host can be timely recovered, so that the recovery utilization rate of the IP address is improved.

Description

IP address recovery method and device
Technical Field
the present application relates to the field of communications technologies, and in particular, to a method and an apparatus for recovering an IP address.
Background
DHCP (Dynamic Host Configuration Protocol) is a network Protocol of a lan, and a server running the DHCP Protocol may allocate an IP address to a subscriber Host added to the lan. Generally, the IP address assigned to a subscriber host by the DHCP server has a lease time limit, and the DHCP server does not assign the IP address to other subscriber hosts until the lease time limit is reached. If some user host has the problems of unexpected crash, network cable pull-out and the like, when the user host joins the local area network again, the IP address can be requested from the DHCP server again, and the DHCP server can allocate the IP address for the user host again. In this case, if the IP address originally allocated to the subscriber host is still within the lease period, the IP address recycling rate is low.
disclosure of Invention
in view of this, the present application provides a method and an apparatus for recovering an IP address to solve the problem of low recovery rate of the IP address in the related art.
specifically, the method is realized through the following technical scheme:
In a first aspect, the present application provides an IP address recovery method, where the method is applied to a DHCP server, and includes:
detecting whether the number of IP addresses available for allocation in an address pool is less than or equal to the IP address pre-storage amount;
when the number of the IP addresses is less than or equal to the IP address pre-storage amount, sending a detection message to the user host with the IP address within the lease term, and starting a detection timer;
If the response message returned by the user host is not received, recovering the IP address distributed for the user host;
And when the timing of the detection timer reaches a detection time point, sending the detection message to the user host with the IP address within the lease term again.
In a second aspect, the present application provides an IP address recycling apparatus, where the apparatus is applied to a DHCP server, and includes:
The detection unit is used for detecting whether the number of IP addresses available for allocation in the address pool is less than or equal to the IP address pre-storage amount or not;
A sending unit, configured to send a detection message to the user host with the IP address within the lease time limit and start a detection timer when the number of the IP addresses is less than or equal to the IP address pre-stored amount;
a recovery unit, configured to recover, when a response message returned by the user host is not received, an IP address allocated to the user host;
and the sending unit is further configured to send the detection message to the subscriber host with the IP address within the lease term again when the timing of the detection timer reaches the detection time point.
By analyzing the above technical solution, when detecting that the number of IP addresses available for allocation in the address pool is less than or equal to the IP address pre-stored amount, the DHCP server may send a detection message to the user host with the IP address within the lease term, and start the detection timer. If the DHCP server does not receive the response message returned by a user host, the IP address allocated to the user host can be recovered. When the timing of the detection timer reaches the detection time point, the DHCP server may send the detection message to the subscriber host whose IP address is within the lease time again. By adopting the mode, the DHCP server can timely recover the IP address distributed for the fault user host, thereby improving the recovery utilization rate of the IP address.
Drawings
Fig. 1 is a flowchart illustrating an IP address recovery method according to an exemplary embodiment of the present application;
Fig. 2 is a hardware structure diagram of a device where an IP address recovery apparatus according to an exemplary embodiment of the present application is located;
Fig. 3 is a block diagram of an IP address recovery apparatus according to an exemplary embodiment of the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
referring to fig. 1, a flowchart of an IP address recycling method according to an exemplary embodiment of the present application is shown, where the method may be applied to a DHCP server, and includes the following steps:
step 101: and detecting whether the number of IP addresses available for allocation in the address pool is less than or equal to the IP address pre-storage amount.
in this embodiment, the DHCP server may count the number of IP addresses available for allocation in the address pool, and compare the counted number of IP addresses with the IP address pre-storage amount to detect whether the number of IP addresses is less than or equal to the IP address pre-storage amount.
in this step, the IP address pre-storage amount may be preset by an administrator, or may be calculated by the DHCP server according to the following formula:
IP address pre-storage (total number of IP addresses in address pool-number of IP addresses statically bound with user host-number of conflicting IP addresses) ÷ preset value
the preset value may be preset by an administrator, for example: assuming that the total number of IP addresses in the address pool is 100, the number of IP addresses statically bound with the user host is 10, the number of conflicting IP addresses is also 10, and if the administrator sets the preset value to 8, the IP address pre-storage amount is 10. The IP address pre-storage amount can be changed according to the change of the total number of the IP addresses in the address pool, when the total number of the IP addresses in the address pool is larger, the IP address pre-storage amount is generally larger, and when the total number of the IP addresses in the address pool is smaller, the IP address pre-storage amount is generally smaller. By adopting the implementation mode of calculating the IP address pre-storage amount, an administrator does not need to manually modify the IP address pre-storage amount when the total quantity of the IP addresses in the address pool changes.
Step 102: and when the number of the IP addresses is less than or equal to the IP address pre-stored quantity, sending a detection message to the user host with the IP address within the lease term, and starting a detection timer.
in this embodiment, based on the detection result of the foregoing step 101, if the DHCP server detects that the number of IP addresses available for allocation in the address pool is less than or equal to the IP address pre-existing amount, a probe message may be sent to the subscriber host whose IP address is within the lease term. Specifically, the DHCP server may store a subscriber host information table, which may include: user host name, MAC address, IP address, lease remaining time, etc. The DHCP server may send a probe message to the subscriber host with the IP address within the lease time based on the subscriber host information table, where the probe message may be constructed using a protocol supported by both the DHCP server and the subscriber host. At the same time, the DHCP server may also start a probe timer.
Step 103: and if the response message returned by the user host is not received, recovering the IP address distributed for the user host.
in this embodiment, after receiving the detection message, the subscriber host may return a response message corresponding to the detection message to the DHCP server, and the DHCP server may further determine that the connection with the subscriber host is normal. If the DHCP server does not receive the response message returned by a user host within a certain time, the IP address distributed to the user host can be recovered.
Step 104: and when the timing of the detection timer reaches a detection time point, sending the detection message to the user host with the IP address within the lease term again.
In this embodiment, when the count of the probe timer started in step 102 reaches the probe time point, the DHCP server may send the probe message to the subscriber host whose IP address is within the lease time again.
It should be noted that after recovering the IP address allocated to a certain subscriber host, the DHCP server may delete the entry corresponding to the subscriber host, and the subsequent DHCP server does not need to send a probe message to the subscriber host.
in an alternative embodiment, the administrator may set the timing length of the probe timer to the lease period of the IP address, or may set the timing length to the remaining value. If the timing length of the probe timer is set to the lease period, the administrator may also set the probe time point to 20% and 70% of the lease period. Specifically, the DHCP server may send the probe packet to the subscriber host whose IP address is within the lease time again when the timing of the probe timer reaches 20% of the lease time; and when the timing of the detection timer reaches 70% of the lease term, sending the detection message to the user host with the IP address within the lease term again.
it should be noted that the number of the detection time points may also be set by an administrator according to actual situations. If the set detection time points are less, the number of IP addresses recovered by the DHCP server in a timing duration may be less, but less bandwidth can be occupied; if more probing time points are set, the number of IP addresses recovered by the DHCP server within a timing duration may be larger, but the bandwidth is occupied. Therefore, an administrator can set the detection time points according to the condition of the service messages in networking, and more detection time points are set as much as possible under the condition of not influencing the transmission of the service messages so as to improve the recycling rate of the IP addresses.
in an alternative embodiment, when the probe timer reaches the time length, the DHCP server may check again whether the number of IP addresses available for allocation in the address pool is less than or equal to the IP address pre-existing amount. If the number of IP addresses is still less than or equal to the IP address pre-storage amount, it indicates that the DHCP server still needs to continue to reclaim IP addresses to ensure the number of IP addresses available for allocation in the address pool, and may control the probe timer to restart timing, for example: resetting the timing duration of the detection timer; if the number of the IP addresses is larger than the IP address pre-storage amount, the IP addresses are enough to be allocated in the address pool, and the detection timer can be deleted.
It can be seen from the above embodiments that, when detecting that the number of IP addresses available for allocation in the address pool is less than or equal to the IP address pre-stored amount, the DHCP server may send a probe message to the user host whose IP address is within the lease term, and start the probe timer. If the DHCP server does not receive the response message returned by a user host, the IP address allocated to the user host can be recovered. When the timing of the detection timer reaches the detection time point, the DHCP server may send the detection message to the subscriber host whose IP address is within the lease time again. By adopting the mode, the DHCP server can timely recover the IP address distributed for the fault user host, thereby improving the recovery utilization rate of the IP address. In addition, the method and the device can define the detection time points by self, and an administrator can set more detection time points as much as possible according to actual conditions under the condition of not influencing service message transmission so as to further improve the recycling rate of the IP address.
Corresponding to the embodiment of the foregoing IP address recycling method, the present application also provides an embodiment of an IP address recycling apparatus.
The embodiment of the IP address recovery device can be applied to a DHCP server. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. The software implementation is taken as an example, and as a logical device, the device is formed by reading corresponding computer program instructions in the nonvolatile memory into the memory for operation through the processor of the DHCP server where the device is located. In terms of hardware, as shown in fig. 2, the hardware structure diagram of the DHCP server where the IP address recovery apparatus of the present application is located is shown, except for the processor, the memory, the network interface, and the nonvolatile memory shown in fig. 2, the DHCP server where the apparatus is located in the embodiment may also include other hardware according to the actual function of the IP address recovery, which is not described again.
referring to fig. 3, a block diagram of an IP address recycling apparatus according to an exemplary embodiment of the present application is shown, where the IP address recycling apparatus 300 can be applied to the DHCP server shown in fig. 2, and includes:
A detecting unit 301, configured to detect whether the number of IP addresses available for allocation in the address pool is less than or equal to an IP address pre-storage amount;
A sending unit 302, configured to send a detection message to a subscriber host with an IP address within a lease time limit and start a detection timer when the number of the IP addresses is less than or equal to the IP address pre-storage amount;
a recovering unit 303, configured to recover, when a response message returned by the user host is not received, an IP address allocated to the user host;
The sending unit 302 may be further configured to send the probe packet to the subscriber host whose IP address is within the lease time again when the timing of the probe timer reaches the probe time point.
In an optional embodiment, the detecting unit may be further configured to detect again whether the number of IP addresses available for allocation in the address pool is less than or equal to the IP address pre-storage amount when the probing timer reaches the time length;
the apparatus 300 may further comprise:
A timing unit 304, configured to control the probe timer to restart timing when the number of IP addresses is still less than or equal to the IP address pre-storage amount;
a deleting unit 305, configured to delete the detection timer when the number of IP addresses is greater than the IP address pre-storage amount.
In another alternative embodiment, the timing duration of the probe timer may be the lease period of the IP address.
In another alternative embodiment, the probing time point may include: 20% and 70% of the lease period.
in another alternative embodiment, the apparatus 300 may further include:
A calculating unit 306, configured to calculate the IP address pre-storage amount according to the following formula:
the IP address pre-storage amount is (the total number of IP addresses in the address pool-the number of IP addresses statically bound with the user host-the number of conflicting IP addresses) ÷ a preset value.
the implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
for the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the application. One of ordinary skill in the art can understand and implement it without inventive effort.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.

Claims (8)

1. An IP address recovery method, which is applied to a DHCP server and comprises the following steps:
detecting whether the number of IP addresses available for allocation in an address pool is less than or equal to the IP address pre-storage amount;
When the number of the IP addresses is less than or equal to the IP address pre-storage amount, sending a detection message to the user host with the IP address within the lease term, and starting a detection timer;
If the response message returned by the user host is not received, recovering the IP address distributed for the user host;
when the timing of the detection timer reaches a detection time point, sending a detection message to the user host with the IP address within the lease term again;
The method further comprises the following steps:
When the detection timer reaches the time length, detecting whether the number of IP addresses available for allocation in an address pool is less than or equal to the IP address pre-storage amount again;
if the number of the IP addresses is still less than or equal to the IP address pre-storage amount, controlling the detection timer to restart timing;
And if the number of the IP addresses is larger than the IP address pre-storage amount, deleting the detection timer.
2. The method of claim 1,
the timing duration of the detection timer is the lease period of the IP address.
3. The method of claim 2, wherein the probing time points comprises:
20% and 70% of the lease period.
4. The method of claim 1, further comprising:
calculating the IP address pre-storage amount according to the following formula:
the IP address pre-storage amount is (the total number of IP addresses in the address pool-the number of IP addresses statically bound with the user host-the number of conflicting IP addresses) ÷ a preset value.
5. an IP address recycling apparatus, applied to a DHCP server, comprising:
The detection unit is used for detecting whether the number of IP addresses available for allocation in the address pool is less than or equal to the IP address pre-storage amount or not;
A sending unit, configured to send a detection message to the user host with the IP address within the lease time limit and start a detection timer when the number of the IP addresses is less than or equal to the IP address pre-stored amount;
a recovery unit, configured to recover, when a response message returned by the user host is not received, an IP address allocated to the user host;
the sending unit is further configured to send the detection message to the user host with the IP address within the lease term again when the timing of the detection timer reaches the detection time point;
The detection unit is further used for detecting whether the number of IP addresses available for allocation in an address pool is less than or equal to the IP address pre-storage amount again when the detection timer reaches the time length;
the device further comprises:
The timing unit is used for controlling the detection timer to restart timing when the number of the IP addresses is still less than or equal to the IP address pre-storage amount;
and the deleting unit is used for deleting the detection timer when the number of the IP addresses is larger than the IP address pre-storage amount.
6. the apparatus of claim 5,
the timing duration of the detection timer is the lease period of the IP address.
7. the apparatus of claim 6, wherein the probing time points comprises:
20% and 70% of the lease period.
8. the apparatus of claim 5, further comprising:
a calculating unit, configured to calculate the IP address pre-storage amount according to the following formula:
The IP address pre-storage amount is (the total number of IP addresses in the address pool-the number of IP addresses statically bound with the user host-the number of conflicting IP addresses) ÷ a preset value.
CN201611040872.6A 2016-11-21 2016-11-21 IP address recovery method and device Active CN106470253B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611040872.6A CN106470253B (en) 2016-11-21 2016-11-21 IP address recovery method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611040872.6A CN106470253B (en) 2016-11-21 2016-11-21 IP address recovery method and device

Publications (2)

Publication Number Publication Date
CN106470253A CN106470253A (en) 2017-03-01
CN106470253B true CN106470253B (en) 2019-12-06

Family

ID=58230972

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611040872.6A Active CN106470253B (en) 2016-11-21 2016-11-21 IP address recovery method and device

Country Status (1)

Country Link
CN (1) CN106470253B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110661897A (en) * 2018-06-29 2020-01-07 华为技术有限公司 Method and device for managing address
CN113194158B (en) * 2021-04-13 2023-02-24 杭州迪普科技股份有限公司 Information storage method, device, equipment and computer readable storage medium
CN113315651B (en) * 2021-04-27 2022-05-27 新华三信息安全技术有限公司 Alarm method and device
CN114726828B (en) * 2022-05-10 2023-08-08 普联技术有限公司 IP address allocation method, device, equipment and storage medium
CN115065664B (en) * 2022-06-17 2024-01-26 北京天融信网络安全技术有限公司 Internet protocol address recycling method, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101674338A (en) * 2009-10-16 2010-03-17 福建星网锐捷网络有限公司 Recovering method of IP address and DHCP server
CN102185724A (en) * 2011-05-30 2011-09-14 杭州华三通信技术有限公司 Address management method and equipment
CN103763405A (en) * 2014-01-21 2014-04-30 福建三元达通讯股份有限公司 Method for quickly recovering DHCP leases
CN105357228A (en) * 2015-12-19 2016-02-24 中国人民解放军信息工程大学 Burst traffic detection method based on dynamic threshold
CN105939405A (en) * 2016-06-12 2016-09-14 杭州迪普科技有限公司 DHCP service processing method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101674338A (en) * 2009-10-16 2010-03-17 福建星网锐捷网络有限公司 Recovering method of IP address and DHCP server
CN102185724A (en) * 2011-05-30 2011-09-14 杭州华三通信技术有限公司 Address management method and equipment
CN103763405A (en) * 2014-01-21 2014-04-30 福建三元达通讯股份有限公司 Method for quickly recovering DHCP leases
CN105357228A (en) * 2015-12-19 2016-02-24 中国人民解放军信息工程大学 Burst traffic detection method based on dynamic threshold
CN105939405A (en) * 2016-06-12 2016-09-14 杭州迪普科技有限公司 DHCP service processing method and device

Also Published As

Publication number Publication date
CN106470253A (en) 2017-03-01

Similar Documents

Publication Publication Date Title
CN106470253B (en) IP address recovery method and device
CN111555963B (en) Message pushing method and device, electronic equipment and storage medium
CN109302498B (en) Network resource access method and device
CN106911728A (en) The choosing method and device of host node in distributed system
CN107426241B (en) Network security protection method and device
CN110661897A (en) Method and device for managing address
CN104717107A (en) Method, device and system for detecting network device
CN103067199A (en) Depth message detection result diffusion method and device
CN103347031B (en) A kind of method and apparatus taking precautions against ARP message aggression
CN108989476A (en) A kind of address distribution method and device
CN105939405B (en) DHCP service processing method and device
CN104793982A (en) Method and device for establishing virtual machine
CN108540582B (en) Terminal identification processing method, server and terminal
CN110012076B (en) Connection establishing method and device
CN106911508B (en) DNS configuration recovery method and device
CN106209561B (en) The sending method and device of loop detection message
CN107005433B (en) Flow table entry timing processing method and device
US20170171357A1 (en) Apparatus and method for assisting in downloading file successfully
CN110545336A (en) IP address replacing method, device, computer equipment and storage medium
CN106131046B (en) anti-attack processing method and device
US10057210B2 (en) Transaction-based network layer address rotation
EP3297254B1 (en) Domain name system (dns) resolution processing method and device
CN115065664A (en) Internet protocol address recovery method, electronic equipment and storage medium
CN110661655B (en) Cluster deployment method and system, electronic device and storage medium
CN111490894B (en) Supply and installation monitoring system and method for virtual machine network card

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