CN114726828A - 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
CN114726828A
CN114726828A CN202210504588.9A CN202210504588A CN114726828A CN 114726828 A CN114726828 A CN 114726828A CN 202210504588 A CN202210504588 A CN 202210504588A CN 114726828 A CN114726828 A CN 114726828A
Authority
CN
China
Prior art keywords
address
addresses
forbidden
duration
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.)
Granted
Application number
CN202210504588.9A
Other languages
Chinese (zh)
Other versions
CN114726828B (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

Images

Landscapes

  • Small-Scale Networks (AREA)

Abstract

The present application relates to the field of network communication technologies, and in particular, to a method, an apparatus, a device, and a storage medium for allocating an IP address. The method comprises the following steps: when the DHCP server has no distributable IP address and the number of the IP addresses forbidden by the DHCP server is larger than a preset value, starting to execute IP address redistribution; in the IP address redistribution process, the forbidden IP addresses are released according to a preset time interval, IP conflict detection is carried out based on the released IP addresses, the IP addresses with IP conflict are forbidden, and the IP addresses without IP conflict are distributed, wherein the time interval is increased according to the increase of the times of forbidding the IP addresses in the IP address redistribution. The method and the device can recover the IP address which is forbidden by mistake in a short time, and are beneficial to reducing the interference to the network topology after the network is recovered, saving the network resources and improving the IP address distribution efficiency.

Description

IP address allocation method, device, equipment and storage medium
Technical Field
The present application relates to the field of network communication technologies, and in particular, to an IP allocation method, apparatus, device, and storage medium.
Background
In a scene that the DHCP server allocates the IP address to the DHCP client, the DHCP server detects whether the IP address to be allocated conflicts with the IP address of the DHCP client or not in a mode of sending a PING instruction before the IP is allocated. 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 indicated to be occupied by other hosts, and if conflict exists, the IP address can be forbidden within a fixed time length, and the IP cannot be allocated to the DHCP client. Such as disabled for 24 hours, 60 seconds, etc.
The forbidden time length of the IP address is set, the IP address can be prevented from being allocated to the DHCP client side within the forbidden time length, 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, so that the DHCP client cannot normally obtain the IP address, or the DHCP server frequently triggers IP collision detection, so that PING messages and ARP messages in the network are greatly increased, and the efficiency of the DHCP server in allocating the IP address is affected.
Disclosure of Invention
In view of this, embodiments of the present application provide an IP address allocation method, an apparatus, a device, and a storage medium, so as to solve the problem in the prior art that, because an IP address is disabled, a DHPC client cannot normally acquire the IP address, or IP collision detection is frequently triggered, which affects the efficiency of a DHCP server in allocating the IP address.
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 address and the number of the IP addresses forbidden by the DHCP server is larger than a preset value, starting to execute IP address reallocation;
in the IP address redistribution process, the forbidden IP addresses are released according to a preset time interval, IP conflict detection is carried out based on the released IP addresses, the IP addresses with IP conflict are forbidden, and the IP addresses without IP conflict are distributed, wherein the time interval is increased according to the increase of the times of forbidding the IP addresses in the IP address redistribution.
With reference to the first aspect, in a first possible implementation manner of the first aspect, the time interval is increased according to an increase in the number of times an IP address is disabled in IP address reallocation, and the time interval includes a first growth rule, where the first growth rule includes:
when the times of forbidding the IP address belong to a first numerical range, the time interval is a first forbidding duration;
and when the times of forbidding the IP address belong to a second numerical range, the time interval is second forbidding duration, wherein any value in the first numerical range is smaller than any value in the second numerical range, and the first forbidding duration is smaller than the second forbidding 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 time duration, and the second disabling time duration exponentially increases with an increase in the number of times the IP address is disabled.
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:
when the forbidden times reach a preset time threshold value, the time interval is a third forbidden time length, and the third forbidden time length is greater than the second forbidden 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 increasing the time interval according to an increase in the number of times the IP address is disabled in IP address reallocation includes:
acquiring a first duration of an IP address in the DHCP server from the beginning of lease to the beginning of lease;
when the first duration is longer than or equal to the first forbidden duration, the duration for forbidding the use of the IP address is the first forbidden duration within the first duration for starting to execute IP address redistribution, and the forbidden duration is determined through the first growth rule after the first duration for starting to execute IP address redistribution.
With reference to the fourth possible implementation manner of the first aspect, in a fifth possible implementation manner of the first aspect, the increasing the time interval according to an increase in the number of times the IP address is disabled in IP address reallocation includes:
when the first duration is less 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 a DHCP server does not have an assignable IP address, and the number of disabled IP addresses of the DHCP server is greater than a predetermined value, the method includes:
when the DHCP server has no assignable IP address, generating first alarm information;
and when the number of the IP addresses forbidden by the DHCP server is 0, generating second alarm information.
A second aspect of the embodiments of the present application provides an IP address allocation apparatus, including:
the condition judging unit is used for starting to execute IP address reallocation when the DHCP server does not have allocatable IP addresses and the number of the IP addresses forbidden by the DHCP server is greater than a preset value;
and the IP address redistribution unit is used for releasing forbidden IP addresses according to a preset time interval in the IP address redistribution process, 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 redistribution.
A third aspect of embodiments of the present application provides an IP address assignment device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the method according to any one of the first aspect when executing the computer program.
A fourth aspect of embodiments of the present application provides a computer-readable storage medium, in which a computer program is stored, which, when executed by a processor, performs the steps of the method according to any one of the first aspect.
Compared with the prior art, the embodiment of the application has the advantages that: this application does not have the IP address of distributable at the DHCP server, and when the quantity of the IP address that the DHCP server forbidden is greater than predetermined first quantity threshold value, carry out IP address reallocation, and in the reallocation process, conflict detection through the IP address, confirm that the IP address that does not take place the IP address conflict distributes to the DHCP client, make the IP address forbidden by the mistake can resume in the short time, accomplish the distribution of the IP address in the DHCP server step by step, through increasing the time interval of IP address release, thereby effectual reduction is to network topology's interference, be favorable to saving network resource, improve IP address allocation efficiency.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic view of an implementation scenario of an IP address allocation method according to an embodiment of the present application;
fig. 2 is a schematic flow chart illustrating an implementation of an IP address assignment method according to an embodiment of the present application;
fig. 3 is a table diagram illustrating the number of DHCP clients and the change of IP address data in a DHCP server according to an embodiment of the present application;
fig. 4 is a table diagram of another DHCP client number and IP address data change in a DHCP server according to an embodiment of the present application;
fig. 5 is a table diagram illustrating the number of DHCP clients and the change of the IP data of the DHCP server in the IP address reassignment process according to an embodiment of the present application;
fig. 6 is a schematic diagram of an IP address assignment device according to an embodiment of the present application;
fig. 7 is a schematic diagram of an IP address assignment device according to 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 structures, 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 explain the technical solution described in the present application, the following description will be given by way of specific examples.
Fig. 1 is a schematic view of an implementation scenario of an IP address allocation method according to an embodiment of the present application. As shown in fig. 1, the implementation scenario includes a DHCP (Dynamic Host Configuration Protocol, which is called by english, and Dynamic Host Configuration Protocol, which is called by chinese, all) server and a DHCP client, where the DHCP client and the DHCP server may establish a communication connection through a wired or wireless network. And the DHCP server is provided with an address pool which can be used for allocation. When the DHCP client and the DHCP server have just established a connection or the DHCP client needs to renew the lease of the IP address to the DHCP server, the DHCP server may look up the IP address in the address pool and allocate the IP address to the DHCP client requesting the 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 can be gradually changed by the IP address allocation method in the embodiment of the application, so that the problem that the IP address is forbidden by mistake in the initial stage can be quickly solved, the forbidden time length is increased along with the operation of the DHCP server, the frequency of triggering a forbidden mechanism is reduced, the forbidden mechanism has less and less interference on network topology, and network resources are saved.
Fig. 2 is a schematic view of an implementation flow of an IP address allocation method provided in an embodiment of the present application, which is detailed as follows:
in S201, when the DHCP server has no assignable IP address and the number of disabled IP addresses of the DHCP server is greater than a predetermined value, IP address reassignment is started.
In a general case, the ratio of the number of DHCP clients to the number of IPs in the DHCP server is smaller than a predetermined ratio, such as smaller than 80%. If the ratio exceeds the preset ratio, an alarm is generated, and the number of the IP addresses in the address pool is increased by the management personnel according to the alarm. Assume that the number of original DHCP clients is C and the number of IP addresses set by the address pool is P. In a topology environment where the number of DHCP clients exceeds more than half the set number of IP addresses of the address pool in the DHCP server, C < P <2C, and C/P < 80%.
In this topology environment, the IP address change information of the DHCP client and the DHCP server is as shown in fig. 3: in an 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 the 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 residual 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 allocation, the data of the IP address in the DHCP server changes at the moment, including that the number of the forbidden IP addresses is changed to 0, and the number of the online IP addresses is changed to 0.
When a new DHCP client applies for an IP address or an original DHCP client (a DHCP client assigned with an IP address) takes a contract, an IP collision detection mechanism of the DHCP server may be triggered by mistake. Through IP address conflict detection, the IP addresses with the number C are found to have conflicts, and the IP addresses with the conflicts are forbidden for a period of time. The number of disabled IP addresses of the DHCP address pool is C, and the number of the remaining allocable IP addresses is P-C. In the disabled period, if the original DHCP client renews the IP address, the DHCP server loses the assignment record of the IP address, which may result in a failure of the renewal.
And after the continuation fails, the DHCP client applies for the IP address again, at the moment, the number of the available IP addresses in the address pool of the DHCP server is P-C, at most, P-C DHCP clients can be on line, and the rest 2C-P DHCP clients cannot be on line. At this time, the number of the online IP addresses recorded in the DHCP server is P-C, and the number of the remaining allocable IP addresses 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 forbidden by mistake, and no allocable IP address exists, the method and the device allocate the IP address forbidden by mistake to the DHCP client again by executing 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 are 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 assignment record of the IP addresses, the number of the disabled IP addresses recorded in the DHCP server is 0, and the number of the IP addresses already online is 0.
Because the DHCP server loses the distribution record of the IP address, when the online DHCP client side sends the renewal request to the DHCP server, the DHCP server loses the distribution record of the IP address, and therefore the renewal request of the DHCP client side cannot be responded. At this time, the DHCP client newly applies for an IP address to the DHCP server. Through the 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 allocate 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 allocable in an address pool of the DHCP server is 0.
The number of assignable IP addresses in the address pool of the DHCP server is 0, that is, there are no assignable IP addresses, and the number of disabled IP addresses is C (assuming that the predetermined value is 0, C is greater than the predetermined value, it is understood that the predetermined value is not limited to 0, and may include other values), an IP address reassignment mechanism or a self-healing mechanism may be started, and an IP address may be reassigned 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 ratio of the DHCP clients to the total number of IP addresses in the address pools in the server reaches the upper limit ratio, i.e., 80%. If the upper limit is exceeded, an alarm is given to remind the administrator to increase the number of IP addresses in the server's address pool.
As shown in fig. 4, in the initialization phase, 800 DHCP clients that have been on-line exist, the number of IP addresses that have been on-line is recorded in the DHCP server as 800, and the number of remaining assignable IP addresses is 200.
When the DHCP server is powered off 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 number of the recorded disabled IP addresses, and the number of the IP addresses already online all become 0.
Since the DHCP client having assigned the IP address has not released the IP address. When the DHCP client initiates a DHCP renewal request, the IP address renewal cannot be completed because the assignment 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 an application for acquiring an IP address sent by a DHCP client, a DHCP server performs collision detection of the IP address, and because the DHCP client does not release the previously acquired IP address, the collision detection result of the IP address determines that the number of disabled IP addresses is 800, and the number of assignable IP addresses is 1000-.
After the DHCP server allocates 200 available IP addresses to 200 DHCP clients among 800 DHCP clients, the number of online DHCP clients is 200, and the remaining 600 DHCP clients have no available IP address to allocate, that is, there is no allocable IP address 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, which satisfies the condition of performing IP address reallocation.
When the DHCP server detects that no distributable IP address exists, an alarm can be generated to prompt a manager that the distributable IP address in the address pool of the DHCP server is insufficient. After the IP address is allocated to the DHCP client, if the number of the forbidden IP addresses of the DHCP server is detected to be 0, an alarm can be generated to prompt a manager that the space of an address pool in the DHCP server is insufficient. And the manager pays attention to and processes the abnormality of the equipment in time according to the received alarm information.
In S202, in the IP address reallocation process, the disabled IP addresses are released at predetermined time intervals, IP collision detection is performed based on the released IP addresses, the IP addresses where IP collision occurs are disabled, and the IP addresses where no IP collision occurs are allocated, wherein the time intervals increase according to an increase in the number of times the IP addresses are disabled in the IP address reallocation.
And determining that the IP address reallocation process needs to be executed by detecting the condition. In the application, the IP address which is disabled by mistake is gradually recovered based on a preset time interval, and the recovered IP address is distributed to the DHCP client.
The time interval is related to the times of forbidding the IP addresses in the IP address redistribution process, and the time interval is increased along with the increase of the times of forbidding the IP addresses.
Wherein the time interval increases as the number of times the IP address is disabled increases, the time interval may be determined based on a range of times.
For example, in the set first growth rule, the number range may include a first value range and a second value range, wherein any value in the first value range is smaller than any value in the second value range. In this case, when the number of times belongs to the first numerical range, the corresponding time interval is a first disabled time length (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 disabled time length. The first disable duration is less than a second disable duration.
The first disable duration may be a fixed value, and the second disable duration may increase exponentially with the number of 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 disable duration is greater than the second disable duration.
Through the first growth rule, when the IP address distribution record of the DHCP server is lost, the mistakenly forbidden IP address is recovered at a smaller time interval, and then the time interval is increased to reduce the frequency of triggering the forbidden mechanism, so that the interference of the forbidden mechanism on the network topology is less and less, and the network resource is saved.
In a possible implementation, the first growth rule may be:
f(t)=3,(1<=t<4)
f(t)=3*2t-3,(4<=t<12)
f(t)=1440,(t>=12)
where t denotes the number of times the IP address is disabled or the number of times the collision detection of the IP address is performed when IP address reallocation is performed. f (t) represents a time interval determined according to the forbidden times t, namely the time length for forbidding to use the IP address when the IP address is detected to have conflict. The disabling once may be to determine the IP addresses with IP conflicts and prohibit all the IP addresses with IP conflicts from being used after performing conflict detection on all the IP addresses in the DHCP server, and this process is called to complete the disabling of IP addresses once.
It is to be understood that the first growth rule is not limited thereto, and may include other different values. Or in the present application, the time interval is increased according to the increase of the number of times of disabling the IP address in the IP address reassignment, and may further include a linearly increasing growth rule.
Considering that there may be a case where the DHCP client initiates a renewal request to the DHCP server when the assignment record of the IP address in the DHCP server is lost, when the determination time interval increases according to an increase in the number of times the IP address is disabled in the IP address reallocation, the time interval may be determined in combination with a first duration from the start of lease to the start of renewal of the IP address in the DHCP server.
Usually, the lease duration of the IP addresses in the address pool is LT,LTThe/2 is the first duration of time for the IP address in the DHCP server to last from the start of the lease to the start of the lease. When the starting time of the DHCP server reaches LTAt/2, all online DHCP clients may be considered to initiate DHCP renewal requests.
If the first duration is less than the first disable duration, a first growth rule may be selected to determine a time interval for disabled IP addresses.
If the first duration is greater than the first disable duration, then fixed time intervals may be employed within the time range of the first duration. The time interval is determined by a first growth rule when the duration is greater than a maximum value of the first duration.
For example, the first growth rule is:
f(t)=3,(1<=t<4)
f(t)=3*2t-3,(4<=t<12)
f(t)=1440,(t>=12)
if the first duration is 10, since the first disable duration is 3 and 10>3, a fixed time interval, such as 2 minutes, may be adopted in the first disable duration. And in the time range of the first duration of starting or allocating the IP address by the DHCP server, the IP address is forbidden according to the time interval of 2 minutes, and the forbidden times are 4 times. When the starting time of the DHCP server or the time for allocating the IP address is more than 9 minutes, the duration for forbidding the IP address, namely the time interval for forbidding the IP address, is determined according to the first growth rule.
In a specific implementation process, in a severe scenario, the ratio of the number of the DHCP clients to the number of the IP in the address pool of the DHCP server reaches 80% (when the ratio exceeds 80%, an alarm is given to increase the number of the IP in the address pool by a manager). Assuming that the maximum number of address pools of the DHCP servers is 1000, the number of DHCP clients in the topology is 800. The DHCP client that has acquired the 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, i.e., the DHCP server can still receive a response to the PING instruction returned by the DHCP client. When the DHCP client side initiates a DHCP request, the DHCP server finds that the IP address conflicts exist in 800 IP addresses in the address pool through conflict detection of the IP addresses because the DHCP client side does not release the IP addresses. The IP address with conflict is set as the forbidden IP address, and the forbidden time is T0. In a period of T0, 200 DHCP clients successfully acquire IP addresses, the remaining 600 DHCP clients are not online (but do not release IP addresses), there are no allocable IP addresses in an address pool in the DHCP server, and the number of disabled IP addresses is 800, which satisfies the condition of IP address reallocation.
As shown in fig. 5, in the process of starting to perform IP address reallocation when the condition for IP address reallocation is satisfied. At 0 th minute, according to a first growth rule, 800 disabled IP addresses are released first, and since 600 DHCP clients to be on-line still apply for IP addresses, the DHCP server finds that 800 IP addresses available for collision detection in the address pool are 800 after releasing the 800 disabled IP addresses through a collision detection mechanism of the IP addresses. Through conflict detection of the IP addresses, it is found that there are 600 conflicting IP addresses, and address disabling is performed on the 600 conflicting IP addresses. Since the IP address disabling performed this time is the first disabling upon entry of the IP address reassignment, the disabling duration of 600 IP addresses, i.e., the time interval for releasing the used IP addresses, is 3 minutes. 200 available IP addresses in the 800 released IP addresses can be online 200 DHCP clients, and the number of the online DHCP clients is 400.
Namely, at the 0 th minute, the number of the disabled IP addresses is 600, the number of the DHCP clients which have come on line and the number of the IP addresses which have come on line are 400, the number of the DHCP clients to come on line is 400, and the number of the remaining assignable IP addresses is 0.
And in the 3 rd minute, the forbidden IP addresses are released again, the DHCP server can release the forbidden 600 IP addresses, the 400 DHCP clients to be on-line still apply for the IP, the DHCP server discovers 400 conflicting IP addresses in the address pool through a conflict detection mechanism, and forbids the 400 conflicting IP addresses. According to a 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 thus 400 IP times are disabled for 3 minutes.
That is, at the 3 rd minute, 200 available IP addresses are available from 600 released IP addresses, 200 DHCP clients can be online again, 600 IP addresses and DHCP clients are online in total, the number of the DHCP clients to be online is 200, through IP collision detection, the number of the IP addresses with collision in the address pool of the DHCP server is 400, and the number of the remaining allocable IP addresses is 0.
Similarly, in the 6 th minute, the DHCP server will release the 400 disabled IP addresses, 200 DHCP clients waiting to go online still apply for IP addresses, the DHCP server finds 200 conflicting IP addresses in the address pool through an IP conflict detection mechanism, executes the third IP address disabling, disables the duration of 200 IP addresses, that is, the time interval for releasing the used IP addresses is 3 minutes, and goes online to 200 clients, which totally goes online to 800 DHCP clients.
That is, at the 6 th minute, the number of online DHPC clients and IP addresses is 800, the number of disabled IP addresses is 200, the disabling duration is 3 minutes, the number of DHCP clients to be online is 0, and the number of remaining assignable IP addresses is 0.
At the 9 th minute, the DHCP server releases the disabled 200 IPs, and the number of assignable IP addresses in the DHCP server is 200. And the DHCP server recovers all the distribution record information, and the topology recovers to be normal.
In the initial stage of restarting the DHCP server, the short forbidden duration is selected when the forbidden times are small, so that the DHCP client to be on-line can be on-line quickly. In the middle and later period of starting the DHCP server, the topology is recovered to be normal.
In a scene that the number of the DHCP clients accounts for 80% of the number of the IPs in the address pool of the DHCP server, after 3 rounds of forbidden IPs are carried out in an ideal state, the DHCP server can recover all the distributed record information, and the topology is recovered to be normal. However, considering that the network communication is abnormal, the communication message is lost, and part of the DHCP client fails to communicate, so the set forbidden duration increases 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 numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Fig. 6 is a schematic diagram of an IP address assignment device according to an embodiment of the present application, and as shown in fig. 6, the IP address assignment device includes:
a condition determining unit 601, configured to start to perform IP address reallocation when a DHCP server has no assignable IP addresses and the number of disabled IP addresses of the DHCP server is greater than a predetermined value;
an IP address reassignment unit 602, configured to, in the IP address reassignment process, release the disabled IP address at a predetermined time interval, perform IP collision detection based on the released IP address, disable the IP address where the IP collision occurs, and assign the IP address where the IP collision does not occur, where the time interval increases according to an increase in the number of times the IP address is disabled in the IP address reassignment.
The IP address assigning apparatus shown in fig. 6 corresponds to the IP address assigning method shown in fig. 2.
Fig. 7 is a schematic diagram of an IP address assignment device according to an embodiment of the present application. As shown in fig. 7, the IP address assigning 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 said memory 71 and operable on said processor 70. The processor 70 implements the steps in the various IP address assignment method embodiments described above when executing the computer program 72. Alternatively, the processor 70 implements the functions of the modules/units in the above-described device embodiments when executing the computer program 72.
Illustratively, 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 accomplish the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program 72 in the IP address assignment device 7.
The IP address assignment device may comprise a DHCP server, which may include, but is 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 does not constitute a limitation of the IP address assignment device 7, and may include more or less components than those shown, or combine some components, or different components, for example, the IP address assignment device may also include input output devices, network access devices, buses, etc.
The Processor 70 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. 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 assigning apparatus 7, such as a hard disk or a memory of the IP address assigning apparatus 7. The memory 71 may also be an external storage device of the IP address assignment 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), and the like, which are equipped on the IP address assignment device 7. Further, the memory 71 may also include both an internal storage unit and an external storage device of the IP address assigning apparatus 7. The memory 71 is used to store the computer program and other programs and data required by the IP address assignment device. The memory 71 may also be used to temporarily store 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-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of 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 processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
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 implementation. 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 ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
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 units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the methods of the embodiments described above can be implemented by hardware related to instructions of a computer program, which can be stored in a computer readable storage medium, and when the computer program is executed by a processor, the steps of the methods described above can be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain other components which may be suitably increased or decreased as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media which may not include electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; 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 solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A method for IP address assignment, the method comprising:
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, starting to execute IP address reallocation;
in the IP address redistribution process, the forbidden IP addresses are released according to a preset time interval, IP conflict detection is carried out based on the released IP addresses, the IP addresses with IP conflict are forbidden, and the IP addresses without IP conflict are distributed, wherein the time interval is increased according to the increase of the times of forbidding the IP addresses in the IP address redistribution.
2. The method of claim 1, wherein the time interval is incremented according to an increase in a number of times an IP address is disabled in IP address reassignment, comprising a first growth rule comprising:
when the times of forbidding the IP address belong to a first numerical range, the time interval is a first forbidding duration;
and when the times of forbidding the IP address belong to a second numerical range, the time interval is second forbidding duration, wherein any value in the first numerical range is smaller than any value in the second numerical range, and the first forbidding duration is smaller than the second forbidding duration.
3. The method of claim 2, wherein the first disable time is a fixed duration, and wherein the second disable time increases exponentially as the number of times the IP address is disabled increases.
4. The method of claim 2, wherein the first growth rule further comprises:
when the forbidden times reach a preset time threshold value, the time interval is a third forbidden time length, and the third forbidden time length is greater than the second forbidden time length.
5. The method of claim 2, wherein the time interval is increased based on an increase in a number of times the IP address is disabled in IP address reassignment, comprising:
acquiring a first duration of an IP address in the DHCP server from the beginning of lease to the beginning of lease;
when the first duration is longer than or equal to the first forbidden duration, the duration for forbidding the use of the IP address is the first forbidden duration within the first duration for starting to execute IP address redistribution, and the forbidden duration is determined through the first growth rule after the first duration for starting to execute IP address redistribution.
6. The method of claim 5, wherein the time interval is increased based on an increase in a number of times the IP address is disabled in IP address reassignment, comprising:
when the first duration is less than or equal to the first forbidden duration, determining the forbidden duration through the first growth rule.
7. The method of claim 1, further comprising:
when the DHCP server has no assignable IP address, generating first alarm information;
and when the number of the IP addresses forbidden by the DHCP server is equal to 0, generating second alarm information.
8. An IP address assignment apparatus, the apparatus comprising:
the condition judging unit is used for starting to execute IP address reallocation when the DHCP server does not have allocatable IP addresses and the number of the IP addresses forbidden by the DHCP server is greater than a preset value;
and the IP address redistribution unit is used for releasing forbidden IP addresses according to a preset time interval in the IP address redistribution process, 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 redistribution.
9. An IP address assignment device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out 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 true CN114726828A (en) 2022-07-08
CN114726828B 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 (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130166776A1 (en) * 2011-12-20 2013-06-27 Huawei Technologies Co., Ltd. Method, apparatus, and system for allocating public ip address
CN104579827A (en) * 2014-12-24 2015-04-29 北京华胜天成科技股份有限公司 IP (Internet protocol) address conflict detecting method and device
CN104580548A (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
US20210119965A1 (en) * 2018-06-29 2021-04-22 Huawei Technologies Co., Ltd. Address Management Method and Apparatus

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130166776A1 (en) * 2011-12-20 2013-06-27 Huawei Technologies Co., Ltd. Method, apparatus, and system for allocating public ip address
CN104579827A (en) * 2014-12-24 2015-04-29 北京华胜天成科技股份有限公司 IP (Internet protocol) address conflict detecting method and device
CN104580548A (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
US20210119965A1 (en) * 2018-06-29 2021-04-22 Huawei Technologies Co., Ltd. Address Management Method and Apparatus
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 (3)

* Cited by examiner, † Cited by third party
Title
JIANG-WHAI DAI等: "A new method to detect abnormal IP address on DHCP", TENCON 2007 - 2007 IEEE REGION 10 CONFERENCE *
何智勇;沈苏彬;毛燕琴;: "DHCP协议优化方案研究", 计算机技术与发展, no. 09 *
余建,刘孙发: "校园网中基于一种并发闭合排队信息算法的DHCP IP分配方法", 武夷学院学报, vol. 37, no. 3 *

Also Published As

Publication number Publication date
CN114726828B (en) 2023-08-08

Similar Documents

Publication Publication Date Title
US20210119965A1 (en) Address Management Method and Apparatus
CN109947724B (en) Method and device for distributed lock service
CN108989476B (en) Address allocation method and device
JP2020526983A (en) Aliase management method and device
CN102238245B (en) Address allocation method and equipment
CN109819064B (en) Method for communication between modules, operating system module and conference panel
CN110798507B (en) Method and system for DHCP address allocation memory
CN112351110A (en) ID distribution method and device based on zookeeper
CN116996908A (en) Fusion management method, device, equipment and medium of master-slave gateway and wireless AP
CN108834130B (en) Identification distribution method, device, terminal and computer readable storage medium
CN111163186A (en) ID generation method, device, equipment and storage medium
CN114124812A (en) Method and device for maintaining consistency of table items and electronic equipment
CN112153628B (en) Activation management, instruction processing and restarting management method and device for code number resources
CN114726828B (en) IP address allocation method, device, equipment and storage medium
CN115065664B (en) Internet protocol address recycling method, electronic equipment and storage medium
CN111367648A (en) Resource allocation method and device
CN111262957A (en) DHCPIP distribution method and system based on virtualization
CN112600765B (en) Method and device for scheduling configuration resources
CN110933199B (en) Address allocation method and device
US11765128B2 (en) DHCP server IP address allocation improvement to nullify the impact of mac randomization
CN115174525B (en) Equipment IP address allocation method and device
CN116366607A (en) DHCP cluster service system, lease management method, device and related equipment
CN111352710A (en) Process management method and device, computing equipment and storage medium
CN114866371B (en) Method and device for establishing IPSec tunnel, storage medium and electronic equipment
CN110311910B (en) Protection device and method for leasing attack by using DHCP

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