CN110213391B - Method and device for configuring network protocol address - Google Patents

Method and device for configuring network protocol address Download PDF

Info

Publication number
CN110213391B
CN110213391B CN201910629139.5A CN201910629139A CN110213391B CN 110213391 B CN110213391 B CN 110213391B CN 201910629139 A CN201910629139 A CN 201910629139A CN 110213391 B CN110213391 B CN 110213391B
Authority
CN
China
Prior art keywords
network protocol
virtual machine
address
protocol address
configuration file
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
CN201910629139.5A
Other languages
Chinese (zh)
Other versions
CN110213391A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201910629139.5A priority Critical patent/CN110213391B/en
Publication of CN110213391A publication Critical patent/CN110213391A/en
Application granted granted Critical
Publication of CN110213391B publication Critical patent/CN110213391B/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
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles
    • 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 a method and a device for configuring a network protocol address, wherein the method comprises the following steps: determining a virtual machine identifier of a virtual machine, and inquiring first network protocol configuration information of the virtual machine from a database based on the virtual machine identifier, wherein the first network protocol configuration information comprises a media access control physical address of the virtual machine and a network identifier of a main network to which the virtual machine belongs; determining a configuration file corresponding to the network identifier; acquiring a target network protocol address, and adding a physical address and the target network protocol address into a configuration file; and configuring the target network protocol address for the virtual machine according to the configuration file containing the target network protocol address. By adopting the embodiment of the application, the online virtual machine can be smoothly upgraded from IPv4 to IPv4/IPv6 dual-protocol stack, the upgrading cost is reduced, and the applicability is strong.

Description

