Internet protocol address allocation method, device and equipment and storage medium

By automating the determination of preset IP address types and address block distribution, and utilizing IP address-assisted addressing, the problem of low efficiency and low accuracy of manual IP address allocation is solved, achieving fast and accurate IP address allocation.

CN115665093BActive Publication Date: 2025-12-30CHINA UNITED NETWORK COMM GRP CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211344040.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-31
Publication Date
2025-12-30
Estimated Expiration
2042-10-31

AI Technical Summary

Technical Problem

Current technologies rely on manual methods for IP address allocation, which is inefficient, prone to errors, and has low accuracy.

Method used

By obtaining the IP address demand of target users, determining the number and address block distribution of preset types of IP addresses, and using the number of IP address-assisted addressing and the distribution of available address blocks, the target IP address is automatically determined and allocated.

Benefits of technology

It enables fast and accurate IP address allocation, improving allocation efficiency and accuracy while reducing human error.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115665093B_ABST
    Figure CN115665093B_ABST
Patent Text Reader

Abstract

The application provides an Internet protocol address allocation method, device, equipment and storage medium. The method comprises the following steps: obtaining an Internet protocol (IP) address demand quantity corresponding to a target user; determining a quantity of preset type IP addresses to be provided according to the IP address demand quantity; the preset type IP addresses comprise a first preset quantity of address blocks, and each address block comprises a second preset quantity of IP addresses; if it is determined that the quantity of preset type IP addresses is one, then determining an IP address auxiliary addressing quantity according to the IP address demand quantity; determining a target IP address from the preset type IP addresses according to the IP address auxiliary addressing quantity and the distribution of available address blocks in the preset type IP addresses, the target IP address meeting the IP address demand quantity; and allocating the target IP address to the target user. The method can quickly determine the target IP address, ensure accuracy in the process of allocating the target IP address, and reduce the error rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to address classification technology, and more particularly to an Internet Protocol address allocation method, apparatus, device and storage medium. Background Technology

[0002] As users' demand for network access increases, the number of Internet Protocol (IP) addresses will also increase accordingly, which in turn increases developers' attention to IP address allocation.

[0003] In existing technologies, once a user determines the number of IP addresses they need, the operator manually allocates the number of available IP addresses to the user based on the number of IP addresses needed and whether the IP addresses are available.

[0004] Existing technology allocates IP addresses manually, which takes a lot of time, is inefficient, and is prone to errors, resulting in low accuracy. Summary of the Invention

[0005] This application provides an Internet Protocol address allocation method, apparatus, device, and storage medium to solve the problems of manual IP address allocation, which requires a lot of time, has low allocation efficiency, is prone to errors, and has low accuracy.

[0006] In a first aspect, this application provides an Internet Protocol (IP) address allocation method, comprising:

[0007] The required number of Internet Protocol (IP) addresses corresponding to the target users;

[0008] The number of preset type IP addresses to be provided is determined based on the required number of IP addresses; the preset type IP addresses include a first preset number of address blocks, and each address block includes a second preset number of IP addresses;

[0009] If the number of IP addresses of the preset type is determined to be one, then the number of auxiliary IP addresses is determined based on the required number of IP addresses; and the target IP address is determined from the preset type of IP addresses based on the number of auxiliary IP addresses and the distribution of available address blocks in the preset type of IP addresses, wherein the target IP address satisfies the required number of IP addresses; the number of auxiliary IP addresses is a specific value determined to assist in finding the target IP address;

[0010] Assign the target IP address to the target user.

[0011] In one approach, determining the number of preset type IP addresses to be provided based on the IP address demand includes:

[0012] The required number of IP addresses is compared with the number of IP addresses included in the preset type of IP address; the number of IP addresses included in the preset type of IP address is the product of the first preset number and the second preset number;

[0013] If the number of IP addresses required is less than or equal to the number of IP addresses included in the preset type of IP address, then the number of preset type IP addresses to be provided is one.

[0014] If the required number of IP addresses is greater than the number of IP addresses included in the preset type of IP address, then the number of preset type IP addresses to be provided is determined to be multiple.

[0015] In one approach, determining the number of IP address auxiliary addressing requests based on the number of IP address requests includes:

[0016] If the required number of IP addresses is determined to be a power of 2, then the required number of IP addresses is determined as the number of IP address auxiliary addresses.

[0017] If the required number of IP addresses is not a power of 2, then the first value that is greater than the required number of IP addresses and equal to a power of 2 is determined as the number of auxiliary IP address addresses, where n is an integer.

[0018] In one approach, determining the target IP address from the preset type of IP addresses based on the number of IP address auxiliary addressings and the distribution of available address blocks in the preset type of IP addresses includes:

[0019] The current candidate first IP address to be provided is determined based on the number of IP address auxiliary addressings and the distribution of available address blocks in the preset type of IP address;

[0020] Based on the number of IP address auxiliary addresses, the availability status of the address block including the current candidate first IP address and the subsequent address blocks, it is determined that the current candidate first IP address is the target first IP address to be provided;

[0021] If the target first IP address is determined, then all target IP addresses to be provided are determined based on the target first IP address and the required number of IP addresses.

[0022] In one embodiment, the method further includes:

[0023] If it is determined that the IP address is not the target first IP address, then the next candidate first IP address to be provided is determined based on the number of auxiliary IP address addresses and the distribution of available address blocks in the preset type of IP address.

[0024] The next candidate first IP address is determined as the current candidate first IP address, and the step of determining whether the current candidate first IP address is the target first IP address to be provided is executed based on the number of IP address auxiliary addressings, the availability status of the address block including the current candidate first IP address and the subsequent address blocks.

[0025] In one approach, determining the current candidate first IP address to be provided based on the number of IP address auxiliary addressings and the distribution of available address blocks in a preset type of IP address includes:

[0026] Obtain the currently available address blocks from the preset type of IP addresses based on the distribution of available address blocks;

[0027] If the sequence number of the first IP address in the current available address block is determined to be an integer multiple of the number of auxiliary IP addresses, then the current available address block is determined as the current candidate address block; the sequence number of the first IP address in the preset type of IP address is zero.

[0028] If it is determined that the sequence number of the first IP address in the current available address block is not an integer multiple of the number of auxiliary IP addresses, then the available address blocks in the preset type of IP addresses are traversed until an available address block in which the sequence number of the first IP address in the preset type of IP address is an integer multiple of the number of auxiliary IP addresses is obtained as the current candidate address block.

[0029] In one approach, determining whether the current candidate first IP address is the target first IP address to be provided, based on the number of IP address auxiliary addressings and the availability status of the address block including the current candidate first IP address and subsequent address blocks, includes:

[0030] The number of subsequent address blocks whose availability status needs to be confirmed is determined based on the number of IP address auxiliary addressings.

[0031] If the address block including the current candidate first IP address and the corresponding number of subsequent address blocks are all in an available state, then the current candidate first IP address is determined to be the target first IP address to be provided.

[0032] If the address block including the current candidate first IP address and the corresponding number of subsequent address blocks are not all in an available state, then it is determined that the current candidate first IP address is not the target first IP address to be provided.

[0033] In one approach, determining the number of subsequent address blocks requiring confirmation of availability based on the number of IP address-assisted addressing steps includes:

[0034] Calculate the quotient of the number of IP address-assisted addressing methods and the second preset number;

[0035] The difference between the quotient and the value one is used to determine the number of subsequent address blocks whose availability status needs to be confirmed.

[0036] In one approach, determining all target IP addresses to be provided based on the target first IP address and the required number of IP addresses includes:

[0037] The first IP address of the target and the third preset number of consecutive IP addresses following the first IP address are determined as the total number of target IP addresses; the sum of the third preset number and the value one is equal to the number of IP addresses required.

[0038] In one approach, if the number of preset type IP addresses is determined to be multiple, and the number of multiple preset type IP addresses is a fourth preset number, then the method further includes:

