Method, apparatus, electronic device, and storage medium for constructing a subnet of a virtual private cloud

By verifying the IP information entered by the user and the IP information of the target virtual private cloud, the accurate target IP information is determined, and the problem of low accuracy in the construction of the virtual private cloud subnet is solved, and a high-accuracy subnet construction is achieved.

CN116233068BActive Publication Date: 2025-05-27INSPUR COMM TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310080022.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-29
Publication Date
2025-05-27
Estimated Expiration
2043-01-29

AI Technical Summary

Technical Problem

In the prior art, the subnet construction accuracy of virtual private clouds is low, and the IP information entered by the user may be inaccurate, resulting in subnet construction errors.

Method used

By obtaining the first IP information of the subnet to be built and the second IP information of the target virtual private cloud, verification is performed to determine the accurate target IP information, thereby building an accurate subnet in the target virtual private cloud.

Benefits of technology

It improves the accuracy of subnet construction of virtual private clouds, ensures that subnet construction is based on accurate IP information, and reduces the risk of incorrect construction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116233068B_ABST
    Figure CN116233068B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of communication technologies, and provides a method, an apparatus, an electronic device, and a storage medium for constructing a subnet of a virtual private cloud. The method includes: obtaining first IP information corresponding to the subnet to be constructed; verifying the first IP information based on second IP information of a target virtual private cloud to obtain a verification result; and determining target IP information based on the verification result for constructing a target subnet in the target virtual private cloud based on the target IP information. Based on the second IP information of the target virtual private cloud, the present invention verifies the first IP information corresponding to the subnet to be constructed to obtain a verification result, and thus determines accurate target IP information based on the verification result for constructing an accurate target subnet in the target virtual private cloud, thereby improving the accuracy of subnet construction of the virtual private cloud.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technologies, and in particular, to a method, an apparatus, an electronic device, and a storage medium for constructing a subnet of a virtual private cloud. Background Art

[0002] With the rapid development of communication technologies, the application scenarios of virtual private clouds are becoming more and more extensive. A virtual private cloud can effectively create a logically isolated virtual network space for users on a public cloud. Usually, multiple subnets are constructed in a virtual private cloud to deploy cloud resources in the multiple subnets respectively, so as to implement different services in one virtual private cloud.

[0003] Currently, the IP information corresponding to the subnet to be constructed is usually determined and input by a user. However, the IP information input by the user may be inaccurate, resulting in an incorrect subnet being constructed in the corresponding virtual private cloud based on the IP information input by the user. For example, the IP address input by the user is not within the network segment of the virtual private cloud, thus causing an error in the construction of the subnet of the virtual private cloud and reducing the accuracy of the subnet construction of the virtual private cloud. Summary of the Invention

[0004] The present invention provides a method, an apparatus, an electronic device, and a storage medium for constructing a subnet of a virtual private cloud, so as to solve the defect of low accuracy in the construction of the subnet of a virtual private cloud in the prior art and achieve highly accurate subnet construction.

[0005] The present invention provides a method for constructing a subnet of a virtual private cloud, including:

[0006] Obtaining first IP information corresponding to the subnet to be constructed, where the first IP information includes a first IP address and first network number bit information of the first IP address, and the first network number bit information includes a prefix of a Classless Inter-Domain Routing (CIDR) address block or a subnet mask;

[0007] Verifying the first IP information based on second IP information of a target virtual private cloud to obtain a verification result, where the second IP information includes a second IP address and second network number bit information of the second IP address, and the second network number bit information includes a prefix of a CIDR address block or a subnet mask;

[0008] Determining target IP information based on the verification result for constructing a target subnet in the target virtual private cloud based on the target IP information, where the target IP information includes a target IP address of the target subnet and target network number bit information of the target IP address, and the target network number bit information includes a prefix of a CIDR address block or a subnet mask.

[0009] A method for constructing a subnet of a virtual private cloud provided by the present invention, verifying the first IP information based on the second IP information of the target virtual private cloud, includes:

[0010] Based on the first network number digit information and the second network number digit information, determine the comparison result of the network number digits of the first IP address and the second IP address;

[0011] Based on the second network number digit information, the first IP address and the second IP address, determine the IP address comparison result, and the IP address comparison result is used to indicate whether the first IP address is the subnet address of the target virtual private cloud;

[0012] Based on the comparison result of the network number digits and the IP address comparison result, determine the verification result.

[0013] A method for constructing a subnet of a virtual private cloud provided by the present invention, determining the verification result based on the comparison result of the network number digits and the IP address comparison result, includes:

[0014] When the network number digit of the first IP address is greater than or equal to the network number digit of the second IP address, and the first IP address is the subnet address of the target virtual private cloud, determine that the verification result is a verification success result;

[0015] When the network number digit of the first IP address is less than the network number digit of the second IP address, or the first IP address is not the subnet address of the target virtual private cloud, determine that the verification result is a verification failure result.

[0016] A method for constructing a subnet of a virtual private cloud provided by the present invention, when the network number digit of the first IP address is greater than or equal to the network number digit of the second IP address, and the first IP address is the subnet address of the target virtual private cloud, determining that the verification result is a verification success result, includes:

[0017] When the network number digit of the first IP address is greater than or equal to the network number digit of the second IP address, and the first IP address is the subnet address of the target virtual private cloud, determine the set of already constructed subnets of the target virtual private cloud, and the set of IP addresses of the set of already constructed subnets;

[0018] Determine that the first IP address does not exist in the set of IP addresses, and determine that the verification result is a first verification success result, where the first verification success result indicates that the first IP information is verified successfully and the first IP information is valid IP information;

[0019] It is determined that the first IP address exists in the IP address set, and it is determined that the verification result is a second verification success result, where the second verification success result indicates that the verification of the first IP information is successful, and the first IP information is invalid IP information.

[0020] According to a method for constructing a subnet of a virtual private cloud provided by the present invention, based on the verification result, determining target IP information includes:

[0021] When the verification result is the first verification success result, determining the first IP information as the target IP information;

[0022] When the verification result is the second verification success result, based on the IP address set and the second network number digit information, updating the first IP address to obtain the target IP address, and determining the first network number information as the target network number digit information;

[0023] When the verification result is the verification failure result, based on the second IP information and the IP address set, updating the first IP information to obtain the target IP information.

[0024] According to a method for constructing a subnet of a virtual private cloud provided by the present invention, after determining the target IP information based on the verification result, it further includes:

[0025] Displaying the target IP information and obtaining a confirmation instruction regarding the target IP information;

[0026] Determining that the confirmation instruction indicates that the target IP information is confirmed to pass, and constructing a target subnet in the target virtual private cloud based on the target IP information;

[0027] Determining that the confirmation instruction indicates that the target IP information is not confirmed to pass, based on the IP address set and the second network number digit information, updating the target IP information to obtain updated IP information, and determining the updated IP information as the target IP information, and returning to the step of displaying the target IP information.

