CN112804367B - Address allocation method and device under dual-stack environment - Google Patents

Address allocation method and device under dual-stack environment Download PDF

Info

Publication number
CN112804367B
CN112804367B CN201911110600.2A CN201911110600A CN112804367B CN 112804367 B CN112804367 B CN 112804367B CN 201911110600 A CN201911110600 A CN 201911110600A CN 112804367 B CN112804367 B CN 112804367B
Authority
CN
China
Prior art keywords
subnet
ipv4
ipv6
address
gateway
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911110600.2A
Other languages
Chinese (zh)
Other versions
CN112804367A (en
Inventor
刘成乾
董玉池
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201911110600.2A priority Critical patent/CN112804367B/en
Publication of CN112804367A publication Critical patent/CN112804367A/en
Application granted granted Critical
Publication of CN112804367B publication Critical patent/CN112804367B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/686Types of network addresses using dual-stack hosts, e.g. in Internet protocol version 4 [IPv4]/Internet protocol version 6 [IPv6] networks

Abstract

The embodiment of the application discloses an address allocation method and device in a dual-stack environment. One embodiment of the method comprises: receiving an IP address acquisition request; and acquiring the distributed IPv4 address from the gateway of the IPv4 subnet created in the VPC and/or acquiring the IPv6 address distributed in the network segment of the IPv6 subnet corresponding to the IPv4 subnet. The embodiment relates to the field of cloud computing, and the network segment of the IPv6 subnet is merged into the IPv4 subnet for management, so that the complexity of address management is reduced.

Description

Address allocation method and device under dual-stack environment
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to an address allocation method and device in a dual-stack environment.
Background
In a Cloud computing Virtual network, VPC (Virtual Private Cloud) provides an isolated form of resource. And the isolation of resources such as security groups, subnets and the like is realized among different VPCs. Even addresses within the same network segment cannot communicate with each other in different VPCs. Therefore, the VPC can be understood as the core of a cloud computing virtual network.
Not only IPv4 addresses, but also IPv6 addresses are indispensable within the VPC. Currently, IPv4 addresses and IPv6 addresses are managed separately. Specifically, two types of subnets are created within the VPC, respectively: IPv 4-like subnets and IPv 6-like subnets. The two types of subnets respectively create gateways, access Control Lists (ACLs), and the like, and perform individual management for respective subnet resources.
Disclosure of Invention
The embodiment of the application provides an address allocation method and device in a dual-stack environment.
In a first aspect, an embodiment of the present application provides an address allocation method in a dual stack environment, including: receiving an IP address acquisition request; and acquiring the distributed IPv4 address from the gateway of the IPv4 type subnet created in the VPC and/or acquiring the IPv6 address distributed in the network segment of the IPv6 type subnet corresponding to the IPv4 type subnet.
In some embodiments, the IP address acquisition request includes API parameters; and acquiring the distributed IPv4 address from the gateway of the IPv4 type subnet established in the VPC and/or acquiring the IPv6 address distributed in the network segment of the IPv6 type subnet corresponding to the IPv4 type subnet, wherein the method comprises the following steps: if the API parameter indicates that the IPv4 address and the IPv6 address are allocated at the same time, acquiring the IPv4 address allocated based on the API parameter from the gateway of the IPv4 subnet; determining an IPv6 subnet corresponding to the IPv4 subnet; and distributing the IPv6 address from the network segment of the IPv6 subnet.
In some embodiments, obtaining the assigned IPv4 address from a gateway of the IPv 4-like subnet created in the VPC and/or obtaining the IPv6 address assigned in the network segment of the IPv 6-like subnet corresponding to the IPv 4-like subnet further includes: and if the API parameters indicate that only IPv4 addresses are allocated, acquiring the IPv4 addresses allocated based on the API parameters from the gateway of the IPv4 subnet.
In some embodiments, obtaining the IPv4 address allocated based on the API parameter from the gateway of the IPv 4-like subnet includes: if the API parameter designates the IPv4 address, checking whether the designated IPv4 address is available; if the specified IPv4 address is available, the specified IPv4 address is obtained from the gateway of the IPv4 type subnet.
In some embodiments, acquiring the IPv4 address allocated based on the API parameter from the gateway of the IPv4 type subnet further includes: and if the API parameter does not specify the IPv4 address or the specified IPv4 address is unavailable, acquiring the randomly distributed IPv4 address from the gateway of the IPv4 subnet.
In some embodiments, determining an IPv6 class subnet corresponding to the IPv4 class subnet includes: inquiring IPv6 type subnet identifications corresponding to the IPv4 type subnet identifications of the IPv4 type subnet in a pre-generated mapping relation table, wherein the IPv4 type subnet identifications and the IPv6 type subnet identifications in the mapping relation table are stored in a one-to-one correspondence mode; and determining the IPv6 subnet corresponding to the IPv4 subnet based on the inquired IPv6 subnet identification.
In some embodiments, the mapping relationship table is generated by: creating each IPv4 subnet in each VPC; determining whether to start IPv6; if the IPv6 is started, automatically creating each IPv6 subnet; and mapping the IPv4 subnet identification of each IPv4 subnet with the IPv6 subnet identification of each IPv6 subnet one by one to generate a mapping relation table.
In some embodiments, distributing IPv6 addresses from within a segment of an IPv 6-like subnet includes: if the API parameter designates the IPv6 address, checking whether the designated IPv6 address is available; if the designated IPv6 address is available, the designated IPv6 address is distributed from the network segment of the IPv6 type subnet.
In some embodiments, allocating IPv6 addresses from within a segment of the IPv 6-like subnet, further comprises: and if the API parameters do not specify the IPv6 address or the specified IPv6 address is unavailable, randomly distributing the IPv6 address from the network segment of the IPv6 type subnet.
In a second aspect, an embodiment of the present application provides an address allocation apparatus in a dual stack environment, including: a receiving unit configured to receive an IP address acquisition request; and the distribution unit is configured to acquire the distributed IPv4 address from the gateway of the IPv4 type subnet created in the VPC and/or acquire the IPv6 address distributed in the network segment of the IPv6 type subnet corresponding to the IPv4 type subnet.
In some embodiments, the IP address acquisition request includes API parameters; and the distribution unit includes: an obtaining subunit configured to obtain, from a gateway of the IPv 4-like subnet, the IPv4 address allocated based on the API parameter if the API parameter indicates that the IPv4 address and the IPv6 address are allocated at the same time; a determining subunit configured to determine an IPv 6-type subnet corresponding to the IPv 4-type subnet; and the allocation subunit is configured to allocate the IPv6 address from the network segment of the IPv6 subnet.
In some embodiments, the acquisition subunit is further configured to: and if the API parameters indicate that only IPv4 addresses are allocated, acquiring the IPv4 addresses allocated based on the API parameters from the gateway of the IPv4 subnet.
In some embodiments, the obtaining subunit comprises: a first checking module configured to check whether the designated IPv4 address is available if the API parameter designates the IPv4 address; a first obtaining module configured to obtain the specified IPv4 address from the gateway of the IPv4 type subnet if the specified IPv4 address is available.
In some embodiments, the first acquisition module is further configured to: and if the API parameter does not specify the IPv4 address or the specified IPv4 address is unavailable, acquiring the randomly distributed IPv4 address from the gateway of the IPv4 subnet.
In some embodiments, determining the subunit comprises: the query module is configured to query IPv6 subnet identifications corresponding to the IPv4 subnet identifications of the IPv4 subnet in a pre-generated mapping relation table, wherein the IPv4 subnet identifications and the IPv6 subnet identifications in the mapping relation table are stored in a one-to-one correspondence mode; and the determining module is configured to determine the IPv6 type subnet corresponding to the IPv4 type subnet based on the inquired IPv6 type subnet identification.
In some embodiments, the mapping relationship table is generated by: creating each IPv4 subnet in each VPC; determining whether to start IPv6; if the IPv6 is started, automatically creating each IPv6 subnet; and mapping the IPv4 subnet identification of each IPv4 subnet and the IPv6 subnet identification of each IPv6 subnet one by one to generate a mapping relation table.
In some embodiments, the allocation subunit comprises: a second check module configured to check whether the designated IPv6 address is available if the API parameter designates the IPv6 address; and the second acquisition module is configured to distribute the specified IPv6 address from the network segment of the IPv6 type subnet if the specified IPv6 address is available.
In some embodiments, the second acquisition module is further configured to: and if the API parameters do not specify the IPv6 address or the specified IPv6 address is unavailable, randomly distributing the IPv6 address from the network segment of the IPv6 type subnet.
In a third aspect, an embodiment of the present application provides an electronic device, including: one or more processors; a storage device having one or more programs stored thereon; when executed by one or more processors, cause the one or more processors to implement a method as described in any implementation of the first aspect.
In a fourth aspect, the present application provides a computer-readable medium, on which a computer program is stored, which, when executed by a processor, implements the method as described in any implementation manner of the first aspect.
According to the address allocation method and device in the dual stack environment provided by the embodiment of the application, under the condition that an IP address acquisition request is received, the allocated IPv4 address is acquired from the gateway of the IPv4 subnet created in the VPC and/or the IPv6 address allocated in the network segment of the IPv6 subnet corresponding to the IPv4 subnet is acquired. The network segment of the IPv6 subnet is merged into the IPv4 subnet for management, so that the complexity of address management is reduced.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture to which the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a method for address assignment in a dual stack environment according to the present application;
FIG. 3 is a flow diagram of yet another embodiment of a method for address assignment in a dual stack environment according to the present application;
FIG. 4 is a flow diagram for one embodiment of a mapping table generation method according to the present application;
FIG. 5 is a timing diagram for one embodiment of an address assignment arrangement in a dual stack environment in accordance with the present application;
FIG. 6 is a schematic block diagram of a computer system suitable for use in implementing an electronic device according to embodiments of the present application.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 shows an exemplary system architecture 100 to which an embodiment of an address allocation method in a dual stack environment or an address allocation apparatus in a dual stack environment of the present application may be applied.
As shown in fig. 1, a system architecture 100 may include a terminal device 101 and a VPC 102. An IPv 4-type subnet 103 and an IPv 6-type subnet 104 are created within the VPC 102. The IPv 4-like subnet 103 is created with a gateway 105. A user may use end device 101 to interact with VPC 102 to receive or send messages, etc. VPC 102 may provide various services. For example, VPC 102 may perform processing such as analysis on data such as an IP address acquisition request received from terminal apparatus 101, and generate a processing result (e.g., an IPv4 address and/or an IPv6 address).
It should be understood that the number of end devices, VPCs, IPv4 type subnets created within VPCs, and IPv6 type subnets, gateways created by IPv4 type subnets in fig. 1 are merely illustrative. According to the implementation requirement, any number of terminal devices, VPCs and gateways created by IPv4 subnets, IPv6 subnets and IPv4 subnets in the VPCs can be provided.
With continued reference to FIG. 2, a flow 200 of one embodiment of a method for address allocation in a dual stack environment in accordance with the present application is shown. The address allocation method under the dual-stack environment comprises the following steps:
step 201, an IP address acquisition request is received.
In this embodiment, the executing body (for example, VPC 102 shown in fig. 1) of the address allocation method in the dual stack environment may receive an IP (Internet Protocol) address acquisition request from a terminal device (for example, terminal device 101 shown in fig. 1) communicatively connected thereto. The dual stack environment means that both IPv4 type subnets and IPv6 type subnets are created in the VPC. The IPv4 subnet can be allocated with IPv4 network segments. A network segment of IPv4 may include several IPv4 addresses. Similarly, the IPv6 subnet may be allocated with IPv6 network segments. A network segment of IPv6 may include several IPv6 addresses. The IP address obtaining request may include an API (Application Programming Interface) parameter. API parameters will typically include the type of address that needs to be assigned, for example, only IPv4 address type, IPv4 address and IPv6 address types. In some cases, the API parameters may also include the number of addresses that need to be allocated.
Step 202, acquiring the distributed IPv4 address from the gateway of the IPv4 subnet created in the VPC and/or acquiring the IPv6 address distributed in the segment of the IPv6 subnet corresponding to the IPv4 subnet.
In this embodiment, in the case of receiving the IP address obtaining request, the execution main body may obtain the allocated IPv4 address from the gateway of the IPv 4-type subnet created in the VPC, or may obtain the allocated IPv4 address from the gateway of the IPv 4-type subnet created in the VPC, and obtain the IPv6 address allocated in the network segment of the IPv 6-type subnet corresponding to the IPv 4-type subnet.
It should be understood that IPv4 type subnets create corresponding gateways, while IPv6 type subnets do not create corresponding gateways. If the IPv4 address needs to be distributed, the gateway of the IPv4 type subnet distributes the IPv4 address from the network segment of the IPv4 type subnet. If the IPv4 address and the IPv6 address need to be allocated simultaneously, the gateway of the IPv4 type subnet allocates the IPv4 address from the network segment of the IPv4 type subnet, determines the IPv6 type subnet corresponding to the IPv4 type subnet at the same time, and allocates the IPv6 address from the network segment of the IPv6 type subnet.
In the address allocation method in the dual stack environment provided in the embodiment of the present application, in the case of receiving an IP address acquisition request, an allocated IPv4 address is acquired from a gateway of an IPv 4-type subnet created in a VPC and/or an IPv6 address allocated in a network segment of an IPv 6-type subnet corresponding to the IPv 4-type subnet is acquired. The network segment of the IPv6 subnet is merged into the IPv4 subnet for management, so that the complexity of address management is reduced.
With further reference to FIG. 3, a flow 300 of yet another embodiment of an address assignment methodology in a dual stack environment in accordance with the subject application is illustrated. The address allocation method under the dual-stack environment comprises the following steps:
step 301, receiving an IP address acquisition request.
In this embodiment, the specific operation of step 301 has been described in detail in step 201 in the embodiment shown in fig. 2, and is not described herein again.
Step 302, if the API parameter indicates that the IPv4 address and the IPv6 address are allocated at the same time, acquiring the IPv4 address allocated based on the API parameter from the gateway of the IPv4 subnet.
In this embodiment, if the API parameter indicates that an IPv4 address and an IPv6 address are allocated at the same time, the execution main body (for example, the VPC 102 shown in fig. 1) of the address allocation method in the dual stack environment may obtain the IPv4 address allocated based on the API parameter from the gateway of the IPv4 subnet. In addition, the distributed IPv4 address is stored in a database for persistence. Because the IPv4 type subnet is created with a corresponding gateway, the gateway of the IPv4 type subnet distributes the IPv4 address from the network segment of the IPv4 type subnet.
In some optional implementations of this embodiment, the API parameter may or may not specify the IPv4 address. If the API parameter specifies an IPv4 address, the execution body may check whether the specified IPv4 address is available. If the specified IPv4 address is available, the executing agent may obtain the specified IPv4 address from the gateway of the IPv 4-like subnet. If the API parameter does not specify an IPv4 address or the specified IPv4 address is not available, the execution body may obtain a randomly allocated IPv4 address from the gateway of the IPv 4-like subnet. In general, the execution body may determine whether the specified IPv4 address has been allocated and is a reserved address. If the specified IPv4 address is already allocated, or is a reserved address, then the specified IPv4 address is not available. If the specified IPv4 address is not allocated and is not a reserved address, then the specified IPv4 address is available.
Step 303, determining the IPv6 subnet corresponding to the IPv4 subnet.
In this embodiment, the execution subject may determine an IPv6 subnet corresponding to the IPv4 subnet. Wherein, the IPv4 type subnet corresponds to the IPv6 type subnet one by one.
In some optional implementation manners of this embodiment, the execution main body may query, in a pre-generated mapping relationship table, an IPv6 subnet identifier corresponding to the IPv4 subnet identifier of the IPv4 subnet; and determining the IPv6 subnet corresponding to the IPv4 subnet based on the inquired IPv6 subnet identification. The IPv4 subnet identifier may be composed of letters, numbers, symbols, and the like, and is a unique identifier of the IPv4 subnet. Similarly, the IPv6 subnet identifier may be composed of letters, numbers, symbols, and the like, and is the unique identifier of the IPv6 subnet. The IPv4 subnet identifications and the IPv6 subnet identifications in the mapping relation table can be stored in a one-to-one correspondence mode. The IPv6 subnet indicated by the inquired IPv6 subnet identification is the IPv6 subnet corresponding to the IPv4 subnet.
And step 304, distributing the IPv6 address from the network segment of the IPv6 subnet.
In this embodiment, the execution agent may allocate an IPv6 address from a network segment of the Pv 6-like subnet. That is, the assigned IPv6 address must be within the segment of the IPv 6-like subnet corresponding to the IPv 4-like subnet.
In some optional implementations of this embodiment, the API parameter may or may not specify the IPv6 address. If the API parameter specifies an IPv6 address, the execution body may check whether the specified IPv6 address is available. If the designated IPv6 address is available, the executing body can distribute the designated IPv6 address from the network segment of the IPv6 type subnet. If the API parameter does not specify an IPv6 address or the specified IPv6 address is unavailable, the execution body may randomly allocate an IPv6 address from within the segment of the IPv 6-like subnet. For the IPv6 address checking method, reference may be made to the IPv4 address checking method, which is not described herein again.
And 305, if the API parameters indicate that only IPv4 addresses are allocated, acquiring the IPv4 addresses allocated based on the API parameters from the gateways of the IPv4 subnets.
In this embodiment, if the API parameter indicates that only the IPv4 address is allocated, the execution main body may obtain the IPv4 address allocated based on the API parameter from the gateway of the IPv4 subnet.
It should be noted that the API parameter indicates that the types of the allocated addresses are different, and the address allocation method in the dual stack environment executes different processes. If the API parameter indicates that both IPv4 and IPv6 addresses are to be assigned, steps 302-304 are performed. If the API parameter indicates that only IPv4 addresses are to be allocated, step 305 is performed. No matter which flow is performed, an IPv4 address must be assigned.
As can be seen from fig. 3, compared with the embodiment corresponding to fig. 2, the flow 300 of the address allocation method in the dual stack environment in this embodiment highlights the step of allocating the address. Therefore, the solution described in the present embodiment allocates addresses based on the indication of the API parameters, and realizes targeted address allocation.
With further reference to FIG. 4, a flow 400 of one embodiment of a mapping relationship table generation method according to the present application is shown. The method for generating the mapping relation table comprises the following steps:
step 401, each IPv 4-like subnet is created within each VPC.
In this embodiment, the execution subject of the mapping relation table generation method may create each IPv 4-type subnet within each VPC. That is, an IPv 4-like subnet is created within a VPC. And when the IPv4 type subnet is created, the corresponding gateway and the ACL are created at the same time and are used for managing the address allocation of the network segment of the IPv4 type subnet.
Step 402, determining whether to open IPv6.
In this embodiment, the execution body may determine whether to turn on IPv6. If IPv6 is turned on, go to step 403. If IPv6 is not opened, the flow is ended.
Step 403, if the IPv6 is started, automatically creating each IPv6 subnet.
In this embodiment, if IPv6 is turned on, the execution body may automatically create each IPv6 subnet. When the IPv6 subnet is created, the corresponding gateway and ACL are not created any more.
Step 404, mapping the IPv4 type subnet identifier of each IPv4 type subnet with the IPv6 type subnet identifier of each IPv6 type subnet one by one, and generating a mapping relationship table.
In this embodiment, the executing body may map the IPv4 type subnet identifier of each IPv4 type subnet with the IPv6 type subnet identifier of each IPv6 type subnet one by one, so as to generate a mapping relationship table. That is to say, the IPv4 subnet identifiers and IPv6 subnet identifiers in the mapping relationship table are stored in a one-to-one correspondence manner.
Unlike the IPv4 address which has a plurality of private address segments, the IPv6 address is a globally unique resource without a private address segment. The IPv6 address running in the public network is allocated to different vendors by a specific organization, so that the IPv6 address resource is theoretically impossible to conflict. In order to better manage the IPv4 subnet and the IPv6 subnet, the mapping relation between the IPv4 subnet and the IPv6 subnet is established by mapping the IPv4 subnet identification and the IPv6 subnet identification one by one, and the IPv6 resource is not managed independently any more.
With further reference to fig. 5, as an implementation of the method shown in the above-mentioned figures, the present application provides an embodiment of an address allocation apparatus in a dual stack environment, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 2, and the apparatus may be specifically applied to various electronic devices.
As shown in fig. 5, the address allocating apparatus 500 in the dual stack environment of the present embodiment may include: a receiving unit 501 and an assigning unit 502. Wherein, the receiving unit 501 is configured to receive an IP address obtaining request; the allocating unit 502 is configured to obtain the allocated IPv4 address from the gateway of the IPv 4-like subnet created within the VPC and/or obtain the IPv6 address allocated within the network segment of the IPv 6-like subnet corresponding to the IPv 4-like subnet.
In this embodiment, in the address allocating apparatus 500 in the dual stack environment: the detailed processing of the receiving unit 501 and the allocating unit 502 and the technical effects thereof can refer to the related descriptions of steps 201-202 in the corresponding embodiment of fig. 2, which are not repeated herein.
In some optional implementations of this embodiment, the IP address acquisition request includes an API parameter; and the distribution unit 502 includes: an acquiring subunit (not shown in the figure), configured to acquire, from the gateway of the IPv 4-like subnet, the IPv4 address allocated based on the API parameter if the API parameter indicates that the IPv4 address and the IPv6 address are allocated at the same time; a determining subunit (not shown in the figure) configured to determine an IPv6 class subnet corresponding to the IPv4 class subnet; an allocation subunit (not shown in the figure) configured to allocate IPv6 addresses from within segments of the IPv 6-like subnet.
In some optional implementations of this embodiment, the obtaining subunit is further configured to: and if the API parameters indicate that only IPv4 addresses are allocated, acquiring the IPv4 addresses allocated based on the API parameters from the gateway of the IPv4 subnet.
In some optional implementations of this embodiment, the obtaining subunit includes: a first checking module (not shown in the figures) configured to check whether the specified IPv4 address is available if the API parameter specifies an IPv4 address; a first obtaining module (not shown in the figure) configured to obtain the specified IPv4 address from the gateway of the IPv 4-type subnet if the specified IPv4 address is available.
In some optional implementations of this embodiment, the first obtaining module is further configured to: and if the API parameters do not specify the IPv4 address or the specified IPv4 address is unavailable, acquiring the randomly distributed IPv4 address from the gateway of the IPv4 subnet.
In some optional implementations of this embodiment, determining the subunit includes: a query module (not shown in the figure) configured to query, in a pre-generated mapping relationship table, an IPv6 subnet identifier corresponding to the IPv4 subnet identifier of the IPv4 subnet, where the IPv4 subnet identifier and the IPv6 subnet identifier in the mapping relationship table are stored in a one-to-one correspondence manner; and a determining module (not shown in the figure) configured to determine the IPv6 type subnet corresponding to the IPv4 type subnet based on the queried IPv6 type subnet identification.
In some optional implementations of this embodiment, the mapping relationship table is generated by: creating each IPv4 subnet in each VPC; determining whether to start IPv6; if the IPv6 is started, automatically creating each IPv6 subnet; and mapping the IPv4 subnet identification of each IPv4 subnet and the IPv6 subnet identification of each IPv6 subnet one by one to generate a mapping relation table.
In some optional implementations of this embodiment, the allocating subunit includes: a second check module (not shown) configured to check whether the specified IPv6 address is available if the API parameter specifies an IPv6 address; and a second obtaining module (not shown) configured to distribute the specified IPv6 address from within the network segment of the IPv 6-like subnet if the specified IPv6 address is available.
In some optional implementations of this embodiment, the second obtaining module is further configured to: and if the API parameters do not specify the IPv6 address or the specified IPv6 address is unavailable, randomly distributing the IPv6 address from the network segment of the IPv6 type subnet.
Referring now to FIG. 6, shown is a block diagram of a computer system 600 suitable for use in implementing the electronic device of an embodiment of the present application. The electronic device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU) 601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that the computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program performs the above-described functions defined in the method of the present application when executed by a Central Processing Unit (CPU) 601.
It should be noted that the computer readable medium described herein can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or electronic device. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes a receiving unit and an assigning unit. Where the names of these units do not constitute a limitation on the unit itself in this case, for example, the receiving unit may also be described as a "unit that receives an IP address acquisition request".
As another aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiment; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: receiving an IP address acquisition request; and acquiring the distributed IPv4 address from the gateway of the IPv4 type subnet created in the VPC and/or acquiring the IPv6 address distributed in the network segment of the IPv6 type subnet corresponding to the IPv4 type subnet.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the invention. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (16)