[0039] Obtain the fourth preset number of preset type IP addresses, where all IP addresses except the last preset type IP address are in an available state;

[0040] The IP address to be provided in the last preset type IP address is determined according to the IP address determination method where the number of preset type IP addresses is one;

[0041] The target IP address is determined from the preset type IP addresses where all IP addresses are in an available state and the last preset type IP address.

[0042] Secondly, this application provides an Internet Protocol address allocation device, the device comprising:

[0043] The acquisition module is used to obtain the required number of Internet Protocol (IP) addresses for the target user.

[0044] The determining module is used to determine the number of preset type IP addresses to be provided based on the number of IP address requirements; the preset type IP addresses include a first preset number of address blocks, and each address block includes a second preset number of IP addresses;

[0045] The determining module is further configured to, if the number of IP addresses of a preset type is determined to be one, determine the number of auxiliary IP address lookups based on the required number of IP addresses; and determine a target IP address from the preset type of IP addresses based on the number of auxiliary IP address lookups and the distribution of available address blocks in the preset type of IP addresses, wherein the target IP address satisfies the required number of IP addresses; the number of auxiliary IP address lookups is a specific value determined to assist in finding the target IP address;

[0046] The allocation module is used to allocate the target IP address to the target user.

[0047] Thirdly, this application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;

[0048] The memory stores computer-executed instructions;

[0049] The processor executes computer execution instructions stored in the memory to implement the method as described in the first aspect or any feasible method described above.

[0050] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method described in the first aspect or any of the feasible methods described above.

[0051] This application provides an Internet Protocol (IP) address allocation method, apparatus, device, and storage medium. The method includes: obtaining the number of IP addresses required by a target user; determining the number of preset type IP addresses to be provided based on the number of IP address requirements; the preset type IP addresses include a first preset number of address blocks, and each address block includes a second preset number of IP addresses; if the number of preset type IP addresses is determined to be one, then determining the number of auxiliary IP address lookups based on the number of IP address requirements; and determining a target IP address from the preset type IP addresses based on the number of auxiliary IP address lookups and the distribution of available address blocks in the preset type IP addresses, wherein the target IP address meets the number of IP address requirements; the number of auxiliary IP address lookups is a specific value determined to assist in finding the target IP address; and allocating the target IP address to the target user. This application first obtains the number of IP addresses required by the target user, and then quickly determines the number of preset type IP addresses based on the number of IP address requirements. Since the preset type IP addresses contain multiple IP addresses, the number of preset type IP addresses can be quickly determined based on the number of IP address requirements and the number of IP addresses contained in the preset type IP addresses. If the number of preset type IP addresses is quickly determined to be one, the number of IP address auxiliary addressing is then determined based on the number of IP address requirements. Since the preset type IP addresses contain multiple address blocks, the allocation device accurately records the distribution and availability status of each address block, thereby accurately determining the available address blocks. Then, based on the number of IP address auxiliary addressing and the distribution of available address blocks in the preset type IP addresses, the target IP address can be accurately determined. Attached Figure Description

[0052] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0053] Figure 1 An application scenario diagram of an Internet Protocol addressing method provided in this application;

[0054] Figure 2 A flowchart illustrating an Internet Protocol address allocation method provided in Embodiment 1 of this application;

[0055] Figure 3 A flowchart illustrating an Internet Protocol address allocation method provided in Embodiment 2 of this application;

[0056] Figure 4 A flowchart illustrating an Internet Protocol address allocation method provided in Embodiment 4 of this application;

[0057] Figure 5 A flowchart illustrating an Internet Protocol address allocation method provided in Embodiment 5 of this application;

[0058] Figure 6 A flowchart illustrating an Internet Protocol address allocation method provided in Embodiment Six of this application;

[0059] Figure 7 A flowchart illustrating an Internet Protocol address allocation method provided in Embodiment 7 of this application;

[0060] Figure 8 A flowchart illustrating an Internet Protocol address allocation method provided in Embodiment 8 of this application;

[0061] Figure 9 A schematic diagram of an Internet Protocol address allocation device provided in Embodiment 9 of this application;

[0062] Figure 10 This is a schematic diagram of the structure of an electronic device provided in Embodiment 10 of this application.

[0063] The accompanying drawings have illustrated specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to specific embodiments. Detailed Implementation

[0064] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0065] First, let me explain the terms used in this application:

[0066] Internet Protocol address (IP): refers to the digital label assigned to a device by which a user accesses the Internet using the Internet protocol.

[0067] In existing technologies, once a user determines the number of IP addresses they need, the operator manually allocates the required number of available IP addresses to the user. Specifically, relevant personnel from the operator determine the number of IP addresses needed, identify the first IP address from a pre-stored IP address table, and then determine whether the first and last IP addresses are available. If they are available, the target IP addresses are then determined.

[0068] However, existing technologies require a lot of time and have low efficiency because IP addresses are allocated manually. At the same time, manual allocation can easily lead to errors in determining the first IP address and the availability of the IP address, resulting in low accuracy of the final target IP address.

[0069] To address the shortcomings of existing technologies, the inventors of this solution have creatively designed a new approach. This solution provides an Internet Protocol (IP) address allocation method. To solve the problem of high time consumption and low efficiency in manual IP address allocation, this application utilizes an IP address allocation device (hereinafter referred to as the allocation device) that can quickly determine the number of IP addresses of a preset type based on the IP address demand of the target user. The preset type IP addresses contain a first preset number of address blocks, and each address block contains a second preset number of IP addresses. Specifically, the allocation device can quickly determine the number of preset type IP addresses by comparing the number of IP addresses demanded with the number of IP addresses contained in the preset type IP addresses. To address the low accuracy of the determined target IP addresses, if the number of preset type IP addresses is determined to be one, the application then determines the number of auxiliary IP address lookups based on the number of IP address demanded. Since the allocation device accurately records the distribution of address blocks in the preset type IP addresses and whether the address blocks are available, the target IP addresses can be accurately determined based on the number of auxiliary IP address lookups and the distribution of available address blocks in the preset type IP addresses, ultimately ensuring that all target IP addresses are available.

[0070] The following describes the application scenarios of the Internet Protocol address allocation method, apparatus, device, and storage medium provided by this application.

[0071] Figure 1 This diagram illustrates an application scenario for an Internet Protocol (IP) addressing method provided in this application. For example... Figure 1 As shown in the diagram, the application scenario includes a target user terminal 101 and an electronic device 102. The electronic device 102 includes an Internet Protocol address allocation device 103, and the target user terminal 101 stores the number of IP addresses required by the target user.

[0072] The target user terminal 101 is communicatively connected to the electronic device 102. The communication connection can be wired or wireless.

[0073] Specifically, electronic device 102 obtains the number of Internet Protocol (IP) addresses required by the target user from the target user terminal 101 and sends the number of IP address requests to allocation device 103. The preset type IP address includes a first preset number of address blocks, and each address block includes a second preset number of IP addresses. Therefore, the number of IP addresses contained in the preset type IP address is equal to the first preset number multiplied by the second preset number of IP addresses. Allocation device 103 determines the number of preset type IP addresses to be provided by dividing the number of IP address requests by the number of IP addresses contained in the preset type IP address. If the number of IP address requests is determined to be less than the number of IP addresses contained in the preset type IP address, then the number of preset type IP addresses is determined to be one, and the distribution of address blocks within one preset type IP address is obtained.

[0074] Furthermore, the allocation device 103 determines the number of auxiliary IP address lookups based on the number of IP address requests. It is understood that the allocation device 103 records the distribution of available address blocks in the preset type of IP address. The allocation device 103 determines the target IP address based on the number of auxiliary IP address lookups and the distribution of available address blocks in the IP address. Then, the allocation device 104 sends the target IP address to the target user terminal 101, and then allocates it to the target user.

[0075] This application provides an Internet Protocol address allocation method, apparatus, device, and storage medium, which aims to solve the above-mentioned technical problems in the prior art.

[0076] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0077] Example 1