[0028] According to a method for constructing a subnet of a virtual private cloud provided by the present invention, based on the second network number digit information, the first IP address, and the second IP address, determining the IP address comparison result between the first IP address and the second IP address includes:

[0029] Based on the second network number digit information, determining a first number to be compared of the first IP address and a second number to be compared of the second IP address;

[0030] Compare the first number to be compared with the second number to be compared to obtain the IP address comparison result.

[0031] The present invention also provides a subnet construction device for a virtual private cloud, including:

[0032] An acquisition module, configured to acquire first IP information corresponding to a subnet to be constructed, where the first IP information includes a first IP address and first network number bit information of the first IP address, and the first network number bit information includes a prefix of a Classless Inter-Domain Routing (CIDR) address block or a subnet mask;

[0033] A verification module, configured to verify the first IP information based on second IP information of a target virtual private cloud to obtain a verification result, where the second IP information includes a second IP address and second network number bit information of the second IP address, and the second network number bit information includes a prefix of a CIDR address block or a subnet mask;

[0034] A determination module, configured to determine target IP information based on the verification result for constructing a target subnet in the target virtual private cloud based on the target IP information, where the target IP information includes a target IP address of the target subnet and target network number bit information of the target IP address, and the target network number bit information includes a prefix of a CIDR address block or a subnet mask.

[0035] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements the subnet construction method of the virtual private cloud as described in any one of the above.

[0036] The present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the subnet construction method of the virtual private cloud as described in any one of the above.

[0037] The subnet construction method, device, electronic device, and storage medium provided by the present invention verify the first IP information corresponding to the subnet to be constructed based on the second IP information of the target virtual private cloud to obtain a verification result, and then determine accurate target IP information based on the verification result for constructing an accurate target subnet in the target virtual private cloud, thereby improving the accuracy of subnet construction in the virtual private cloud. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] To more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0039] Figure 1 One of the schematic flowcharts of the method for constructing a subnet of a virtual private cloud provided by the present invention;

[0040] Figure 2 Another schematic flowchart of the method for constructing a subnet of a virtual private cloud provided by the present invention;

[0041] Figure 3 Another schematic flowchart of the method for constructing a subnet of a virtual private cloud provided by the present invention;

[0042] Figure 4 Schematic structural diagram of the apparatus for constructing a subnet of a virtual private cloud provided by the present invention;

[0043] Figure 5 Schematic structural diagram of the electronic device provided by the present invention. Detailed implementation manners

[0044] To make the objectives, technical solutions, and advantages of the present invention clearer, the following will clearly and completely describe the technical solutions in the present invention in conjunction with the drawings in the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art without creative efforts based on the embodiments in the present invention belong to the scope of protection of the present invention.

[0045] With the rapid development of communication technologies, the application scenarios of virtual private clouds (VPCs) are becoming increasingly extensive. For example, with the increasing number of remote work scenarios, various enterprises and institutions are migrating to the cloud, and each enterprise and institution has a corresponding virtual private cloud. A virtual private cloud can effectively create a logically isolated virtual network space for users on the public cloud.

[0046] To scientifically and effectively utilize the address space within a virtual private cloud, it is usually divided into multiple finer-grained subnets, that is, multiple subnets are constructed in the virtual private cloud to deploy cloud resources separately in multiple subnets, so as to implement different services in a single virtual private cloud. Moreover, multiple subnets can be constructed in the same virtual private cloud to support cross-availability zone deployment of cloud resources, providing strong guarantee for cross-availability zone disaster recovery.

[0047] Currently, the IP information corresponding to the subnet to be constructed is usually determined and input by the user. However, the IP information input by the user may be inaccurate, resulting in an incorrect subnet being constructed in the corresponding virtual private cloud based on the IP information input by the user. For example, the IP address input by the user is not within the network segment of the virtual private cloud, resulting in an incorrect construction of the subnet of the virtual private cloud and reducing the accuracy of the subnet construction of the virtual private cloud.

[0048] In view of the above problems, the present invention proposes the following embodiments. Figure 1 One of the flow diagrams of the subnet construction method for the virtual private cloud provided by the present invention is as Figure 1 shown. The subnet construction method for the virtual private cloud includes:

[0049] Step 110, obtain the first IP information corresponding to the subnet to be constructed. The first IP information includes the first IP address and the first network number bit information of the first IP address. The first network number bit information includes the prefix of the Classless Inter-Domain Routing (CIDR) address block or the subnet mask.

[0050] Here, the subnet to be constructed is the subnet that needs to be constructed, that is, the subnet that needs to be planned or divided in the target virtual private cloud. In other words, it is the subnet that needs to be planned or divided in the target virtual private cloud. This first IP information is the IP information corresponding to the initial subnet to be constructed. This first IP information can be accurate IP information, that is, based on this first IP information, an accurate subnet can be constructed in the target virtual private cloud. At this time, the IP information of the constructed subnet is the same as the IP information corresponding to the initial subnet to be constructed. This first IP information can also be inaccurate IP information, that is, based on this first IP information, an accurate subnet cannot be constructed in the target virtual private cloud. At this time, the IP information of the constructed subnet is different from the IP information corresponding to the initial subnet to be constructed, that is, the target IP information determined based on the verification result is accurate IP information, so that an accurate subnet can be constructed in the target virtual private cloud based on this target IP information.

[0051] Here, the first network number bit information is used to represent the number of bits of the network number of the first IP address.

[0052] In one embodiment, the first network number bit information is the prefix of the CIDR (Classless Inter-Domain Routing) address block. For example, the first IP information is a CIDR address block, the CIDR address block is 10.10.0.0 / 12, the first IP address is 10.10.0.0, and the prefix of the CIDR address block is 12. CIDR is a method for classifying IP addresses that is used to allocate IP addresses to users and effectively route IP data packets on the Internet.

[0053] In another embodiment, the number of bits of the first network number information is a subnet mask. For example, the first IP address is 10.10.0.0, and the subnet mask is 255.240.0.0.

[0054] In one embodiment, the method provided by the embodiments of the present invention is applied to a front-end device. The above step 110 includes: obtaining a subnet construction instruction, and determining first IP information corresponding to the subnet to be constructed based on the subnet construction instruction. The subnet construction instruction indicates the first IP information. For example, the subnet construction instruction includes the first IP information. The front-end device obtains the subnet construction instruction, so that the verification of the first IP information can be completed on the front-end device, so that the verification process does not need to interact with the back-end service, nor does it need to rely on a third-party tool. The front-end device performs the verification by itself, thereby improving the convenience and efficiency of subnet verification, and further improving the convenience and efficiency of subnet construction.

