Gateway address flexible allocation method and device based on fragmentation technology

Through the flexible gateway address allocation method based on sharding technology, the problems of lack of automatic IP address allocation, waste of resources and complex allocation in the existing technology are solved, efficient and accurate IP address resource allocation is achieved, and operation and maintenance costs and work pressure are reduced.

CN119583512APending Publication Date: 2025-03-07CHINA UNITECHS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411476601.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-22
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

The existing technology lacks automatic IP address allocation means, resulting in waste of IP address resources, complex allocation process, relying on manual planning, high time cost, low efficiency, and inability to unify the multi-service resource allocation design.

Method used

The flexible gateway address allocation method based on sharding technology is adopted, and automated address allocation is achieved by confirming the gateway mask, partition address segment, comparing the occupied partition set, and using partitions with small addresses first.

Benefits of technology

It improves the utilization rate of IP address resources, reduces address waste, reduces operation and maintenance costs, improves business activation efficiency, and reduces the working pressure of operation and maintenance personnel.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119583512A_ABST
    Figure CN119583512A_ABST
Patent Text Reader

Abstract

The invention discloses a method and a device for flexibly allocating gateway addresses based on a fragmentation technology, and the method comprises the steps: confirming a gateway mask according to the number of required user addresses; partitioning the planning address field by using a gateway mask to obtain a total partition set; reading an occupied address field, and partitioning by using a gateway mask to obtain an occupied partition set; if a certain partition in the occupied partition set falls into the partition set of the planned address field, discarding the partition in the partition set of the planned address field; remaining partitions in the partition set of the planning address field are recorded as an idle partition set, and the partitions with small addresses are preferentially used and stored in the occupation table. According to the method and the device, the IP address resource allocation is more flexible and accurate, the address allocation algorithm is optimized, the address waste is reduced, the utilization rate of the address resource is improved, the service fulfillment efficiency is further improved, the working pressure of network operation and maintenance personnel is reduced, and the operation and maintenance cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of address allocation, in particular to a method and device for flexibly allocating gateway addresses based on fragmentation technology. Background Art

[0002] IPv4 and IPv6 are core protocols in the Internet protocol suite and are used to implement data transmission and routing in the network. In different business requirements or in different activation scenarios of the same business, the address pool range, number of addresses and address allocation requirements used by users are different, and are basically in a state of manual allocation and maintenance.

[0003] The main problems at present are as follows:

[0004] (1) There is a lack of means for automatic address allocation, and the automatic allocation is basically coarse-grained, resulting in a waste of IP address resources.

[0005] (2) In the past, address segment allocation had certain prerequisites, for example, automatic allocation could only be achieved under the same mask.

[0006] (3) For complex scenarios, manual planning is the only option, which greatly increases the workload of operation and maintenance personnel and places high demands on their processing capabilities.

[0007] (4) The multi-service resource allocation is not designed into a unified process, and the allocation rules are not converged.

[0008] (5) Manual allocation has high time cost, low efficiency and poor accuracy. Summary of the invention

[0009] In order to solve the above problems existing in the prior art, the present invention provides a method and device for flexible allocation of gateway addresses based on sharding technology, which makes the allocation of IP address resources more flexible and accurate, reduces the waste of addresses, improves the utilization rate of address resources, further improves the efficiency of service activation, reduces the work pressure of network operation and maintenance personnel, and reduces the operation and maintenance costs by optimizing the address allocation algorithm.

[0010] To achieve the above object, the present invention adopts the following technical solutions:

[0011] In one embodiment of the present invention, a method for flexible allocation of gateway addresses based on sharding technology is proposed, the method comprising:

[0012] Confirm the gateway mask according to the number of user addresses required;

[0013] Partition the planned address segment using the gateway mask to obtain the total partition set;

[0014] Read the occupied address segment and partition it using the gateway mask to obtain the occupied partition set;

[0015] If a partition in the occupied partition set falls into the partition set of the planned address segment, then this partition is discarded in the partition set of the planned address segment;