[0078] Figure 2 This is a flowchart illustrating an Internet Protocol (IP) address allocation method provided in Embodiment 1 of this application. The execution entity of this embodiment is an IP address allocation device, such as... Figure 2 As shown, the specific steps are as follows.

[0079] S201, Obtain the required number of Internet Protocol (IP) addresses for the target user.

[0080] The number of Internet Protocol (IP) addresses required can be multiple.

[0081] Specifically, the number of Internet Protocol (IP) addresses required by the target user can be stored in the target user's terminal, and the allocation device obtains the number of Internet Protocol (IP) addresses required by the target user from the target user's terminal.

[0082] S202, determine the number of preset type IP addresses to be provided based on the number of IP address requirements; the preset type IP addresses include a first preset number of address blocks, and each address block includes a second preset number of IP addresses.

[0083] The preset type IP address includes a first preset number of address blocks, and each address block includes a second preset number of IP addresses. Each address block contains a first IP address and a last IP address, where the first IP address is the first IP address in the address block, and the last IP address is the last IP address in the address block. The preset type IP address can be any type of address, such as a Class C address; there is no restriction here. The address block can be denoted as Km, where m is the address block number.

[0084] Specifically, the allocation device first determines the number of IP addresses included in the preset type of IP address. The number of IP addresses included in the preset type of IP address is equal to a first preset number multiplied by a second preset number. Then, the allocation device can calculate and compare the number of IP addresses required with the number of preset type IP addresses, and determine the number of preset type IP addresses based on the comparison result.

[0085] S203, if the number of preset type IP addresses is determined to be one, then the number of auxiliary IP address lookups is determined based on the number of IP address requirements; and the target IP address is determined from the preset type IP addresses based on the number of auxiliary IP address lookups and the distribution of available address blocks in the preset type IP addresses, and the target IP address meets the number of IP address requirements; the number of auxiliary IP address lookups is a specific value determined to assist in finding the target IP address;

[0086] The number of IP address auxiliary addresses is a set number of auxiliary addresses for finding the target IP address, which can be used to determine the target IP address in this application.

[0087] Specifically, if the allocation device determines that the number of IP addresses of the preset type is one, it can determine the number of auxiliary IP addresses based on whether the required number of IP addresses is a power of 2. The allocation device determines whether the preset type of IP addresses are available and the distribution of address blocks within those IP addresses. Furthermore, the allocation device can identify available address blocks within the preset type of IP addresses. Then, based on the number of auxiliary IP addresses and the distribution of available address blocks, the allocation device determines the target IP addresses, where the number of target IP addresses meets the required number of IP addresses.

[0088] S204 assigns the target IP address to the target user.

[0089] Specifically, the distribution device sends the target IP address to the target user terminal, thereby making the target user aware of the target IP address.

[0090] This embodiment provides an Internet Protocol (IP) address allocation method, which includes: obtaining the number of IP addresses required by a target user; determining the number of preset type IP addresses to be provided based on the number of IP address requirements; the preset type IP addresses include a first preset number of address blocks, and each address block includes a second preset number of IP addresses; if the number of preset type IP addresses is determined to be one, then determining the number of auxiliary IP address lookups based on the number of IP address requirements; and determining a target IP address from the preset type IP addresses based on the number of auxiliary IP address lookups and the distribution of available address blocks in the preset type IP addresses, wherein the target IP address meets the number of IP address requirements; the number of auxiliary IP address lookups is a specific value determined to assist in finding the target IP address; and allocating the target IP address to the target user. This application embodiment first obtains the number of IP addresses required by the target user, and then quickly determines the number of preset type IP addresses based on the number of IP address requirements. Since the preset type IP addresses contain multiple IP addresses, the number of preset type IP addresses can be quickly determined by determining the number of IP address requirements and the number of IP addresses contained in the preset type IP addresses. If the number of preset type IP addresses is quickly determined to be one, the number of IP address auxiliary addressing is then determined based on the number of IP address requirements. Since the preset type IP addresses contain multiple address blocks, the allocation device accurately records the distribution and availability status of each address block, thereby accurately determining the available address blocks. Then, based on the number of IP address auxiliary addressing and the distribution of available address blocks in the preset type IP addresses, the target IP address can be accurately determined.

[0091] Example 2

[0092] Figure 3 This is a flowchart illustrating an Internet Protocol (IP) address allocation method provided in Embodiment 2 of this application. This embodiment is a further refinement of Embodiment 1 above. This embodiment is an optional method for determining the number of preset type IP addresses to be provided based on the required number of IP addresses, such as... Figure 3 As shown, the specific steps are as follows.

[0093] S301, compare the number of IP addresses required with the number of IP addresses included in the preset type of IP address; the number of IP addresses included in the preset type of IP address is the product of the first preset number and the second preset number.

[0094] The number of IP addresses included in the preset type IP address is equal to the product of the first preset number and the second preset number.

[0095] For example, if a preset type of IP address includes 64 address blocks, and each address block includes 4 IP addresses, then the number of IP addresses contained in the preset type of IP address = 64 * 4 = 256.

[0096] S302, if the number of IP addresses required is less than or equal to the number of IP addresses included in the preset type of IP address, then the number of preset type IP addresses to be provided is determined to be one.

[0097] Specifically, if the number of IP addresses required is less than or equal to the number of IP addresses included in the preset type of IP address, it means that only one preset type of IP address is needed to allocate the number of IP addresses required by the target user. Therefore, the allocation device determines that a preset type of IP address needs to be provided for IP address allocation.

[0098] For example, if the target user requires 8 IP addresses and the number of IP addresses included in the preset type of IP address is 256, the allocation device compares 8 with 256 and determines that the number of IP addresses required is less than the number of IP addresses included in the preset type of address, and then determines that a preset type of IP address is needed.

[0099] S303 If it is determined that the number of IP addresses required is greater than the number of IP addresses included in the preset type of IP address, then it is determined that the number of preset type IP addresses to be provided is multiple.

[0100] Specifically, if the allocation device determines that the number of IP addresses required is greater than the number of addresses included in the preset type of IP addresses, it can preliminarily determine that multiple preset type IP addresses need to be provided.

[0101] In one approach, the quotient between the required number of IP addresses and the number of IP addresses included in the preset type of IP addresses can be calculated, and the specific number of preset type IP addresses that need to be provided can be determined based on the quotient.

[0102] For example, if the required number of IP addresses is 288 and the number of IP addresses included in the preset type of IP address is 256, the allocation device determines that the required number of IP addresses is greater than the number of IP addresses included in the preset type of IP address. Therefore, it determines that multiple preset type IP addresses need to be provided. The allocation device further calculates the quotient of the required number of IP addresses and the number of IP addresses included in the preset type of IP address. This quotient is denoted as the preset type IP address quantity quotient = 288 / 256 = 1...32, where 1 is the integer value of the preset type IP address quantity quotient and 32 is the remainder value. Thus, it is determined that the number of preset type IP addresses = integer value + value 1 = 1 + 1 = 2, and therefore the number of preset type IP addresses is 2.

[0103] This embodiment provides an Internet Protocol (IP) address allocation method. When determining the number of preset type IP addresses to be provided based on the IP address demand, the method specifically includes: comparing the IP address demand with the number of IP addresses included in the preset type IP addresses; the number of IP addresses included in the preset type IP addresses is the product of a first preset number and a second preset number; if the IP address demand is less than or equal to the number of IP addresses included in the preset type IP addresses, then the number of preset type IP addresses to be provided is determined to be one; if the IP address demand is greater than the number of IP addresses included in the preset type IP addresses, then the number of preset type IP addresses to be provided is determined to be multiple. This embodiment first calculates the product of the first preset quantity and the second preset quantity to accurately determine the number of IP addresses included in the preset type of IP address. Then, it compares the number of IP addresses required with the number of IP addresses included in the preset type of IP address to determine the number of preset type IP addresses that need to be provided based on the comparison result. If the number of IP addresses required is less than or equal to the number of IP addresses included in the preset type of IP address, it can be accurately determined that the number of preset type IP addresses that need to be provided is one. If the number of IP addresses required is greater than or equal to the number of IP addresses included in the preset type of IP address, the allocation device can determine that the number of preset type IP addresses that need to be provided is multiple.