[0055] Step 120, verifying the first IP information based on the second IP information of the target virtual private cloud to obtain a verification result. The second IP information includes a second IP address and the number of bits of the second network number of the second IP address. The number of bits of the second network number information includes the prefix of the CIDR address block or the subnet mask.

[0056] Here, the target virtual private cloud is the virtual private cloud for which the subnet is currently to be constructed, that is, it is the virtual private cloud for which the subnet is currently to be planned or divided. The IP address space of the target virtual private cloud includes a network segment.

[0057] Here, the number of bits of the second network number information is used to represent the number of bits of the network number of the second IP address.

[0058] In one embodiment, the number of bits of the second network number information is the prefix of the CIDR address block. For example, the second IP information is a CIDR address block, the CIDR address block is 10.0.0.0 / 8, the second IP address is 10.0.0.0, the prefix of the CIDR address block is 8, and the network segment corresponding to the target virtual private cloud is from 10.0.0.0 / 8 to 10.255.255.255 / 8.

[0059] In another embodiment, the number of bits of the second network number information is a subnet mask. For example, the second IP address is 10.0.0.0, the subnet mask is 255.0.0.0, the network segment corresponding to the target virtual private cloud is from 10.0.0.0 to 10.255.255.255, and the subnet mask of the network segment is 255.0.0.0.

[0060] Here, the verification result is used to represent whether the first IP information is accurate IP information, that is, it is used to represent whether a correct subnet can be constructed in the target virtual private cloud based on the first IP information.

[0061] In one embodiment, the following step 130 includes: when the verification result indicates that the first IP information is accurate IP information, determining the first IP information as the target IP information; when the verification result indicates that the first IP information is inaccurate IP information, updating the first IP information based on the second IP information to obtain the target IP information, and the verification result corresponding to the target IP information indicates that the target IP information is accurate IP information. Further, updating the first IP information based on the second IP information and the IP address set, where the IP address set includes the IP addresses of the established subnets of the target virtual private cloud.

[0062] In one embodiment, based on the second network number digit information, the first IP address, and the second IP address, determining the IP address comparison result between the first IP address and the second IP address; based on the IP address comparison result, determining the verification result. Wherein, the IP address comparison result is used to indicate whether the first IP address is the subnet address of the target virtual private cloud. Specifically, when the first IP address is the subnet address of the target virtual private cloud, determining the verification result as a verification success result; when the first IP address is not the subnet address of the target virtual private cloud, determining the verification result as a verification failure result.

[0063] Correspondingly, the following step 130 includes: when the verification result is a verification success result, determining the first IP information as the target IP information; when the verification result is a verification failure result, updating the first IP information based on the second IP information to obtain the target IP information.

[0064] Further, when the first IP address is the subnet address of the target virtual private cloud, determining the established subnet set of the target virtual private cloud and the IP address set of the established subnet set; determining that the first IP address does not exist in the IP address set, determining the verification result as a first verification success result, where the first verification success result indicates that the first IP information is verified successfully and the first IP information is valid IP information; determining that the first IP address exists in the IP address set, determining the verification result as a second verification success result, where the second verification success result indicates that the first IP information is verified successfully and the first IP information is invalid IP information.

[0065] Accordingly, the following step 130 includes: when the verification result is the first verification success result, determining the first IP information as the target IP information; when the verification result is the second verification success result, updating the first IP address based on the IP address set and the second network number bit information to obtain the target IP address, and determining the first network number information as the target network number bit information; when the verification result is the verification failure result, updating the first IP information based on the second IP information and the IP address set to obtain the target IP information.

[0066] In one embodiment, based on the first network number bit information and the second network number bit information, the network number bit comparison result between the first IP address and the second IP address is determined. Specifically, when the network number bit of the first IP address is greater than or equal to the network number bit of the second IP address, determining the verification result as the verification success result; when the network number bit of the first IP address is less than the network number bit of the second IP address, determining the verification result as the verification failure result.

[0067] Accordingly, the following step 130 includes: when the verification result is the verification success result, determining the first IP information as the target IP information; when the verification result is the verification failure result, updating the first IP information based on the second IP information to obtain the target IP information.

[0068] Further, when the network number bit of the first IP address is greater than or equal to the network number bit of the second IP address, determining the set of built subnets of the target virtual private cloud, and the IP address set of the set of built subnets; determining that the first IP address does not exist in the IP address set, determining the verification result as the first verification success result, where the first verification success result indicates that the first IP information is verified successfully and the first IP information is valid IP information; determining that the first IP address exists in the IP address set, determining the verification result as the second verification success result, where the second verification success result indicates that the first IP information is verified successfully and the first IP information is invalid IP information.

[0069] Accordingly, the following step 130 includes: when the verification result is the first verification success result, determining the first IP information as the target IP information; when the verification result is the second verification success result, updating the first IP address based on the IP address set and the second network number bit information to obtain the target IP address, and determining the first network number information as the target network number bit information; when the verification result is the verification failure result, updating the first IP information based on the second IP information and the IP address set to obtain the target IP information.

[0070] Step 130: Based on the verification result, determine the target IP information for constructing a target subnet in the target virtual private cloud based on the target IP information. The target IP information includes the target IP address of the target subnet and the target network number bit information of the target IP address. The target network number bit information includes the prefix of the CIDR address block or the subnet mask.

[0071] Here, the target IP information is accurate IP information, that is, based on the target IP information, an accurate target subnet can be constructed in the target virtual private cloud. In other words, an accurate target subnet can be planned or partitioned in the target virtual private cloud. The target subnet is an accurate subnet in the target virtual private cloud, and the IP information of the target subnet is the target IP information.

[0072] Specifically, when the verification result indicates that the first IP information is accurate IP information, the first IP information is determined as the target IP information; when the verification result indicates that the first IP information is inaccurate IP information, the first IP information is updated based on the second IP information to obtain the target IP information. Further, the first IP information is updated based on the second IP information and the IP address set, and the IP address set includes the IP addresses of the already constructed subnets in the target virtual private cloud.

[0073] Here, the target network number bit information is used to represent the number of bits of the network number of the target IP address.

[0074] In one embodiment, the target network number bit information is the prefix of the CIDR address block. For example, the target IP information is a CIDR address block, the CIDR address block is 10.10.0.0 / 12, the target IP address is 10.10.0.0, and the prefix of the CIDR address block is 12.

[0075] In another embodiment, the target network number bit information is the subnet mask. For example, the target IP address is 10.10.0.0, and the subnet mask is 255.240.0.0.

[0076] In some embodiments, after the above step 130, the method further includes: displaying target IP information and receiving a confirmation instruction regarding the target IP information; determining that the confirmation instruction indicates that the target IP information is confirmed to pass, and constructing a target subnet in the target virtual private cloud based on the target IP information; determining that the confirmation instruction indicates that the target IP information is not confirmed to pass, updating the target IP information based on the second network number digit information to obtain updated IP information, and determining the updated IP information as the target IP information, and returning to the step of displaying the target IP information. Further, based on the second network number digit information and the IP address set, the target IP information is updated to obtain updated IP information, and the IP address set includes the IP addresses of the already constructed subnets in the target virtual private cloud.

[0077] In some embodiments, after the above step 130, the method further includes: deploying cloud resources on the target subnet. The cloud resources may include, but are not limited to, at least one of the following: cloud servers, cloud databases, cloud containers, and the like.

[0078] The subnet construction method for a virtual private cloud provided by an embodiment of the present invention verifies the first IP information corresponding to the subnet to be constructed based on the second IP information of the target virtual private cloud to obtain a verification result, and thus determines accurate target IP information based on the verification result for constructing an accurate target subnet in the target virtual private cloud, thereby improving the accuracy of subnet construction for the virtual private cloud.

[0079] Based on the above embodiments, Figure 2 is the second flowchart of the subnet construction method for a virtual private cloud provided by the present invention. As Figure 2 shown, the above step 120 includes:

[0080] Step 121, based on the first network number digit information and the second network number digit information, determine the network number digit comparison result between the first IP address and the second IP address.

[0081] Here, the network number digit comparison result includes a first network number digit comparison result and a second network number digit comparison result. The first network number digit comparison result is that the network number digit of the first IP address is greater than or equal to the network number digit of the second IP address, and the second network number digit comparison result is that the network number digit of the first IP address is less than the network number digit of the second IP address.

[0082] Step 122, based on the second network number digit information, the first IP address, and the second IP address, determine the IP address comparison result between the first IP address and the second IP address, and the IP address comparison result is used to represent whether the first IP address is the subnet address of the target virtual private cloud.

[0083] Specifically, based on the second network number digit information, the first IP address is compared with the second IP address to obtain the IP address comparison result. More specifically, based on the second network number digit information, it is determined whether the first IP address is a subnet address of the second IP address.

[0084] Here, the IP address comparison result includes the first IP address comparison result and the second IP address comparison result. The first IP address comparison result is that the first IP address is a subnet address of the target virtual private cloud, that is, the first IP address comparison result is that the first IP address is a subnet address of the second IP address. In other words, the first IP address is within the network segment of the target virtual private cloud. The second IP address comparison result is that the first IP address is not a subnet address of the target virtual private cloud, that is, the first IP address comparison result is that the first IP address is not a subnet address of the second IP address. In other words, the first IP address is not within the network segment of the target virtual private cloud.

[0085] Step 123, based on the network number digit comparison result and the IP address comparison result, determine the verification result.

[0086] Specifically, when the network number digits of the first IP address are greater than or equal to those of the second IP address, the first IP information may be the subnet information of the target virtual private cloud. Based on this, when the first IP address is a subnet address of the target virtual private cloud, it is determined that the verification result is a verification success result; when the network number digits of the first IP address are less than those of the second IP address, the first IP information is definitely not the subnet information of the target virtual private cloud. Based on this, it is determined that the verification result is a verification failure result; when the network number digits of the first IP address are greater than or equal to those of the second IP address, the first IP information may be the subnet information of the target virtual private cloud. However, when the first IP address is not a subnet address of the target virtual private cloud, it is determined that the verification result is a verification failure result.

[0087] The subnet construction method for a virtual private cloud provided by an embodiment of the present invention determines whether the first IP information is the subnet information of the target virtual private cloud based on the comparison result of the network number bits of the first IP address and the second IP address, as well as the comparison result of the IP addresses of the first IP address and the second IP address, that is, determines whether the correct target subnet can be constructed in the target virtual private cloud based on the first IP information, so as to obtain a verification result, provide support for the verification of the first IP information, and provide support for the determination of the verification result, for subsequent determination of whether the first IP information needs to be updated based on the verification result, and update the first IP information that needs to be updated based on the verification result, for constructing an accurate target subnet in the target virtual private cloud based on the finally determined accurate target IP information, thereby improving the accuracy of subnet construction in the virtual private cloud.

[0088] Based on any of the above embodiments, in this method, the above step 123 includes:

[0089] When the number of network bits of the first IP address is greater than or equal to the number of network bits of the second IP address, and the first IP address is the subnet address of the target virtual private cloud, determine that the verification result is a verification success result;

[0090] When the number of network bits of the first IP address is less than the number of network bits of the second IP address, or the first IP address is not the subnet address of the target virtual private cloud, determine that the verification result is a verification failure result.

[0091] The subnet construction method for a virtual private cloud provided by an embodiment of the present invention determines that the first IP information is the subnet information of the target virtual private cloud when the number of network bits of the first IP address is greater than or equal to the number of network bits of the second IP address, and the first IP address is the subnet address of the target virtual private cloud, and then determines that the verification result is a verification success result, and further ensures that the target IP information determined subsequently is the subnet information of the target virtual private cloud, for constructing an accurate target subnet in the target virtual private cloud based on the target IP information, thereby improving the accuracy of subnet construction in the virtual private cloud; when the number of network bits of the first IP address is less than the number of network bits of the second IP address, or the first IP address is not the subnet address of the target virtual private cloud, determine that the first IP information is not the subnet information of the target virtual private cloud, and then determine that the verification result is a verification failure result, and further ensure that the target IP information determined subsequently is the subnet information of the target virtual private cloud, for constructing an accurate target subnet in the target virtual private cloud based on the target IP information, thereby improving the accuracy of subnet construction in the virtual private cloud.

[0092] Based on any of the above embodiments, in this method, when the number of network bits of the first IP address is greater than or equal to the number of network bits of the second IP address, and the first IP address is the subnet address of the target virtual private cloud, determining that the verification result is a verification success result includes:

[0093] When the number of network bits of the first IP address is greater than or equal to the number of network bits of the second IP address, and the first IP address is the subnet address of the target virtual private cloud, determine the set of built subnets of the target virtual private cloud, and the set of IP addresses of the set of built subnets;

[0094] Determine that the first IP address does not exist in the set of IP addresses, and determine that the verification result is a first verification success result, where the first verification success result indicates that the first IP information is verified successfully, and the first IP information is valid IP information;

[0095] Determine that the first IP address exists in the set of IP addresses, and determine that the verification result is a second verification success result, where the second verification success result indicates that the first IP information is verified successfully, and the first IP information is invalid IP information.

[0096] Here, the set of built subnets includes the built subnets of the target virtual private cloud, and the number of built subnets in the set of built subnets can be 0, 1, or multiple. The built subnets are the subnets that have been built in the target virtual private cloud before the current moment.

[0097] Here, the set of IP addresses includes the IP addresses of the built subnets in the target virtual private cloud. The number of IP addresses in the set of IP addresses can be 0, 1, or multiple, that is, the number of IP addresses in the set of IP addresses is the same as the number of built subnets. One built subnet corresponds to one IP address. The IP addresses in the set of IP addresses are the IP addresses of the subnets that have been built in the target virtual private cloud before the current moment, that is, the subnet IP addresses that have been planned before the current moment.

[0098] Here, the first verification success result indicates that the first IP information is verified successfully, that is, it indicates that the first IP information is the subnet information of the target virtual private cloud; and it indicates that the first IP information is valid IP information, that is, it indicates that before the current moment, the subnet corresponding to the first IP address has not been built in the target virtual private cloud.

[0099] Here, the second verification success result indicates that the first IP information is verified successfully, that is, it indicates that the first IP information is the subnet information of the target virtual private cloud; and it indicates that the first IP information is invalid IP information, that is, it indicates that before the current moment, the subnet corresponding to the first IP address has been built in the target virtual private cloud.

[0100] In the subnet construction method of the virtual private cloud provided by the embodiment of the present invention, when the number of network bits of the first IP address is greater than or equal to the number of network bits of the second IP address, and the first IP address is the subnet address of the target virtual private cloud, the first IP information is determined as the subnet information of the target virtual private cloud. Based on this, it is further determined whether a subnet corresponding to the first IP address is constructed in the target virtual private cloud. If it is determined that a subnet corresponding to the first IP address is constructed in the target virtual private cloud, the verification result is determined as the first verification success result, thereby ensuring that the subsequent determined target IP information is the subnet information of the target virtual private cloud, and ensuring that no subnet corresponding to the target IP address is constructed in the target virtual private cloud, so as to construct an accurate target subnet in the target virtual private cloud based on the target IP information, thereby further improving the accuracy of subnet construction of the virtual private cloud; if it is determined that no subnet corresponding to the first IP address is constructed in the target virtual private cloud, the verification result is determined as the second verification success result, thereby ensuring that the subsequent determined target IP information is the subnet information of the target virtual private cloud, and ensuring that no subnet corresponding to the target IP address is constructed in the target virtual private cloud, so as to construct an accurate target subnet in the target virtual private cloud based on the target IP information, thereby further improving the accuracy of subnet construction of the virtual private cloud. In summary, the embodiment of the present invention not only verifies whether the first IP information is the subnet information of the target virtual private cloud, that is, performs in-segment verification, but also verifies whether a subnet corresponding to the first IP address is constructed in the target virtual private cloud, that is, performs coincidence verification, thereby further improving the accuracy of subnet construction of the virtual private cloud.

[0101] Based on any of the above embodiments, Figure 3 FIG. 3 is a schematic flow chart of the subnet construction method of the virtual private cloud provided by the present invention. As Figure 3 shown, the above step 130 includes:

[0102] Step 131, when the verification result is the first verification success result, determine the first IP information as the target IP information.

[0103] Specifically, when the first IP information is the subnet information of the target virtual private cloud, and no subnet corresponding to the first IP address is constructed in the target virtual private cloud, the first IP information is determined as the target IP information, that is, the first IP address is determined as the target IP address, and the first network number bit information is determined as the target network number bit information.

[0104] Step 132, when the verification result is the second verification success result, based on the IP address set and the second network number digit information, update the first IP address to obtain the target IP address, and determine the first network number information as the target network number digit information.

[0105] Specifically, when the first IP information is the subnet information of the target virtual private cloud and a subnet corresponding to the first IP address is built in the target virtual private cloud, based on the second network number digit information, ensure that when updating the first IP address, the network number of the first IP address is not updated, that is, the network number of the first IP address remains unchanged; based on the IP address set, update the first IP address to obtain the target IP address, ensure that the target IP address does not exist in the IP address set, and further ensure that the target IP information is the subnet information of the target virtual private cloud, and ensure that no subnet corresponding to the target IP address is built in the target virtual private cloud, so as to build an accurate target subnet in the target virtual private cloud based on the target IP information, thereby further improving the accuracy of subnet construction in the virtual private cloud.

[0106] In one embodiment, the way to update the first IP address is to make the target IP address as close as possible to the first IP address.

[0107] Step 133, when the verification result is the verification failure result, based on the second IP information and the IP address set, update the first IP information to obtain the target IP information.

[0108] Specifically, when the network number digit of the first IP address is less than the network number digit of the second IP address, or the first IP address is not the subnet address of the target virtual private cloud, based on the second IP address and the second network number digit information of the second IP information, ensure that the first N bits of the target IP address in the target IP information are the same as the network number of the second IP address, where N is the network number digit represented by the second network number digit information; based on the IP address set, ensure that no subnet corresponding to the target IP address is built in the target virtual private cloud.

[0109] More specifically, in the case where the number of network bits of the first IP address is less than the number of network bits of the second IP address, based on the second network bit number information of the second IP information, the first network bit number information in the first IP information is updated to ensure that the number of network bits of the target IP address is greater than or equal to the number of network bits of the second IP address, thereby ensuring that the target IP information is the subnet information of the target virtual private cloud, so as to construct an accurate target subnet in the target virtual private cloud based on the target IP information, thereby further improving the accuracy of subnet construction in the virtual private cloud; at this time, the first IP address is determined as the target IP address. In the case where the first IP address is not the subnet address of the target virtual private cloud, based on the second IP address and the second network bit number information of the second IP information, the first IP information is updated to ensure that the first N bits of the target IP address in the target IP information are the same as the network number of the second IP address, where N is the number of network bits represented by the second network bit number information. Based on the IP address set, it is ensured that no subnet corresponding to the target IP address is constructed in the target virtual private cloud, thereby ensuring that the target IP information is the subnet information of the target virtual private cloud and ensuring that no subnet corresponding to the target IP address is constructed in the target virtual private cloud, so as to construct an accurate target subnet in the target virtual private cloud based on the target IP information, thereby further improving the accuracy of subnet construction in the virtual private cloud.

[0110] In one embodiment, the way to update the first IP information is to make the target IP information as close as possible to the first IP information.

[0111] The subnet construction method for a virtual private cloud provided by an embodiment of the present invention, in the case where the number of network bits of the first IP address is greater than or equal to the number of network bits of the second IP address, and the first IP address is the subnet address of the target virtual private cloud, and there is no subnet corresponding to the first IP address constructed in the target virtual private cloud, determines the first IP information as the target IP information, thereby ensuring that the target IP information is the subnet information of the target virtual private cloud, and ensuring that there is no subnet corresponding to the target IP address constructed in the target virtual private cloud, for constructing an accurate target subnet in the target virtual private cloud based on the target IP information, thereby further improving the accuracy of subnet construction for the virtual private cloud; in the case where the number of network bits of the first IP address is greater than or equal to the number of network bits of the second IP address, and the first IP address is the subnet address of the target virtual private cloud, and there is a subnet corresponding to the first IP address constructed in the target virtual private cloud, updates the first IP address based on the IP address set and the second network number bit information to obtain the target IP address, and determines the first network number information as the target network number bit information, thereby ensuring that the target IP information is the subnet information of the target virtual private cloud, and ensuring that there is no subnet corresponding to the target IP address constructed in the target virtual private cloud, for constructing an accurate target subnet in the target virtual private cloud based on the target IP information, thereby further improving the accuracy of subnet construction for the virtual private cloud; in the case where the number of network bits of the first IP address is less than the number of network bits of the second IP address, or the first IP address is not the subnet address of the target virtual private cloud, updates the first IP information based on the second IP information and the IP address set to obtain the target IP information, thereby ensuring that the target IP information is the subnet information of the target virtual private cloud, and ensuring that there is no subnet corresponding to the target IP address constructed in the target virtual private cloud, for constructing an accurate target subnet in the target virtual private cloud based on the target IP information, thereby further improving the accuracy of subnet construction for the virtual private cloud.

[0112] Based on any of the above embodiments, after the above step 130, the method further includes:

[0113] Display the target IP information, and obtain a confirmation instruction regarding the target IP information;

[0114] Determine that the confirmation instruction indicates that the target IP information is confirmed to pass, and construct a target subnet in the target virtual private cloud based on the target IP information;

[0115] Determine that the confirmation instruction indicates that the target IP information is not confirmed to pass, update the target IP information based on the IP address set and the second network number bit information to obtain updated IP information, and determine the updated IP information as the target IP information, and return to the step of displaying the target IP information.

[0116] It should be noted that the target IP information is displayed for the user to view, so that the user can confirm the target IP information, thereby generating a confirmation instruction for the target IP information, so that the execution entity of the embodiment of the present invention can obtain the confirmation instruction.

[0117] Here, the confirmation instruction indicates whether the target IP information is confirmed to pass.

[0118] Specifically, based on the second network number digit information, when ensuring the update of the target network number digit information, the network number digit of the target IP address is greater than or equal to the network number digit of the second IP address; based on the second network number digit information, when ensuring the update of the target IP address, the first N bits of the target IP address will not be updated, that is, the first N bits of the target IP address will not be modified, where N is the network number digit represented by the second network number digit information; based on the IP address set, it is ensured that there is no updated target IP address in the IP address set. In summary, it is ensured that the finally updated target IP information is the subnet information of the target virtual private cloud, and it is ensured that no subnet corresponding to the target IP address is built in the target virtual private cloud, so as to build an accurate target subnet in the target virtual private cloud based on the target IP information, thereby further improving the accuracy of subnet construction in the virtual private cloud.

[0119] It should be noted that if it is determined that the confirmation instruction indicates that the target IP information is not confirmed to pass, and the step of displaying the target IP information is returned, the updated target IP information is continuously displayed until the confirmation instruction of the finally updated target IP information indicates that the target IP information is confirmed to pass.

[0120] The subnet construction method of the virtual private cloud provided by the embodiment of the present invention displays the target IP information and obtains a confirmation instruction for the target IP information, so that the user can confirm the target IP information, preventing the target IP information from being different from the first IP information and not being the IP information required by the user, thereby improving the user experience; at the same time, when the confirmation instruction indicates that the target IP information is not confirmed to pass, based on the IP address set and the second network number digit information, the target IP information is updated to obtain updated IP information, and the updated IP information is determined as the target IP information, and the step of returning to display the target IP information is performed, so as to finally build a target subnet in the target virtual private cloud based on the target IP information confirmed by the user, thereby ensuring that the target subnet required by the user is built, further improving the accuracy of subnet construction in the virtual private cloud, and improving the user experience.

[0121] Based on any of the above embodiments, in this method, the above step 122 includes:

[0122] Determine a first number to be compared of the first IP address and a second number to be compared of the second IP address based on the second network number digit information;

[0123] The first number to be compared is compared with the second number to be compared to obtain the IP address comparison result.

[0124] In one embodiment, the second network number digit information is a prefix of a CIDR address block. For example, the second IP information is a CIDR address block, the CIDR address block is 10.0.0.0 / 8, the second IP address is 10.0.0.0, the prefix of the CIDR address block is 8, if the first IP address is 10.10.0.0, the first number to be compared is 10 (00001010 in binary), the second number to be compared is 10 (00001010 in binary), at this time, the IP address comparison result is that the first IP address is the subnet address of the target virtual private cloud; if the first IP address is 11.10.0.0, the first number to be compared is 11 (00001011 in binary), the second number to be compared is 10 (00001010 in binary), at this time, the IP address comparison result is that the first IP address is not the subnet address of the target virtual private cloud.

[0125] In another embodiment, the second network number digit information is a subnet mask. For example, the second IP address is 10.0.0.0, and the subnet mask is 255.0.0.0. If the first IP address is 10.10.0.0, the first number to be compared is 10 (00001010 in binary), and the second number to be compared is 10 (00001010 in binary). At this time, the IP address comparison result is that the first IP address is the subnet address of the target virtual private cloud; if the first IP address is 11.10.0.0, the first number to be compared is 11 (00001011 in binary), and the second number to be compared is 10 (00001010 in binary). At this time, the IP address comparison result is that the first IP address is not the subnet address of the target virtual private cloud.

[0126] The subnet construction method of the virtual private cloud provided by the embodiment of the present invention determines a first number to be compared for the first IP address and a second number to be compared for the second IP address based on the second network number bit information; the first number to be compared is compared with the second number to be compared to obtain an IP address comparison result, thereby providing support for determining the IP address comparison result.

[0127] In actual application, users only need to enter the first IP information in the front-end graphical interface, without interacting with the back-end service or using third-party tools. The front-end can verify the first IP information by itself and create a subnet corresponding to the target IP information, thereby scientifically, concisely, efficiently and accurately constructing the subnet of the target virtual private cloud.

[0128] The subnet construction device of the virtual private cloud provided by the present invention will be described below. The subnet construction device of the virtual private cloud described below can be correspondingly referred to the subnet construction method of the virtual private cloud described above.

[0129] Figure 4 It is a schematic structural diagram of the subnet construction device of the virtual private cloud provided by the present invention. As Figure 4 shown, the subnet construction device of the virtual private cloud includes:

[0130] An obtaining module 410, configured to obtain first IP information corresponding to a subnet to be constructed. The first IP information includes a first IP address and first network number bit information of the first IP address. The first network number bit information includes a prefix of a Classless Inter-Domain Routing (CIDR) address block or a subnet mask.

[0131] A verification module 420, configured to verify the first IP information based on second IP information of a target virtual private cloud to obtain a verification result. The second IP information includes a second IP address and second network number bit information of the second IP address. The second network number bit information includes a prefix of a CIDR address block or a subnet mask.