1. An address allocation method in a dual stack environment comprises the following steps:
receiving an IP address acquisition request;
acquiring an IPv4 address distributed from a gateway of an IPv4 subnet created in a Virtual Private Cloud (VPC) and/or acquiring an IPv6 address distributed in a network segment of an IPv6 subnet corresponding to the IPv4 subnet;
wherein, the IPv6 subnet corresponding to the IPv4 subnet is determined by the following steps:
inquiring an IPv6 subnet identification corresponding to the IPv4 subnet identification of the IPv4 subnet in a pre-generated mapping relation table, wherein the IPv4 subnet identification and the IPv6 subnet identification in the mapping relation table are stored in a one-to-one correspondence manner;
determining an IPv6 subnet corresponding to the IPv4 subnet based on the inquired IPv6 subnet identification;
the mapping relation table is generated by the following steps:
creating each IPv4 subnet in each VPC;
determining whether to start IPv6;
if the IPv6 is started, automatically creating each IPv6 subnet;
and mapping the IPv4 subnet identification of each IPv4 subnet with the IPv6 subnet identification of each IPv6 subnet one by one to generate the mapping relation table.
2. The method of claim 1, wherein the IP address acquisition request includes API parameters; and
the acquiring, from a gateway of an IPv 4-based subnet created within the VPC, the assigned IPv4 address and/or acquiring the IPv6 address assigned within a network segment of an IPv 6-based subnet corresponding to the IPv 4-based subnet includes:
if the API parameter indicates that an IPv4 address and an IPv6 address are allocated at the same time, acquiring the IPv4 address allocated based on the API parameter from the gateway of the IPv4 subnet;
determining an IPv6 subnet corresponding to the IPv4 subnet;
and distributing the IPv6 address from the network segment of the IPv6 subnet.
3. The method of claim 2, wherein the obtaining the assigned IPv4 address from the gateway of the IPv 4-like subnet created within the VPC and/or obtaining the IPv6 address assigned within the network segment of the IPv 6-like subnet corresponding to the IPv 4-like subnet further comprises:
and if the API parameter indicates that only IPv4 addresses are allocated, acquiring the IPv4 addresses allocated based on the API parameter from the gateway of the IPv4 subnet.
4. The method of claim 2 or 3, wherein the obtaining, from the gateway of the IPv4 subnet, the IPv4 address assigned based on the API parameter includes:
if the API parameter designates the IPv4 address, checking whether the designated IPv4 address is available;
and if the specified IPv4 address is available, acquiring the specified IPv4 address from the gateway of the IPv4 subnet.
5. The method of claim 4, wherein the obtaining, from the gateway of the IPv 4-like subnet, the IPv4 address assigned based on the API parameter further comprises:
and if the API parameter does not specify the IPv4 address or the specified IPv4 address is unavailable, acquiring the randomly distributed IPv4 address from the gateway of the IPv4 subnet.
6. The method of claim 2, wherein said distributing IPv6 addresses from within a network segment of said IPv 6-like subnet comprises:
if the API parameter designates the IPv6 address, checking whether the designated IPv6 address is available;
and if the specified IPv6 address is available, distributing the specified IPv6 address from the network segment of the IPv6 type subnet.
7. The method of claim 6, wherein said distributing IPv6 addresses from within a network segment of said IPv 6-like subnet, further comprises:
if the API parameter does not specify the IPv6 address or the specified IPv6 address is unavailable, randomly distributing the IPv6 address from the network segment of the IPv6 subnet.
8. An address allocation apparatus in a dual stack environment, comprising:
a receiving unit configured to receive an IP address acquisition request;
the distribution unit is configured to acquire distributed IPv4 addresses from a gateway of an IPv4 type subnet created in a Virtual Private Cloud (VPC) and/or acquire distributed IPv6 addresses in a network segment of an IPv6 type subnet corresponding to the IPv4 type subnet;
wherein the apparatus further comprises a determination unit, the determination unit further configured to:
inquiring an IPv6 type subnet identification corresponding to the IPv4 type subnet identification of the IPv4 type subnet in a pre-generated mapping relation table, wherein the IPv4 type subnet identification and the IPv6 type subnet identification in the mapping relation table are stored in a one-to-one correspondence manner;
determining an IPv6 subnet corresponding to the IPv4 subnet based on the inquired IPv6 subnet identification;
wherein the apparatus further comprises a generating unit, the generating unit being further configured to:
creating each IPv4 subnet in each VPC;
determining whether to start IPv6;
if the IPv6 is started, automatically creating each IPv6 subnet;
and mapping the IPv4 subnet identification of each IPv4 subnet with the IPv6 subnet identification of each IPv6 subnet one by one to generate the mapping relation table.
9. The apparatus of claim 8, wherein the IP address acquisition request includes API parameters; and
the distribution unit includes:
an obtaining subunit configured to obtain, from the gateway of the IPv 4-like subnet, an IPv4 address allocated based on the API parameter if the API parameter indicates that both an IPv4 address and an IPv6 address are allocated;
a determining subunit configured to determine an IPv 6-type subnet corresponding to the IPv 4-type subnet;
and the allocation subunit is configured to allocate the IPv6 address from the network segment of the IPv6 subnet.
10. The apparatus of claim 9, wherein the acquisition subunit is further configured to:
and if the API parameter indicates that only IPv4 addresses are allocated, acquiring the IPv4 addresses allocated based on the API parameter from the gateway of the IPv4 subnet.
11. The apparatus of claim 9 or 10, wherein the acquisition subunit comprises:
a first checking module configured to check whether the designated IPv4 address is available if the API parameter designates an IPv4 address;
a first obtaining module configured to obtain the specified IPv4 address from the gateway of the IPv4 subnet if the specified IPv4 address is available.
12. The apparatus of claim 11, wherein the first acquisition module is further configured to:
and if the API parameters do not specify the IPv4 address or the specified IPv4 address is unavailable, acquiring the randomly distributed IPv4 address from the gateway of the IPv4 subnet.
13. The apparatus of claim 9, wherein the allocation subunit comprises:
a second check module configured to check whether the specified IPv6 address is available if the API parameter specifies an IPv6 address;
and the second acquisition module is configured to distribute the specified IPv6 address from the network segment of the IPv6 type subnet if the specified IPv6 address is available.
14. The apparatus of claim 13, wherein the second acquisition module is further configured to:
and if the API parameter does not specify the IPv6 address or the specified IPv6 address is unavailable, randomly distributing the IPv6 address from the network segment of the IPv6 type subnet.
15. An electronic device, comprising:
one or more processors;
a storage device having one or more programs stored thereon,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
16. A computer-readable medium, on which a computer program is stored, wherein the computer program, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN201911110600.2A 2019-11-14 2019-11-14 Address allocation method and device under dual-stack environment Active CN112804367B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911110600.2A CN112804367B (en) 2019-11-14 2019-11-14 Address allocation method and device under dual-stack environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911110600.2A CN112804367B (en) 2019-11-14 2019-11-14 Address allocation method and device under dual-stack environment