[0104] Example 3

[0105] This application embodiment is a further refinement of any of the above embodiments. This embodiment is an optional method for determining the number of IP address auxiliary addressings based on the number of IP address requirements, and the specific content is as follows.

[0106] If the required number of IP addresses is determined to be a power of 2, then the required number of IP addresses is defined as the number of IP address auxiliary addresses.

[0107] Specifically, the allocation device calculates whether the number of IP addresses required satisfies a power of 2. For example, if the number of IP addresses required is 8, then 8 = 2^3 is calculated, thus determining that the number of IP addresses required satisfies a power of 2. The allocation device then determines the number of IP addresses required as the number of IP address auxiliary addresses.

[0108] It is understandable that the number of IP address auxiliary addressings can be the same as or different from the number of IP address requirements.

[0109] If the required number of IP addresses is not a power of 2, then the first value that is greater than the required number of IP addresses and equal to a power of 2 is determined as the number of auxiliary IP address addresses, where n is an integer.

[0110] Specifically, if the allocation device determines that the number of IP addresses required is not a power of 2, it can determine the first value that is greater than the number of IP addresses required and equal to a power of 2, and determine this value as the number of IP address auxiliary addresses.

[0111] For example, if the number of IP addresses required is 11, and the allocation device determines that the number of IP addresses required is not a power of 2, then it determines that the first value that is greater than the number of IP addresses required and equal to a power of 2 is 16, where 16 is greater than 11 and equal to a power of 2, and is the first value that is greater than the number of IP addresses required and equal to a power of 2.

[0112] This embodiment provides an Internet Protocol (IP) address allocation method. When determining the number of auxiliary IP address addresses based on the number of IP address requests, if the number of IP address requests is determined to be a power of 2, then the number of IP address requests is determined as the number of auxiliary IP address addresses. If the number of IP address requests is not a power of 2, then the first value greater than the number of IP address requests and equal to a power of 2 is determined as the number of auxiliary IP address addresses, where n is an integer. This embodiment accurately determines the number of auxiliary IP address addresses based on whether the number of IP address requests satisfies a power of 2. If the number of IP address requests is determined to be a power of 2, then this number of IP address requests can be quickly determined as the number of IP address replication addresses. If the number of IP address requests is not a power of 2, then after calculation, the allocation device can accurately determine the first value greater than the number of IP address requests and equal to a power of 2 as the number of auxiliary IP address addresses.

[0113] Example 4

[0114] Figure 4This is a flowchart illustrating an Internet Protocol (IP) address allocation method provided in Embodiment 4 of this application. This embodiment is a further refinement of any of the above embodiments. This embodiment is an optional method for determining a target IP address from a preset type of IP address based on the number of IP address auxiliary addressings and the distribution of available address blocks in the preset type of IP address. Figure 4 As shown, the specific steps are as follows.

[0115] S401, determine the current candidate first IP address to be provided based on the number of IP address auxiliary addressings and the distribution of available address blocks in the preset type of IP address.

[0116] The available address block refers to an address block within a preset type of IP address that is not being used by other users.

[0117] The current first candidate IP address refers to the first IP address in a candidate address block.

[0118] Specifically, the allocation device determines the available address blocks in the preset type of IP address and the first IP address of each available address block. Then, the allocation device determines the current candidate first IP address based on the number of auxiliary IP address lookups and the first IP address of the available address blocks in the preset type of IP address. The address block to which the current candidate first IP address belongs must be available.

[0119] S402, based on the number of IP address auxiliary addressings, the availability status of the address block including the current candidate first IP address and the subsequent address blocks, determine that the current candidate first IP address is the target first IP address to be provided.

[0120] Specifically, the allocation device determines, based on the number of IP address auxiliary addressings, how many address blocks of preset type IP addresses are needed to satisfy that number of IP address auxiliary addressings. This is the total number of address blocks of preset type IP addresses required. The allocation device determines the address blocks including the current candidate IP address, and determines the number of subsequent address blocks based on the total number of address blocks of preset type IP addresses required. It also determines the sequence number of the subsequent address blocks based on the address block number to which the current candidate first IP address belongs, and then determines the subsequent address blocks. Next, it determines whether the subsequent address blocks are available, and finally, the allocation device determines that the current candidate first IP address is the target first IP address to be provided.

[0121] For example, if the number of IP address auxiliary addresses is 8, according to the example in S301, the total number of address blocks of the preset type IP addresses required is 8 / 4 = 2. The address block to which the current candidate first IP address belongs is K3. Then the number of subsequent address blocks is equal to the total number of address blocks of the preset type IP addresses required minus the number of address blocks to which the current candidate first IP address belongs. Therefore, the number of subsequent address blocks is 2 - 1 = 1. Thus, the subsequent address block is determined to be K4. Then, based on the availability status of the subsequent address block K4, it is determined whether the current candidate first IP address is the target first IP address to be provided.

[0122] S403 If the target first IP address is determined, then the total number of target IP addresses to be provided is determined based on the target first IP address and the required number of IP addresses.

[0123] The total target IP addresses to be provided refer to all IP addresses that are to be provided to the user.

[0124] Specifically, if the allocation device determines the target first IP address, it will determine multiple IP addresses following the target first IP address based on the number of IP addresses required by the target user, and then determine the target first IP address and multiple IP addresses as the total number of IP addresses to be provided to the target user.

[0125] In one approach, this method is an optional approach that determines all target IP addresses to be provided based on the target's first IP address and the required number of IP addresses, as detailed below.

[0126] The first IP address of the target and the third preset number of consecutive IP addresses following the first IP address are determined as the total number of target IP addresses; the sum of the third preset number and the value one equals the number of IP addresses required.

[0127] The third preset quantity is a value preset in advance based on the number of IP addresses required. The sum of the third preset quantity and the number of target first-order IP addresses equals the number of IP addresses required. The number of target first-order IP addresses is the value 1. Therefore, the sum of the third preset quantity and the value 1 equals the number of IP addresses required.

[0128] For example, if the target IP address requirement is 8, then the first IP address of the target will occupy one IP address. Therefore, the third preset number is the number of IP address requirements minus the number of the first IP addresses of the target, which equals 7. The allocation device determines the 7 consecutive IP addresses arranged after the first IP address, then determines the first IP address of the target and the 7 consecutive IP addresses following it as the total target IP addresses, and provides all IP addresses to the target user.

[0129] This method, when determining the total number of target IP addresses to be provided based on the target's first IP address and the required number of IP addresses, specifically includes: determining the target's first IP address and a third preset number of consecutive IP addresses following the first IP address as the total number of target IP addresses; the sum of the third preset number and the value one equals the required number of IP addresses. In this method, the third preset number is accurately calculated based on the required number of IP addresses, and then the third preset number of consecutive IP addresses following the target's first IP address are determined. This allows for the accurate determination of the target's first IP address and the third preset number of consecutive IP addresses as the total number of target IP addresses. Since the total number of target IP addresses is ultimately determined based on the target user's IP address requirements, the final total number of IP addresses meets the target user's needs. This method ensures that the number of target IP addresses provided to the target user meets the actual demand.