[0132] A determination module 430, configured to determine target IP information based on the verification result for constructing a target subnet in the target virtual private cloud based on the target IP information. The target IP information includes a target IP address of the target subnet and target network number bit information of the target IP address. The target network number bit information includes a prefix of a CIDR address block or a subnet mask.

[0133] The subnet construction device of the virtual private cloud provided by the embodiments of the present invention verifies the first IP information corresponding to the subnet to be constructed based on the second IP information of the target virtual private cloud to obtain a verification result, and then determines accurate target IP information based on the verification result for constructing an accurate target subnet in the target virtual private cloud based on the target IP information, thereby improving the accuracy of subnet construction of the virtual private cloud.

[0134] Based on any of the above embodiments, the verification module 420 includes:

[0135] A first result determination unit, configured to determine a comparison result of the network number bits of the first IP address and the second IP address based on the first network number bit information and the second network number bit information.

[0136] A second result determination unit, configured to determine an IP address comparison result between the first IP address and the second IP address based on the second network number digit information, the first IP address, and the second IP address, where the IP address comparison result is used to indicate whether the first IP address is a subnet address of the target virtual private cloud;

[0137] A third result determination unit, configured to determine the verification result based on the network number digit comparison result and the IP address comparison result.

[0138] Based on any of the above embodiments, the third result determination unit is further configured to:

[0139] In a case where the network number digit of the first IP address is greater than or equal to the network number digit of the second IP address, and the first IP address is a subnet address of the target virtual private cloud, determine that the verification result is a verification success result;

[0140] In a case where the network number digit of the first IP address is less than the network number digit of the second IP address, or the first IP address is not a subnet address of the target virtual private cloud, determine that the verification result is a verification failure result.

[0141] Based on any of the above embodiments, the third result determination unit is further configured to:

[0142] In a case where the network number digit of the first IP address is greater than or equal to the network number digit of the second IP address, and the first IP address is a subnet address of the target virtual private cloud, determine the set of built subnets of the target virtual private cloud, and the set of IP addresses of the set of built subnets;

[0143] Determine that the first IP address does not exist in the set of IP addresses, and determine that the verification result is a first verification success result, where the first verification success result indicates that the first IP information is verified successfully and the first IP information is valid IP information;

[0144] Determine that the first IP address exists in the set of IP addresses, and determine that the verification result is a second verification success result, where the second verification success result indicates that the first IP information is verified successfully and the first IP information is invalid IP information.

[0145] Based on any of the above embodiments, the determination module 430 includes:

[0146] An information determination unit, configured to determine the first IP information as target IP information in a case where the verification result is the first verification success result;

[0147] An address update unit, configured to, when the verification result is the second verification success result, update the first IP address based on the IP address set and the second network number bit information to obtain the target IP address, and determine the first network number information as the target network number bit information;

[0148] An information update unit, configured to, when the verification result is the verification failure result, update the first IP information based on the second IP information and the IP address set to obtain the target IP information.

[0149] Based on any of the above embodiments, the apparatus further includes:

[0150] An information display module, configured to display the target IP information and obtain a confirmation instruction regarding the target IP information;

[0151] A subnet construction module, configured to determine that the confirmation instruction indicates that the target IP information is confirmed to pass, and construct a target subnet in the target virtual private cloud based on the target IP information;

[0152] An IP update module, configured to determine that the confirmation instruction indicates that the target IP information is not confirmed to pass, update the target IP information based on the IP address set and the second network number bit information to obtain updated IP information, and determine the updated IP information as the target IP information, and return to the step of displaying the target IP information.

[0153] Based on any of the above embodiments, the second result determination unit is further configured to:

[0154] Based on the second network number bit information, determine a first number to be compared of the first IP address and a second number to be compared of the second IP address;

[0155] Compare the first number to be compared with the second number to be compared to obtain the IP address comparison result.

[0156] Figure 5 Illustrates a schematic physical structure diagram of an electronic device, such as Figure 5As shown in the figure, the electronic device may include: a processor 510, a communications interface 520, a memory 530, and a communication bus 540. Among them, the processor 510, the communications interface 520, and the memory 530 complete communication with each other through the communication bus 540. The processor 510 may call logical instructions in the memory 530 to execute a method for constructing a subnet of a virtual private cloud. The method includes: obtaining first IP information corresponding to the subnet to be constructed, where the first IP information includes a first IP address and first network number bit information of the first IP address, and the first network number bit information includes a prefix of a Classless Inter-Domain Routing (CIDR) address block or a subnet mask; verifying the first IP information based on second IP information of a target virtual private cloud to obtain a verification result, where the second IP information includes a second IP address and second network number bit information of the second IP address, and the second network number bit information includes a prefix of a CIDR address block or a subnet mask; determining target IP information based on the verification result for constructing a target subnet in the target virtual private cloud based on the target IP information, where the target IP information includes a target IP address of the target subnet and target network number bit information of the target IP address, and the target network number bit information includes a prefix of a CIDR address block or a subnet mask.

[0157] In addition, when the logical instructions in the above-mentioned memory 530 can be implemented in the form of software functional units and sold or used as an independent product, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc that can store program codes.

[0158] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the subnet construction method of the virtual private cloud provided by the above-mentioned various methods. The method includes: obtaining first IP information corresponding to the subnet to be constructed, where the first IP information includes a first IP address and first network number bit information of the first IP address, and the first network number bit information includes a prefix of a Classless Inter-Domain Routing (CIDR) address block or a subnet mask; based on second IP information of the target virtual private cloud, verifying the first IP information to obtain a verification result, where the second IP information includes a second IP address and second network number bit information of the second IP address, and the second network number bit information includes a prefix of a CIDR address block or a subnet mask; based on the verification result, determining target IP information for constructing a target subnet in the target virtual private cloud based on the target IP information, where the target IP information includes a target IP address of the target subnet and target network number bit information of the target IP address, and the target network number bit information includes a prefix of a CIDR address block or a subnet mask.

[0159] In yet another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the subnet construction method of the virtual private cloud provided by the above-mentioned various methods. The method includes: obtaining first IP information corresponding to the subnet to be constructed, where the first IP information includes a first IP address and first network number bit information of the first IP address, and the first network number bit information includes a prefix of a Classless Inter-Domain Routing (CIDR) address block or a subnet mask; based on second IP information of the target virtual private cloud, verifying the first IP information to obtain a verification result, where the second IP information includes a second IP address and second network number bit information of the second IP address, and the second network number bit information includes a prefix of a CIDR address block or a subnet mask; based on the verification result, determining target IP information for constructing a target subnet in the target virtual private cloud based on the target IP information, where the target IP information includes a target IP address of the target subnet and target network number bit information of the target IP address, and the target network number bit information includes a prefix of a CIDR address block or a subnet mask.

[0160] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative work.