Publications (2)

Publication Number Publication Date
CN112804367A CN112804367A (en) 2021-05-14
CN112804367B true CN112804367B (en) 2023-04-07

Family

ID=75803466

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911110600.2A Active CN112804367B (en) 2019-11-14 2019-11-14 Address allocation method and device under dual-stack environment

Country Status (1)

Country Link
CN (1) CN112804367B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115277639A (en) * 2022-05-30 2022-11-01 紫光建筑云科技(重庆)有限公司 Method for realizing VPC supporting IPv6
CN116319662A (en) * 2023-02-09 2023-06-23 浙江九州云信息科技有限公司 Processing method for realizing IPV4 and IPV6 dual stack inter-cut by cloud host

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1762126A (en) * 2003-03-19 2006-04-19 三星电子株式会社 Use the mobile IP communication system and the method thereof of dual stack transition mechanism
CN101075944A (en) * 2006-05-19 2007-11-21 华为技术有限公司 Method and system for allocating IP address
CN102014175A (en) * 2010-12-09 2011-04-13 中兴通讯股份有限公司 DHCPv6 protocol-based IPv4 address distribution method and system
WO2011120424A1 (en) * 2010-03-29 2011-10-06 Hangzhou H3C Technologies Co., Ltd. Method and apparatus for processing packets in ipv6 network
CN102340509A (en) * 2011-10-24 2012-02-01 杭州华三通信技术有限公司 Access control method and equipment for dual-stack user
CN104333612A (en) * 2014-10-29 2015-02-04 中国联合网络通信集团有限公司 Network address translation method and device
CN106790759A (en) * 2016-12-29 2017-05-31 赛尔网络有限公司 IPv4/IPv6 converting systems and method based on SDN
CN109561171A (en) * 2019-01-22 2019-04-02 北京百度网讯科技有限公司 The configuration method and device of virtual private cloud service

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100693046B1 (en) * 2004-12-20 2007-03-12 삼성전자주식회사 Network system and method for assigning dynamic address and performing routing using dynamic address
US8909812B2 (en) * 2009-06-03 2014-12-09 China Mobile Group Beijing Co., Ltd. Method and device for communication for host device with IPv4 application

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1762126A (en) * 2003-03-19 2006-04-19 三星电子株式会社 Use the mobile IP communication system and the method thereof of dual stack transition mechanism
CN101075944A (en) * 2006-05-19 2007-11-21 华为技术有限公司 Method and system for allocating IP address
WO2011120424A1 (en) * 2010-03-29 2011-10-06 Hangzhou H3C Technologies Co., Ltd. Method and apparatus for processing packets in ipv6 network
CN102014175A (en) * 2010-12-09 2011-04-13 中兴通讯股份有限公司 DHCPv6 protocol-based IPv4 address distribution method and system
CN102340509A (en) * 2011-10-24 2012-02-01 杭州华三通信技术有限公司 Access control method and equipment for dual-stack user
CN104333612A (en) * 2014-10-29 2015-02-04 中国联合网络通信集团有限公司 Network address translation method and device
CN106790759A (en) * 2016-12-29 2017-05-31 赛尔网络有限公司 IPv4/IPv6 converting systems and method based on SDN
CN109561171A (en) * 2019-01-22 2019-04-02 北京百度网讯科技有限公司 The configuration method and device of virtual private cloud service