[0130] This embodiment provides an Internet Protocol (IP) address allocation method. When determining a target IP address from a preset type of IP address based on the number of IP address auxiliary addresses and the distribution of available address blocks in the preset type of IP address, the method specifically includes: determining the current candidate first IP address to be provided based on the number of IP address auxiliary addresses and the distribution of available address blocks in the preset type of IP address; determining whether the current candidate first IP address is the target first IP address to be provided based on the number of IP address auxiliary addresses, the availability status of the address blocks including the current candidate first IP address and subsequent address blocks; if it is determined to be the target first IP address, then determining all target IP addresses to be provided based on the target first IP address and the required number of IP addresses. This embodiment accurately determines the current candidate first IP address to be provided based on the number of IP address-assisted addressings and the distribution of available address blocks in the preset type of IP addresses. Then, the allocation device determines whether the address block including the current candidate first IP address and the subsequent address blocks are available. Based on whether the address blocks are available, it can further determine whether the current candidate first IP address can be used as the target first IP address. Based on the judgment of whether the address blocks are available, it is beneficial to accurately determine the target first IP address. Once the target first IP address is determined, all target IP addresses can be determined based on the number of IP addresses required and the target first IP address. Since the determination of all IP addresses is based on the number of IP addresses required, all target IP addresses meet the target user's quantity requirements.

[0131] Example 5

[0132] The embodiments described in this application are further refinements of any of the above embodiments, and the specific details are as follows.

[0133] If it is determined that the IP address is not the target first IP address, the next candidate first IP address to be provided is determined based on the number of auxiliary IP address addresses and the distribution of available address blocks in the preset type of IP address.

[0134] Specifically, the allocation device searches for an available address block after the current address block that is not the target first IP address, and determines the next candidate first IP address based on the first IP address of the available address block and the number of IP address auxiliary addresses.

[0135] The next candidate first IP address is determined as the current candidate first IP address, and the steps are performed to determine whether the current candidate first IP address is the target first IP address to be provided, based on the number of IP address auxiliary addressings, the availability status of the address block including the current candidate first IP address and the subsequent address blocks.

[0136] Specifically, if the next candidate first IP address is determined to be the current candidate first IP address, the steps in Example 4 can be executed to determine all target IP addresses that meet the target user's IP address requirements.

[0137] This embodiment provides an Internet Protocol (IP) allocation method, specifically including: if it is determined that the IP address is not the target first IP address, then determining the next candidate first IP address to be provided based on the number of IP address auxiliary addresses and the distribution of available address blocks in the preset type of IP addresses; determining the next candidate first IP address as the current candidate first IP address, and executing the step of determining that the current candidate first IP address is the target first IP address to be provided based on the number of IP address auxiliary addresses, the availability status of the address blocks including the current candidate first IP address, and the subsequent address blocks. In this embodiment, if it is determined that the IP address is not the target first IP address, the step of finding the next candidate first IP address is executed, and then the next candidate first IP address to be provided is further determined based on the number of IP address auxiliary addresses and the distribution of available address blocks in the preset type of IP addresses. The next candidate first IP address is then determined as the current candidate first IP address, and then the step of determining that the current candidate first IP address is the target first IP address to be provided based on the number of IP address auxiliary addresses, the availability status of the address blocks including the current candidate first IP address, and the subsequent address blocks is repeated to determine all target IP addresses. In this embodiment, after determining that the target first IP address is not the first IP address, the next candidate first IP address is searched for, thereby accurately finding the target first IP address and then determining the target IP address.

[0138] In one way, Figure 5This is a flowchart illustrating an Internet Protocol (IP) address allocation method provided in Embodiment 5 of this application. This method is an optional approach that determines the current candidate first IP address as the target first IP address to be provided based on the number of IP address auxiliary addressings, the availability status of the address block including the current candidate first IP address, and the subsequent address blocks. Figure 5 As shown, the specific steps are as follows.

[0139] S501 determines the number of subsequent address blocks whose availability status needs to be confirmed based on the number of IP address auxiliary addressings.

[0140] The number of subsequent address blocks whose availability status needs to be confirmed refers to determining whether multiple subsequent address blocks, including the address block containing the current candidate first IP address, are in an available state.

[0141] Specifically, the allocation device calculates the number of subsequent address blocks whose availability status needs to be confirmed based on the number of IP address-assisted addressings.

[0142] In one approach, this method is an optional way to determine the number of subsequent address blocks whose availability status needs to be confirmed based on the number of IP address auxiliary addressings, as detailed below.

[0143] Calculate the quotient of the number of IP address auxiliary addressings and the second preset number.

[0144] Specifically, the allocation device determines the total number of address blocks required by using the quotient of the number of IP address-assisted addressings and the second preset number.

[0145] For example, assuming the number of IP address auxiliary addresses is 8, the total number of address blocks required is equal to the number of IP address auxiliary addresses divided by the second preset number = 8 / 4 = 4.

[0146] The difference between the quotient and the value one is used to determine the number of subsequent address blocks whose availability status needs to be confirmed.

[0147] The number of address blocks that include the first IP address of the current candidate is one, and the value 1 indicates the number of address blocks that include the first IP address of the current candidate.

[0148] Specifically, the allocation device first determines the number of address blocks including the current candidate first IP address, and then determines the number of subsequent address blocks whose availability status needs to be confirmed based on the total number of address blocks required. Specifically, the difference between the quotient and the first value is determined as the number of subsequent address blocks whose availability status needs to be confirmed.

[0149] For example, based on the above example, since the number of address blocks including the current candidate first IP address is 1, the number of subsequent address blocks can be obtained as the total number of address blocks required minus the number of address blocks including the current candidate first IP address = 2 - 1 = 1.

[0150] This method, when determining the number of subsequent address blocks requiring confirmation of availability based on the number of IP address auxiliary addressings, specifically includes: calculating the quotient between the number of IP address auxiliary addressings and a second preset number; and determining the difference between the quotient and a first value as the number of subsequent address blocks requiring confirmation of availability. This allocation device accurately determines the total number of address blocks required to meet the IP address auxiliary addressing requirement based on the quotient between the number of IP address auxiliary addressings and the second preset number, and further determines the number of subsequent address blocks requiring confirmation of availability based on the total number of required address blocks. This method, after calculation, can accurately determine the number of subsequent address blocks requiring confirmation of availability.

[0151] S502, if the address block including the current candidate first IP address and the corresponding number of subsequent address blocks are all in an available state, then the current candidate first IP address is determined to be the target first IP address to be provided.

[0152] Specifically, the allocation device determines that the address block including the current candidate first IP address is in an available state. Then, the allocation device determines that the corresponding number of subsequent address blocks are also in an available state. The allocation device then determines that the current candidate first IP address is the target first IP address to be provided.

[0153] S503 If the address block including the current candidate first IP address and the corresponding number of subsequent address blocks are not all in an available state, then it is determined that the current candidate first IP address is not the target first IP address to be provided.

[0154] Specifically, if the allocation device determines that the address block including the current candidate first IP address is not in an available state, and / or the corresponding number of subsequent address blocks are not in an available state, then the allocation device determines that the current candidate first IP address is not the target first IP address to be provided.

[0155] This method, when determining whether the current candidate first IP address is the target first IP address to be provided based on the number of IP address auxiliary addressings and the availability status of the address blocks including the current candidate first IP address and subsequent address blocks, specifically includes: determining the number of subsequent address blocks whose availability status needs to be confirmed based on the number of IP address auxiliary addressings; if both the address blocks including the current candidate first IP address and the corresponding number of subsequent address blocks are available, then the current candidate first IP address is determined to be the target first IP address to be provided; if not both the address blocks including the current candidate first IP address and the corresponding number of subsequent address blocks are available, then the current candidate first IP address is determined not to be the target first IP address to be provided. This embodiment first determines the number of subsequent address blocks whose availability needs to be confirmed based on the number of IP address auxiliary addressings. Since the allocation device can accurately calculate the number of subsequent address blocks whose availability needs to be confirmed, it accurately determines the current candidate first IP address as the target first IP address. The allocation device determines that the address block including the current candidate first IP address and the corresponding number of subsequent address blocks are both in an available state, and determines that the current candidate first IP address is the target first IP address. It determines that when the address block including the current candidate first IP address and the corresponding number of subsequent address blocks are not both in an available state, it accurately determines that the current candidate first IP address is not the target first IP address. Based on the allocation device's judgment on the availability of the address block including the current candidate first IP address and the corresponding number of subsequent address blocks, it accurately determines the target first IP address.

[0156] Example 6

[0157] Figure 6 This is a flowchart illustrating an Internet Protocol (IP) address allocation method provided in Embodiment Six of this application. This embodiment is a further refinement of any of the above embodiments. This embodiment is an optional method for determining the current candidate first-place IP address to be provided based on the number of IP address auxiliary addressings and the distribution of available address blocks in a preset type of IP address. Figure 6 As shown, the specific steps are as follows.

[0158] S601: Obtain the currently available address blocks in the preset type of IP address based on the distribution of available address blocks.

[0159] Specifically, the allocation device obtains the first available address block from the preset type of IP address and uses it as the current available address block.

[0160] For example, if a preset type of IP address contains multiple available address blocks, such as K1, K2, and K3, then K1 is first obtained as the current available address block.

[0161] S602, if it is determined that the sequence number of the first IP address in the current available address block is an integer multiple of the number of auxiliary IP addresses, then the current available address block is determined as the current candidate address block; the sequence number of the first IP address in the preset type IP address is zero.

[0162] Each IP address has a sequence number. For example, the first IP address in address block K1 has a sequence number of 0, and the last IP address has a sequence number of 3.

[0163] In the preset type IP address, the sequence number of the first IP address is zero, which means that the first IP address in the first address block of the preset type IP address is zero.

[0164] Specifically, the allocation device determines the currently available address block and the first IP address in the available address block. Each IP address has a sequence number in the preset type of IP address. After determining the sequence number of the first IP address, it is then determined whether the sequence number of the first IP address is an integer multiple of the number of auxiliary IP addresses.

[0165] It is understandable that there can be multiple currently available address blocks, so there may be multiple IP address sequences that are integer multiples of the number of IP address auxiliary addresses. Therefore, the allocation device selects the first IP address whose sequence number is an integer multiple of the number of IP address auxiliary addresses.

[0166] S603, if it is determined that the sequence number of the first IP address in the current available address block is not an integer multiple of the number of IP address auxiliary addresses, then the available address blocks in the preset type IP address are traversed until an available address block in which the sequence number of the first IP address in the preset type IP address is an integer multiple of the number of IP address auxiliary addresses is obtained as the current candidate address block.

[0167] Specifically, if the first IP address sequence number in the currently available address block is not an integer multiple of the number of IP address auxiliary addresses, the allocation device then traverses the available address blocks in the preset type of IP address to determine the next currently available address block, and then executes the steps in S602. This process is repeated until the first IP address sequence number in the available address block is obtained to be an integer multiple of the number of IP address auxiliary addresses, and then the allocation device determines that the available address block can be used as the current candidate address block.

[0168] This embodiment provides an Internet Protocol (IP) address allocation method. When determining the current candidate first IP address to be provided based on the number of IP address auxiliary addresses and the distribution of available address blocks in a preset type of IP address, the method specifically includes: S601, obtaining currently available address blocks in the preset type of IP address based on the distribution of available address blocks; if it is determined that the sequence number of the first IP address in the current available address block is an integer multiple of the number of IP address auxiliary addresses, then the current available address block is determined as the current candidate address block; the sequence number of the first IP address in the preset type of IP address is zero; if it is determined that the sequence number of the first IP address in the current available address block is not an integer multiple of the number of IP address auxiliary addresses, then the available address blocks in the preset type of IP address are traversed until an available address block in which the sequence number of the first IP address in the preset type of IP address is an integer multiple of the number of IP address auxiliary addresses is obtained as the current candidate address block. This embodiment first determines the currently available address block in the preset type of IP address, then determines the first IP address sequence number of the currently available address block, and then accurately calculates whether the first IP address sequence number is an integer multiple of the number of IP address auxiliary addresses. If it is an integer multiple, the currently available address block can be determined as the current candidate address block; if it is not an integer multiple, the allocation device then begins to traverse the available address blocks in the preset type of IP address, and then accurately finds the next currently available address block, and then performs the same operation as above to determine whether the first IP address sequence number of the next currently available address block is an integer multiple of the number of IP address auxiliary addresses. If not, it continues until an available address block is found whose first IP address sequence number satisfies the condition of being an integer multiple of the number of IP address auxiliary addresses, thereby accurately determining the current candidate address block from multiple available address blocks in the preset type of IP address.

[0169] Example 7

[0170] Figure 7 This is a flowchart illustrating an Internet Protocol (IP) address allocation method provided in Embodiment 7 of this application. This embodiment is a further refinement of any of the above embodiments. This embodiment is an optional method if the number of preset type IP addresses is determined to be multiple, and the number of multiple preset type IP addresses is a fourth preset number, such as... Figure 7 As shown, the specific steps are as follows.

[0171] S701, obtain the fourth preset number of preset type IP addresses, wherein all IP addresses in the preset type IP addresses except the last preset type IP address are in an available state.

[0172] The fourth preset quantity can be calculated from the number of IP addresses required.

[0173] For example, if the number of IP addresses required is 288, and a preset type of IP address contains 256, then the fourth preset quantity is equal to the number of IP addresses required divided by 256, which equals 1...32. Therefore, the fourth preset quantity is determined to be two, where all IP addresses in the first preset type of IP address are in an available state.

[0174] Specifically, preset type IP addresses can be stored in the storage area, and the allocation device obtains a fourth preset number of preset type IP addresses from the storage area.

[0175] S702, determine the IP address to be provided in the last preset type IP address according to the IP address determination method where the number of preset type IP addresses is one.

[0176] Specifically, the allocation device uses the remainder value in the calculation result as the number of IP addresses that still need to be allocated. The allocation device will use the IP addresses in the last preset type IP address to determine the IP addresses to be provided in the last preset type IP address according to the IP address determination method where the number of preset type IP addresses is one.

[0177] For example, according to the exemplary example in S701, the remaining value 32 needs to be allocated using the last preset type IP address, where the remaining value is the number of IP addresses that still need to be allocated. The allocation method is the same as in the above embodiment, and will not be repeated here.

[0178] S703, determine the target IP address from the preset type IP addresses where all IP addresses are in an available state and the IP address to be provided determined from the last preset type IP address.

[0179] Among them, the number of IP addresses of the preset type that are all in an available state is one less than the number of the fourth preset.

[0180] Specifically, the assigned address uses a preset type of IP address where all IP addresses are in an available state, and the IP address to be provided determined in S702 as the target IP address.

[0181] This embodiment provides an Internet Protocol (IP) address allocation method. When the number of preset type IP addresses is determined to be multiple, and the total number of preset type IP addresses is a fourth preset number, the method specifically includes: obtaining the fourth preset number of preset type IP addresses, wherein all IP addresses in the preset type IP addresses except the last preset type IP address are in a usable state; determining the IP address to be provided from the last preset type IP address according to the IP address determination method where the number of preset type IP addresses is one; and determining the preset type IP addresses where all IP addresses are in a usable state and the IP address to be provided from the last preset type IP address as the target IP address. This embodiment first obtains the fourth preset number of preset type IP addresses. Since the IP addresses in the preset type IP addresses before the last preset type IP address are all in a usable state, it is only necessary to determine the IP address to be provided from the last preset type IP address. According to the IP address determination method where the number of preset type IP addresses is one, the IP address to be provided from the last preset type IP address can be accurately determined, and thus the target IP address can be determined.

[0182] Example 8

[0183] Figure 8 This is a flowchart illustrating an Internet Protocol (IP) address allocation method provided in Embodiment 8 of this application. This embodiment is a further refinement of the above embodiments, and it mainly employs an IP address allocation algorithm, such as... Figure 8 As shown, the specific steps are as follows.

[0184] In this embodiment, m refers to the address block number. If m = 1, it corresponds to K1.

[0185] In this embodiment, L represents the number of IP address auxiliary addressings;

[0186] S801, Input m = 1;