Method and device for configuring network protocol address
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for configuring a network protocol address.
Background
With the rapid development of the Internet, the contradiction of the shortage of the address space of Internet Protocol version 4 (IPv 4) becomes increasingly prominent, so that Internet Protocol version 6 (Internet Protocol version 6, IPv6) is designed and proposed as the next-generation Internet Protocol to redefine the address space and solve the problem of address shortage. Meanwhile, the development of cloud computing has great demand on IPv6 address resources, and most enterprises at present mostly adopt third-party equipment or independently develop an IPv4/IPv6 conversion middleware to realize that the same virtual machine can communicate with both an IPv4 system and an IPv6 system. However, the method is relatively dependent on hardware and is not beneficial to system stability, so how to implement smooth transition of the virtual machine from IPv4 to IPv4/IPv6 dual-protocol stack without interrupting service becomes a problem to be solved at present.
Disclosure of Invention
The embodiment of the application provides a method and a device for configuring a network protocol address. The method can realize smooth upgrade of the online virtual machine from IPv4 to IPv4/IPv6 dual-protocol stack, reduce upgrade cost and has strong applicability.
In a first aspect, an embodiment of the present application provides a method for configuring a network protocol address, where the method includes:
determining a virtual machine identifier of a virtual machine, and querying first network protocol configuration information of the virtual machine from a database based on the virtual machine identifier, wherein the first network protocol configuration information includes a physical address of the virtual machine, a first network protocol address of the virtual machine, and a network identifier of a main network to which the virtual machine belongs, and the first network protocol address is a network protocol address for performing communication based on a first network protocol;
determining a configuration file corresponding to the network identifier;
acquiring a target network protocol address, and adding the physical address and the target network protocol address to the configuration file, wherein the target network protocol address is a network protocol address for performing communication based on a second network protocol, and the second network protocol is different from the first network protocol;
and configuring the target network protocol address for the virtual machine according to the configuration file containing the target network protocol address.
According to the method and the device for updating the target network address of the virtual machine, the acquired target network protocol address and the acquired physical address are added to the configuration file, so that the target network address of the virtual machine is configured according to the updated configuration file, the operation mode is simple and convenient, errors are not prone to occurring, meanwhile, the updating cost of smoothly updating the IPv4 to the IPv4/IPv6 is reduced, and the applicability is high.
With reference to the first aspect, in a possible implementation manner, after the obtaining the target network protocol address, the method further includes:
establishing a corresponding relation between the physical address and the target network protocol address, and adding the corresponding relation to the configuration file;
and the corresponding relation is used for searching and obtaining the target network protocol address based on the physical address.
According to the method and the device, the corresponding relation between the physical address and the target network protocol address is established, the accuracy of configuring the target network address of the virtual machine can be improved, the understanding is easy, the operation mode is simple and convenient, and the applicability is strong.
With reference to the first aspect, in a possible implementation manner, the configuring, according to a configuration file including the target network protocol address, the target network protocol address for the virtual machine includes:
resetting a network protocol address configuration process;
acquiring a network protocol address configuration request sent by the virtual machine based on the reset network protocol address configuration process, wherein the network protocol address configuration request is used for requesting to acquire a network protocol address which is communicated based on the second network protocol, and the network protocol address configuration request comprises the physical address;
and acquiring the target network protocol address corresponding to the physical address from the configuration file based on the network protocol address configuration process by combining the physical address and the corresponding relation, and sending the target network protocol address to the virtual machine.
According to the method and the device, the configuration file is enabled to be effective by resetting the network protocol address configuration process, the target network protocol address is configured for the virtual machine based on the network protocol address configuration process, the operation is simple and convenient, errors are not prone to occurring, and the applicability is high.
With reference to the first aspect, in one possible implementation, the method further includes:
when the virtual machine is closed and restarted and the configuration information in the configuration file is emptied, obtaining historical configuration information of the virtual machine from the database, wherein the historical configuration information at least comprises the physical address, the target network protocol address and the corresponding relation;
and adding the historical configuration information to the configuration file.
According to the embodiment of the application, the historical configuration information in the database is added to the configuration file, so that the efficiency of virtual machine configuration can be improved, the understanding is easy, the operation is simple and convenient, and the applicability is high.
With reference to the first aspect, in a possible implementation manner, the virtual machine belongs to a first network protocol subnet in the main network, and the virtual machine in the first network protocol subnet communicates based on the first network protocol;
the acquiring the target network protocol address includes:
creating a second network protocol subnet, wherein the second network protocol subnet is one subnet in the main network, a virtual machine in the second network protocol subnet communicates based on the second network protocol, and the second network protocol subnet comprises a plurality of second network protocol addresses;
and acquiring any second network protocol address from the plurality of second network protocol addresses as a target network protocol address.
According to the method and the device, the second network protocol subnet is created, the second network protocol subnet comprising a plurality of second network protocol addresses can be determined, the flexibility of selecting the target network protocol address is improved, meanwhile, the broadcast storm can be effectively inhibited, and the applicability is high.
With reference to the first aspect, in a possible implementation manner, the establishing a correspondence between the physical address and the target network protocol address includes:
acquiring a data format included in the configuration file;
and combining the physical address and the target network protocol address according to the data format to establish a corresponding relation between the physical address and the target network protocol address.
According to the embodiment of the application, the corresponding relation between the physical address and the target network protocol address is established according to the acquired data format, the format of the configuration information in the configuration file is standardized, the operation mode is simple and convenient, errors are not prone to occurring, and the applicability is high.
In a second aspect, an embodiment of the present application provides an apparatus for configuring a network protocol address, where the apparatus includes:
a first network protocol configuration information obtaining module, configured to determine a virtual machine identifier of a virtual machine, and query, based on the virtual machine identifier, first network protocol configuration information of the virtual machine from a database, where the first network protocol configuration information includes a physical address of the virtual machine, a first network protocol address of the virtual machine, and a network identifier of a host network to which the virtual machine belongs, and the first network protocol address is a network protocol address for performing communication based on a first network protocol;
a configuration file determining module, configured to determine a configuration file corresponding to the network identifier determined by the first network protocol configuration information obtaining module;
a configuration file updating module, configured to acquire a target network protocol address, and add the physical address and the target network protocol address determined by the first network protocol configuration information acquiring module to the configuration file determined by the configuration file determining module, where the target network protocol address is a network protocol address for performing communication based on a second network protocol, and the second network protocol is different from the first network protocol;
and the target network protocol address configuration module is used for configuring the target network protocol address for the virtual machine according to the configuration file determined by the configuration file updating module containing the target network protocol address.
With reference to the second aspect, in a possible implementation manner, the apparatus further includes:
a corresponding relationship establishing module, configured to establish a corresponding relationship between the physical address determined by the first network protocol configuration information obtaining module and the target network protocol address determined by the configuration file updating module, and add the corresponding relationship to the configuration file;
and the corresponding relation is used for searching and obtaining the target network protocol address based on the physical address.
With reference to the second aspect, in a possible implementation manner, the target network protocol address configuration module includes:
the network protocol address configuration process resetting unit is used for resetting the network protocol address configuration process;
a network protocol address configuration request obtaining unit, configured to obtain, based on the reset network protocol address configuration process, a network protocol address configuration request sent by the virtual machine, where the network protocol address configuration request is used to request to obtain a network protocol address that performs communication based on the second network protocol, and the network protocol address configuration request includes the physical address;
and the target network protocol address sending unit is used for acquiring the target network protocol address corresponding to the physical address from the configuration file by combining the physical address and the corresponding relation based on the network protocol address configuration process and sending the target network protocol address to the virtual machine.
With reference to the second aspect, in a possible implementation manner, the apparatus for configuring a network protocol address further includes:
a configuration file loading module, configured to, when the virtual machine is closed and restarted and configuration information in the configuration file is emptied, obtain historical configuration information of the virtual machine from the database, where the historical configuration information at least includes the physical address, the target network protocol address, and the corresponding relationship; and adding the historical configuration information to the configuration file.
With reference to the second aspect, in a possible implementation manner, the virtual machine belongs to a first network protocol subnet in the main network, and the virtual machine in the first network protocol subnet communicates based on the first network protocol; the device for configuring the network protocol address further comprises:
a second network protocol subnet creating module, configured to create a second network protocol subnet, where the second network protocol subnet is one subnet in the main network, and a virtual machine in the second network protocol subnet performs communication based on the second network protocol, and the second network protocol subnet includes a plurality of second network protocol addresses; and acquiring any second network protocol address from the plurality of second network protocol addresses as a target network protocol address.
With reference to the second aspect, in a possible implementation manner, the correspondence relationship establishing module is specifically configured to:
acquiring a data format included in the configuration file;
and combining the physical address and the target network protocol address according to the data format to establish a corresponding relation between the physical address and the target network protocol address.
In a third aspect, an embodiment of the present application provides a terminal device, where the terminal device includes a processor and a memory, and the processor and the memory are connected to each other. The memory is configured to store a computer program that supports the terminal device to execute the method provided by the first aspect and/or any one of the possible implementation manners of the first aspect, where the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method provided by the first aspect and/or any one of the possible implementation manners of the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program, where the computer program includes program instructions, and the program instructions, when executed by a processor, cause the processor to execute the method provided by the first aspect and/or any one of the possible implementation manners of the first aspect.
The embodiment of the application has the following beneficial effects:
by determining the virtual machine identifier of the virtual machine, the embodiment of the application can query the first network protocol configuration information comprising the physical address and the network identifier from the database based on the virtual machine identifier. By obtaining the target network protocol address, the physical address and the target network protocol address may be added to a configuration file corresponding to the network identifier, and then the target network protocol address may be configured for the virtual machine based on the configuration file. By adopting the embodiment of the application, the online virtual machine can be smoothly upgraded from IPv4 to IPv4/IPv6, the upgrading cost is reduced, and the applicability is strong.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic architecture diagram of a communication system provided in an embodiment of the present application;
FIG. 2 is a system architecture diagram of an IPv4 network provided by the embodiment of the present application;
fig. 3 is a flowchart illustrating a method for configuring a network protocol address according to an embodiment of the present application;
fig. 4 is a schematic view of an application scenario of a configuration file provided in an embodiment of the present application;
fig. 5 is a schematic view of an application scenario for creating an IPv6subnet under the same host network according to an embodiment of the present application;
fig. 6 is a schematic view of an application scenario of an update configuration file provided in an embodiment of the present application;
fig. 7 is a schematic application scenario diagram of a configuration method of a network protocol address provided in an embodiment of the present application;
FIG. 8 is a system architecture diagram of an IPv4/IPv6 network provided by an embodiment of the present application;
fig. 9 is another flowchart illustrating a method for configuring a network protocol address according to an embodiment of the present application;
FIG. 10 is a schematic structural diagram of an apparatus for implementing an IPv4/IPv6 dual protocol stack according to an embodiment of the present application;
fig. 11 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The configuration method of the network protocol address provided by the embodiment of the application can be widely applied to various cloud platforms, servers or terminal equipment capable of configuring the network protocol address for the online virtual machine. The online virtual machine refers to a virtual machine which has already been created with an IPv4 network or an IPv6 network and can normally run a service, that is, a virtual machine which has already been created and is running. The terminal devices include, but are not limited to, smart phones, tablet computers, notebook computers, desktop computers, and the like, and are not limited thereto. The cloud platform includes, but is not limited to, an OpenStack cloud platform, etc., and for convenience of description, the cloud platform will be described below as an example. Referring to fig. 1, fig. 1 is a schematic structural diagram of a communication system provided in an embodiment of the present application. As shown in fig. 1, the communication system provided in the embodiment of the present application includes a cloud platform and virtual machines, where the virtual machines include a virtual machine a, a virtual machine B, …, and a virtual machine C. The cloud platform receives a network protocol address configuration request sent by any virtual machine, and can send a network protocol address corresponding to a physical address to the virtual machine according to the physical address included in the network protocol address configuration request.
For convenience of understanding, prior to describing the method provided by the embodiment of the present application, the related knowledge related to the method provided by the embodiment of the present application is briefly described as follows:
1. information Technology (IT) environments of enterprises and service providers are continuously evolving, and cloud computing is taken as a necessary trend of future development of the enterprise IT, so that brand-new service selection is provided for enterprise customers, and meanwhile, the requirement on service delivery is also provided. Cloud computing is an internet-related service-based add-on, use, and delivery model that provides dynamically scalable and virtualized resources over the internet. In brief, the cloud computing uses the transmission capability of the internet to transfer the storage and processing process of data from the local server to the internet, is not a new technology, but is a product of development and fusion of traditional IT technologies such as distributed computing, parallel computing, network storage, virtualization and the like, and is a service mode. Cloud computing is classified into narrow-sense cloud computing and generalized cloud computing. Cloud computing in the narrow sense refers to a mode of delivery and use of IT infrastructure, meaning that required resources (hardware, platforms, software) are obtained in an on-demand, easily scalable manner over a network. The network that provides the resources is referred to as the "cloud". The broad cloud computing refers to a delivery and use mode of a service, and refers to obtaining a required service in an on-demand and easily-extensible manner through a network, wherein the service can be IT (information technology) infrastructure and software, and can also be any other service.
Virtualization technology has been an important driving factor for the development of cloud computing. As an infrastructure of cloud computing, virtualization of desktops, storage and servers has been developed well, and network virtualization enables network switching equipment which is the infrastructure to support a network virtualization multi-tenant architecture, effectively separates a physical network from a logic network, meets the service characteristics of cloud computing, and improves the utilization rate of network resources. In brief, by using a host virtualization technology, a plurality of virtual machines can be run on one physical host, and the virtual machines are independent and do not affect each other, so that a user can flexibly install any software on the virtual machines. The host virtualization technology isolates application programs running on the same host, avoids resource conflict, and can dynamically migrate hardware resources which are not fully utilized to the most needed application programs, thereby improving the utilization rate of bottom hardware resources. With the increasing number of virtual machines, the number of IP addresses required for cloud computing is also increasing proportionally.
2. The transmission Control Protocol/network Protocol (TCP/IP) is the most successful network system and Protocol specification in the world at present, and is also the most basic communication Protocol in the network. The IP protocol is a protocol of a network layer in the TCP/IP protocol suite, which is a core protocol of the TCP/IP protocol suite, and the version number of the current IP protocol is 4, i.e., IPv 4. IPv4 is The fourth revision of The Internet Engineering Task Force (IETF) in The development of Internet protocols, which is also The first widely deployed version of The protocol. IPv4 has been used for thirty-three years as it evolved, and IPv4, which uses a 32-bit (4-byte) address length, can theoretically allocate addresses to 40 billion hosts throughout the Internet. However, with the explosion of the internet, the limited address space defined by IPv4 will be exhausted soon, and the shortage of the address space will certainly hinder the further development of the internet. Therefore, IPv6 was designed and proposed as a next-generation IP protocol instead of IPv4 to redefine the address space and solve the address shortage problem. The IPv6 adopts the address length of 128 bits (16 bytes), and estimates the addresses which can be actually distributed by the IPv6 according to a conservative method, and more than 1000 IP addresses can be distributed in each square meter of the whole earth. In addition to solving the problem of IP address shortage once and for all, other problems that are difficult to solve in IPv4, such as end-to-end IP connectivity, quality of service (QoS), security, multicast, mobility, plug and play, etc., are also considered in the design process of IPv 6.
In the embodiment of the present application, the first network protocol may include, without limitation, an IPv4 protocol or an IPv6 protocol, and the second network protocol may also include, without limitation, an IPv4 protocol or an IPv6 protocol, and the first network protocol and the second network protocol are different. For example, when the first network protocol is the IPv4 protocol, the second network protocol is the IPv6 protocol; when the first network protocol is the IPv6 protocol, the second network protocol is the IPv4 protocol. For convenience of description, all the embodiments described in the following application are described by taking the first network protocol as the IPv4 protocol and the second network protocol as the IPv6 protocol as examples.
3. The OpenStack is an open source cloud computing platform developed by OpenStack community developers and cloud computing technical experts, and aims to provide a simple, large-scale expandable and function-rich solution for cloud infrastructure of public clouds and private clouds. OpenStack has been developed to date, integrating a total of several components: nova (computing service), Neutron (web service), Swift (object storage service), circle (block storage service), company (mirror service), Keystone (authentication service), Horizon (UI service), Ceilometer (monitoring service), Heat (cluster service), and Trove (database service).
4. Neutron as a core component of OpenStack can provide Network support for the whole OpenStack environment, including two-layer switching, three-layer routing, load balancing, firewall and Virtual Private Network (VPN), etc. Neutron provides a flexible framework by which both open source and commercial software can be deployed to implement these functions. Network resources managed by Neutron include a main network (network), a subnet (subnet), and a port (port). Wherein, the network can be regarded as an isolated two-layer broadcast domain, and the subnet can be regarded as an IP address pool (IPv4 address pool or IPv6 address pool). The networks and the subnets are in a one-to-many relationship, that is, there may be multiple different subnets under one network, but one subnet can only belong to one network, and an IPv4subnet (i.e., IPv4subnet) and an IPv6subnet (i.e., IPv6subnet) constructed in this embodiment all belong to the same network, that is, the IPv4subnet and the IPv6subnet share an isolated two-layer broadcast domain. A port can be seen as a port on a virtual switch, on which a physical address and a network protocol address, i.e. a Media Access Control (MAC) address and an IP address (IPv4 address and/or IPv6 address) are defined, where the IP address of the port (IPv4 address or IPv6 address) is allocated from a subnet (i.e. an IPv4 address pool or IPv6 address pool). When a Virtual network Interface (VIF) of a Virtual machine is connected to a port, that is, when the VIF of the Virtual machine is bound to the port, the port assigns a physical address and an IP address (IPv4 address and/or IPv6 address) to the VIF, where the port and the VIF are in a one-to-one relationship.
5. The component of Neutron that provides Dynamic Host Configuration Protocol (DHCP) services is the DHCP agent. When the DHCP agent runs on the network node, the DHCP function is realized through dnsmasq by default. dnsmasq is an open source software providing DHCP and DNS services, and when it is used as a DNS nameresolution server, it can improve the connection speed to the visited web address by caching DNS requests, and when it is used as a DHCP server, it can be used to assign IP addresses and provide routing, etc. In the embodiment of the application, only the function of providing the DHCP service by the dnsmasq is concerned, that is, when a network is created and DHCP is enabled on a subnet, a DHCP agent on a network node starts a dnsmasq process to provide the DHCP service for the network. The dnsemasq process and the network are in a one-to-one relationship, that is, one dnsemasq process can provide DHCP service for all sub-nets in the same network.
According to the configuration method of the network protocol address provided by the embodiment of the application, by determining the virtual machine identifier of the virtual machine, the first network protocol configuration information (i.e., IPv4 configuration information) of the virtual machine can be queried from the database based on the virtual machine identifier, where the first network protocol configuration information includes a physical address of the virtual machine, a first network protocol address (i.e., IPv4 address) of the virtual machine, and a network identifier of a host network to which the virtual machine belongs. Determining a configuration file corresponding to the network identifier, adding the physical address and the target network protocol address to the configuration file by acquiring the target network protocol address (namely the IPv6 address), and configuring the target network protocol address for the virtual machine according to the configuration file containing the target network protocol address. By adopting the embodiment of the application, the online virtual machine can be smoothly upgraded from IPv4 to IPv4/IPv6 dual-protocol stack, the upgrading cost is reduced, and the applicability is strong.
In the embodiment of the application, the virtual machine is an online virtual machine which has already created an IPv4 network and can normally run a service. For ease of understanding, referring to fig. 2, fig. 2 is a schematic diagram of a system architecture of an IPv4 network provided in an embodiment of the present application. As shown in fig. 2, the IPv4 network in the embodiment of the present application is created on a cloud platform, where the IPv4 network includes a created main network 1, and an IPv4subnet 1, ports, and virtual machines created under the main network 1. The ports comprise port 1, port 2, port … and port 3, and the virtual machines comprise virtual machine A, virtual machine B, … and virtual machine C. Virtual machine a is connected with port 1, virtual machine B is connected with port 2, and virtual machine C is connected with port 3, wherein port 1, port 2, …, and port 3 are connected with IPv4subnet 1, i.e. the IPv4 addresses on the ports all come from IPv4subnet 1. When an IPv4 network is created, the virtual machine A, the virtual machine B, … and the virtual machine C can communicate based on an IPv4 protocol.
The method and the related apparatus provided by the embodiments of the present application will be described in detail with reference to fig. 3 to 11, respectively. The method provided by the embodiment of the application can comprise data processing stages, wherein the data processing stages are used for determining the virtual machine identifier, acquiring first network protocol configuration information, determining a configuration file, acquiring a target network protocol address, adding the target network protocol address to the configuration file, distributing the target network protocol address to the virtual machine based on the configuration file, and the like. The implementation of each data processing stage can be seen in the following implementations shown in fig. 3 to 11.
Referring to fig. 3, fig. 3 is a schematic flowchart of a method for configuring a network protocol address according to an embodiment of the present disclosure. The method provided by the embodiment of the application can comprise the following steps 101 to 104:
101. the method comprises the steps of determining a virtual machine identification of the virtual machine, and inquiring first network protocol configuration information of the virtual machine from a database based on the virtual machine identification.
In some possible implementations, if the virtual machine belongs to a first network protocol subnet in the primary network, the virtual machine in the first network protocol subnet can communicate based on the first network protocol. Then, by determining the virtual machine identifier of the virtual machine, the first network protocol configuration information of the virtual machine may be queried from the database based on the virtual machine identifier, where the first network protocol configuration information includes a physical address of the virtual machine, a first network protocol address of the virtual machine, a network identifier of a host network to which the virtual machine belongs, and the like, which is not limited herein. Here, the first network protocol address is a network protocol address for performing communication based on the first network protocol, where the first network protocol may be an IPv4 protocol or an IPv6 protocol, and the like, which is not limited herein. It is understood that, when the first network protocol is the IPv4 protocol, the first network protocol address is the IPv4 address, the first network protocol configuration information is the IPv4 configuration information, and the first network protocol subnet is the IPv4 subnet; when the first network protocol is the IPv6 protocol, the first network protocol address is an IPv6 address, the first network protocol configuration information is IPv6 configuration information, and the first network protocol subnet is an IPv6 subnet. For convenience of description, in the embodiments of the present application, the first network protocol is an IPv4 protocol, the first network protocol address is an IPv4 address, the first network protocol configuration information is IPv4 configuration information, and the first network protocol subnet is an IPv4 subnet.
Specifically, since the virtual machine in the example of the present application is an online virtual machine which has already created an IPv4 network and is capable of normally running traffic, all information related to the creation of the IPv4 network is already stored in the database, that is, the IPv4 configuration information of all online virtual machines is stored in the database. By determining the virtual machine identification of the virtual machine, the IPv4 configuration information corresponding to the virtual machine identification can be inquired from the database based on the virtual machine identification. One virtual machine corresponds to one virtual machine identifier, and the virtual machine identifier is a character string generated when the virtual machine is created and used for uniquely marking the virtual machine, and the character string may be composed of numbers, characters and/or letters, which is not limited herein. The IPv4 configuration information may include a physical address of the virtual machine, an IPv4 address of the virtual machine, a network identifier of a main network (i.e., a network) to which the virtual machine belongs, an IPv4subnet identifier of an IPv4subnet (i.e., an IPv4subnet) to which the virtual machine belongs, a port identifier of a port (i.e., a port) bound by the virtual machine, and a port state, which are not limited herein.
102. And determining a configuration file corresponding to the network identifier.
In some possible embodiments, by obtaining the IPv4 configuration information of the virtual machine, the network identifier included in the IPv4 configuration information may be obtained, and based on the network identifier, a configuration file corresponding to the network identifier may be matched in the database. It can be understood that one network identifier corresponds to one configuration file, one configuration file includes a plurality of records, one record corresponds to one piece of configuration information of one virtual machine, and one piece of configuration information may be composed of one physical address, one virtual machine name, and one network protocol address. That is, all configuration information of all virtual machines included under one main network is stored in one configuration file.
For example, referring to fig. 4, fig. 4 is a schematic view of an application scenario of a configuration file provided in an embodiment of the present application. The network identifier of the configuration file as the master network is the configuration file corresponding to the network identifier 1, and the configuration file comprises 4 records, namely a first record, a second record, a third record and a fourth record. The data format of each record is "physical address, virtual machine name, network protocol address", and the network protocol addresses included in the first to fourth records in the figure are all the first network protocol addresses (i.e., IPv4 addresses).
103. And acquiring a target network protocol address, and adding the physical address and the target network protocol address into the configuration file.
In some possible embodiments, since the online virtual machine in the present application belongs to the first network protocol subnet (i.e., IPv4subnet) in the main network, if a second network protocol address needs to be configured for the online virtual machine, a second network protocol subnet needs to be created. The second network protocol subnet is a subnet in the main network, the virtual machines in the second network protocol subnet communicate based on the second network protocol, and the second network protocol is different from the first network protocol. Since the first network protocol in this embodiment of the application is an IPv4 protocol, the second network protocol is an IPv6 protocol, and when the second network protocol is an IPv6 protocol, the second network protocol address is an IPv6 address, the second network protocol configuration information is IPv6 configuration information, and the second network protocol subnet is an IPv6subnet (i.e., IPv6 subnet). Specifically, by obtaining the IPv6subnet address field and the IPv6subnet name, an IPv6subnet can be created. Here, the IPv6subnet can be regarded as an IPv6 address pool or an IPv6 address range, that is, the IPv6subnet includes a plurality of IPv6 addresses. In the embodiment of the application, since the addition of the second network protocol address (i.e., the IPv6 address) to the online virtual machine is implemented, the main network already exists, and only one IPv6subnet needs to be continuously created under the main network. That is, the IPv4subnet in which the virtual machine resides and the newly created IPv6subnet belong to the same main network. For example, referring to fig. 5, fig. 5 is a schematic view of an application scenario for creating an IPv6subnet under the same host network according to an embodiment of the present application. The created IPv4 network on the cloud platform comprises a main network 1, an IPv4subnet 1 created under the main network 1, ports and virtual machines. The ports comprise a port 1, a port 2, a port … and a port 3, the virtual machines comprise a virtual machine A, a virtual machine B, a virtual machine … and a virtual machine C, the virtual machine A is connected with the port 1, the virtual machine B is connected with the port 2, and the virtual machine C is connected with the port 3. Port 1, port 2, … and port 3 are connected to IPv4subnet 1, that is, the IPv4 addresses on the ports are all from IPv4subnet 1. As shown in fig. 5, the IPv6subnet 1 is created under the main network 1, and the IPv4subnet 1 and the IPv6subnet 1 belong to the same main network 1.
In some possible embodiments, after the IPv6subnet is created, the IPv6 address can be determined as the target network protocol address by randomly acquiring an unused IPv6 address from the created IPv6 subnet. And then adding the physical address of the virtual machine and the obtained IPv6 address into a configuration file corresponding to the main network to which the virtual machine belongs. Specifically, a configuration file corresponding to the network identifier may be searched or matched through the determined network identifier of the main network to which the virtual machine belongs, and by acquiring a data format of configuration information included in the configuration file, a piece of configuration information may be generated based on the data format and the determined virtual machine name, physical address of the virtual machine, and target network protocol address to establish a corresponding relationship between the physical address and the target network protocol address. That is, the determined virtual machine name, physical address, and target network protocol address may be added to the configuration file according to the data format described above. It will be appreciated that the above-described process of adding the physical address and the target network protocol address to the configuration file does not affect the normal operation of the online virtual machine.
For example, referring to fig. 6, fig. 6 is a schematic view of an application scenario of an update configuration file provided in an embodiment of the present application. The network identifier of the configuration file as the master network is the configuration file corresponding to the network identifier 1, and the configuration file comprises 4 records, namely a first record, a second record, a third record and a fourth record. The data format of each record is "physical address, virtual machine name, network protocol address", and the network protocol addresses included in the first to fourth records in the figure are all the first network protocol addresses (i.e., IPv4 addresses). If the physical address of the virtual machine to be configured is physical address 1, the virtual machine name is virtual machine name 1, and the target network protocol address is second network protocol address 1, the physical address 1, the virtual machine name 1, and the second network protocol address 1 may be added to the configuration file in the form of "physical address 1, virtual machine name 1, and second network protocol address 1" as a fifth record in the configuration file according to the data format "physical address, virtual machine name, and network protocol address".
104. And configuring the target network protocol address for the virtual machine according to the configuration file containing the target network protocol address.
In some possible embodiments, the process of adding the physical address and the target network protocol address to the configuration file is equivalent to adding a new piece of IPv6 configuration information in the configuration file, and the process is the same as a programmer writing source code in a development tool. But if the updated configuration file needs to be validated, the network protocol address configuration process, which may be a dnsmasq process, needs to be reset, just as the source code written by the programmer needs to be compiled first in the compiler. In an embodiment of the present application, the network protocol address configuration process may be reset based on the SIGKILL signal by acquiring the SIGKILL signal. Briefly, because the virtual machine is an online virtual machine capable of normally running a service, the network protocol address configuration process has been started, that is, a host network to which the virtual machine belongs has started a network protocol address configuration process to provide a DHCP service for the host network. Because the IPv4subnet to which the virtual machine belongs and the newly-built IPv6subnet belong to the same main network, and the network protocol address configuration process and the main network are in a one-to-one relationship, that is, one network protocol address configuration process can provide DHCP service for the virtual machines under all subnets in the same main network, the reset network protocol address configuration process needs to terminate the originally existing network protocol address configuration process first. In the embodiment of the present application, by obtaining a SIGKILL signal, the SIGKILL signal may immediately terminate an originally existing network protocol address configuration process, and then the cloud platform may immediately restart a network protocol address configuration process when it is monitored that the network protocol address configuration process abnormally exits, that is, reset the network protocol address configuration process.
In some possible embodiments, the updated configuration file may be validated by resetting the network protocol address configuration process. Therefore, when a network protocol address configuration request sent by the virtual machine is received, by analyzing the network protocol address configuration request, the physical address carried in the network protocol address configuration request and the address type of the requested network protocol address can be obtained, where the address type of the requested network protocol address is an IPv6 address, that is, the network protocol address configuration request is used to request to acquire a network protocol address (i.e., an IPv6 address) that communicates based on the second network protocol (i.e., an IPv6 protocol). Therefore, based on the reset network protocol address configuration process, and in combination with the physical address carried in the network protocol address configuration request and the updated configuration file, the target network protocol address corresponding to the physical address can be obtained from the updated configuration file, and the target network protocol address is sent to the virtual machine. Specifically, the network protocol address configuration process may obtain a target network protocol address (i.e., an IPv6 address) corresponding to the physical address of the virtual machine from the configuration file by searching for the configuration file corresponding to the network identifier, and then sending the target network protocol address to the virtual machine by parsing the configuration file. Based on this, the IPv4 address and the IPv6 address will exist on the virtual machine at the same time, and the implementation process of the above steps will not affect the operation of the virtual machine, that is, based on the method in the embodiment of the present application, the virtual machine can complete smooth transition from the IPv4 to the IPv4/IPv6 dual-protocol stack without interrupting the service.
For example, referring to fig. 7, fig. 7 is a schematic view of an application scenario of a configuration method of a network protocol address provided in an embodiment of the present application. Assuming that the virtual machine is a virtual machine C, the steps are as follows: s01, acquiring the physical address of the virtual machine C from the database based on the virtual machine identifier; s02, acquiring an IPv6 address from the IPv6subnet 1, and adding the IPv6 address, the physical address and the virtual machine name into a configuration file; s03, resetting a network protocol address configuration process; s04, acquiring a network protocol address configuration request of the virtual machine C; s05, the network protocol address configuration process obtains the IPv6 address corresponding to the physical address of the virtual machine C from the configuration file, and sends the IPv6 address to the virtual machine C. Based on the method, the virtual machine C can be continuously allocated to the IPv6 address on the basis of owning the IPv4 address. In other words, the implementation based on the above steps S01-S05 can realize that the virtual machine C has the IPv4/IPv6 dual-protocol stack without interrupting the service, that is, the connection is established between the IPv6subnet 1 and the port 3.
Further, if all the virtual machines under the IPv4subnet pass through the above configuration process of the IPv6 address, it can be realized that each virtual machine can own the IPv4/IPv6 dual-protocol stack without interrupting the service. For example, referring to fig. 8, fig. 8 is a schematic system architecture diagram of an IPv4/IPv6 network provided by the embodiment of the present application. The IPv4/IPv6 network in the embodiment of the present application is created on a cloud platform, and includes a main network 1, an IPv4subnet 1, an IPv6subnet 1, a port, and a virtual machine, which are created under the main network 1. The ports comprise a port 1, a port 2, a port … and a port 3, the virtual machines comprise a virtual machine A, a virtual machine B, a virtual machine … and a virtual machine C, the virtual machine A is connected with the port 1, the virtual machine B is connected with the port 2, and the virtual machine C is connected with the port 3. Port 1, port 2, …, port 3 are all connected to IPv4subnet 1 and IPv6subnet 2, respectively. That is to say, the IPv4 addresses on the ports all come from the IPv4subnet 1, and the IPv6 addresses on the ports all come from the IPv6subnet 1, that is, the virtual machine a, the virtual machine B, and the virtual machine … of the IPv4/IPv6 network are built, and the virtual machine C can communicate based on the IPv4 protocol and also can communicate based on the IPv6 protocol.
According to the configuration method of the network protocol address provided by the embodiment of the application, by determining the virtual machine identifier of the virtual machine, the first network protocol configuration information (i.e., IPv4 configuration information) of the virtual machine can be queried from the database based on the virtual machine identifier, where the first network protocol configuration information at least includes a physical address of the virtual machine, a first network protocol address (i.e., IPv4 address) of the virtual machine, and a network identifier of a host network to which the virtual machine belongs. Determining a configuration file corresponding to the network identifier, adding the physical address and the target network protocol address to the configuration file by acquiring the target network protocol address (namely the IPv6 address), and then enabling the network protocol address configuration process to configure the target network protocol address for the virtual machine according to the configuration file containing the target network protocol address by resetting the network protocol address configuration process. By adopting the embodiment of the application, the online virtual machine can be smoothly upgraded from IPv4 to IPv4/IPv6 dual-protocol stack, the upgrading cost is reduced, and the applicability is strong.
Referring to fig. 9, fig. 9 is another schematic flowchart of a method for implementing an IPv4/IPv6 dual stack according to an embodiment of the present application. The method provided by the embodiment of the application can comprise the following steps 201 to 204:
201. the method comprises the steps of determining a virtual machine identification of the virtual machine, and inquiring first network protocol configuration information of the virtual machine from a database based on the virtual machine identification.
202. And determining a configuration file corresponding to the network identifier.
203. And acquiring a target network protocol address, and adding the physical address and the target network protocol address to a configuration file corresponding to the network identifier.
204. And configuring the target network protocol address for the virtual machine according to the configuration file containing the target network protocol address.
For a specific implementation manner of the foregoing step 201 to step 204, reference may be made to the description of step 101 to step 104 in the embodiment corresponding to fig. 3, which is not described herein again.
205. When the virtual machine is closed and restarted and the configuration information in the configuration file is emptied, obtaining the historical configuration information of the virtual machine from the database and adding the historical configuration information to the configuration file.
In some possible embodiments, when the cloud platform is turned off and restarted or the virtual machine is turned off and restarted, the configuration file configuration information is disappeared or emptied, so that for convenience of subsequent use and efficiency of configuring the network protocol address for the virtual machine, the information including the physical address, the target network protocol address (i.e., the IPv6 address), and the network identifier may be stored in the database as a piece of historical configuration information. That is, an IPv6 configuration message is generated according to the physical address of the virtual machine, the target network protocol address and the network identifier of the network to which the virtual machine belongs, and the IPv6 configuration message is updated to the database. Therefore, when the cloud platform is restarted next time, the cloud platform can read the configuration information in the database and write the configuration information into the configuration file, so that when the virtual machine requests the network protocol address, the network protocol address configuration process can find the network protocol address corresponding to the physical address in the configuration file according to the physical address of the virtual machine, and the virtual machine is continuously leased.
According to the configuration method of the network protocol address provided by the embodiment of the application, by determining the virtual machine identifier of the virtual machine, the first network protocol configuration information (i.e., IPv4 configuration information) of the virtual machine can be queried from the database based on the virtual machine identifier, where the first network protocol configuration information at least includes a physical address of the virtual machine, a first network protocol address (i.e., IPv4 address) of the virtual machine, and a network identifier of a host network to which the virtual machine belongs. Determining a configuration file corresponding to the network identifier, adding the physical address and the target network protocol address to the configuration file by acquiring the target network protocol address (namely the IPv6 address), and then enabling the network protocol address configuration process to configure the target network protocol address for the virtual machine according to the configuration file containing the target network protocol address by resetting the network protocol address configuration process. And finally, storing the IPv6 configuration information comprising the physical address, the target network protocol address and the network identifier in a database, and updating the configuration record in the database. By adopting the embodiment of the application, the online virtual machine can be smoothly upgraded from IPv4 to IPv4/IPv6 dual-protocol stack, the upgrading cost is reduced, and the applicability is strong.
Referring to fig. 10, fig. 10 is a schematic structural diagram of a configuration apparatus for a network protocol address according to an embodiment of the present application. The device for configuring the network protocol address provided by the embodiment of the application comprises:
a first network protocol configuration information obtaining module 31, configured to determine a virtual machine identifier of a virtual machine, and query, based on the virtual machine identifier, first network protocol configuration information of the virtual machine from a database, where the first network protocol configuration information includes a physical address of the virtual machine, a first network protocol address of the virtual machine, and a network identifier of a host network to which the virtual machine belongs, and the first network protocol address is a network protocol address for performing communication based on a first network protocol;
a configuration file determining module 32, configured to determine a configuration file corresponding to the network identifier determined by the first network protocol configuration information obtaining module 31;
a configuration file updating module 33, configured to acquire a target network protocol address, and add the physical address and the target network protocol address determined by the first network protocol configuration information acquiring module 31 to the configuration file determined by the configuration file determining module 32, where the target network protocol address is a network protocol address for performing communication based on a second network protocol, and the second network protocol is different from the first network protocol;
a target network protocol address configuration module 34, configured to configure the target network protocol address for the virtual machine according to the configuration file determined by the configuration file update module 33 that includes the target network protocol address.
In some possible embodiments, the apparatus further comprises:
a mapping relationship establishing module 35, configured to establish a mapping relationship between the physical address determined by the first network protocol configuration information obtaining module 31 and the target network protocol address determined by the configuration file updating module 33, and add the mapping relationship to the configuration file; and the corresponding relation is used for searching and obtaining the target network protocol address based on the physical address.
In some possible embodiments, the target network protocol address configuration module 34 includes:
a network protocol address configuration process resetting unit 3401, configured to reset a network protocol address configuration process;
a network protocol address configuration request obtaining unit 3402, configured to obtain, based on the network protocol address configuration process after the reset, a network protocol address configuration request sent by the virtual machine, where the network protocol address configuration request is used to request to obtain a network protocol address for performing communication based on the second network protocol, and the network protocol address configuration request includes the physical address;
a target network protocol address sending unit 3403, configured to obtain the target network protocol address corresponding to the physical address from the configuration file based on the network protocol address configuration process by combining the physical address and the correspondence, and send the target network protocol address to the virtual machine.
In some possible embodiments, the apparatus for configuring a network protocol address further includes:
a configuration file loading module 36, configured to, when the virtual machine is closed and restarted and configuration information in the configuration file is cleared, obtain historical configuration information of the virtual machine from the database, where the historical configuration information at least includes the physical address, the target network protocol address, and the corresponding relationship; and adding the historical configuration information to the configuration file.
In some possible embodiments, the virtual machine belongs to a first network protocol subnet in the main network, and the virtual machines in the first network protocol subnet communicate based on the first network protocol; the device for configuring the network protocol address further comprises:
a second network protocol subnet creating module 37, configured to create a second network protocol subnet, where the second network protocol subnet is one subnet in the main network, and a virtual machine in the second network protocol subnet performs communication based on the second network protocol, and the second network protocol subnet includes a plurality of second network protocol addresses; and acquiring any second network protocol address from the plurality of second network protocol addresses as a target network protocol address.
In some possible embodiments, the correspondence establishing module is specifically configured to:
acquiring a data format included in the configuration file;
and combining the physical address and the target network protocol address according to the data format to establish a corresponding relation between the physical address and the target network protocol address.
In a specific implementation, the configuration apparatus for network protocol address may execute, through its built-in functional modules, the implementation manners provided in the steps in fig. 3 and fig. 9. For example, the first network protocol configuration information obtaining module 31 may be configured to execute implementation manners such as determining a virtual machine identifier in each step, and querying the first network protocol configuration information based on the virtual machine identifier, which may specifically refer to the implementation manners provided in each step, and details are not described here. The configuration file determining module 32 may be configured to execute the implementation manners described in the relevant steps, such as determining the corresponding configuration file according to the network identifier in each step, which may specifically refer to the implementation manners provided in each step, and is not described herein again. The configuration file updating module 33 may be configured to execute implementation manners such as obtaining a target network protocol address in each step, and updating a physical address and the target network protocol address to a configuration file, which may specifically refer to the implementation manners provided in each step, and will not be described herein again. The target network protocol address configuration module 34 may be configured to execute implementation manners such as configuring a target network protocol address of the virtual machine according to the configuration file in each step, which may specifically refer to the implementation manners provided in each step, and details are not described here. The correspondence establishing module 35 may be configured to execute implementation manners such as establishing a correspondence between a physical address and a target network protocol address in each step, which may specifically refer to the implementation manners provided in each step, and will not be described herein again. The configuration file loading module 36 may be configured to execute implementation manners such as obtaining historical configuration information in each step and loading the historical configuration information to a configuration file, which may specifically refer to the implementation manners provided in each step, and will not be described herein again. The second network protocol subnet creating module 37 may be configured to execute the implementation manners of creating the second network protocol subnet in the above steps and obtaining the target network protocol address from the second network protocol subnet, and specifically refer to the implementation manners provided in the above steps, which is not described herein again.
In this embodiment of the present application, the network protocol address configuring device may query, from the database, first network protocol configuration information (i.e., IPv4 configuration information) of the virtual machine based on the determined virtual machine identifier, where the first network protocol configuration information includes at least a physical address of the virtual machine, a first network protocol address (i.e., IPv4 address) of the virtual machine, and a network identifier of a host network to which the virtual machine belongs. Determining a configuration file corresponding to the network identifier, adding the physical address and the target network protocol address to the configuration file by acquiring the target network protocol address (namely the IPv6 address), and then enabling the network protocol address configuration process to configure the target network protocol address for the virtual machine according to the configuration file containing the target network protocol address by resetting the network protocol address configuration process. And finally, storing the IPv6 configuration information comprising the physical address, the target network protocol address and the network identifier in a database, and updating the configuration record in the database. By adopting the embodiment of the application, the online virtual machine can be smoothly upgraded from IPv4 to IPv4/IPv6 dual-protocol stack, the upgrading cost is reduced, the flexibility is high, and the application range is wide.
Referring to fig. 11, fig. 11 is a schematic structural diagram of a terminal device provided in an embodiment of the present application. As shown in fig. 11, the terminal device in this embodiment may include: one or more processors 401 and memory 402. The processor 401 and the memory 402 are connected by a bus 403. The memory 402 is used to store a computer program comprising program instructions, and the processor 401 is used to execute the program instructions stored in the memory 402 to perform the following operations:
determining a virtual machine identifier of a virtual machine, and querying first network protocol configuration information of the virtual machine from a database based on the virtual machine identifier, wherein the first network protocol configuration information includes a physical address of the virtual machine, a first network protocol address of the virtual machine, and a network identifier of a main network to which the virtual machine belongs, and the first network protocol address is a network protocol address for performing communication based on a first network protocol;
determining a configuration file corresponding to the network identifier;
acquiring a target network protocol address, and adding the physical address and the target network protocol address to the configuration file, wherein the target network protocol address is a network protocol address for performing communication based on a second network protocol, and the second network protocol is different from the first network protocol;
and configuring the target network protocol address for the virtual machine according to the configuration file containing the target network protocol address.
In some possible embodiments, the processor 401 is configured to:
establishing a corresponding relation between the physical address and the target network protocol address, and adding the corresponding relation to the configuration file;
and the corresponding relation is used for searching and obtaining the target network protocol address based on the physical address.
In some possible embodiments, the processor 401 is configured to:
resetting a network protocol address configuration process;
acquiring a network protocol address configuration request sent by the virtual machine based on the reset network protocol address configuration process, wherein the network protocol address configuration request is used for requesting to acquire a network protocol address which is communicated based on the second network protocol, and the network protocol address configuration request comprises the physical address;
and acquiring the target network protocol address corresponding to the physical address from the configuration file based on the network protocol address configuration process by combining the physical address and the corresponding relation, and sending the target network protocol address to the virtual machine.
In some possible embodiments, the processor 401 is configured to:
when the virtual machine is closed and restarted and the configuration information in the configuration file is emptied, obtaining historical configuration information of the virtual machine from the database, wherein the historical configuration information at least comprises the physical address, the target network protocol address and the corresponding relation;
and adding the historical configuration information to the configuration file.
In some possible embodiments, the virtual machine belongs to a first network protocol subnet in the main network, and the virtual machines in the first network protocol subnet communicate based on the first network protocol; the processor 401 is configured to:
creating a second network protocol subnet, wherein the second network protocol subnet is one subnet in the main network, a virtual machine in the second network protocol subnet communicates based on the second network protocol, and the second network protocol subnet comprises a plurality of second network protocol addresses;
and acquiring any second network protocol address from the plurality of second network protocol addresses as a target network protocol address.
In some possible embodiments, the processor 401 is configured to:
acquiring a data format included in the configuration file;
and combining the physical address and the target network protocol address according to the data format to establish a corresponding relation between the physical address and the target network protocol address.
It should be appreciated that in some possible implementations, the processor 401 may be a Central Processing Unit (CPU), and the processor may be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The memory 402 may include both read-only memory and random access memory, and provides instructions and data to the processor 401. A portion of the memory 402 may also include non-volatile random access memory. For example, the memory 402 may also store device type information.
In a specific implementation, the terminal device may execute the implementation manners provided in the steps in fig. 3 and fig. 9 through the built-in functional modules, which may specifically refer to the implementation manners provided in the steps, and are not described herein again.
In this embodiment, the terminal device may query, from the database, first network protocol configuration information (i.e., IPv4 configuration information) of the virtual machine based on the determined virtual machine identifier, where the first network protocol configuration information includes at least a physical address of the virtual machine, a first network protocol address (i.e., IPv4 address) of the virtual machine, and a network identifier of a host network to which the virtual machine belongs. Determining a configuration file corresponding to the network identifier, adding the physical address and the target network protocol address to the configuration file by acquiring the target network protocol address (namely the IPv6 address), and then enabling the network protocol address configuration process to configure the target network protocol address for the virtual machine according to the configuration file containing the target network protocol address by resetting the network protocol address configuration process. And finally, storing the IPv6 configuration information comprising the physical address, the target network protocol address and the network identifier in a database, and updating the configuration record in the database. By adopting the embodiment of the application, the online virtual machine can be smoothly upgraded from IPv4 to IPv4/IPv6 dual-protocol stack, the upgrading cost is reduced, the flexibility is high, and the application range is wide.
An embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, where the computer program includes program instructions, and when the program instructions are executed by a processor, the method for configuring a network protocol address provided in each step in fig. 3 and fig. 9 is implemented, which may specifically refer to implementation manners provided in each step, and details of the implementation manners are not described herein again.
The computer-readable storage medium may be a network protocol address configuration device provided in any of the foregoing embodiments or an internal storage unit of the terminal device, such as a hard disk or a memory of an electronic device. The computer readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk, a Smart Memory Card (SMC), a Secure Digital (SD) card, a flash card (flash card), and the like, which are provided on the electronic device. Further, the computer readable storage medium may also include both an internal storage unit and an external storage device of the electronic device. The computer-readable storage medium is used for storing the computer program and other programs and data required by the electronic device. The computer readable storage medium may also be used to temporarily store data that has been output or is to be output.
The terms "first", "second", "third", "fourth", and the like in the claims and in the description and drawings of the present application are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments. The term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items. Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The method and the related apparatus provided by the embodiments of the present application are described with reference to the flowchart and/or the structural diagram of the method provided by the embodiments of the present application, and each flow and/or block of the flowchart and/or the structural diagram of the method, and the combination of the flow and/or block in the flowchart and/or the block diagram can be specifically implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block or blocks of the block diagram. These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block or blocks of the block diagram. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block or blocks.

Claims (10)

1. A method for configuring a network protocol address, the method comprising:
determining a virtual machine identifier of a virtual machine, and inquiring first network protocol configuration information of the virtual machine from a database based on the virtual machine identifier, wherein the first network protocol configuration information comprises a physical address of the virtual machine, a first network protocol address of the virtual machine and a network identifier of a main network to which the virtual machine belongs, and the first network protocol address is a network protocol address for communicating based on a first network protocol;
determining a configuration file corresponding to the network identifier in the database, wherein the configuration file stores all configuration information of all virtual machines of a main network to which the virtual machine belongs, the configuration file comprises a plurality of records, one record corresponds to one piece of configuration information of one virtual machine, and one piece of configuration information consists of a physical address, a virtual machine name and a network protocol address;
acquiring a target network protocol address, and adding the physical address and the target network protocol address into the configuration file, wherein the target network protocol address is a network protocol address for communication based on a second network protocol, and the second network protocol is different from the first network protocol;
and configuring the target network protocol address for the virtual machine according to the configuration file containing the target network protocol address.
2. The method of claim 1, wherein after obtaining the target network protocol address, the method further comprises:
establishing a corresponding relation between the physical address and the target network protocol address, and adding the corresponding relation to the configuration file;
and the corresponding relation is used for searching and obtaining the target network protocol address based on the physical address.
3. The method of claim 2, wherein configuring the target network protocol address for the virtual machine according to a configuration file containing the target network protocol address comprises:
resetting a network protocol address configuration process;
acquiring a network protocol address configuration request sent by the virtual machine based on the reset network protocol address configuration process, wherein the network protocol address configuration request is used for requesting to acquire a network protocol address which is communicated based on the second network protocol, and the network protocol address configuration request comprises the physical address;
and acquiring the target network protocol address corresponding to the physical address from the configuration file based on the network protocol address configuration process by combining the physical address and the corresponding relation, and sending the target network protocol address to the virtual machine.
4. The method of claim 2, further comprising:
when the virtual machine is closed and restarted and the configuration information in the configuration file is emptied, obtaining historical configuration information of the virtual machine from the database, wherein the historical configuration information at least comprises the physical address, the target network protocol address and the corresponding relation;
adding the historical configuration information to the configuration file.
5. The method of any of claims 1-4, wherein the virtual machine belongs to a first network protocol subnet in the primary network, the virtual machine in the first network protocol subnet communicating based on the first network protocol;
the acquiring the target network protocol address comprises the following steps:
creating a second network protocol subnet, wherein the second network protocol subnet is one subnet in the main network, a virtual machine in the second network protocol subnet communicates based on the second network protocol, and the second network protocol subnet comprises a plurality of second network protocol addresses;
and acquiring any second network protocol address from the plurality of second network protocol addresses as a target network protocol address.
6. The method according to any one of claims 2-4, wherein said establishing the correspondence between the physical address and the target network protocol address comprises:
acquiring a data format included in the configuration file;
and combining the physical address and the target network protocol address according to the data format to establish the corresponding relation between the physical address and the target network protocol address.
7. An apparatus for configuring a network protocol address, the apparatus comprising:
the first network protocol configuration information acquisition module is used for determining a virtual machine identifier of a virtual machine, and inquiring first network protocol configuration information of the virtual machine from a database based on the virtual machine identifier, wherein the first network protocol configuration information comprises a physical address of the virtual machine, a first network protocol address of the virtual machine and a network identifier of a main network to which the virtual machine belongs, and the first network protocol address is a network protocol address for communication based on a first network protocol;
a configuration file determining module, configured to determine, in the database, a configuration file corresponding to the network identifier determined by the first network protocol configuration information obtaining module, where the configuration file stores all configuration information of all virtual machines of a host network to which the virtual machine belongs, the configuration file includes a plurality of records, one record corresponds to one piece of configuration information of one virtual machine, and one piece of configuration information is composed of a physical address, a virtual machine name, and a network protocol address;
a configuration file updating module, configured to obtain a target network protocol address, and add the physical address and the target network protocol address determined by the first network protocol configuration information obtaining module to the configuration file determined by the configuration file determining module, where the target network protocol address is a network protocol address for performing communication based on a second network protocol, and the second network protocol is different from the first network protocol;
and the target network protocol address configuration module is used for configuring the target network protocol address for the virtual machine according to the configuration file determined by the configuration file updating module containing the target network protocol address.
8. The apparatus of claim 7, further comprising:
a corresponding relationship establishing module, configured to establish a corresponding relationship between the physical address determined by the first network protocol configuration information obtaining module and the target network protocol address determined by the configuration file updating module, and add the corresponding relationship to the configuration file;
and the corresponding relation is used for searching and obtaining the target network protocol address based on the physical address.
9. A terminal device, comprising a processor and a memory, the processor and the memory being interconnected;
the memory for storing a computer program comprising program instructions, the processor being configured to invoke the program instructions to perform the method of any of claims 1-6.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to carry out the method according to any one of claims 1-6.
CN201910629139.5A 2019-07-12 2019-07-12 Method and device for configuring network protocol address Active CN110213391B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910629139.5A CN110213391B (en) 2019-07-12 2019-07-12 Method and device for configuring network protocol address

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910629139.5A CN110213391B (en) 2019-07-12 2019-07-12 Method and device for configuring network protocol address

Publications (2)

Publication Number Publication Date
CN110213391A CN110213391A (en) 2019-09-06
CN110213391B true CN110213391B (en) 2021-09-28

Family

ID=67797272

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910629139.5A Active CN110213391B (en) 2019-07-12 2019-07-12 Method and device for configuring network protocol address

Country Status (1)

Country Link
CN (1) CN110213391B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111586196B (en) * 2020-04-07 2022-09-06 华云数据控股集团有限公司 Method, device and system for realizing network double stacks of virtual machine
CN111600972B (en) * 2020-05-15 2023-04-07 咪咕视讯科技有限公司 Configuration method of double-stack address, server and readable storage medium
CN111629084B (en) * 2020-07-28 2020-11-03 腾讯科技(深圳)有限公司 Data transmission method and device, storage medium and electronic equipment
CN113938459A (en) * 2021-09-06 2022-01-14 锐捷网络股份有限公司 IPv6 configuration method and device
CN115277639A (en) * 2022-05-30 2022-11-01 紫光建筑云科技(重庆)有限公司 Method for realizing VPC supporting IPv6
CN115190101B (en) * 2022-09-08 2023-01-17 北京交通大学 Network address management and data transmission method of equipment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004221745A (en) * 2003-01-10 2004-08-05 Fujitsu Ltd Address conversion apparatus
US7948916B2 (en) * 2003-01-31 2011-05-24 Hewlett-Packard Development Company, L.P. Method and apparatus for discovering topology information in a network
CN103312828A (en) * 2012-03-09 2013-09-18 中兴通讯股份有限公司 Method, device and system of MAC and IP address couple configuration of virtual machine
CN108347493B (en) * 2017-01-25 2020-06-26 华为技术有限公司 Hybrid cloud management method and device and computing equipment
CN109688241B (en) * 2018-12-25 2021-08-31 武汉烽火信息集成技术有限公司 IPv4/IPv6 dual-stack conversion method and system based on SDN

Also Published As

Publication number Publication date
CN110213391A (en) 2019-09-06

Similar Documents

Publication Publication Date Title
CN110213391B (en) Method and device for configuring network protocol address
US10375015B2 (en) Methods and system for allocating an IP address for an instance in a network function virtualization (NFV) system
US11956207B2 (en) Multi-tenant aware dynamic host configuration protocol (DHCP) mechanism for cloud networking
US20220377045A1 (en) Network virtualization of containers in computing systems
US9749145B2 (en) Interoperability for distributed overlay virtual environment
US8725898B1 (en) Scalable port address translations
US9628290B2 (en) Traffic migration acceleration for overlay virtual environments
US11240152B2 (en) Exposing a subset of hosts on an overlay network to components external to the overlay network without exposing another subset of hosts on the overlay network
US8924542B1 (en) Methods and apparatus for scalable private services
CN109981493B (en) Method and device for configuring virtual machine network
US11032369B1 (en) System and method for non-disruptive migration of software components to a public cloud system
US10079798B2 (en) Domain intercommunication in shared computing environments
US10243920B1 (en) Internet protocol address reassignment between virtual machine instances
CN111124535B (en) Function expansion method, device, equipment and storage medium of cloud host QGA
CN110636149B (en) Remote access method, device, router and storage medium
US11863520B2 (en) Data access methods and systems
US11909624B2 (en) Communication method, apparatus, device, system, and computer-readable storage medium
CN117827118A (en) Method, device and equipment for mounting cloud disk on bare metal server
CN117255018A (en) Network configuration method and device for bare metal instance and computer equipment
CN116506400A (en) Communication 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