CN114726828B - IP address allocation method, device, equipment and storage medium - Google Patents

IP address allocation method, device, equipment and storage medium Download PDF

Info

Publication number
CN114726828B
CN114726828B CN202210504588.9A CN202210504588A CN114726828B CN 114726828 B CN114726828 B CN 114726828B CN 202210504588 A CN202210504588 A CN 202210504588A CN 114726828 B CN114726828 B CN 114726828B
Authority
CN
China
Prior art keywords
address
addresses
duration
disabling
dhcp server
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
CN202210504588.9A
Other languages
Chinese (zh)
Other versions
CN114726828A (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.)
TP Link Technologies Co Ltd
Original Assignee
TP Link 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 TP Link Technologies Co Ltd filed Critical TP Link Technologies Co Ltd
Priority to CN202210504588.9A priority Critical patent/CN114726828B/en
Publication of CN114726828A publication Critical patent/CN114726828A/en
Application granted granted Critical
Publication of CN114726828B publication Critical patent/CN114726828B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Small-Scale Networks (AREA)

Abstract

The present invention relates to the field of network communications technologies, and in particular, to an IP address allocation method, apparatus, device, and storage medium. The method comprises the following steps: when the DHCP server has no allocable IP addresses and the number of the IP addresses forbidden by the DHCP server is larger than a preset value, starting to execute IP address reassignment; in the process of reassigning the IP address, the disabled IP address is released according to a preset time interval, IP conflict detection is carried out based on the released IP address, the IP address with the IP conflict is disabled, the IP address without the IP conflict is distributed, and the time interval is increased according to the increase of the times of disabling the IP address in the reassignment of the IP address. The IP address which is forbidden by mistake can be recovered in a short time, after the network is recovered, the interference to the network topology is reduced, the network resource is saved, and the IP address allocation efficiency is improved.

Description