[0187] S802, determine whether Km is available. If not, proceed to S803; if yes, proceed to S804.

[0188] S803, re-enter m = m + 1;

[0189] S804, determine whether the quotient of the first IP address of Km and L is equal to an integer; if not, proceed to S803; if yes, proceed to S805.

[0190] S805, determine whether L is greater than the second preset quantity; if L is equal to the second preset quantity, then execute S806; if L is greater than the second preset quantity, then execute S807.

[0191] S806, parameter P = L / second preset quantity, calculate parameter P = 1, then execute S808;

[0192] S807, calculate the value of parameter P, determine address block K(m+p-1), and determine whether all IP addresses between Km and K(m+p-1) are available; if not, proceed to S803; if yes, proceed to S808.

[0193] S808 determines the first IP address and the last IP address based on the first IP address = Km = 4(m-1) and the last IP address = K(m+p-1) = 4(m+p-1)-1, and then determines the target IP address.

[0194] For example, if all IP addresses in a preset type of IP address are available, and L equals 8 and the second preset quantity is 4, then two address blocks are required. First, execute S801. When n=1, the corresponding address block is K1. Then execute S802 to determine if K1 is available. If K1 is available, execute S804. Determine that the first IP address of K1 is 0. Calculate the quotient of the first IP address of K1 and L to be 0. Determine that it is an integer, then execute S805. Next, determine that L(8) is greater than the second preset quantity (4), then execute S807. Calculate the parameter P=L / second preset quantity=8 / 4=2, determine that K(m+p-1)=K2, then determine whether all IP addresses between K1 and K2 are available. If the IP addresses in K1 and K2 are available, then execute S808. According to the first IP address=Km=4(m-1)=4(1-1)=0, the last IP address K(m+p-1)=4(m+p-1)-1=7, then determine that the target IP address is 0-7 of the preset type IP address.

[0195] Example 9

[0196] The following are embodiments of the apparatus described in this application. Figure 9 This is a schematic diagram of an Internet Protocol address allocation device provided in Embodiment 9 of this application. Figure 9 As shown, the device 900 includes the following modules.

[0197] Module 901 is used to obtain the required number of Internet Protocol (IP) addresses for the target user.

[0198] The determining module 902 is used to determine the number of preset type IP addresses to be provided based on the number of IP address requirements; the preset type IP addresses include a first preset number of address blocks, and each address block includes a second preset number of IP addresses;

[0199] The determining module 902 is also used to determine the number of auxiliary IP addresses based on the number of IP addresses required if the number of IP addresses of the preset type is one; and to determine the target IP address from the preset type IP addresses based on the number of auxiliary IP addresses and the distribution of available address blocks in the preset type IP addresses, wherein the target IP address meets the number of IP addresses required; the number of auxiliary IP addresses is a specific value determined to assist in finding the target IP address;

[0200] The allocation module 903 is used to assign a target IP address to a target user.

[0201] In one approach, the determining module 902, when determining the number of preset type IP addresses to be provided based on the IP address demand, is specifically used for:

[0202] The required number of IP addresses is compared with the number of IP addresses included in the preset type of IP address; the number of IP addresses included in the preset type of IP address is the product of the first preset number and the second preset number;

[0203] If the number of IP addresses required is less than or equal to the number of IP addresses included in the preset type of IP address, then the number of preset type IP addresses to be provided is one.

[0204] If the required number of IP addresses is greater than the number of IP addresses included in the preset type of IP address, then the number of preset type IP addresses to be provided is determined to be multiple.

[0205] In one approach, module 902, when determining the number of IP address auxiliary addressing requests based on the number of IP address requests, is specifically used for:

[0206] If the required number of IP addresses is determined to be a power of 2, then the required number of IP addresses is determined as the number of IP address auxiliary addresses.

[0207] If the required number of IP addresses is not a power of 2, then the first value that is greater than the required number of IP addresses and equal to a power of 2 is determined as the number of auxiliary IP address addresses, where n is an integer.

[0208] In one approach, the determining module 902, when determining the target IP address from the preset type IP addresses based on the number of IP address auxiliary addressings and the distribution of available address blocks in the preset type IP addresses, is specifically used for:

[0209] The current candidate first IP address to be provided is determined based on the number of IP address auxiliary addressings and the distribution of available address blocks in the preset type of IP address.

[0210] The current candidate first IP address is determined to be the target first IP address to be provided based on the number of IP address auxiliary addressings, the availability status of the address block including the current first IP address and the subsequent address blocks;

[0211] If the target first IP address is determined, then the total number of target IP addresses to be provided is determined based on the target first IP address and the required number of IP addresses.

[0212] In one embodiment, the determining module 902 is further configured to: if it is determined that the IP address is not the target first IP address, determine the next candidate first IP address to be provided based on the number of auxiliary IP address lookups and the distribution of available address blocks in the preset type of IP address; determine the next candidate first IP address as the current candidate first IP address, and perform the step of determining that the current candidate first IP address is the target first IP address to be provided based on the number of auxiliary IP address lookups, the availability status of the address blocks including the current candidate first IP address and the subsequent address blocks.

[0213] In one approach, the determining module 902, when determining the current candidate first IP address to be provided based on the number of IP address auxiliary addressings and the distribution of available address blocks in the preset type of IP addresses, is specifically used for:

[0214] Based on the distribution of available address blocks, obtain the currently available address blocks from the preset type of IP addresses; if it is determined that the sequence number of the first IP address in the current available address block is an integer multiple of the number of IP address auxiliary addresses, then the current available address block is determined as the current candidate address block; the sequence number of the first IP address in the preset type of IP addresses is zero; if it is determined that the sequence number of the first IP address in the current available address block is not an integer multiple of the number of IP address auxiliary addresses, then traverse the available address blocks in the preset type of IP addresses until an available address block in which the sequence number of the first IP address in the preset type of IP addresses is an integer multiple of the number of IP address auxiliary addresses is obtained as the current candidate address block.

[0215] In one approach, the determining module 902, when determining whether the current candidate first IP address is the target first IP address to be provided based on the number of IP address auxiliary addressings, the availability status of the address block including the current candidate first IP address, and the subsequent address blocks, is specifically used for:

[0216] The number of subsequent address blocks whose availability needs to be confirmed is determined based on the number of IP address auxiliary addressings; if the address block including the current candidate first IP address and the corresponding number of subsequent address blocks are all in an available state, then the current candidate first IP address is determined to be the target first IP address to be provided; if the address block including the current candidate first IP address and the corresponding number of subsequent address blocks are not all in an available state, then the current candidate first IP address is determined not to be the target first IP address to be provided.

[0217] In one approach, the determining module 902, when determining the number of subsequent address blocks whose availability status needs to be confirmed based on the number of IP address auxiliary addressings, is specifically used for:

[0218] Calculate the quotient between the number of IP address auxiliary addressings and the second preset number; determine the difference between the quotient and the first value as the number of subsequent address blocks whose availability status needs to be confirmed.

[0219] In one approach, the determining module 902, when determining all target IP addresses to be provided based on the target first IP address and the required number of IP addresses, is specifically used for:

[0220] The first IP address of the target and the third preset number of consecutive IP addresses following the first IP address are determined as the total number of target IP addresses; the sum of the third preset number and the value one equals the number of IP addresses required.

[0221] In one embodiment, when the number of preset type IP addresses is multiple and the number of preset type IP addresses is a fourth preset number, the acquisition module 901 is further configured to acquire the fourth preset number of preset type IP addresses, wherein all IP addresses in the preset type IP addresses except the last preset type IP address are in an available state; the determination module 902 is further configured to determine the IP address to be provided from the last preset type IP address according to the IP address determination method where the number of preset type IP addresses is one; the determination module 902 is further configured to determine the preset type IP addresses in an available state and the IP address to be provided determined from the last preset type IP address as the target IP address.

[0222] Example 10

[0223] Figure 10 This is a schematic diagram of the structure of an electronic device provided in Embodiment 10 of this application. Figure 10As shown, the electronic device 100 may include a processor 1001 and a memory 1002 communicatively connected to the processor 1001. The memory 1002 stores computer-executable instructions; the processor 1001 executes the computer-executable instructions stored in the memory 1002 to implement any one of the method embodiments 1 to 8 described above. The specific implementation methods and technical effects are similar and will not be repeated here.

[0224] In this embodiment, the memory 1002 and the processor 1001 are connected via a bus. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 10 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0225] Example 11

[0226] This application provides a computer-readable storage medium storing computer-executable instructions. When executed by a processor, the computer-executable instructions are used to implement any one of the method embodiments 1 to 8 described above. The specific implementation methods and technical effects are similar and will not be repeated here.

[0227] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0228] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. An Internet Protocol address allocation method, characterized by, The method comprises: acquiring an IP address demand quantity corresponding to a target user; determining a quantity of preset type IP addresses to be provided according to the IP address demand quantity; the preset type IP addresses comprise a first preset quantity of address blocks, and each address block comprises a second preset quantity of IP addresses; if it is determined that the quantity of preset type IP addresses is one, then determining an IP address auxiliary searching quantity according to the IP address demand quantity, and determining a target IP address from the preset type IP addresses according to the IP address auxiliary searching quantity and a distribution of available address blocks in the preset type IP addresses, the target IP address satisfying the IP address demand quantity; the IP address auxiliary searching quantity is a specific value determined for assisting in searching for the target IP address; allocating the target IP address to the target user; the step of determining the IP address auxiliary searching quantity according to the IP address demand quantity comprises: if it is determined that the IP address demand quantity is a power of 2, then determining the IP address demand quantity as the IP address auxiliary searching quantity; if it is determined that the IP address demand quantity is not a power of 2, then determining a value greater than the IP address demand quantity and equal to a power of 2 as the IP address auxiliary searching quantity, wherein n is an integer.

2. The method of claim 1, wherein, the step of determining the quantity of preset type IP addresses to be provided according to the IP address demand quantity comprises: comparing the IP address demand quantity with a quantity of IP addresses comprised in the preset type IP addresses; the quantity of IP addresses comprised in the preset type IP addresses is a product of the first preset quantity and the second preset quantity; if it is determined that the IP address demand quantity is less than or equal to the quantity of IP addresses comprised in the preset type IP addresses, then determining that the quantity of preset type IP addresses to be provided is one; if it is determined that the IP address demand quantity is greater than the quantity of IP addresses comprised in the preset type IP addresses, then determining that the quantity of preset type IP addresses to be provided is multiple.

3. The method according to claim 1 or 2, characterized in that, the step of determining the target IP address from the preset type IP addresses according to the IP address auxiliary searching quantity and the distribution of available address blocks in the preset type IP addresses comprises: determining a current candidate first IP address to be provided according to the IP address auxiliary searching quantity and the distribution of available address blocks in the preset type IP addresses; determining whether the current candidate first IP address is a target first IP address to be provided according to the IP address auxiliary searching quantity, an address block comprising the current candidate first IP address, and an available state of a subsequent address block; if it is determined that the current candidate first IP address is the target first IP address, then determining all target IP addresses to be provided according to the target first IP address and the IP address demand quantity.

4. The method of claim 3, wherein, the method further comprises: if it is determined that the current candidate first IP address is not the target first IP address, then determining a next candidate first IP address to be provided according to the IP address auxiliary searching quantity and the distribution of available address blocks in the preset type IP addresses; determining a next candidate first IP address as the current candidate first IP address, and performing a step of determining whether the current candidate first IP address is a target first IP address to be provided according to the IP address auxiliary addressing number, a state of whether address blocks including the current candidate first IP address and subsequent address blocks are available.

5. The method of claim 3, wherein, The step of determining the current candidate first IP address to be provided according to the IP address auxiliary addressing number and a distribution of available address blocks in the preset type IP address comprises: obtaining a current available address block in the preset type IP address according to the distribution of available address blocks; if it is determined that a serial number of a first IP address in the current available address block in the preset type IP address is an integer multiple of the IP address auxiliary addressing number, determining the current available address block as a current candidate address block; the serial number of the first IP address in the preset type IP address is zero; if it is determined that the serial number of the first IP address in the current available address block in the preset type IP address is not an integer multiple of the IP address auxiliary addressing number, performing traversal on available address blocks in the preset type IP address until an available address block in which a serial number of a first IP address in the available address block in the preset type IP address is an integer multiple of the IP address auxiliary addressing number is obtained as the current candidate address block.

6. The method of claim 3, wherein, The step of determining whether the current candidate first IP address is the target first IP address to be provided according to the IP address auxiliary addressing number, a state of whether address blocks including the current candidate first IP address and subsequent address blocks are available comprises: determining a number of subsequent address blocks whose states of whether available need to be confirmed according to the IP address auxiliary addressing number; if the address block including the current candidate first IP address and the corresponding number of subsequent address blocks are all in the available state, determining that the current candidate first IP address is the target first IP address to be provided; if the address block including the current candidate first IP address and the corresponding number of subsequent address blocks are not all in the available state, determining that the current candidate first IP address is not the target first IP address to be provided.

7. The method of claim 6, wherein, The step of determining the number of subsequent address blocks whose states of whether available need to be confirmed according to the IP address auxiliary addressing number comprises: calculating a quotient value of the IP address auxiliary addressing number and a second preset number; determining a difference value between the quotient value and a number one as the number of subsequent address blocks whose states of whether available need to be confirmed.

8. The method of claim 3, wherein, The step of determining all target IP addresses to be provided according to the target first IP address and the IP address required number comprises: determining the target first IP address and continuous IP addresses arranged after the first IP address by a third preset number as all target IP addresses; a sum of the third preset number and a number one is equal to the IP address required number.

9. The method of claim 1 or 2, wherein, If it is determined that the number of preset type IP addresses is multiple, and the number of multiple preset type IP addresses is a fourth preset number, the method further comprises: obtaining fourth preset type IP addresses, wherein IP addresses in preset type IP addresses other than the last preset type IP address are all in the available state; The last preset type IP address is determined according to an IP address determination manner of the preset type IP address with a quantity of one, and an IP address to be provided in the last preset type IP address is determined; The preset type IP address with all IP addresses in an available state and the IP address to be provided in the last preset type IP address are determined as target IP addresses.

10. An Internet Protocol address allocation apparatus, characterized by comprising: The apparatus comprises: An acquisition module is configured to acquire a quantity of IP addresses required by a target user; A determination module is configured to determine a quantity of preset type IP addresses to be provided according to the quantity of IP addresses required; the preset type IP addresses include a first preset quantity of address blocks, and each address block includes a second preset quantity of IP addresses; The determination module is further configured to, if the quantity of preset type IP addresses is determined to be one, determine an IP address auxiliary addressing quantity according to the quantity of IP addresses required, and determine target IP addresses from the preset type IP addresses according to the IP address auxiliary addressing quantity and a distribution of available address blocks in the preset type IP addresses, the target IP addresses satisfying the quantity of IP addresses required; An allocation module is configured to allocate the target IP addresses to the target user; The determination module is specifically configured to, when determining the IP address auxiliary addressing quantity according to the quantity of IP addresses required: If the quantity of IP addresses required is determined to be a power of 2, the quantity of IP addresses required is determined as the IP address auxiliary addressing quantity; If the quantity of IP addresses required is determined to be not a power of 2, a first value greater than the quantity of IP addresses required and equal to a power of 2 is determined as the IP address auxiliary addressing quantity, wherein n is an integer.

11. An electronic device comprising: A processor, and a memory connected with the processor in communication; The memory stores computer execution instructions; The processor executes the computer execution instructions stored in the memory to implement the method in any one of claims 1-9.

12. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by the processor to implement the method in any one of claims 1-9.

Citation Information

Patent Citations

  • Access configuration method, access method and device

    CN113395368A