[0016] The remaining partitions in the partition set of the planned address segment are recorded as the free partition set, and the partitions with smaller addresses are used first and stored in the occupation table.

[0017] Furthermore, the occupied address segments are read and partitioned using the gateway mask to obtain an occupied partition set, including:

[0018] Read the occupation table and partition the occupied address segments according to the gateway mask;

[0019] If the occupied address segment mask is larger than the gateway mask, the occupied address segment is included in any partition of the planned address segment, and this partition is considered occupied and discarded;

[0020] If the occupied address segment mask is smaller than the gateway mask, the occupied address segment is partitioned according to the gateway mask, and the partitions that overlap with the planned address segment are considered occupied and discarded;

[0021] Define the dropped partitions as the set of occupied partitions.

[0022] Furthermore, the method can be encapsulated into a capability exposure interface for third-party system calls.

[0023] In one embodiment of the present invention, a device for flexibly allocating gateway addresses based on sharding technology is also proposed, and the device includes:

[0024] A gateway mask confirmation module is used to confirm the gateway mask according to the number of required user addresses;

[0025] A planned address segment partitioning module is used to partition the planned address segment using the gateway mask to obtain a total partition set;

[0026] An occupied address segment partitioning module is used to read the occupied address segment and partition it using the gateway mask to obtain an occupied partition set;

[0027] The address segment partition comparison module is used to discard a partition in the planned address segment partition set if the partition in the occupied partition set falls into the planned address segment partition set; the remaining partitions in the planned address segment partition set are recorded as the free partition set;

[0028] The gateway address allocation module is used to arrange the partitions in the free partition set from small to large, give priority to the partitions with small addresses, take the first available address as the gateway address, and store it in the occupation table.

[0029] Furthermore, the occupied address segments are read and partitioned using the gateway mask to obtain an occupied partition set, including:

[0030] Read the occupation table and partition the occupied address segments according to the gateway mask;

[0031] If the occupied address segment mask is larger than the gateway mask, the occupied address segment is included in any partition of the planned address segment, and this partition is considered occupied and discarded;

[0032] If the occupied address segment mask is smaller than the gateway mask, the occupied address segment is partitioned according to the gateway mask, and the partitions that overlap with the planned address segment are considered occupied and discarded;

[0033] Define the dropped partitions as the set of occupied partitions.

[0034] Furthermore, the number of required user addresses is input into the device, and the gateway addresses that need to be configured can be separated.

[0035] In one embodiment of the present invention, a computer device is also proposed, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the aforementioned flexible allocation of gateway addresses based on sharding technology is implemented.

[0036] In one embodiment of the present invention, a computer-readable storage medium is further proposed, wherein the computer-readable storage medium stores a computer program for executing flexible allocation of gateway addresses based on sharding technology.

[0037] Beneficial effects:

[0038] 1. The present invention effectively solves the problem of gateway and user address allocation in different business scenarios, and changes the manual allocation method of operation and maintenance personnel to an automatic allocation method, thereby improving the efficiency of operation and maintenance and reducing the complexity and cost of operation and maintenance.

[0039] 2. The present invention effectively improves the activation efficiency and enhances the adaptability to various industry scenarios.

[0040] 3. The present invention improves the speed of allocation and the accuracy of resources through automatic allocation, reduces the impact on customer service usage, and also reduces the requirements on the technical capabilities of operation and maintenance personnel, reduces the work invested by operation and maintenance personnel, and plays a role in reducing costs and increasing efficiency in the operation and maintenance of operator services. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 It is a flow chart of a method for flexible allocation of gateway addresses based on sharding technology of the present invention;

[0042] Figure 2It is a schematic diagram of the structure of the device for flexible allocation of gateway addresses based on the sharding technology of the present invention;

[0043] Figure 3 It is a schematic diagram of the computer device structure of the present invention. DETAILED DESCRIPTION

[0044] The principles and spirit of the present invention will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present invention, and are not intended to limit the scope of the present invention in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.

[0045] Those skilled in the art will appreciate that the embodiments of the present invention may be implemented as a device, apparatus, equipment, method or computer program product. Therefore, the present disclosure may be implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.

[0046] According to the implementation mode of the present invention, a method and device for flexibly allocating gateway addresses based on sharding technology are proposed. The front-end system provides the required number of user addresses to the device according to business requirements, and the gateway addresses to be configured can be allocated. The sharding technology is used to avoid resource waste to the greatest extent, and a conflict mechanism is built in to avoid resource conflicts.

[0047] The principle and spirit of the present invention are explained in detail below with reference to several representative embodiments of the present invention.

[0048] Figure 1 This is a flow chart of the method for flexible allocation of gateway addresses based on sharding technology of the present invention. This method can be encapsulated into a capability interface for third-party system calls, that is, there is no need to perceive the specific internal allocation logic, only the allocation requirements, that is, the number of user addresses to be allocated, need to be passed in. Figure 1 As shown, the method includes:

[0049] Confirm the gateway mask according to the number of user addresses required;

[0050] Partition the planned address segment using the gateway mask to obtain the total partition set;

[0051] Read the occupied address segment and partition it with the gateway mask. If the occupied address segment mask is larger than the gateway mask, the occupied address segment is included in any partition of the planned address segment, and this partition is considered occupied and discarded. If the occupied address segment mask is smaller than the gateway mask, the occupied address segment is partitioned according to the gateway mask, and the partitions that overlap with the planned address segment are considered occupied and discarded. The discarded partitions are defined as the occupied partition set, and the occupied partition set is obtained.

[0052] If a partition in the occupied partition set falls into the partition set of the planned address segment, then this partition is discarded in the partition set of the planned address segment;

[0053] The remaining partitions in the partition set of the planned address segment are recorded as the free partition set, and the partitions with smaller addresses are used first and stored in the occupation table.

[0054] It should be noted that, although the operations of the method of the present invention are described in a specific order in the above embodiments and the accompanying drawings, this does not require or imply that the operations must be performed in the specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.

[0055] In order to explain more clearly the above-mentioned method of flexible allocation of gateway addresses based on sharding technology, a specific embodiment is used for illustration below. However, it should be noted that this embodiment is only for better illustrating the present invention and does not constitute an improper limitation to the present invention.

[0056] Taking the allocation of IPv4 gateway addresses as an example, assuming that the number of user addresses required is n, enter the automatic allocation process through the unified entrance:

[0057] 1. Confirm the mask.

[0058] When the mask is 30, the number of addresses within the address segment is 2^(32-30)=4. Remove one gateway address, one network address, and one broadcast address, and the actual number of available user addresses is 4-3=1, so the number of requested user addresses of the device is n=1.

[0059] When the mask is 29, the number of addresses within the address segment is 2^(32-29)=8. Remove one gateway address, one network address, and one broadcast address, and the actual number of available user addresses is 8-3=5. The number of requested user addresses of the device is 2<=n<=5.

[0060] By analogy, when the mask is M, the number of addresses within the address segment is 2^(32-M). Remove one gateway address, one network address, and one broadcast address, and the actual number of user addresses that can be used is 2^(32-M)-3; then the number of requested user addresses of the device is 2^(32-M-1)-3+1<=n<=2^(32-M)-3, which is simplified to: 2^(31-M)-2<=n<=2^(32-M)-3.

[0061] According to mathematical operations, the address segment mask M can be calculated according to n.

[0062] 2. Read the planning table to obtain the address segment planned for the device or service, and partition the planned address segment according to the mask M confirmed in the previous step.

[0063] The following is an example:

[0064] Assume that the number of user addresses to be allocated is 4, which falls in the interval [2,5], and the gateway mask is 29. The planned address segment is: 192.168.1.0 / 24. First, partition the address segment according to the gateway mask 28, which can be divided into 192.168.1.0 / 29, 192.168.1.8 / 29....192.168.1.248 / 29, a total of 32 partitions. Defined as partition set A.

[0065] 3. Read the occupation table and partition the occupied address segment Q according to the gateway mask M.

[0066] The occupied address segments are divided into two situations:

[0067] (1) The occupied address segment mask is greater than the gateway mask M. In this case, if a segment falls into any partition of the planned address segment, the partition is considered occupied and discarded.

[0068] (2) The mask of the occupied address segment is greater than the gateway mask M. In this case, the occupied address segment is partitioned according to mask M, and the partitions that overlap with the planned address segment are considered occupied and need to be discarded. The discarded partitions are defined as set B.

[0069] The following is an example:

[0070] Assume that the used address segments are 192.168.1.17 / 28 and 192.168.1.0 / 30.

[0071] The address segment is 192.168.1.0 / 30, and the mask 30>29. If it falls into the partition 192.168.1.0 / 29, 192.168.1.0 / 29 needs to be discarded and stored in set B.

[0072] The address segment is 192.168.1.17 / 28, and mask 28 < 29. Then the address segment is partitioned according to mask 29, which can be divided into 192.168.1.17 / 29 and 192.168.1.17 / 24. These two segments need to be discarded and stored in set B.

[0073] 4. Compare the address segment partition sets A and B, define the remaining free partition as C, then C = AB.

[0074] 5. Arrange the partitions in the free partition set C from small to large, give priority to the partition with a smaller address, take the first available address as the gateway address, and store it in the occupation table.

[0075] 6. The gateway address will not be repeated, and resources are used efficiently without wasting idle resources.

[0076] Based on the same inventive concept, the present invention also proposes a device for flexible allocation of gateway addresses based on sharding technology. The implementation of the device can refer to the implementation of the above method, and the repeated parts will not be repeated. The term "module" used below can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.

[0077] Figure 2 The schematic diagram of the device structure of the present invention for flexibly allocating gateway addresses based on the sharding technology. The number of required user addresses is input into the device, and the gateway addresses to be configured can be separated. Figure 2 As shown, the device comprises:

[0078] The gateway mask confirmation module 101 is used to confirm the gateway mask according to the required number of user addresses.

[0079] The planned address segment partitioning module 102 is used to partition the planned address segment using the gateway mask to obtain a total partition set.

[0080] The occupied address segment partitioning module 103 is used to read the occupied address segment and partition it using the gateway mask to obtain an occupied partition set, including:

[0081] Read the occupation table and partition the occupied address segments according to the gateway mask;

[0082] If the occupied address segment mask is larger than the gateway mask, the occupied address segment is included in any partition of the planned address segment, and this partition is considered occupied and discarded;

[0083] If the occupied address segment mask is smaller than the gateway mask, the occupied address segment is partitioned according to the gateway mask, and the partitions that overlap with the planned address segment are considered occupied and discarded;

[0084] Define the dropped partitions as the set of occupied partitions.

[0085] The address segment partition comparison module 104 is used to discard a partition in the planned address segment partition set if the partition in the occupied partition set falls into the planned address segment partition set; the remaining partitions in the planned address segment partition set are recorded as the free partition set.

[0086] The gateway address allocation module 105 is used to arrange the partitions in the free partition set from small to large, give priority to the partition with a small address, take the first available address as the gateway address, and store it in the occupation table.

[0087] It should be noted that although several modules of the device for flexible allocation of gateway addresses based on sharding technology are mentioned in the above detailed description, this division is only exemplary and not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules described above can be concretized in one module. Conversely, the features and functions of one module described above can be further divided into multiple modules for concretization.

[0088] Based on the above invention concept, Figure 3 As shown, the present invention also proposes a computer device 200, including a memory 210, a processor 220, and a computer program 230 stored in the memory 210 and executable on the processor 220. When the processor 220 executes the computer program 230, the aforementioned flexible allocation of gateway addresses based on sharding technology is implemented.

[0089] Based on the aforementioned inventive concept, the present invention further proposes a computer-readable storage medium, which stores a computer program for executing the aforementioned flexible allocation of gateway addresses based on sharding technology.

[0090] The method and device for flexible allocation of gateway addresses based on sharding technology proposed in the present invention simplify the complex address allocation process. By uniformly using the device, the gateway address required for the configuration can be obtained efficiently and accurately, effectively improving the operation and maintenance efficiency. The present invention supports flexible expansion of allocation rules according to business characteristics. The complex gateway address and user address allocation methods are unified, which reduces the operational requirements and professional business knowledge requirements for operation and maintenance personnel, and performs gateway allocation in an automatic rather than manual manner, thereby improving the activation efficiency.

[0091] Although the spirit and principle of the present invention have been described with reference to several specific embodiments, it should be understood that the present invention is not limited to the disclosed specific embodiments, and the division of various aspects does not mean that the features in these aspects cannot be combined to benefit, and such division is only for the convenience of expression. The present invention is intended to cover various modifications and equivalent arrangements contained in the spirit and scope of the attached claims.

[0092] Regarding the limitation of the protection scope of the present invention, those skilled in the art should understand that, based on the technical solution of the present invention, various modifications or variations that can be made by those skilled in the art without creative work are still within the protection scope of the present invention.

Claims

1. A method for flexible allocation of gateway addresses based on sharding technology, characterized in that: The method includes: Confirm the gateway mask according to the number of user addresses required; Partition the planned address segment using the gateway mask to obtain the total partition set; Read the occupied address segment and partition it using the gateway mask to obtain the occupied partition set; If a partition in the occupied partition set falls into the partition set of the planned address segment, then this partition is discarded in the partition set of the planned address segment; The remaining partitions in the partition set of the planned address segment are recorded as the free partition set, and the partitions with smaller addresses are used first and stored in the occupation table.

2. The method for flexible allocation of gateway addresses based on sharding technology according to claim 1 is characterized in that: Read the occupied address segment and partition it using the gateway mask to obtain the occupied partition set, including: Read the occupation table and partition the occupied address segments according to the gateway mask; If the occupied address segment mask is larger than the gateway mask, the occupied address segment is included in any partition of the planned address segment, and this partition is considered occupied and discarded; If the occupied address segment mask is smaller than the gateway mask, the occupied address segment is partitioned according to the gateway mask, and the partitions that overlap with the planned address segment are considered occupied and discarded; Define the dropped partitions as the set of occupied partitions.

3. The method for flexible allocation of gateway addresses based on sharding technology according to claim 1 is characterized in that: This method can be encapsulated into a capability exposure interface for third-party system calls.

4. A device for flexible allocation of gateway addresses based on sharding technology, characterized in that: The device includes: A gateway mask confirmation module is used to confirm the gateway mask according to the number of required user addresses; A planned address segment partitioning module is used to partition the planned address segment using the gateway mask to obtain a total partition set; An occupied address segment partitioning module is used to read the occupied address segment and partition it using the gateway mask to obtain an occupied partition set; The address segment partition comparison module is used to discard a partition in the planned address segment partition set if the partition in the occupied partition set falls into the planned address segment partition set; the remaining partitions in the planned address segment partition set are recorded as the free partition set; The gateway address allocation module is used to arrange the partitions in the free partition set from small to large, give priority to the partitions with small addresses, take the first available address as the gateway address, and store it in the occupation table.

5. The device for flexible allocation of gateway addresses based on sharding technology according to claim 4, characterized in that: Read the occupied address segment and partition it using the gateway mask to obtain the occupied partition set, including: Read the occupation table and partition the occupied address segments according to the gateway mask; If the occupied address segment mask is larger than the gateway mask, the occupied address segment is included in any partition of the planned address segment, and this partition is considered occupied and discarded; If the occupied address segment mask is smaller than the gateway mask, the occupied address segment is partitioned according to the gateway mask, and the partitions that overlap with the planned address segment are considered occupied and discarded; Define the dropped partitions as the set of occupied partitions.

6. The device for flexible allocation of gateway addresses based on sharding technology according to claim 4, characterized in that: By inputting the required number of user addresses into the device, the gateway addresses that need to be configured can be separated.

7. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 3 is implemented.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program for executing the method according to any one of claims 1 to 3.