IP address allocation method, device, equipment and storage medium
Technical Field
The present invention relates to the field of network communications technologies, and in particular, to an IP allocation method, apparatus, device, and storage medium.
Background
In the scenario that the DHCP server allocates an IP address to the DHCP client, before allocating an IP, the DHCP server detects whether the IP address to be allocated collides with the IP address of the DHCP client by sending a PING instruction. The DHCP server sends an ARP request message to the IP address to be allocated, if the ARP response can be received, the IP address to be allocated is occupied by other hosts, if a conflict exists, the IP address can be forbidden in a fixed duration, and the IP is not allocated to the DHCP client. Such as 24 hours, 60 seconds, etc.
The IP address forbidden duration is set, so that the IP address can be prevented from being distributed to the DHCP client in the forbidden duration, and the problem of IP address conflict can be effectively avoided. However, when the IP address is disabled, the IP address of the address pool may be insufficient, which causes that the DHCP client cannot normally acquire the IP address, or the DHCP server frequently triggers the IP conflict detection, which causes that PING messages and ARP messages in the network are greatly increased, and affects the efficiency of allocating the IP address by the DHCP server.
Disclosure of Invention
In view of this, the embodiments of the present application provide an IP address allocation method, apparatus, device, and storage medium, so as to solve the problem in the prior art that the DHPC client cannot normally acquire the IP address because the IP address is disabled, or frequently trigger IP conflict detection, and affect the efficiency of allocating the IP address by the DHCP server.
A first aspect of an embodiment of the present application provides an IP address allocation method, where the method includes:
when the DHCP server has no allocable IP addresses and the number of the IP addresses forbidden by the DHCP server is larger than a preset value, starting to execute IP address reassignment;
in the process of reassigning the IP address, the disabled IP address is released according to a preset time interval, IP conflict detection is carried out based on the released IP address, the IP address with the IP conflict is disabled, the IP address without the IP conflict is distributed, and the time interval is increased according to the increase of the times of disabling the IP address in the reassignment of the IP address.
With reference to the first aspect, in a first possible implementation manner of the first aspect, the time interval increases according to an increase in the number of times IP addresses are disabled in the IP address reassignment, including a first growth rule, the first growth rule including:
when the number of times of disabling the IP address belongs to a first numerical range, the time interval is a first disabling duration;
and when the times of disabling the IP address belong to a second numerical range, the time interval is a second disabling duration, wherein any value in the first numerical range is smaller than any value in the second numerical range, and the first disabling duration is smaller than the second disabling duration.
With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner of the first aspect, the first disabling time is a fixed duration, and the second disabling time increases exponentially with an increase in the number of times of disabling the IP address.
With reference to the first possible implementation manner of the first aspect, in a third possible implementation manner of the first aspect, the first growth rule further includes:
and when the disabling times reach a preset time threshold, the time interval is a third disabling time length, and the third disabling time length is longer than the second disabling time length.
With reference to the first possible implementation manner of the first aspect, in a fourth possible implementation manner of the first aspect, the time interval increases according to an increase in the number of times the IP address is disabled in the IP address reassignment, including:
acquiring a first duration from start of lease to start of continuation of an IP address in the DHCP server;
and when the first duration is longer than or equal to the first forbidden duration, the duration for forbidden use of the IP address is the first forbidden duration in the first duration for starting to execute the IP address reassignment, and after the first duration for starting to execute the IP address reassignment, the forbidden duration is determined through the first growth rule.
With reference to the fourth possible implementation manner of the first aspect, in a fifth possible implementation manner of the first aspect, the time interval increases according to an increase in the number of times the IP address is disabled in the IP address reassignment, including:
and when the first duration is smaller than or equal to the first forbidden duration, determining the forbidden duration through the first growth rule.
With reference to the first aspect, in a sixth possible implementation manner of the first aspect, when the DHCP server has no assignable IP address and the number of IP addresses disabled by the DHCP server is greater than a predetermined value, the method includes:
when the DHCP server does not have an assignable IP address, generating first alarm information;
and when the number of the forbidden IP addresses of the DHCP server is 0, generating second alarm information.
A second aspect of embodiments of the present application provides an IP address allocation apparatus, including:
a condition judging unit for starting to execute IP address reassignment when the DHCP server has no allocable IP address and the number of the IP addresses forbidden by the DHCP server is larger than a preset value;
and the IP address reassignment unit is used for releasing the forbidden IP addresses according to a preset time interval in the process of IP address reassignment, carrying out IP conflict detection based on the released IP addresses, forbidding the IP addresses with IP conflicts, and distributing the IP addresses without IP conflicts, wherein the time interval is increased according to the increase of the times of forbidding the IP addresses in the IP address reassignment.
A third aspect of embodiments of the present application provides an IP address allocation apparatus comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the method according to any one of the first aspects when the computer program is executed.
A fourth aspect of the embodiments of the present application provides a computer-readable storage medium storing a computer program which, when executed by a processor, implements the steps of the method according to any one of the first aspects.
Compared with the prior art, the embodiment of the application has the beneficial effects that: according to the method and the device, when the DHCP server does not have the allocable IP addresses, and the number of the IP addresses forbidden by the DHCP server is larger than the preset first number threshold, the IP addresses are reallocated, and in the reallocation process, the IP addresses which do not have the IP address conflict are determined to be allocated to the DHCP client through the conflict detection of the IP addresses, so that the IP addresses which are forbidden by mistake can be recovered in a short time, the allocation of the IP addresses in the DHCP server is gradually completed, the interference to network topology is effectively reduced by increasing the time interval of IP address release, network resources are saved, and the IP address allocation efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required for the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of an implementation scenario of an IP address allocation method provided in an embodiment of the present application;
fig. 2 is a schematic implementation flow chart of an IP address allocation method provided in an embodiment of the present application;
fig. 3 is a table diagram of the number of DHCP clients and the IP address data change in the DHCP server according to the embodiment of the present application;
fig. 4 is a table diagram of still another DHCP client number and IP address data change in a DHCP server provided by an embodiment of the present application;
fig. 5 is a table diagram of changes of the number of DHCP clients and the IP data of the DHCP server in the IP address reassignment process according to the embodiment of the present application;
fig. 6 is a schematic diagram of an IP address allocation apparatus according to an embodiment of the present application;
fig. 7 is a schematic diagram of an IP address allocation apparatus provided in an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system configurations, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
In order to illustrate the technical solutions described in the present application, the following description is made by specific examples.
Fig. 1 is a schematic diagram of an implementation scenario of an IP address allocation method according to an embodiment of the present application. As shown in fig. 1, this implementation scenario includes a DHCP (english, all of which are called Dynamic Host Configuration Protocol, chinese, all of which are called dynamic host configuration protocol) server and a DHCP client, which can establish a communication connection through a wired or wireless network. Wherein, the DHCP server is provided with an address pool which can be used for distribution. When the DHCP client and the DHCP server just establish connection, or the DHCP client needs to renew lease of an IP address to the DHCP server, the DHCP server may search for the IP address in the address pool and allocate the IP address to the DHCP client requesting lease of the IP address. When the address pool in the DHCP server has no available IP address, the time interval for releasing the forbidden IP address may be changed gradually by the IP address allocation method according to the embodiment of the present application, so that the problem that the IP address is forbidden by mistake in the initial stage may be solved rapidly, and as the operation of the DHCP server increases, the forbidden duration increases, the frequency of triggering the forbidden mechanism decreases, the interference of the forbidden mechanism on the network topology is less and less, and the network resource is saved.
Fig. 2 is a schematic implementation flow chart of an IP address allocation method provided in the embodiment of the present application, which is described in detail below:
in S201, when the DHCP server has no allocable IP address and the number of IP addresses disabled by the DHCP server is greater than a predetermined value, IP address reassignment starts to be performed.
In general, the ratio of the number of DHCP clients to the number of IPs in the DHCP server is less than a predetermined ratio, such as less than 80%. If the predetermined ratio is exceeded, an alert is generated, and the manager increases the number of IP addresses in the address pool based on the alert. Assuming that the original number of DHCP clients is C, the number of IP addresses set by the address pool is P. In a topology environment in which the number of DHCP clients exceeds the set number of IP addresses of the address pool in the DHCP server by more than half, C < P <2C, and C/P < = 80%.
In this topology environment, IP address change information of the DHCP client and the DHCP server is as shown in fig. 3: in the initialization state, the number of the online DHCP clients is C, the number of the DHCP clients to be online is 0, the number of forbidden IP addresses in the DHCP server is C, the number of the online IP addresses in the DHCP server is C, and the number of the rest allocable IP addresses in an address pool of the DHCP server is P-C.
If the DHCP server loses the record information of the IP address assignment, the data of the IP address in the DHCP server changes, including disabling the number of IP addresses to 0 and the number of IP addresses already on-line to 0.
When a new DHCP client applies for an IP address, or when an original DHCP client (a DHCP client to which an IP address has been assigned) continues, an IP collision detection mechanism of the DHCP server may be triggered by mistake. Through the detection of the conflict of the IP addresses, the number of the IP addresses with the conflict is found, and the IP addresses with the conflict are forbidden for a period of time. The number of IP disabled by the DHCP address pool is C and the number of remaining allocable IP addresses is P-C. During the disabled period, if the original DHCP client renews the IP address, the renewal may fail due to the DHCP server losing the allocation record of the IP address.
After the success, the DHCP client applies for the IP address again, at this time, the number of the available IP addresses in the address pool of the DHCP server is P-C, at most, the P-C DHCP clients can only be on line, and the rest 2C-P DHCP clients can not be on line. At this time, the number of online IP addresses recorded in the DHCP server is P-C, and the number of allocatable IP addresses remaining in the address pool of the DHCP server is 0.
Based on the above change process, in order to effectively adapt to the problem that when the DHCP server loses the allocation record of the IP address, the IP address of the online DHCP client is wrongly disabled, so that no allocatable IP address exists, the present application reallocates the wrongly disabled IP address to the DHCP client by executing the IP address reallocation.
In order to accurately judge whether the DHCP server loses the allocation record of the IP address, the number of allocable IP addresses in the DHCP server and the number of forbidden IP addresses can be detected to determine that the DHCP server loses the allocation record of the IP address.
As can be seen from the change information of the IP addresses of the DHCP client and the DHCP server shown in fig. 3, when the DHCP server loses the allocation record of the IP addresses, the number of disabled IP addresses recorded at the DHCP server is 0 and the number of already-online IP addresses is 0.
Since the DHCP server loses the allocation record of the IP address, when the online DHCP client initiates a renewal request to the DHCP server, the DHCP server cannot respond to the renewal request of the DHCP client because the DHCP server loses the allocation record of the IP address. At this time, the DHCP client re-applies the IP address to the DHCP server. Through IP conflict detection, the number of available IP addresses in the DHCP server is P-C, after the available IP addresses (P-C) are allocated to the DHCP clients applying for the IP addresses, 2C-P DHCP clients still cannot be allocated to the IP addresses (if a new DHCP client applies for the IP addresses, the number of the DHCP clients not allocated with the IP addresses is larger than 2C-P), and at the moment, the number of the IP addresses which can be allocated in an address pool of the DHCP server is 0.
The number of IP addresses allocable in the address pool of the DHCP server is 0, i.e. there is no allocable IP address, and the number of forbidden IP addresses is C (assuming that the predetermined value is 0, C is greater than the predetermined value, it will be understood that the predetermined value is not limited to 0, but may include other values), an IP address reassignment mechanism or a self-healing mechanism may be started to reassign the IP address to the DHCP client.
Assuming that the maximum number of address pools in the DHCP server is 1000, the number of DHCP clients in the topology is 800, and the proportion of DHCP clients to the total number of IP addresses in the address pools in the server reaches an upper limit proportion, i.e. 80%. If the upper limit is exceeded, an alert may be provided to alert the administrator to increase the number of IP addresses in the server's address pool.
As shown in fig. 4, in the initialization stage, the number of online DHCP clients is 800, the number of online IP addresses recorded in the DHCP server is 800, and the number of remaining allocable IP addresses is 200.
When the DHCP server is powered down and restarted, the DHCP server may lose the allocation record information, i.e., lose the allocation record of the IP address. At this time, the data recorded in the DHCP server changes, including the recorded number of disabled IP addresses, and the number of online IP addresses becomes 0.
Since the DHCP client that has assigned the IP address has not released the IP address. When the DHCP client initiates a DHCP renew request, the renewal of the IP address cannot be completed because the allocation record of the IP address in the DHCP server is lost. At this time, the DHCP client needs to reinitiate an application for acquiring a new IP address to the DHCP server in order to continue communication. When receiving the application of acquiring the IP address sent by the DHCP client, the DHCP server performs collision detection on the IP address, and since the DHCP client does not release the IP address acquired before, the number of forbidden IP addresses is determined to be 800 by the collision detection result of the IP address, and the number of assignable IP addresses is 1000-800=200.
After the DHCP server allocates 200 available IP addresses to 200 DHCP clients out of 800 DHCP clients, the number of online DHCP clients is 200, and the remaining 600 DHCP clients have no available IP addresses that can be allocated, i.e., no IP addresses that can be allocated in the address pool, at this time, the number of online IP addresses recorded in the DHCP server is 200, the number of disabled IP addresses is 800 (greater than a predetermined value), and the number of remaining allocable IP addresses is 0, thereby satisfying the condition for performing IP address reassignment.
When the DHCP server detects that no IP address can be allocated, an alarm may also be generated to prompt the manager that the IP address available in the address pool of the DHCP server is insufficient. After the IP addresses have been allocated to the DHCP clients, if it is detected that the number of IP addresses disabled by the DHCP server is 0, an alarm may be generated to prompt the manager that the space of the address pool in the DHCP server is insufficient. And the manager timely pays attention to and processes the abnormality of the equipment according to the received alarm information.
In S202, in the process of reassigning the IP address, the disabled IP address is released at predetermined time intervals, IP conflict detection is performed based on the released IP address, the IP address where the IP conflict occurs is disabled, and the IP address where the IP conflict does not occur is assigned, wherein the time intervals increase according to the increase of the number of times of disabling the IP address in the reassignment of the IP address.
The detection condition determines that the reassignment process of the IP address needs to be performed. In the present application, the IP address that is erroneously disabled is gradually recovered based on a predetermined time interval, and the recovered IP address is allocated to the DHCP client.
Wherein the time interval is related to the number of times of occurrence of forbidden IP addresses in the process of executing the present IP address reassignment, and the time interval increases with the increase of the number of times of forbidden IP addresses.
Wherein the time interval increases with an increasing number of times the IP address is disabled, the time interval may be determined based on the range of times.
For example, in the set first growth rule, the range of times may include a first range of values and a second range of values, wherein any value in the first range of values is less than any value in the second range of values. In this case, when the number of times belongs to the first numerical range, the corresponding time interval is a first disabling duration (i.e., the time for disabling the IP address), and when the number of times belongs to the second numerical range, the corresponding time interval is a second disabling duration. The first disabling time period is smaller than the second disabling time period.
The first disabling time period may be a fixed value, and the second disabling time period may exponentially increase with the increase of the times.
In a possible implementation manner, the first growth rule further includes a third numerical range, and when the number of times of disabling the IP address belongs to the third numerical range, the corresponding time interval is a third disabling duration. Wherein the third disabled time period is longer than the second disabled time period.
Through the first growth rule, when the allocation record of the IP address of the DHCP server is lost, the IP address which is forbidden by mistake is recovered at a smaller time interval, and then the frequency of triggering the forbidden mechanism is reduced by increasing the time interval, so that the forbidden mechanism has less and less interference on the network topology, thereby being beneficial to saving network resources.
In a possible implementation, the first growth rule may be:
f(t)=3,(1<=t<4)
f(t)=3*2 t-3 ,(4<=t<12)
f(t)=1440,(t>=12)
wherein t represents the number of times of disabling the IP address or the number of times of performing collision detection of the IP address when IP address reconfiguration is performed. f (t) represents a time interval determined according to the disabling number t, that is, a time period during which the use of the IP address is disabled when a collision of the IP address is detected. Wherein, the disabling may be to determine the IP addresses having the IP conflict after the conflict detection is performed on all the IP addresses in the DHCP server and prohibit all the IP addresses having the IP conflict from being used, which is called to complete disabling the IP addresses once.
It will be appreciated that the first growth rule described above is not limited thereto and may include other different values. Or in the present application, the time interval increases according to an increase in the number of times the IP address is disabled in the IP address reassignment, and may further include a linearly increasing growth rule.
Considering that there may be a DHCP client initiating a renewal request to the DHCP server when the allocation record of the IP address in the DHCP server is lost, the time interval may be determined in combination with a first duration of the IP address in the DHCP server from start of lease to start of renewal when the determined time interval increases according to an increase in the number of times the IP address is disabled in the IP address reassignment.
Typically, the lease duration of the IP addresses in the address pool is L T ,L T And/2, namely the first duration from the start of lease to the start of continuation of the IP address in the DHCP server. When the starting time of the DHCP server reaches L T At/2, all online DHCP clients may be considered to initiate DHCP renewal requests.
If the first duration is less than the first disabled duration, a first growth rule may be selected to determine a time interval for the disabled IP address.
If the first duration is longer than the first disabling duration, a fixed time interval may be used within the time range of the first duration. And when the time interval is larger than the maximum value of the first duration, determining the time interval through a first growth rule.
For example, the first growth rule is:
f(t)=3,(1<=t<4)
f(t)=3*2 t-3 ,(4<=t<12)
f(t)=1440,(t>=12)
if the first duration is 10, since the first disabling duration is 3 and 10>3, a fixed time interval is adopted in the first disabling duration, for example, a value such as 2 minutes may be selected. The IP addresses are disabled at intervals of 2 minutes in a time frame of a first duration in which the DHCP server starts or allocates the IP addresses, the number of times of disabling being 4. When the start time of the DHCP server or the time of allocating the IP address is greater than 9 minutes, determining the duration of disabling the IP address according to the first growth rule, that is, the time interval of disabling the IP address.
In a specific implementation, in a severe scenario, the ratio of the number of DHCP clients to the number of IPs in the address pool of the DHCP server reaches 80% (when more than 80% would alert the manager to increase the number of IPs in the address pool). Let the maximum number in the address pool of DHCP servers be 1000 and the number of DHCP clients in the topology be 800. The DHCP client that has acquired IP is called an online DHCP client.
As shown in fig. 4, when the running DHCP server is powered off and restarted, the DHCP server loses the allocation record of the IP address. The 800 DHCP clients that have acquired the IP address have not released the IP address yet, i.e., the DHCP server may still receive a response to the PING instruction returned by the DHCP client. When the DHCP client initiates a DHCP request, the DHCP server detects that 800 IP addresses in the address pool have IP address conflicts through the conflict detection of the IP addresses because the DHCP client does not release the IP addresses. The IP address where there is a conflict is set as a disabled IP address, and the disabled duration is T0. In the period of T0, 200 DHCP clients successfully acquire the IP addresses, the rest 600 DHCP clients are not on line (but do not release the IP addresses), no allocable IP addresses exist in an address pool in the DHCP server, the number of forbidden IP addresses is 800, and the condition of IP address reassignment is met.
As shown in fig. 5, in the process of executing the IP address reassignment, the condition for the IP address reassignment is satisfied. At the 0 th minute, according to the first growth rule, the forbidden 800 IP addresses are released first, and since 600 DHCP clients to be online are still applying for the IP addresses, the DHCP server finds that the available IP addresses for collision detection in the address pool are 800 after the forbidden 800 IP addresses are released through the collision detection mechanism of the IP addresses. Through collision detection of the IP addresses, 600 IP addresses with collision are found to exist, and address disabling is performed on the 600 IP addresses with collision. Since the present execution of the IP address disabling is the first disabling upon entering the IP address reassignment, the disabling period of 600 IP addresses, i.e., the time interval for releasing the used IP address is 3 minutes. 200 available IP addresses in the 800 released IP addresses can be used for uploading 200 DHCP clients, and the number of the online DHCP clients is 400.
That is, at the 0 th minute, the number of forbidden IP addresses is 600, the number of DHCP clients which are on line and the number of IP addresses which are on line is 400, the number of DHCP clients to be on line is 400, and the number of remaining allocable IP addresses is 0.
And when the 3 rd minute is reached, the disabled IP addresses are released again, the DHCP server releases the disabled 600 IP addresses, 400 DHCP clients to be on line still apply for IP, the DHCP server discovers 400 IP addresses with conflict in the address pool through a conflict detection mechanism, and the 400 IP addresses with conflict are disabled. According to the first growth rule, the duration of the 2 nd disabling, i.e. the time interval for releasing the disabled IP address, is 3 minutes, and therefore 400 IP times are disabled for 3 minutes.
That is, at 3 minutes, 200 available IP addresses are available in the released 600 IP addresses, 200 DHCP clients can be put on line again, the total number of 600 IP addresses and DHCP clients to be put on line is 200, the number of the IP addresses having collision in the address pool of the DHCP server is 400 through IP collision detection, and the number of the remaining allocable IP addresses is 0.
Similarly, at the 6 th minute, the DHCP server releases the disabled 400 IP addresses, 200 DHCP clients to be online are still applying for the IP addresses, the DHCP server discovers 200 conflicting IP addresses in the address pool through the IP conflict detection mechanism, performs the third time of disabling the IP addresses, namely, the duration of disabling the 200 IP addresses, that is, the time interval of releasing the used IP addresses is 3 minutes, and the 200 clients are online, for a total of 800 DHCP clients.
Namely, at the 6 th minute, the number of online DHPC clients and IP addresses is 800, the number of forbidden IP addresses is 200, the forbidden duration is 3 minutes, the number of DHCP clients to be online is 0, and the number of the remaining allocable IP addresses is 0.
At 9 minutes, the DHCP server will release 200 IPs that are disabled, the number of IP addresses that can be allocated in the DHCP server being 200. The DHCP server recovers all the allocation record information, and the topology is recovered to be normal.
According to the method and the device, in the initial stage of restarting the DHCP server, the shorter forbidden duration is selected when the forbidden times are smaller, so that the DHCP client to be on line can be rapidly on line. In the middle and later stages of the DHCP server start-up, the topology has recovered to normal.
In the scenario that the number of the DHCP clients is 80% of the IP number of the address pool of the DHCP server, after 3 rounds of forbidden IP are performed in an ideal state, the DHCP server can recover all the distributed record information, and the topology is recovered to be normal. However, in consideration of abnormal network communication, the communication message is lost, and part of the DHCP client fails to communicate, so that the set forbidden duration is increased along with the increase of the starting time of the DHCP server, and the maximum value is 24 hours.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic of each process, and should not limit the implementation process of the embodiment of the present application in any way.
Fig. 6 is a schematic diagram of an IP address allocation apparatus according to an embodiment of the present application, as shown in fig. 6, where the apparatus includes:
a condition judging unit 601, configured to start performing IP address reassignment when a DHCP server has no allocable IP address and the number of IP addresses disabled by the DHCP server is greater than a predetermined value;
an IP address reassigning unit 602, configured to release the disabled IP address at predetermined time intervals during the reassigning of the IP address, perform IP conflict detection based on the released IP address, disable the IP address where the IP conflict occurs, and assign the IP address where the IP conflict does not occur, wherein the time intervals increase according to an increase in the number of times the IP address is disabled in the reassigning of the IP address.
The IP address assignment device shown in fig. 6 corresponds to the IP address assignment method shown in fig. 2.
Fig. 7 is a schematic diagram of an IP address allocation apparatus according to an embodiment of the present application. As shown in fig. 7, the IP address assignment apparatus 7 of this embodiment includes: a processor 70, a memory 71 and a computer program 72, such as an IP address assignment program, stored in the memory 71 and executable on the processor 70. The processor 70, when executing the computer program 72, implements the steps of the various IP address assignment method embodiments described above. Alternatively, the processor 70, when executing the computer program 72, performs the functions of the modules/units of the apparatus embodiments described above.
By way of example, the computer program 72 may be partitioned into one or more modules/units that are stored in the memory 71 and executed by the processor 70 to complete the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing a specific function for describing the execution of the computer program 72 in the IP address assignment device 7.
The IP address assignment device may be a DHCP server including, but not limited to, a processor 70, a memory 71. It will be appreciated by those skilled in the art that fig. 7 is merely an example of the IP address assignment device 7 and is not meant to be limiting as to the IP address assignment device 7, and may include more or fewer components than shown, or may combine certain components, or different components, e.g., the IP address assignment device may also include input and output devices, network access devices, buses, etc.
The processor 70 may be a central processing unit (Central Processing Unit, CPU), or may be another general purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a Field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 71 may be an internal storage unit of the IP address assignment apparatus 7, for example, a hard disk or a memory of the IP address assignment apparatus 7. The memory 71 may be an external storage device of the IP address allocation device 7, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided in the IP address allocation device 7. Further, the memory 71 may also include both an internal storage unit and an external storage device of the IP address assignment apparatus 7. The memory 71 is used for storing the computer program and other programs and data required by the IP address assignment apparatus. The memory 71 may also be used for temporarily storing data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other manners. For example, the apparatus/terminal device embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical function division, and there may be additional divisions in actual implementation, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown 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 units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. With such understanding, the present application implements all or part of the flow of the method of the above embodiments, and may also be implemented by hardware associated with computer program instructions, where the computer program may be stored on a computer readable storage medium, where the computer program, when executed by a processor, implements the steps of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the computer readable medium may include content that is subject to appropriate increases and decreases as required by jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is not included as electrical carrier signals and telecommunication signals.
The above embodiments are only for illustrating the technical solution of the present application, and are not limiting; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.

Claims (10)

1. An IP address allocation method, the method comprising:
when the DHCP server has no allocable IP addresses and the number of the IP addresses forbidden by the DHCP server is larger than a preset value, starting to execute IP address reassignment;
in the process of reassigning the IP address, the disabled IP address is released according to a preset time interval, IP conflict detection is carried out based on the released IP address, the IP address with the IP conflict is disabled, the IP address without the IP conflict is distributed, and the time interval is increased according to the increase of the times of disabling the IP address in the reassignment of the IP address.
2. The method of claim 1, wherein the time interval increases according to an increase in the number of times IP addresses are disabled in the IP address reassignment, comprising a first growth rule comprising:
when the number of times of disabling the IP address belongs to a first numerical range, the time interval is a first disabling duration;
and when the times of disabling the IP address belong to a second numerical range, the time interval is a second disabling duration, wherein any value in the first numerical range is smaller than any value in the second numerical range, and the first disabling duration is smaller than the second disabling duration.
3. The method of claim 2, wherein the first disabling period is a fixed period and the second disabling period increases exponentially with an increase in the number of times the IP address is disabled.
4. The method of claim 2, wherein the first growth rule further comprises:
and when the disabling times reach a preset time threshold, the time interval is a third disabling time length, and the third disabling time length is longer than the second disabling time length.
5. The method of claim 2, wherein the time interval increases according to an increase in the number of times IP addresses are disabled in the IP address reassignment, comprising:
acquiring a first duration from start of lease to start of continuation of an IP address in the DHCP server;
and when the first duration is longer than or equal to the first forbidden duration, the duration for forbidden use of the IP address is the first forbidden duration in the first duration for starting to execute the IP address reassignment, and after the first duration for starting to execute the IP address reassignment, the forbidden duration is determined through the first growth rule.
6. The method of claim 5, wherein the time interval increases according to an increase in the number of times an IP address is disabled in the IP address reassignment, comprising:
and when the first duration is smaller than or equal to the first forbidden duration, determining the forbidden duration through the first growth rule.
7. The method according to claim 1, wherein the method further comprises:
when the DHCP server does not have an assignable IP address, generating first alarm information;
and when the number of the forbidden IP addresses of the DHCP server is equal to 0, generating second alarm information.
8. An IP address assignment apparatus, the apparatus comprising:
a condition judging unit for starting to execute IP address reassignment when the DHCP server has no allocable IP address and the number of the IP addresses forbidden by the DHCP server is larger than a preset value;
and the IP address reassignment unit is used for releasing the forbidden IP addresses according to a preset time interval in the process of IP address reassignment, carrying out IP conflict detection based on the released IP addresses, forbidding the IP addresses with IP conflicts, and distributing the IP addresses without IP conflicts, wherein the time interval is increased according to the increase of the times of forbidding the IP addresses in the IP address reassignment.
9. IP address allocation apparatus comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 7 when the computer program is executed by the processor.
10. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the method according to any one of claims 1 to 7.
CN202210504588.9A 2022-05-10 2022-05-10 IP address allocation method, device, equipment and storage medium Active CN114726828B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210504588.9A CN114726828B (en) 2022-05-10 2022-05-10 IP address allocation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210504588.9A CN114726828B (en) 2022-05-10 2022-05-10 IP address allocation method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114726828A CN114726828A (en) 2022-07-08
CN114726828B true CN114726828B (en) 2023-08-08

Family

ID=82230292

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210504588.9A Active CN114726828B (en) 2022-05-10 2022-05-10 IP address allocation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114726828B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104580548A (en) * 2014-12-24 2015-04-29 北京华胜天成科技股份有限公司 IP (Internet protocol) address conflict detecting method and device
CN104579827A (en) * 2014-12-24 2015-04-29 北京华胜天成科技股份有限公司 IP (Internet protocol) address conflict detecting method and device
WO2016206519A1 (en) * 2015-06-23 2016-12-29 中兴通讯股份有限公司 Ip address allocation method and device
CN106470253A (en) * 2016-11-21 2017-03-01 杭州迪普科技股份有限公司 IP address recovery method and device
CN108337333A (en) * 2018-03-23 2018-07-27 普联技术有限公司 IP address management method, management equipment, Network Personal Video Recorder and storage medium
WO2019158010A1 (en) * 2018-02-13 2019-08-22 华为技术有限公司 Resource management method, device and system
CN111262957A (en) * 2020-01-11 2020-06-09 苏州浪潮智能科技有限公司 DHCPIP distribution method and system based on virtualization
CN111371921A (en) * 2020-03-24 2020-07-03 河南信大网御科技有限公司 IP address recovery method, address pool management method and address pool management server

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102594933B (en) * 2011-12-20 2015-04-08 华为技术有限公司 Method, device and system for address allocation of public networks
CN110661897A (en) * 2018-06-29 2020-01-07 华为技术有限公司 Method and device for managing address

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104580548A (en) * 2014-12-24 2015-04-29 北京华胜天成科技股份有限公司 IP (Internet protocol) address conflict detecting method and device
CN104579827A (en) * 2014-12-24 2015-04-29 北京华胜天成科技股份有限公司 IP (Internet protocol) address conflict detecting method and device
WO2016206519A1 (en) * 2015-06-23 2016-12-29 中兴通讯股份有限公司 Ip address allocation method and device
CN106470253A (en) * 2016-11-21 2017-03-01 杭州迪普科技股份有限公司 IP address recovery method and device
WO2019158010A1 (en) * 2018-02-13 2019-08-22 华为技术有限公司 Resource management method, device and system
CN108337333A (en) * 2018-03-23 2018-07-27 普联技术有限公司 IP address management method, management equipment, Network Personal Video Recorder and storage medium
CN111262957A (en) * 2020-01-11 2020-06-09 苏州浪潮智能科技有限公司 DHCPIP distribution method and system based on virtualization
CN111371921A (en) * 2020-03-24 2020-07-03 河南信大网御科技有限公司 IP address recovery method, address pool management method and address pool management server

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
校园网中基于一种并发闭合排队信息算法的DHCP IP分配方法;余建,刘孙发;武夷学院学报;第37卷(第3期);全文 *

Also Published As

Publication number Publication date
CN114726828A (en) 2022-07-08

Similar Documents

Publication Publication Date Title
US20210119965A1 (en) Address Management Method and Apparatus
CN108337333B (en) IP address management method, management device, network video recorder and storage medium
CN108418806B (en) Message processing method and device
CN108989476B (en) Address allocation method and device
CN112351110B (en) ID distribution method and device based on zookeeper
CN111935335A (en) DHCP address allocation method and device
CN102238245B (en) Address allocation method and equipment
CN109819064B (en) Method for communication between modules, operating system module and conference panel
CN114726828B (en) IP address allocation method, device, equipment and storage medium
CN108834130B (en) Identification distribution method, device, terminal and computer readable storage medium
CN114124812A (en) Method and device for maintaining consistency of table items and electronic equipment
CN112889305B (en) Short-term lease allocation for network address conflict reduction in DHCP failover deployments
CN115065664B (en) Internet protocol address recycling method, electronic equipment and storage medium
CN111988446B (en) Message processing method and device, electronic equipment and storage medium
EP3407553B1 (en) Pppoe message transmission method and pppoe server
CN111367648A (en) Resource allocation method and device
CN111262957A (en) DHCPIP distribution method and system based on virtualization
CN110933199B (en) Address allocation method and device
CN109167846B (en) Communication port allocation method and device
CN110311910B (en) Protection device and method for leasing attack by using DHCP
CN112100017A (en) Memory resource monitoring method and device
CN110995877B (en) Method for automatically updating IP address, snooping equipment and DHCP server
CN113114799B (en) Method, system and network device for preventing IP (Internet protocol) confinement under decline message attack and storage medium
CN110062063B (en) Network address management device and method
CN114866371B (en) Method and device for establishing IPSec tunnel, storage medium and electronic equipment

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