[0161] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the essence of the above technical solution, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0162] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for constructing a subnet of a virtual private cloud, characterized in that, it includes: Obtain the first IP information corresponding to the subnet to be constructed, where the first IP information includes the first IP address and the first network number bit information of the first IP address, and the first network number bit information includes the prefix of the Classless Inter-Domain Routing (CIDR) address block or the subnet mask; Based on the second IP information of the target virtual private cloud, verify the first IP information to obtain a verification result, where the second IP information includes the second IP address and the second network number bit information of the second IP address, and the second network number bit information includes the prefix of the CIDR address block or the subnet mask; Based on the verification result, determine the target IP information for constructing the target subnet in the target virtual private cloud based on the target IP information. The target IP information includes the target IP address of the target subnet and the target network number bit information of the target IP address, and the target network number bit information includes the prefix of the CIDR address block or the subnet mask; The determining the target IP information based on the verification result includes: In the case where the verification result is the first verification success result, determine the first IP information as the target IP information; the first verification success result indicates that the first IP information is the subnet information of the target virtual private cloud and indicates that no subnet corresponding to the first IP address has been constructed in the target virtual private cloud; In the case where the verification result is the second verification success result, update the first IP address based on the IP address set of the constructed subnet set of the target virtual private cloud and the second network number bit information to obtain the target IP address, and determine the first network number bit information as the target network number bit information; the second verification success result indicates that the first IP information is the subnet information of the target virtual private cloud and indicates that the subnet corresponding to the first IP address has been constructed in the target virtual private cloud; In the case where the verification result is a verification failure result, update the first IP information based on the second IP information and the IP address set to obtain the target IP information; the verification failure result indicates that the network number bit of the first IP address is less than the network number bit of the second IP address, or the first IP address is not the subnet address of the target virtual private cloud.

2. The method for constructing a subnet of a virtual private cloud according to claim 1, characterized in that, the verifying the first IP information based on the second IP information of the target virtual private cloud to obtain a verification result includes: Based on the first network number bit information and the second network number bit information, determine the network number bit comparison result between the first IP address and the second IP address; Based on the second network number bit information, the first IP address and the second IP address, determine the IP address comparison result between the first IP address and the second IP address, and the IP address comparison result is used to indicate whether the first IP address is the subnet address of the target virtual private cloud; Determine the verification result based on the comparison result of the network number bits and the comparison result of the IP addresses.

3. The method for constructing a subnet of a virtual private cloud according to claim 2, wherein, the determining the verification result based on the comparison result of the network number bits and the comparison result of the IP addresses includes: when the number of network bits of the first IP address is greater than or equal to the number of network bits of the second IP address, and the first IP address is the subnet address of the target virtual private cloud, determining the verification result as a verification success result; when the number of network bits of the first IP address is less than the number of network bits of the second IP address, or the first IP address is not the subnet address of the target virtual private cloud, determining the verification result as a verification failure result.

4. The method for constructing a subnet of a virtual private cloud according to claim 3, wherein, the determining the verification result as a verification success result when the number of network bits of the first IP address is greater than or equal to the number of network bits of the second IP address, and the first IP address is the subnet address of the target virtual private cloud includes: when the number of network bits of the first IP address is greater than or equal to the number of network bits of the second IP address, and the first IP address is the subnet address of the target virtual private cloud, determining the set of already constructed subnets of the target virtual private cloud, and the set of IP addresses of the set of already constructed subnets; determining that the first IP address does not exist in the set of IP addresses, and determining the verification result as a first verification success result, where the first verification success result indicates that the first IP information is verified successfully and the first IP information is valid IP information; determining that the first IP address exists in the set of IP addresses, and determining the verification result as a second verification success result, where the second verification success result indicates that the first IP information is verified successfully and the first IP information is invalid IP information.

5. The method for constructing a subnet of a virtual private cloud according to claim 4, wherein, after determining the target IP information based on the verification result, further includes: displaying the target IP information and obtaining a confirmation instruction regarding the target IP information; determining that the confirmation instruction indicates that the target IP information is confirmed to pass, and constructing a target subnet in the target virtual private cloud based on the target IP information; determining that the confirmation instruction indicates that the target IP information is not confirmed to pass, updating the target IP information based on the set of IP addresses and the second network number bit information to obtain updated IP information, and determining the updated IP information as the target IP information, and returning to the step of displaying the target IP information.

6. The method for constructing a subnet of a virtual private cloud according to claim 2, wherein, the determining the comparison result of the IP addresses of the first IP address and the second IP address based on the second network number bit information, the first IP address and the second IP address includes: Determine a first number to be compared of the first IP address and a second number to be compared of the second IP address based on the second network number digit information; Compare the first number to be compared with the second number to be compared to obtain the IP address comparison result.

7. A subnet construction device for a virtual private cloud, characterized in that it includes: An acquisition module, configured to acquire first IP information corresponding to a subnet to be constructed, where the first IP information includes a first IP address and first network number digit information of the first IP address, and the first network number digit information includes a prefix of a Classless Inter-Domain Routing (CIDR) address block or a subnet mask; A verification module, configured to verify the first IP information based on second IP information of a target virtual private cloud to obtain a verification result, where the second IP information includes a second IP address and second network number digit information of the second IP address, and the second network number digit information includes a prefix of a CIDR address block or a subnet mask; A determination module, configured to determine target IP information based on the verification result for constructing a target subnet in the target virtual private cloud based on the target IP information, where the target IP information includes a target IP address of the target subnet and target network number digit information of the target IP address, and the target network number digit information includes a prefix of a CIDR address block or a subnet mask; The determination module includes: An information determination unit, configured to determine the first IP information as the target IP information when the verification result is a first verification success result; the first verification success result indicates that the first IP information is subnet information of the target virtual private cloud and indicates that no subnet corresponding to the first IP address is constructed in the target virtual private cloud; An address update unit, configured to update the first IP address to obtain the target IP address based on an IP address set of a constructed subnet set of the target virtual private cloud and the second network number digit information and determine the first network number digit information as the target network number digit information when the verification result is a second verification success result; the second verification success result indicates that the first IP information is subnet information of the target virtual private cloud and indicates that a subnet corresponding to the first IP address is constructed in the target virtual private cloud; An information update unit, configured to update the first IP information to obtain the target IP information based on the second IP information and the IP address set when the verification result is a verification failure result; the verification failure result indicates that the network number digit of the first IP address is less than the network number digit of the second IP address, or the first IP address is not a subnet address of the target virtual private cloud.

8. An electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that when the processor executes the program, it implements the subnet construction method of the virtual private cloud according to any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium, on which a computer program is stored, characterized in that, when the computer program is executed by a processor, it implements the method for constructing a subnet of the virtual private cloud according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Networking method and network system

    CN104660479A

  • Analysis method and device, electronic equipment and storage medium

    CN112910919A