Method and device for allocating IPV6 addresses
By structuring and calculating the information of the assigned network segments, unassigned IPV6 addresses are generated, the complex and time-consuming issue of IPV6 addresses is solved, the allocation efficiency and accuracy are improved, and manpower and material resources are saved.
Patent Information
- Application Number
- CN202310361115.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-06
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2043-04-06
AI Technical Summary
In the prior art, IPV6 address allocation is complex and consumes manpower and time, affecting the progress of network construction, resulting in inefficiency.
By structuring the assigned network segment information, a structured IP segment information pool is generated, and an unassigned subnet number is calculated based on the IP segment requirements prefix and the affiliated units, and a replacement process is performed to generate an unassigned IPV6 address.
It improves the efficiency and accuracy of IPV6 address allocation, reduces the waste of manpower and material resources, and optimizes the user experience.
Smart Images

Figure CN116545984B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a method and device for allocating IPv6 addresses. Background Art
[0002] In data communication network operation and maintenance, IPV6 address allocation is usually based on user needs, and detailed small network segments are planned within a larger network segment. Currently, IPV6 address allocation is done by operation and maintenance personnel manually querying IP addresses one by one based on existing address allocation records to confirm unallocated network segment addresses to meet user needs. However, IPV6 addresses are represented in dotted hexadecimal notation. Compared with the dotted decimal notation of IPV4 addresses, the expression of IPV6 addresses is more complex. In the frequent IPV6 address allocation work, relying on operation and maintenance personnel to handle it often cannot be allocated quickly and accurately, and it requires more manpower and time, affecting the progress of network construction and increasing costs. Summary of the Invention
[0003] The technical problem to be solved by the present invention is: the present invention provides a method and device for allocating IPV6 addresses to improve the efficiency of IPV6 address allocation.
[0004] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0005] In a first aspect, the present invention provides a method for allocating an IPv6 address, comprising:
[0006] Acquire allocated network segment information, perform structured processing on each IP network segment in the allocated network segment information to generate a structured IP network segment, and establish an IP network segment information pool based on the structured IP network segment;
[0007] Receiving the IP network segment demand prefix and the affiliated unit of the application end, calculating the subnet number of each of the structured IP network segments in the IP network segment information pool based on the IP network segment demand prefix and the affiliated unit, combining the subnet number with the network address prefix of the structured IP network segment to generate a two-tuple set;
[0008] Based on the two-tuple set and the IP network segment requirement prefix, an allocated subnet number set is generated, and a natural number that does not exist in the allocated subnet number set is randomly selected, and the natural number is used as the unallocated subnet number. The unallocated subnet number is padded to generate an unallocated IPV6 address, and the unallocated IPV6 address is returned to the application end.
[0009] The beneficial effect of the present invention is that, by performing structured processing on each IP segment in the allocated segment information and establishing an IP segment information pool, the traditional manual table archiving is transformed into structured storage, the storage efficiency is improved while avoiding the occurrence of manual mis-archiving, the IP segment requirement prefix of the application end can be directly received, the user experience is improved, and the allocated subnet number set can be calculated through the IP segment requirement prefix and the affiliated unit, so as to obtain the unallocated subnet number based on the allocated subnet number, thereby improving the query efficiency and accuracy of the unallocated subnet number, thereby improving the efficiency of IPV6 address allocation and saving manpower and material resources.
[0010] Optionally, the performing structural processing on each IP network segment in the allocated network segment information includes:
[0011] Each IP network segment in the allocated network segment information is divided into a corresponding IP subnet number, a host number and a prefix.
[0012] According to the above description, the IP subnet number, host number and prefix corresponding to each IP network segment are accurately recorded to facilitate subsequent queries for unassigned subnet numbers.
[0013] Optionally, the calculating the subnet number of each structured IP network segment in the IP network segment information pool based on the required IP network segment prefix and the affiliated unit includes:
[0014] According to the affiliated unit, all structured IP network segments consistent with the affiliated unit and the fixed prefix preset by the affiliated unit in the IP network segment information pool are obtained;
[0015] Deleting the fixed prefix from each of the structured IP network segments to generate a first network address;
[0016] performing binary processing on the first network address and removing the colon from the binary-processed first network address to generate a second network address;
[0017] The number of digits of the fixed prefix is deducted from the required prefix of the IP network segment to generate a first digit, and the high digits of the second network address are continuously taken according to the first digit to generate a subnet number.
[0018] According to the above description, the fixed prefix of each structured IP network segment can be determined by the affiliated unit, and the subnet number can be quickly calculated in combination with the required prefix of the IP network segment.
[0019] Optionally, generating the allocated subnet number set based on the two-tuple set and the IP network segment required prefix includes:
[0020] Comparing the network address prefix of each structured IP network segment in the two-tuple set with the IP network segment required prefix, and when the network address prefix is smaller than the IP network segment required prefix, generating a first one-tuple set according to the subnet number of the structured IP network segment corresponding to the network address prefix and the IP network segment required prefix;
[0021] Otherwise, the subnet number of the structured IP network segment corresponding to the network address prefix is used as a single element;
[0022] All single elements and all first tuple sets are combined to generate a second tuple set, and the second tuple set is used as the allocated subnet number set.
[0023] According to the above description, by comparing the network address prefix of each structured IP network segment in the tuple set with the IP network segment requirement prefix, different processing is performed according to different comparison results, thereby ensuring the integrity of the allocated subnet number while improving the query efficiency of the allocated subnet number.
[0024] Optionally, generating a first tuple set according to the subnet number of the structured IP network segment corresponding to the network address prefix and the IP network segment required prefix includes:
[0025] Then calculate the difference between the network address prefix and the IP network segment required prefix;
[0026] Obtain the subnet number of the structured IP network segment corresponding to the network address prefix;
[0027] Calculate the highest allocated subnet number based on the subnet number and the difference:
[0028] Y=x+2 (a-b) -1
[0029] Where y represents the highest allocated subnet number, x represents the subnet number of the structured IP segment, a represents the required prefix of the IP segment, b represents the network address prefix of the IP segment, and ab represents the difference between the network address prefix and the required prefix of the IP segment.
[0030] Positive integers between the subnet number and the highest subnet number are continuously taken, and the subnet number, the positive integer and the highest subnet number are combined into a first tuple set.
[0031] According to the above description, the subnet number, the consecutive positive integers between the subnet number and the highest subnet number, and the highest subnet number are combined into a first tuple set, thereby ensuring the integrity of the first tuple set.
[0032] Optionally, the performing padding processing on the unallocated subnet number to generate an unallocated IPv6 address, and returning the unallocated IPv6 address to the application end includes:
[0033] Performing binary processing on the unassigned subnet number to generate a first unassigned subnet number;
[0034] Calculate the host bits according to the required prefix of the IP network segment, fill the host bits in the lower order, and generate filled host bits;
[0035] Combining the padded host bits with the first unallocated subnet number to generate a second unallocated subnet number;
[0036] Performing hexadecimal processing on the second unassigned subnet number to generate a third unassigned subnet number;
[0037] Filling the upper bits of the third unallocated subnet number with the fixed prefix of the unit to which it belongs to generate a fourth unallocated subnet number;
[0038] The fourth unallocated subnet number is combined with the IP segment required prefix to generate an unallocated IPV6 address, and the unallocated IPV6 address is returned to the application end.
[0039] According to the above description, the obtained unassigned subnet number will be padded with host bits, fixed prefixes, and corresponding binary and hexadecimal processing, so that the unassigned IPV6 address returned to the user is a complete address, optimizing the user experience.
[0040] In a second aspect, the present invention provides an apparatus for allocating IPV6 addresses, comprising 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 method for allocating IPV6 addresses described in the first aspect is implemented.
[0041] Among them, the technical effect corresponding to the IPV6 address allocation device provided by the second aspect refers to the relevant description of the IPV6 address allocation method provided by the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A flowchart of a method for allocating IPV6 addresses provided by an embodiment of the present invention;
[0043] Figure 2 A schematic diagram of the overall process of an IPV6 address allocation method provided by an embodiment of the present invention;
[0044] Figure 3 The application interface involved in the embodiment of the present invention;
[0045] Figure 4 A schematic diagram of the structure of an IPV6 address allocation device provided by an embodiment of the present invention.
[0046] [Description of Reference Numerals]
[0047] 1. A device for allocating IPv6 addresses;
[0048] 2. Processor;
[0049] 3. Memory. DETAILED DESCRIPTION
[0050] To better understand the above technical solutions, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments described herein. Instead, these embodiments are provided to enable a clearer and more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.
[0051] Example 1
[0052] Please refer to Figures 1 to 3 The present invention provides a method for allocating an IPV6 address, comprising the steps of:
[0053] S1. Obtain allocated network segment information, perform structured processing on each IP network segment in the allocated network segment information to generate a structured IP network segment, and establish an IP network segment information pool based on the structured IP network segment;
[0054] In this embodiment, if Figures 1 to 2 As shown, the structured IP network segment is a hexadecimal structured IP network segment. When it is a hexadecimal structure, the number of bits of the structured IP network segment is 32 bits. When it is a binary structure, the number of bits of the structured IP network segment is 128 bits.
[0055] At this time, the structural processing of each IP network segment in the allocated network segment information in step S1 includes:
[0056] S11. Divide each IP network segment in the allocated network segment information into a corresponding IP subnet number, a host number, and a prefix.
[0057] In this embodiment, each IP network segment in the allocated network segment information is divided into a corresponding IP subnet number, a host number, and a prefix, where the prefix represents the number of bits in the IP subnet number in binary format. For example, if the allocated network segment information is AD80:0000:0000:0000:ABAA:0000:00C2:0002 / 112, then AD80:0000:0000:0000:ABAA:0000:00C2 is the IP subnet number, and 0002 is the host number, both in hexadecimal format. The prefix 112 is in decimal format, indicating that the IP subnet number has 112 binary digits, or 28 hexadecimal digits.
[0058] S2. Receive the IP network segment requirement prefix and the affiliated unit of the application end, calculate the subnet number of each structured IP network segment in the IP network segment information pool based on the IP network segment requirement prefix and the affiliated unit, combine the subnet number with the network address prefix of the structured IP network segment, and generate a two-tuple set;
[0059] In this embodiment, if Figures 1 to 3 As shown, Figure 3 The department in the above is the affiliated unit. According to the IP segment requirement prefix and the affiliated unit received from the application end, the subnet number of each structured IP segment in the IP segment information pool is calculated, and the calculated subnet number is combined with the network address prefix of the structured IP segment to generate a tuple set.
[0060] At this time, the calculation of the subnet number of each structured IP network segment in the IP network segment information pool based on the IP network segment required prefix and the affiliated unit in step S2 includes:
[0061] S21. Obtain, according to the affiliated unit, all structured IP network segments consistent with the affiliated unit and the fixed prefix preset by the affiliated unit in the IP network segment information pool;
[0062] S22. Deleting the fixed prefix from each of the structured IP network segments to generate a first network address;
[0063] In this embodiment, if Figure 2 As shown, the fixed prefix preset in the structured IP network segment is related to the affiliated unit. The fixed prefix of the structured IP network segment is obtained according to the affiliated unit, and the fixed prefix is deleted from each structured IP network segment to generate the first network address.
[0064] In a specific embodiment, the affiliated unit is Group A, and the structured IP segments belonging to Group A in the IP segment information pool are: IP1 = 3409:8034:5A06:0000::0000 / 124; IP2 = 3409:8034:5A06:0000::0100 / 120. The preset fixed prefix of Group A is 3409:8034:5A06, so the fixed prefix is deleted from IP1 and IP2, and the generated first network address of IP1 is: 0000::0000, and the first network address of IP2 is: 0000::0100, which is hexadecimal at this time.
[0065] S23. Perform binary processing on the first network address, remove the colon from the binary-processed first network address, and generate a second network address;
[0066] In this implementation, if Figure 2 As shown, the first network address obtained in step S22 is binary-processed, that is, the IP1 first network address: 0000::0000 is converted into a binary structure: 00000000 0000 0000::0000 00000000 0000, and the IP2 first network address: 0000::0100 is converted into a binary structure: 0000 0000 00000000::0000 0001 0000 0000, and the colon of the first network address after binary processing is removed, thereby obtaining the IP1 second network address: 000000000 0000 0000......0000 0000 0000 0000, and the IP2 second network address: 0000000000000 0000......0000 0001 0000 0000.
[0067] S24. Deduct the number of digits of the fixed prefix from the required prefix of the IP network segment to generate a first digit, and continuously take high digits of the second network address according to the first digit to generate a subnet number.
[0068] In this embodiment, the required prefix of the IP network segment is 121, and the fixed prefix in hexadecimal structure is 3409:8034:5A06, that is, the number of bits of the fixed prefix in binary structure is: 12*4=48 bits, and the first digit is obtained as 121-48=73. The second network address of IP2 in binary structure is: 0000 0000 00000000......0000 0001 0000 0000, which continuously takes 73 high bits of the second network address of IP2, and obtains 00000...00010, which is the subnet number, including a total of 71 zeros. When converted to hexadecimal, the first 0 is omitted, which is 2.
[0069] S3. Generate an allocated subnet number set based on the two-tuple set and the IP network segment requirement prefix, randomly select a natural number that does not exist in the allocated subnet number set, use the natural number as the unallocated subnet number, fill in the unallocated subnet number, generate an unallocated IPV6 address, and return the unallocated IPV6 address to the application end.
[0070] In this embodiment, if Figures 1 to 2 As shown, an allocated subnet number set is generated based on a two-tuple set and an IP network segment requirement prefix, and a natural number that does not exist in the allocated subnet number set is randomly selected as an unallocated subnet number, and the unallocated subnet number is padded to generate an unallocated IPV6 address and return it to the application end.
[0071] At this time, in step S3, generating the allocated subnet number set based on the two-tuple set and the IP network segment required prefix includes:
[0072] S31, comparing the network address prefix of each structured IP network segment in the two-tuple set with the IP network segment required prefix, and when the network address prefix is smaller than the IP network segment required prefix, generating a first one-tuple set according to the subnet number of the structured IP network segment corresponding to the network address prefix and the IP network segment required prefix;
[0073] In this embodiment, if Figure 2 As shown, the network address prefix and the IP segment requirement prefix of each structured IP segment in the two-tuple set are compared. When the network address prefix is smaller than the IP segment requirement prefix, the first one-tuple set is generated based on the subnet number of the structured IP segment corresponding to the network address prefix and the IP segment requirement prefix.
[0074] In a specific embodiment, the IP network segment requirement prefix is 121, the structured IP network segments in the two-tuple set are IP1 and IP2, the network address prefix of IP1 is 124, and the network address prefix of IP2 is 120, where 124>121 and 120<121. Therefore, the first one-tuple set is generated based on the subnet number of IP2 and the IP network segment requirement prefix 121.
[0075] At this time, the step S31 generates a first tuple set according to the subnet number of the structured IP network segment corresponding to the network address prefix and the IP network segment required prefix, including:
[0076] S311, calculating the difference between the network address prefix and the IP network segment required prefix;
[0077] S312. Obtain the subnet number of the structured IP network segment corresponding to the network address prefix;
[0078] S313. Calculate the highest allocated subnet number based on the subnet number and the difference:
[0079] Y=x+2 (a-b) -1
[0080] Where y represents the highest allocated subnet number, x represents the subnet number of the structured IP segment, a represents the required prefix of the IP segment, b represents the network address prefix of the IP segment, and ab represents the difference between the network address prefix and the required prefix of the IP segment.
[0081] In this embodiment, when the network address prefix is smaller than the IP segment demand prefix, the difference between the network address prefix and the IP segment demand prefix is calculated, and the subnet number of the structured IP segment corresponding to the network address prefix is obtained. The highest allocated subnet number is calculated by a formula based on the obtained subnet number and the calculated difference.
[0082] In a specific embodiment, the network address prefix of IP2 is 120, and the IP segment prefix is 121, then the difference = 121-120 = 1, and the subnet number of IP2 is 2, then the highest allocated subnet number is
[0083] Y=2+2 (121-120) -1=3.
[0084] S314 . Continuously select positive integers between the subnet number and the highest subnet number, and form a first tuple set of the subnet number, the positive integer, and the highest subnet number.
[0085] In this embodiment, positive integers between the subnet number and the highest allocated subnet number calculated in step S313 are successively obtained, and the obtained positive integers, the subnet number, and the highest subnet number are combined into a first tuple set.
[0086] In a specific embodiment, the subnet number is 2 and the highest subnet number is 3. Then, positive integers between the subnet number 2 and the highest subnet number 3 are consecutively taken. There is no positive integer between 2 and 3, so the first tuple set is: {2,3}.
[0087] S32. Otherwise, taking the subnet number of the structured IP network segment corresponding to the network address prefix as a single element;
[0088] In this embodiment, the network address prefix of IP1 is greater than the required prefix of the IP network segment, and the IP1 subnet number 0 is used as a single element.
[0089] S33: Union all single elements and all first tuple sets to generate a second tuple set, and use the second tuple set as the allocated subnet number set.
[0090] In this embodiment, if Figure 2 As shown, all the single elements in step S32 and all the first tuple sets generated in step S314 are combined to generate a second tuple set, and the generated second tuple set is used as the allocated subnet number set.
[0091] In a specific embodiment, the single element generated in step S32 is 0, and the first tuple set generated in step S314 is {2, 3}, then the second tuple set generated is: {0, 2, 3}, that is, {0, 2, 3} is the allocated subnet number set.
[0092] At this time, the step S3 of performing padding processing on the unallocated subnet number to generate an unallocated IPv6 address and returning the unallocated IPv6 address to the application end includes:
[0093] S34, performing binary processing on the unallocated subnet number to generate a first unallocated subnet number;
[0094] In this embodiment, the allocated subnet number set generated in step S33 is {0, 2, 3}. Take any natural number that does not exist in {0, 2, 3}: 1, then 1 is used as the unallocated subnet number. 1 is binary processed, and the binary structure of 1 is: 1 is the first unallocated subnet number.
[0095] S35. Calculate the host bits according to the required prefix of the IP network segment, fill the host bits in the lower order, and generate filled host bits.
[0096] In this embodiment, the IP network segment requires a prefix of 121, and the number of bits of the structured IP network segment in binary is 128 bits, so the host bits = 128-121=7, thereby padding the host bits toward the low bits. At this time, the default is to pad the host bits toward the low bits with 0, generating the padded host bits: 0000000.
[0097] S36. Combine the padded host bits with the first unallocated subnet number to generate a second unallocated subnet number;
[0098] In this embodiment, the padded host bits are: 0000000, and the first unallocated subnet number is: 1, which is combined to generate the second unallocated subnet number: 10000000.
[0099] S37. Perform hexadecimal processing on the second unallocated subnet number to generate a third unallocated subnet number;
[0100] In this embodiment, the second unallocated subnet number 10000000 generated in step S36 is processed in hexadecimal to generate a third unallocated subnet number: 80.
[0101] S38. Fill the upper bits of the third unallocated subnet number with the fixed prefix of the affiliated unit to generate a fourth unallocated subnet number;
[0102] In this embodiment, the third unallocated subnet number 80 generated in step S37 is padded with the fixed prefix of the unit to which it belongs. For example, if the fixed prefix is 3409:8034:5A06, the fourth unallocated subnet number 3409:8034:5A06::80 is generated.
[0103] S39. Combine the fourth unallocated subnet number with the IP network segment required prefix to generate an unallocated IPv6 address, and return the unallocated IPv6 address to the application end.
[0104] In this embodiment, the fourth unallocated subnet number 3409:8034:5A06::80 generated in step S38 is combined with the IP network segment required prefix 121 to generate an unallocated IPV6 address: 3409:8034:5A06::80 / 121, and 3409:8034:5A06::80 / 121 is returned to the application end.
[0105] Example 2
[0106] Please refer to Figure 4 , an IPV6 address allocation device 1, including a memory 3, a processor 2 and a computer program stored in the memory 3 and executable on the processor 2, wherein the processor 2 implements the steps in the above-mentioned embodiment 1 when executing the computer program.
[0107] Since the systems / devices described in the above embodiments of the present invention are systems / devices used to implement the methods of the above embodiments of the present invention, those skilled in the art will be able to understand the specific structures and variations of these systems / devices based on the methods described in the above embodiments of the present invention, and thus will not be described in detail here. All systems / devices used in the methods of the above embodiments of the present invention are within the scope of protection of the present invention.
[0108] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0109] The present invention is described with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions.
[0110] It should be noted that, in the claims, any reference signs placed between brackets shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claims. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention may be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In claims enumerating several means, several of these means may be embodied by one and the same hardware. The use of the words first, second, third etc. is for convenience only and does not indicate any order. These words may be understood as part of the component name.
[0111] In addition, it should be noted that, in the description of this specification, the description of the terms "one embodiment", "some embodiments", "embodiment", "example", "specific example" or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.
[0112] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments after learning the basic creative concept. Therefore, the claims should be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0113] Obviously, those skilled in the art may make various modifications and variations to the present invention without departing from the spirit and scope of the present invention. Thus, if such modifications and variations fall within the scope of the claims and their equivalents, the present invention shall also include such modifications and variations.
Claims
1. A method for allocating an IPV6 address, characterized in that: include: Acquire allocated network segment information, perform structured processing on each IP network segment in the allocated network segment information to generate a structured IP network segment, and establish an IP network segment information pool based on the structured IP network segment; Receiving the IP network segment demand prefix and the affiliated unit of the application end, calculating the subnet number of each of the structured IP network segments in the IP network segment information pool based on the IP network segment demand prefix and the affiliated unit, combining the subnet number with the network address prefix of the structured IP network segment to generate a two-tuple set; Based on the two-tuple set and the IP network segment requirement prefix, an allocated subnet number set is generated, and a natural number that does not exist in the allocated subnet number set is randomly selected, and the natural number is used as the unallocated subnet number. The unallocated subnet number is padded to generate an unallocated IPV6 address, and the unallocated IPV6 address is returned to the application end.
2. The method for allocating an IPV6 address according to claim 1, wherein: The structural processing of each IP network segment in the allocated network segment information includes: Each IP network segment in the allocated network segment information is divided into a corresponding IP subnet number, a host number and a prefix.
3. The method for allocating an IPV6 address according to claim 1, wherein: The calculating of the subnet number of each structured IP network segment in the IP network segment information pool based on the IP network segment required prefix and the affiliated unit includes: According to the affiliated unit, all structured IP network segments consistent with the affiliated unit and the fixed prefix preset by the affiliated unit in the IP network segment information pool are obtained; Deleting the fixed prefix from each of the structured IP network segments to generate a first network address; performing binary processing on the first network address and removing the colon from the binary-processed first network address to generate a second network address; The number of digits of the fixed prefix is deducted from the required prefix of the IP network segment to generate a first digit, and the high digits of the second network address are continuously taken according to the first digit to generate a subnet number.
4. The method for allocating an IPV6 address according to claim 1, wherein: Generating the allocated subnet number set based on the two-tuple set and the IP network segment required prefix includes: Comparing the network address prefix of each structured IP network segment in the two-tuple set with the IP network segment required prefix, and when the network address prefix is smaller than the IP network segment required prefix, generating a first one-tuple set according to the subnet number of the structured IP network segment corresponding to the network address prefix and the IP network segment required prefix; Otherwise, the subnet number of the structured IP network segment corresponding to the network address prefix is used as a single element; All single elements and all first tuple sets are combined to generate a second tuple set, and the second tuple set is used as the allocated subnet number set.
5. The method for allocating an IPV6 address as claimed in claim 4, wherein: Generating a first tuple set according to the subnet number of the structured IP network segment corresponding to the network address prefix and the IP network segment required prefix includes: Then calculate the difference between the network address prefix and the IP network segment required prefix; Obtain the subnet number of the structured IP network segment corresponding to the network address prefix; Calculate the highest allocated subnet number based on the subnet number and the difference: Y=x+2 (a-b) -1 Where y represents the highest allocated subnet number, x represents the subnet number of the structured IP segment, a represents the required prefix of the IP segment, b represents the network address prefix of the IP segment, and ab represents the difference between the network address prefix and the required prefix of the IP segment. Positive integers between the subnet number and the highest subnet number are continuously taken, and the subnet number, the positive integer and the highest subnet number are combined into a first tuple set.
6. The method for allocating an IPV6 address according to claim 1, wherein: The performing padding processing on the unallocated subnet number to generate an unallocated IPv6 address, and returning the unallocated IPv6 address to the application end comprises: Performing binary processing on the unassigned subnet number to generate a first unassigned subnet number; Calculate the host bits according to the required prefix of the IP network segment, fill the host bits in the lower order, and generate filled host bits; Combining the padded host bits with the first unallocated subnet number to generate a second unallocated subnet number; Performing hexadecimal processing on the second unassigned subnet number to generate a third unassigned subnet number; Filling the upper bits of the third unallocated subnet number with the fixed prefix of the unit to which it belongs to generate a fourth unallocated subnet number; The fourth unallocated subnet number is combined with the IP segment required prefix to generate an unallocated IPV6 address, and the unallocated IPV6 address is returned to the application end.
7. An apparatus for allocating IPv6 addresses, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
IPv6-based address visual management method and system, and storage medium
CN115460146A
IPv6 address resource optimization and management method
CN115695370A