Also Published As

Publication number Publication date
CN112804367A (en) 2021-05-14

Similar Documents

Publication Publication Date Title
CN107566541B (en) Container network resource allocation method, system, storage medium and electronic device
CN109561171B (en) Configuration method and device of virtual private cloud service
US10855528B2 (en) Viral system discovery and installation for distributed networks
US11683394B2 (en) Systems and methods for isolating applications associated with multiple tenants within a computing platform
CN112804367B (en) Address allocation method and device under dual-stack environment
CN112367370A (en) Management method, device, equipment and medium for hybrid cloud resource data
WO2016150139A1 (en) Method and apparatus for establishing network service instance
CN114745724A (en) Access processing method and device, electronic equipment and computer readable medium
KR20200038038A (en) Apparatus and method for managing application on multi-cloud service environment
CN111371685B (en) Data processing and IPv6 mounting method and device
CN113037529B (en) Reserved bandwidth allocation method, device, equipment and storage medium
CN108370329B (en) Management method and device for management function object
CN112202935A (en) NAT address pool management method and device
CN110636149A (en) Remote access method, device, router and storage medium
CN108696557B (en) Information processing system, method and device
CN115220869A (en) Resource allocation method, device, equipment and medium
US11277336B2 (en) Tunnel-based network connectivity for computing clusters
US11108735B2 (en) Mapping subnets in different virtual networks using private address space
CN112217852A (en) Platform-as-a-service system and method based on workflow engine
US7490142B2 (en) Automatic client management authority assignment
CN107124411B (en) Virtual private cloud implementation method, device and system under classic network environment
US11522831B1 (en) Increasing edge device address space while complying with a radio communication protocol
CN109769030B (en) Method and apparatus for controlling access of applications
CN113301154B (en) Public cloud resource creation method and device, storage medium and electronic equipment
CN115174525B (en) Equipment IP address allocation method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant