[go: up one dir, main page]

CN120935105A - Virtual machine communication methods, systems, computer equipment and storage media - Google Patents

Virtual machine communication methods, systems, computer equipment and storage media

Info

Publication number
CN120935105A
CN120935105A CN202511071561.5A CN202511071561A CN120935105A CN 120935105 A CN120935105 A CN 120935105A CN 202511071561 A CN202511071561 A CN 202511071561A CN 120935105 A CN120935105 A CN 120935105A
Authority
CN
China
Prior art keywords
request message
virtual machine
virtual
protocol
protocol conversion
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.)
Pending
Application number
CN202511071561.5A
Other languages
Chinese (zh)
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.)
Inspur Jinan data Technology Co ltd
Original Assignee
Inspur Jinan data Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur Jinan data Technology Co ltd filed Critical Inspur Jinan data Technology Co ltd
Priority to CN202511071561.5A priority Critical patent/CN120935105A/en
Publication of CN120935105A publication Critical patent/CN120935105A/en
Pending legal-status Critical Current

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

本申请公开了一种虚拟机通信方法、系统、计算机设备及存储介质,涉及云平台技术领域,包括:虚拟路由器将第一请求报文发送至预设端口,通过预设端口将第一请求报文发送至协议转换模块,协议转换模块对第一请求报文进行协议转换得到第二请求报文,通过虚拟路由器将第二请求报文发送至第二虚拟机。可以解决虚拟机之间的跨协议通信过度依赖物理设备,调整物理设备效率低,难以满足云平台的弹性扩展需求的问题。该方法在网络命名空间内部署协议转换模块,使用协议转换模块实现第一请求报文到第二请求报文的转换,移除了对物理设备的依赖,使用预设端口和虚拟路由器替代物理三层网络设备,减少了物理三层网络设备的公网地址需求。

This application discloses a virtual machine communication method, system, computer device, and storage medium, relating to the field of cloud platform technology. The method includes: a virtual router sending a first request message to a preset port; the first request message being sent to a protocol conversion module through the preset port; the protocol conversion module performing protocol conversion on the first request message to obtain a second request message; and the second request message being sent to a second virtual machine through the virtual router. This method solves the problem of excessive reliance on physical devices for cross-protocol communication between virtual machines, resulting in low efficiency in adjusting physical devices and difficulty in meeting the elastic scaling requirements of cloud platforms. The method deploys a protocol conversion module within the network namespace, using this module to convert the first request message to the second request message, removing the dependence on physical devices and replacing physical Layer 3 network devices with preset ports and virtual routers, thus reducing the public IP address requirements of physical Layer 3 network devices.

Description

Virtual machine communication method, system, computer equipment and storage medium
Technical Field
The application relates to the technical field of cloud platforms, in particular to a virtual machine communication method, a virtual machine communication system, computer equipment and a storage medium.
Background
As the internet scale grows exponentially, the pool of IPv4 (Internet Protocol version, fourth edition of internet communication protocol) addresses has been exhausted, and in order to avoid limiting network development, the current address shortage problem is solved by currently adopting the sixth edition of internet communication protocol (Internet Protocol version, IPv 6) addresses. However, a large number of critical traffic in current cloud platforms still rely on IPv4 addresses for communication, including a large number of database services and third party interfaces. Under the condition that the current new protocol and the old protocol coexist, the cloud platform must support mixed deployment of IPv4/IPv6 dual stack Virtual Machines (VM), and cross-protocol communication can be realized between the Virtual machines.
Currently, cross-protocol communication in cloud platforms mainly relies on a combination scheme of physical three-layer network devices and independent hardware NAT64 (Network Address Translation-IPv6 to IPv4, IPv6 and IPv4 network address translation technology) gateways. The scheme has strong dependence on physical equipment, static routing is required to be configured on the physical router, and the transmission of the message among the equipment where the cloud platform is located, the physical three-layer network equipment and the gateway is realized through the static routing. When the cloud platform dynamically expands, virtual machines migrate or network topology changes, static routes on physical routers need to be adjusted, but the current manual mode of adjusting the static routes is low in efficiency, and the elastic expansion requirement of the cloud platform is difficult to meet.
Disclosure of Invention
In view of the above, the present application provides a virtual machine communication method, system, computer device and storage medium, so as to solve the problem that inter-protocol communication between virtual machines excessively depends on physical devices, and adjustment of physical devices is inefficient, and it is difficult to satisfy the elastic expansion requirement of a cloud platform.
In a first aspect, the present application provides a virtual machine communication method, which is applied to a virtual router, and the method includes:
Under the condition that a first request message of a first virtual machine is received, the first request message is sent to a preset port, so that the preset port sends the first request message to a protocol conversion module, the protocol conversion module is used for carrying out protocol conversion on the first request message to obtain a second request message, a virtual router and the first virtual machine are located in the same cloud platform, the preset port and the protocol conversion module are located in the same network naming space, the virtual router is connected with the preset port through a virtual network, and under the condition that a second request message sent by the preset port is received, the second request message is sent to a second virtual machine, wherein communication protocols of the first virtual machine and the second virtual machine are different, and the virtual router and the second virtual machine are located in the same cloud platform.
In a second aspect, the present application provides a virtual machine communication method, where the method is applied to a protocol conversion module, and the method includes:
Under the condition that a first request message of a first virtual machine is received, protocol conversion is carried out on the first request message to obtain a second request message, wherein the first request message received by a protocol conversion module is sent by a preset port, the first request message received by the preset port is sent by a virtual router, the virtual router and the first virtual machine are located in the same cloud platform, the preset port and the protocol conversion module are located in the same network naming space, the virtual router and the preset port are connected through a virtual network, the second request message is sent to the preset port, so that the preset port sends the second request message to the virtual router, the virtual router is used for sending the second request message to the second virtual machine, communication protocols of the first virtual machine and the second virtual machine are different, and the virtual router and the second virtual machine are located in the same cloud platform.
In a third aspect, the present application provides a virtual machine communication system, the system comprising a virtual router, a preset port and a protocol conversion module;
The virtual router is connected with the preset port through a virtual network and is used for sending the first request message to the preset port under the condition that the first request message of the first virtual machine is received, the preset port and the protocol conversion module are located in the same network naming space and are used for sending the first request message to the protocol conversion module, the protocol conversion module is used for carrying out protocol conversion on the first request message to obtain a second request message and sending the second request message to the preset port, the preset port is used for sending the second request message to the virtual router, and the virtual router is used for sending the second request message to the second virtual machine under the condition that the second request message sent by the preset port is received.
In a fourth aspect, the present application provides a computer device, including a memory and a processor, where the memory and the processor are communicatively connected to each other, and the memory stores computer instructions, and the processor executes the computer instructions, thereby executing the virtual machine communication method according to the first aspect or any implementation manner corresponding to the first aspect, or executing the virtual machine communication method according to the second aspect or any implementation manner corresponding to the second aspect.
In a fifth aspect, the present application provides a computer-readable storage medium having stored thereon computer instructions for causing a computer to perform the virtual machine communication method of the first aspect or any of the embodiments corresponding thereto, or the virtual machine communication method of the second aspect or any of the embodiments corresponding thereto.
In a sixth aspect, the present application provides a computer program product comprising computer instructions for causing a computer to perform the virtual machine communication method of the first aspect or any of its corresponding embodiments, or to perform the virtual machine communication method of the second aspect or any of its corresponding embodiments.
According to the application, the virtual router sends the first request message to the preset port, the first request message is sent to the protocol conversion module through the preset port, the protocol conversion module carries out protocol conversion on the first request message to obtain the second request message, and the second request message is sent to the second virtual machine through the virtual router. The method and the device can solve the problems that inter-protocol communication between virtual machines excessively depends on physical equipment, the efficiency of adjusting the physical equipment is low, and the elastic expansion requirement of a cloud platform is difficult to meet. According to the method, a protocol conversion module is arranged in the network naming space, the conversion from the first request message to the second request message is realized by using the protocol conversion module, the dependence on physical equipment is removed, the requirement of opening the cloud-in-cloud-out network is reduced, and the communication flow is shortened. In addition, the preset port and the virtual router are used for replacing the physical three-layer network equipment, so that the requirement of public network addresses of the physical three-layer network equipment is reduced, and the flexibility is also increased for protocol conversion.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the related art, the drawings that are required to be used in the description of the embodiments or the related art will be briefly described, and it is apparent that the drawings in the description below are some embodiments of the present application, and other drawings may be obtained according to the drawings without inventive effort for those skilled in the art.
FIG. 1 is a flow diagram of virtual machine communication for a virtual router according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a virtual machine communication system according to an embodiment of the present application;
FIG. 3 is a flow chart of another virtual machine communication method applied to a virtual router according to an embodiment of the present application;
FIG. 4 is a flow diagram of virtual machine communication applied to a protocol conversion module according to an embodiment of the present application;
FIG. 5 is a flow chart of another virtual machine communication method applied to a protocol conversion module according to an embodiment of the present application;
FIG. 6 is a flow diagram of a deployment module deployment component according to an embodiment of the application;
FIG. 7 is a block diagram of a virtual machine communication apparatus deployed at a virtual router according to an embodiment of the application;
FIG. 8 is a block diagram of a virtual machine communication device deployed at a protocol conversion module according to an embodiment of the present application;
Fig. 9 is a schematic diagram of a hardware structure of a computer device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
IPv6 is a new generation of internet protocol, and uses 128-bit addresses to provide basic support for the internet of things and large-scale networks. IPv4 is an internet protocol widely used currently, and with the adoption of a 32-bit address, along with the exponential growth of the internet scale, the problem of exhaustion of the IPv4 address has become a core bottleneck restricting the development of a network. Currently, there are still a large number of business systems in the internet that rely on the IPv4 protocol, and in particular in cloud environments, a large number of legacy applications, database services, and third party interfaces still operate in the IPv4 network. The current situation that the IPv4 protocol and the IPv6 protocol coexist makes the cloud platform necessary to support the hybrid deployment of the IPv4/IPv6 dual stack virtual machine, and cross-protocol communication becomes a core requirement of the cloud platform.
Cross-protocol communication requires that protocol translation be implemented between IPv4 and IPv6, and currently, NAT64 translation technology is generally adopted to implement protocol translation. NAT64 is a network translation technique that enables IPv6 devices to access IPv4 resources while hiding internal network structures by establishing a bi-directional mapping of protocols and addresses between the IPv6 and IPv4 networks. However, the traditional cloud platform mainly adopts a combined scheme of physical three-layer network equipment and independent hardware NAT64 gateway, the physical equipment dependency of the cross-protocol communication scheme is strong, the address management is complex and the safety isolation is insufficient, firstly, static routing is required to be configured on a physical router, the cross-protocol communication message is forwarded to a special NAT64 gateway node, if the cloud environment is dynamically expanded, virtual machine migration or network topology changes, the static routing is required to be manually adjusted, the adjustment efficiency is low, the elastic expansion requirement of the cloud platform is difficult to meet, secondly, in the scheme, the NAT64 gateway is required to be configured with the IPv4 address and the IPv6 address in the public network, the communication relationship between the virtual machine and the public network where the NAT64 gateway is located in the cloud platform is required to be opened, the address planning is complex, finally, the NAT64 gateway is used as a single-point access physical network in the scheme, and the whole cloud platform is possibly interrupted once being attacked.
OpenvSwitch is an open-source virtual switch, which realizes flexible network flow control and network interconnection between virtualized environments through Software, supports SDN (Software-Defined Networking) protocol, and is widely used for constructing programmable and high-performance virtual networks by cloud platforms. OVN (Open Virtual Network ) is a network virtualization technology based on a software defined network, which provides flexible network topology and security policy management for cloud environments, and enhances isolation and scalability of networks. The Linux network naming space is a resource isolation mechanism provided by a Linux kernel, and by creating an independent network protocol stack for each process or container, network configuration among different virtual environments is realized without interference, and communication safety and flexible scheduling are ensured. The network protocol stack includes information such as IP (Internet Protocol, internet communication protocol) addresses, routing tables, firewall rules, etc.
Based on the above, the embodiment of the application provides a virtual machine communication method, which combines a virtual switch and an open virtual network to create OpenvSwitch a virtual router in a cloud platform, creates a protocol conversion module in a Linux network naming space, creates a OpenvSwitch internal port according to OpenvSwitch technology in the Linux network naming space, uses the Linux network naming space and OpenvSwitch internal port to realize connection of OpenvSwitch virtual router and NAT64 conversion module, forwards a message to the NAT64 conversion module by using OpenvSwitch virtual router, removes dependence on physical three-layer forwarding equipment and NAT64 gateway, reduces the requirement of opening cloud-to-cloud external network, and shortens communication flow. The dual-stack communication method based on the pure software architecture achieves the effects of automation, light weight and high reliability of cross-protocol communication.
According to an embodiment of the present application, there is provided an embodiment of a virtual machine communication method applied to a virtual router, it being noted that the steps shown in the flowchart of the drawings may be performed in a computer system such as a set of computer executable instructions, e.g., a computer, a server, etc., and, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order different from that shown or described herein.
In this embodiment, a virtual machine communication method applied to a virtual router is provided, and fig. 1 is a flowchart of a virtual machine communication method according to an embodiment of the present application, as shown in fig. 1, where the flowchart includes the following steps:
Step S101, under the condition that a first request message of a first virtual machine is received, the first request message is sent to a preset port, so that the preset port sends the first request message to a protocol conversion module, wherein the protocol conversion module is used for carrying out protocol conversion on the first request message to obtain a second request message, a virtual router and the first virtual machine are located in the same cloud platform, the preset port and the protocol conversion module are located in the same network naming space, and the virtual router and the preset port are connected through a virtual network.
In particular, virtual routers are OpenvSwitch virtual routers created in a cloud platform, for example, in combination with virtual switch technology and open virtual networks. OpenvSwitch virtual routers support a hybrid configuration of dynamic routing protocols and static routing. The router is internally provided with a flow classification engine, and the five-tuple (source IP address, destination IP address, port, protocol and virtual local area network identifier) is matched with the message needing protocol conversion, so that the performance loss caused by full flow scanning is avoided. The preset port is, for example, a OpenvSwitch internal port created according to virtual switch technology in Linux network namespaces. OpenvSwitch internal ports, namely, as a bridge between the Virtual router and the protocol conversion module, the Virtual router and the protocol conversion module are in bidirectional communication by adopting VETH (Virtual Ethernet) pair technology, VETH is a pair of Virtual Ethernet devices, and a pair of VETH devices are connected together through a Virtual link. In addition, each preset port is configured with a unique media access control address. The network namespaces are, for example, linux network namespaces, which are exclusive namespaces, and the network configuration among different virtual environments is not interfered by each other by creating an independent network protocol stack for each process or container, so that the communication safety and flexible scheduling are ensured. The network protocol stack includes information such as IP addresses, routing tables, firewall rules, etc. The protocol conversion module is, for example, a NAT64 conversion module, and the NAT64 conversion module is generated according to NAT64 conversion rules by creating NAT64 conversion rules in a Linux network naming space and is used for realizing bidirectional conversion of IPv6/IPv4 protocol. As shown in fig. 2, the virtual machine communication system comprises a protocol conversion module, a preset port, a virtual router and a network naming space, and is used for realizing dual-stack communication between an in-cloud IPv4 virtual machine and an in-cloud IPv6 virtual machine. The virtual router and the first virtual machine are positioned in the same cloud platform, the preset port and the protocol conversion module are positioned in the same network naming space, and the virtual router and the preset port are connected through a virtual network.
The first virtual machine is, for example, an in-cloud IPv4 virtual machine or an in-cloud IPv6 virtual machine. The first virtual machine generates a first request message by using a corresponding protocol, forwards the first request message to the virtual router, for example, the first virtual machine is an in-cloud IPv6 virtual machine, the second virtual machine is an in-cloud IPv4 virtual machine, the first virtual machine accesses an IPv6 address containing the second virtual machine according to NAT64 rules, and the message is firstly forwarded to the OpenvSwitch virtual router.
The virtual router matches the first request message with the built-in static route under the condition that the virtual router receives the first request message of the first virtual machine, if the first request message is matched with the static route in the virtual router, the first request message is sent to a preset port according to a matching result, for example, the protocol type of the first request message is an IPv6 protocol, as shown in fig. 2, the virtual router matches the first request message with the IPv6 static route, and forwards the first request message to the OpenvSwitch internal port according to the matching result.
The preset port sends the first request message to the protocol conversion module according to the built-in address information, for example, if the protocol type of the first request message is IPv6, the OpenvSwitch internal port forwards the first request message to the NAT64 conversion module in the Linux network naming space according to the IPv6 address.
After the protocol conversion module receives the first request message, the protocol conversion module performs protocol conversion on the first request message according to the protocol conversion rule to obtain a second request message, for example, the protocol conversion module performs NAT64 conversion on the first request message according to the NAT64 conversion rule, and converts IPv6 network segments of the source address and the destination address into an IPv4 message, namely the second request message.
By adding static route on OpenvSwitch virtual router to forward message to be NAT64 converted to NAT64 conversion module, it can ensure quick forwarding and low delay of message, and avoid all messages being forwarded to NAT64 conversion module, reduce performance consumption of NAT64 conversion module, and use OpenvSwitch virtual router to replace physical three-layer gateway equipment, and reduce maintenance complexity and cost. The Linux network naming space is responsible for providing an independent network environment, isolating the network structure of an operating system, improving the safety of the NAT64 conversion module, and removing the dependence of the NAT64 conversion module on a host machine physical network card.
Step S102, under the condition that a second request message sent by a preset port is received, the second request message is sent to a second virtual machine, wherein the communication protocols of the first virtual machine and the second virtual machine are different, and the virtual router and the second virtual machine are located in the same cloud platform.
Specifically, the protocol conversion module converts the first request message into a second request message, then forwards the second request message to a preset port, and the preset port forwards the second request message to the virtual router, for example, the NAT64 conversion module converts the first request message of the IPv6 protocol into the second request message of the IPv4 protocol, then forwards the second request message to the OpenvSwitch internal port, and the OpenvSwitch internal port forwards the second request message to the virtual router.
The second virtual machine is, for example, an in-cloud IPv6 virtual machine or an in-cloud IPv4 virtual machine, and the communication protocols of the first virtual machine and the second virtual machine are different, namely, the first virtual machine is the in-cloud IPv6 virtual machine, the second virtual machine is the in-cloud IPv4 virtual machine, the first virtual machine is the in-cloud IPv4 virtual machine, and the second virtual machine is the in-cloud IPv6 virtual machine. Under the condition that the virtual router receives a second request message sent by a preset port, the second request message is matched with the built-in static route, if the second request message is matched with the static route in the virtual router, the second request message is sent to a second virtual machine according to a matching result, for example, the protocol type of the second request message is an IPv4 protocol, as shown in fig. 2, the virtual router and the second virtual machine are in the same cloud platform, the virtual router matches the second request message with the IPv4 static route, and the second request message is forwarded to the corresponding cloud IPv4 virtual machine, namely the second virtual machine according to the matching result.
According to the virtual machine communication method, the virtual router sends the first request message to the preset port, the first request message is sent to the protocol conversion module through the preset port, the protocol conversion module carries out protocol conversion on the first request message to obtain the second request message, and the second request message is sent to the second virtual machine through the virtual router. According to the method, a protocol conversion module is arranged in the network naming space, the conversion from the first request message to the second request message is realized by using the protocol conversion module, the dependence on physical equipment is removed, the requirement of opening the cloud-in-cloud-out network is reduced, and the communication flow is shortened. In addition, the preset port and the virtual router are used for replacing the physical three-layer network equipment, so that the requirement of public network addresses of the physical three-layer network equipment is reduced, and the flexibility is also increased for protocol conversion. The method solves the problems that inter-protocol communication between virtual machines excessively depends on physical equipment, the efficiency of adjusting the physical equipment is low, and the elastic expansion requirement of a cloud platform is difficult to meet.
In this embodiment, another virtual machine communication method applied to a virtual router is provided, and fig. 3 is a flowchart of another virtual machine communication method applied to a virtual router according to an embodiment of the present application, as shown in fig. 3, where the flowchart includes the following steps:
Step S301, under the condition that a first request message of a first virtual machine is received, the first request message is sent to a preset port, so that the preset port sends the first request message to a protocol conversion module, wherein the protocol conversion module is used for carrying out protocol conversion on the first request message to obtain a second request message, a virtual router and the first virtual machine are located in the same cloud platform, the preset port and the protocol conversion module are located in the same network naming space, and the virtual router and the preset port are connected through a virtual network.
Specifically, please refer to step S101 in the embodiment shown in fig. 1 for a specific implementation manner of this step, which is not described herein.
Step S302, under the condition that a second request message sent by a preset port is received, the second request message is sent to a second virtual machine, wherein the communication protocols of the first virtual machine and the second virtual machine are different, and the virtual router and the second virtual machine are located in the same cloud platform.
Specifically, please refer to step S102 in the embodiment shown in fig. 1 for a specific implementation manner of this step, which is not described herein.
Step S303, under the condition that a first reply message of the second virtual machine is received, the first reply message is matched with the routing table, and a first matching result is obtained.
Specifically, the second virtual machine is, for example, an in-cloud IPv6 virtual machine or an in-cloud IPv4 virtual machine, and the communication protocols of the first virtual machine and the second virtual machine are different, namely, the first virtual machine is the in-cloud IPv6 virtual machine, the second virtual machine is the in-cloud IPv4 virtual machine, the first virtual machine is the in-cloud IPv4 virtual machine, and the second virtual machine is the in-cloud IPv6 virtual machine.
And under the condition that the second virtual machine receives the second request message, analyzing the second request message to determine the request information of the first virtual machine, wherein the second virtual machine needs to reply whether the first virtual machine allows the first virtual machine to access the second virtual machine or not. The second virtual machine generates a first reply message, for example, if the second virtual machine is an IPv4 virtual machine in the cloud, the first reply message is generated according to an IPv4 protocol and the reply information, and if the second virtual machine is an IPv6 virtual machine in the cloud, the first reply message is generated according to an IPv6 protocol and the reply information. The second virtual machine sends the first reply message to the virtual router. And under the condition that the virtual router receives the first reply message of the second virtual machine, matching the first reply message with the built-in static route, and determining a first matching result if the first reply message is matched with the static route in the virtual router. For example, the protocol type of the first reply message is an IPv4 protocol, as shown in fig. 2, the virtual router matches the first reply message with the IPv4 static route, determines a first matching result, and may forward the first reply message to the OpenvSwitch internal port according to the first matching result.
Step S304, a first reply message is sent to a preset port according to a first matching result, so that the preset port sends the first reply message to a protocol conversion module, wherein the protocol conversion module is used for carrying out protocol conversion on the first reply message to obtain a second reply message.
Specifically, the virtual router sends a first reply message to the preset port according to the first matching result. The preset port sends the first request message to the protocol conversion module according to the built-in address information, for example, if the protocol type of the first reply message is IPv4, the OpenvSwitch internal port forwards the first reply message to the NAT64 conversion module in the Linux network naming space according to the IPv4 address.
After the protocol conversion module receives the first reply message, the protocol conversion is carried out on the first reply message according to the protocol conversion rule to obtain a second reply message, for example, the protocol conversion module carries out NAT64 conversion on the first reply message according to the NAT64 conversion rule to convert the IPv4 network segment of the source address and the destination address into an IPv6 message, namely the second reply message.
Step S305, in the case of receiving the second reply message sent by the preset port, matching the second reply message with the routing table to obtain a second matching result.
Step S306, according to the second matching result, the second reply message is sent to the first virtual machine.
Specifically, the protocol conversion module converts the first reply message into a second reply message, then forwards the second reply message to a preset port, and the preset port forwards the second reply message to the virtual router, for example, the NAT64 conversion module converts the first reply message of the IPv4 protocol into the second reply message of the IPv6 protocol, then forwards the second reply message to the OpenvSwitch internal port, and the OpenvSwitch internal port forwards the second reply message to the virtual router.
And under the condition that the virtual router receives a second reply message sent by the preset port, matching the second request message with the built-in static route, and if the second request message is matched with the static route in the virtual router, determining a second matching result, and sending the second request message to the first virtual machine by the virtual router according to the second matching result. For example, the protocol type of the second request message is an IPv6 protocol, as shown in fig. 2, the virtual router and the second virtual machine are located in the same cloud platform, the virtual router matches the second request message with the IPv6 static route, a second matching result is determined, and the virtual router forwards the second request message to the corresponding intra-cloud IPv6 virtual machine, that is, the first virtual machine according to the second matching result.
As an optional embodiment, the step S301 "sending the first request message to the preset port" includes steps S3011 to S3013.
Step S3011, determining whether the first request packet is a packet to be converted from a protocol. Step S3012, in the case that it is determined that the first request packet is a packet to be converted by the protocol, matching the first request packet with the routing table to obtain a third matching result. Step S3013, send the first request message to the preset port according to the third matching result.
The virtual router judges whether the first request message is a message to be protocol-converted or not under the condition that the first request message of the first virtual machine is received, for example, the five-tuple information of the message to be protocol-converted is recorded in the virtual router, the first request message is matched with the five-tuple information, if the matching is successful, the first request message is determined to be the message to be protocol-converted, in addition, the static route of the message to be protocol-converted can be recorded in the static route table, and if the first request message is successfully matched with the static routes, the first request message is determined to be the message to be protocol-converted.
And under the condition that the first request message is the message to be subjected to protocol conversion, matching the first request message with the built-in static route, and if the first request message is matched with the static route in the virtual router, determining a third matching result, for example, the protocol type of the first request message is an IPv6 protocol, the virtual router matches the first request message with the IPv6 static route to determine the third matching result, the protocol type of the first request message is an IPv4 protocol, and the virtual router matches the first request message with the IPv4 static route to determine the third matching result. And sending the first request message to a preset port according to the third matching result, for example, forwarding the first request message to the OpenvSwitch internal port according to the third matching result.
In this embodiment, the first request message is screened by the virtual router, only the message to be converted by the protocol is sent to the preset port, and the message is forwarded to the protocol conversion module by the preset port, so that the quick forwarding and low delay of the message can be ensured, all the messages are prevented from being forwarded to the protocol conversion module, the performance consumption of the protocol conversion module is reduced, and the complexity and cost requirement of maintenance are also reduced by using the virtual router to replace the physical three-layer gateway device.
As an alternative embodiment, step S3011 includes steps A1 to A4.
And A1, acquiring quintuple information of a first request message. And step A2, matching the quintuple information with preset information. And step A3, if the matching is successful, determining that the first request message is a message to be subjected to protocol conversion. And step A4, if the matching fails, determining that the first request message is not the message to be converted by the protocol.
Specifically, quintuple information of the first request message is obtained, wherein the quintuple information comprises a source IP address, a destination IP address, a port address, a protocol type and a virtual local area network identifier. In this embodiment, a traffic classification engine is built in the virtual router, and preset information is recorded in the traffic classification engine, where the preset information is quintuple information of a message to be protocol-converted specified by a user. Matching the quintuple information with preset information, and if the matching is successful, determining that the first request message is a message to be subjected to protocol conversion; if the matching fails, it is determined that the first request message is not a message to be protocol converted. In addition, the preset information can be prefix information of the message to be protocol-converted, which is specified by the user, for example, the user specifies 64:ff9b:96 as the NAT64 conversion prefix, and any message needs to be protocol-converted if the message uses 64:ff9b:96 as the prefix information.
According to the virtual machine communication method, the virtual router sends the first request message to the preset port, the first request message is sent to the protocol conversion module through the preset port, the protocol conversion module carries out protocol conversion on the first request message to obtain the second request message, and the second request message is sent to the second virtual machine through the virtual router. According to the method, a protocol conversion module is arranged in the network naming space, the conversion from the first request message to the second request message is realized by using the protocol conversion module, the dependence on physical equipment is removed, the requirement of opening the cloud-in-cloud-out network is reduced, and the communication flow is shortened. In addition, the preset port and the virtual router are used for replacing the physical three-layer network equipment, so that the requirement of public network addresses of the physical three-layer network equipment is reduced, and the flexibility is also increased for protocol conversion. The method solves the problems that inter-protocol communication between virtual machines excessively depends on physical equipment, the efficiency of adjusting the physical equipment is low, and the elastic expansion requirement of a cloud platform is difficult to meet.
According to an embodiment of the present application, there is provided an embodiment of a virtual machine communication method applied to a protocol conversion module, it should be noted that the steps illustrated in the flowchart of the drawings may be performed in a computer system such as a set of computer executable instructions, for example, a computer, a server, etc., and although a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be performed in an order different from that herein.
In this embodiment, a virtual machine communication method applied to a protocol conversion module is provided, and fig. 4 is a flowchart of a virtual machine communication method applied to a protocol conversion module according to an embodiment of the present application, as shown in fig. 4, the flowchart includes the following steps:
in step S401, under the condition that the first request message of the first virtual machine is received, performing protocol conversion on the first request message to obtain a second request message, where the first request message received by the protocol conversion module is sent by a preset port, the first request message received by the preset port is sent by a virtual router, the virtual router and the first virtual machine are in the same cloud platform, the preset port and the protocol conversion module are in the same network naming space, and the virtual router and the preset port are connected through a virtual network.
Specifically, the virtual router matches the first request message with the built-in static route under the condition that the first request message of the first virtual machine is received, if the first request message is matched with the static route in the virtual router, the first request message is sent to a preset port according to a matching result, for example, the protocol type of the first request message is an IPv6 protocol, as shown in fig. 2, the virtual router matches the first request message with the IPv6 static route, and forwards the first request message to the OpenvSwitch internal port according to the matching result. The preset port sends the first request message to the protocol conversion module according to the built-in address information, for example, if the protocol type of the first request message is IPv6, the OpenvSwitch internal port forwards the first request message to the NAT64 conversion module in the Linux network naming space according to the IPv6 address.
After the protocol conversion module receives the first request message, the protocol conversion module performs protocol conversion on the first request message according to the protocol conversion rule to obtain a second request message, for example, the protocol conversion module performs NAT64 conversion on the first request message according to the NAT64 conversion rule, and converts IPv6 network segments of the source address and the destination address into an IPv4 message, namely the second request message.
Step S402, a second request message is sent to a preset port, so that the preset port sends the second request message to a virtual router, wherein the virtual router is used for sending the second request message to a second virtual machine, communication protocols of the first virtual machine and the second virtual machine are different, and the virtual router and the second virtual machine are in the same cloud platform.
Specifically, the protocol conversion module converts the first request message into a second request message, then forwards the second request message to a preset port, and the preset port forwards the second request message to the virtual router, for example, the NAT64 conversion module converts the first request message of the IPv6 protocol into the second request message of the IPv4 protocol, then forwards the second request message to the OpenvSwitch internal port, and the OpenvSwitch internal port forwards the second request message to the virtual router.
The second virtual machine is, for example, an in-cloud IPv6 virtual machine or an in-cloud IPv4 virtual machine, and the communication protocols of the first virtual machine and the second virtual machine are different, namely, the first virtual machine is the in-cloud IPv6 virtual machine, the second virtual machine is the in-cloud IPv4 virtual machine, the first virtual machine is the in-cloud IPv4 virtual machine, and the second virtual machine is the in-cloud IPv6 virtual machine. And under the condition that the virtual router receives a second request message sent by the preset port, matching the second request message with the built-in static route, and if the second request message is matched with the static route in the virtual router, sending the second request message to the second virtual machine according to a matching result.
According to the virtual machine communication method, the protocol conversion module performs protocol conversion on the received first request message to obtain a second request message, and the second request message is sent to the second virtual machine through the preset port and the virtual router. The method comprises the steps of arranging a protocol conversion module in a network naming space, converting a first request message into a second request message by using the protocol conversion module, replacing physical three-layer network equipment by using a preset port and a virtual router, and removing the dependence on the physical equipment. The method solves the problems that inter-protocol communication between virtual machines excessively depends on physical equipment, the efficiency of adjusting the physical equipment is low, and the elastic expansion requirement of a cloud platform is difficult to meet.
In this embodiment, another virtual machine communication method applied to a protocol conversion module is provided, and fig. 5 is a flowchart of another virtual machine communication method applied to a protocol conversion module according to an embodiment of the present application, as shown in fig. 5, the flowchart includes the following steps:
In step S501, under the condition that a first request message of a first virtual machine is received, performing protocol conversion on the first request message to obtain a second request message, where the first request message received by the protocol conversion module is sent by a preset port, the first request message received by the preset port is sent by a virtual router, the virtual router and the first virtual machine are in the same cloud platform, the preset port and the protocol conversion module are in the same network naming space, and the virtual router and the preset port are connected through a virtual network.
Specifically, please refer to step S401 in the embodiment shown in fig. 4 for a specific implementation manner of this step, which is not described herein.
Step S502, a second request message is sent to a preset port, so that the preset port sends the second request message to a virtual router, wherein the virtual router is used for sending the second request message to a second virtual machine, communication protocols of the first virtual machine and the second virtual machine are different, and the virtual router and the second virtual machine are in the same cloud platform.
Specifically, please refer to step S401 in the embodiment shown in fig. 4 for a specific implementation manner of this step, which is not described herein.
In step S503, under the condition that the first reply message of the second virtual machine is received, performing protocol conversion on the first reply message to obtain a second reply message, where the first reply message received by the protocol conversion module is sent by a preset port, the first reply message received by the preset port is sent by the virtual router according to a first matching result, and the first matching result is obtained by matching the first reply message with the routing table by the virtual router.
Specifically, the virtual router matches the first reply message with the built-in static route under the condition that the first reply message of the second virtual machine is received, and if the first reply message is matched with the static route in the virtual router, a first matching result is determined. For example, the protocol type of the first reply message is an IPv4 protocol, as shown in fig. 2, the virtual router matches the first reply message with the IPv4 static route, determines a first matching result, and may forward the first reply message to the OpenvSwitch internal port according to the first matching result. And the virtual router sends the first reply message to the preset port according to the first matching result. The preset port sends the first request message to the protocol conversion module according to the built-in address information, for example, if the protocol type of the first reply message is IPv4, the OpenvSwitch internal port forwards the first reply message to the NAT64 conversion module in the Linux network naming space according to the IPv4 address.
After the protocol conversion module receives the first reply message, the protocol conversion is carried out on the first reply message according to the protocol conversion rule to obtain a second reply message, for example, the protocol conversion module carries out NAT64 conversion on the first reply message according to the NAT64 conversion rule to convert the IPv4 network segment of the source address and the destination address into an IPv6 message, namely the second reply message.
Step S504, the second reply message is sent to the preset port, so that the preset port sends the second reply message to the virtual router, wherein the virtual router is used for sending the second reply message to the first virtual machine according to a second matching result, and the second matching result is obtained by matching the second reply message with the routing table by the virtual router.
Specifically, the protocol conversion module converts the first reply message into a second reply message, then forwards the second reply message to a preset port, and the preset port forwards the second reply message to the virtual router, for example, the NAT64 conversion module converts the first reply message of the IPv4 protocol into the second reply message of the IPv6 protocol, then forwards the second reply message to the OpenvSwitch internal port, and the OpenvSwitch internal port forwards the second reply message to the virtual router.
And under the condition that the virtual router receives a second reply message sent by the preset port, matching the second request message with the built-in static route, and if the second request message is matched with the static route in the virtual router, determining a second matching result, and sending the second request message to the first virtual machine by the virtual router according to the second matching result.
According to the virtual machine communication method, the protocol conversion module performs protocol conversion on the received first request message to obtain a second request message, and the second request message is sent to the second virtual machine through the preset port and the virtual router. The method comprises the steps of arranging a protocol conversion module in a network naming space, converting a first request message into a second request message by using the protocol conversion module, replacing physical three-layer network equipment by using a preset port and a virtual router, and removing the dependence on the physical equipment. The method solves the problems that inter-protocol communication between virtual machines excessively depends on physical equipment, the efficiency of adjusting the physical equipment is low, and the elastic expansion requirement of a cloud platform is difficult to meet.
As an optional embodiment, the step S401 "performing protocol conversion on the first request message to obtain the second request message" includes step B1 and step B2.
And step B1, the protocol conversion module receives the first request message and detects the IP address format of the first request message.
Specifically, the protocol conversion module determines whether the source address of the first request packet is an IP address of the first virtual machine, determines whether the destination address of the first request packet is an IP address of another virtual machine in the cloud platform, and the protocol type of the other virtual machine needs to be different from that of the first virtual machine. If the above is satisfied, it is determined that protocol conversion is required for the first request message.
And B2, if the protocol conversion module determines that the protocol conversion needs to be carried out on the first request message and the first request message is an IPv6 protocol message, converting the first request message from the IPv6 protocol message to an IPv4 protocol message, namely a second request message, and sending the second request message to a preset port.
Specifically, in this embodiment, there are two modes of converting an IPv6 protocol packet into an IPv4 protocol packet, namely, stateful IPv4 and IPv6 conversion, and stateless IPv4 and IPv6 conversion.
The stateful IPv4 and IPv6 conversion comprises setting an IPv4 address pool in a protocol conversion module, randomly selecting an IPv4 address from the IPv4 address pool as a corresponding address of the IPv6 address when converting the IPv6 address into the IPv4 address, storing the mapping relation in the protocol conversion module, replacing the IPv6 address in the first request message with the corresponding IPv4 address, thereby converting the IPv6 address into the IPv4 address, searching the IPv6 address corresponding to the IPv4 address from the mapping relation when converting the IPv4 address into the corresponding IPv6 address, and replacing the IPv4 address in the first request message with the corresponding IPv6 address, thereby converting the IPv4 address into the IPv6 address.
Stateless IPv4 and IPv6 translation includes not requiring a mapping relationship to be stored in the protocol translation module. In order to realize the intercommunication between the IPv4 protocol and the IPv6 protocol, an IPv4 address is embedded into an IPv6 address, and the IPv4 address can be converted into the IPv6 address only by adding a specific IPv6 prefix to the IPv4 address, for example, the IPv4 address is d.d.d, the IPv6 prefix is X.X.X.D, the IPv4 address is subjected to protocol conversion, and the converted IPv6 address is X.X.X.d.d, and at the moment, the IPv6 address is converted back to the IPv4 address only by removing the specific prefix X.X.X.X.D. Therefore, the preset format is "X.X.X: d.d." and the specific prefix is "X.X.X:", if the source address and the destination address of the first request message conform to the preset format, the specific prefix in the source address and the destination address of the first request message is removed, so as to generate the message source address and the message destination address of the IPv4 data access request packet.
In this embodiment, the network protocol conversion is implemented by a software method, and no physical device is used, so that the cost of the network protocol conversion is reduced. The whole system is brought into cloud platform management, the advantages of the cloud platform are fully utilized, and the system is convenient to manage and high in reliability.
The embodiment provides a virtual machine communication system, as shown in fig. 2, which comprises a virtual router, a preset port and a protocol conversion module, wherein the virtual router is positioned in the same cloud platform as a first virtual machine and a second virtual machine, communication protocols of the first virtual machine and the second virtual machine are different, the virtual router is connected with the preset port through a virtual network and is used for sending a first request message to the preset port when receiving the first request message of the first virtual machine, the preset port is positioned in the same network naming space as the protocol conversion module and is used for sending the first request message to the protocol conversion module, the protocol conversion module is used for carrying out protocol conversion on the first request message to obtain a second request message and sending the second request message to the preset port, the preset port is used for sending the second request message to the virtual router, and the virtual router is used for sending the second request message to the second virtual machine when receiving the second request message sent by the preset port.
Specifically, as shown in fig. 2, the virtual machine communication system comprises a protocol conversion module, a preset port, a virtual router and a network naming space, and is used for realizing dual-stack communication between an in-cloud IPv4 virtual machine and an in-cloud IPv6 virtual machine. The virtual router and the first virtual machine are located in the same cloud platform, and the preset port and the protocol conversion module are located in the same network naming space. The virtual router is connected with the preset port through a virtual network, for example, as shown in fig. 2, a virtual network connection relationship between the preset port and the virtual router is realized through a network bridge, a first tunnel network card and a second tunnel network card.
Virtual routers, for example, openvSwitch virtual routers created in a cloud platform in combination with virtual switch technology and open virtual networks. OpenvSwitch virtual routers support a hybrid configuration of dynamic routing protocols and static routing. The router is internally provided with a flow classification engine, and the five-tuple (source IP address, destination IP address, port, protocol and virtual local area network identifier) is matched with the message needing protocol conversion, so that the performance loss caused by full flow scanning is avoided. The preset port is, for example, a OpenvSwitch internal port created according to virtual switch technology in Linux network namespaces. OpenvSwitch internal ports, which are bridges of the virtual router and the protocol conversion module, and the virtual router and the protocol conversion module are in bidirectional communication by adopting a virtual Ethernet pair technology, VETH is a pair of virtual Ethernet devices, and the pair of virtual Ethernet devices are connected together through a virtual link. In addition, each preset port is configured with a unique media access control address. The network namespaces are, for example, linux network namespaces, which are exclusive namespaces, and the network configuration among different virtual environments is not interfered by each other by creating an independent network protocol stack for each process or container, so that the communication safety and flexible scheduling are ensured. The network protocol stack includes information such as IP addresses, routing tables, firewall rules, etc. Protocol conversion modules such as:
And the NAT64 conversion module is used for realizing bidirectional conversion of the IPv6/IPv4 protocol by creating NAT64 conversion rules in the Linux network naming space and generating according to the NAT64 conversion rules.
The first virtual machine is, for example, an in-cloud IPv4 virtual machine or an in-cloud IPv6 virtual machine, and the communication protocols of the first virtual machine and the second virtual machine are different, namely, the first virtual machine is the in-cloud IPv6 virtual machine, the second virtual machine is the in-cloud IPv4 virtual machine, the first virtual machine is the in-cloud IPv4 virtual machine, and the second virtual machine is the in-cloud IPv6 virtual machine.
The first virtual machine generates a first request message by using a corresponding protocol, and forwards the first request message to the virtual router. The virtual router matches the first request message with the built-in static route under the condition that the virtual router receives the first request message of the first virtual machine, if the first request message is matched with the static route in the virtual router, the first request message is sent to a preset port according to a matching result, for example, the protocol type of the first request message is an IPv6 protocol, as shown in fig. 2, the virtual router matches the first request message with the IPv6 static route, and forwards the first request message to the OpenvSwitch internal port according to the matching result. The preset port sends the first request message to the protocol conversion module according to the built-in address information, for example, if the protocol type of the first request message is IPv6, the OpenvSwitch internal port forwards the first request message to the NAT64 conversion module in the Linux network naming space according to the IPv6 address. After the protocol conversion module receives the first request message, the protocol conversion module performs protocol conversion on the first request message according to the protocol conversion rule to obtain a second request message, for example, the protocol conversion module performs NAT64 conversion on the first request message according to the NAT64 conversion rule, and converts IPv6 network segments of the source address and the destination address into an IPv4 message, namely the second request message.
The protocol conversion module converts the first request message into a second request message, then forwards the second request message to a preset port, and the preset port forwards the second request message to the virtual router, for example, the NAT64 conversion module converts the first request message of the IPv6 protocol into the second request message of the IPv4 protocol, then forwards the second request message to the OpenvSwitch internal port, and the OpenvSwitch internal port forwards the second request message to the virtual router. Under the condition that the virtual router receives a second request message sent by a preset port, the second request message is matched with the built-in static route, if the second request message is matched with the static route in the virtual router, the second request message is sent to a second virtual machine according to a matching result, for example, the protocol type of the second request message is an IPv4 protocol, as shown in fig. 2, the virtual router and the second virtual machine are in the same cloud platform, the virtual router matches the second request message with the IPv4 static route, and the second request message is forwarded to the corresponding cloud IPv4 virtual machine, namely the second virtual machine according to the matching result.
According to the virtual router of the virtual machine communication system, a first request message is sent to a preset port, the first request message is sent to a protocol conversion module through the preset port, the protocol conversion module carries out protocol conversion on the first request message to obtain a second request message, and the second request message is sent to a second virtual machine through the virtual router. According to the method, a protocol conversion module is arranged in the network naming space, the conversion from the first request message to the second request message is realized by using the protocol conversion module, the dependence on physical equipment is removed, the requirement of opening the cloud-in-cloud-out network is reduced, and the communication flow is shortened. In addition, the preset port and the virtual router are used for replacing the physical three-layer network equipment, so that the requirement of public network addresses of the physical three-layer network equipment is reduced, and the flexibility is also increased for protocol conversion. The method solves the problems that inter-protocol communication between virtual machines excessively depends on physical equipment, the efficiency of adjusting the physical equipment is low, and the elastic expansion requirement of a cloud platform is difficult to meet.
As an alternative embodiment, the system further comprises a configuration interface module and a deployment module;
the configuration interface module is used for providing a configuration interface, the configuration interface is used for acquiring user configuration information, the deployment module is used for acquiring a first network protocol, a second network protocol and prefix information of the first network protocol in the user configuration information, creating a virtual router, adding the first network protocol and the second network protocol into the virtual router, creating a static route of the virtual router according to the prefix information, the deployment module is also used for acquiring a target cloud platform node in the user configuration information, creating a network naming space on the target cloud platform node, the deployment module is also used for creating a preset port in the target cloud platform node, adding the preset port into the network naming space, configuring the preset port according to the first network protocol and the second network protocol, and the deployment module is also used for acquiring a preset protocol conversion rule in the user configuration information and creating a protocol conversion module in the network naming space according to the preset protocol conversion rule.
The virtual machine communication system further comprises a configuration interface module and a deployment module. This embodiment will be described with reference to fig. 6.
The configuration interface module is configured to provide a configuration interface for a user, where the configuration interface is, for example, a cloud platform page, and the cloud platform page is a visual page, as shown in fig. 6, the user may select any cloud platform node in the cloud platform page as a target cloud platform node, and the target cloud platform node is used as a gateway node, where the gateway node is used to perform NAT64 conversion. A user may create a protocol translation resource, such as NAT64 translation resource, containing an IPv6 prefix, an IPv4 address pool, and an IPv6/IPv4 network to be opened, on a cloud platform page. The configuration interface module configuration interface obtains user configuration information, including the target cloud platform node selected by the user for NAT64 translation and NAT64 translation resources. Configuration interface module the configuration interface generates a user request containing user configuration information and sends the user request to the deployment module.
After receiving the user request, the deployment module acquires user configuration information in the user request, and acquires a first network protocol, a second network protocol and prefix information of the first network protocol in the user configuration information, wherein the first network protocol is, for example, an IPv6 protocol, the second network protocol is, for example, an IPv4 protocol, and the prefix information of the first network protocol is, for example, prefix information of an IPv6 protocol, and the prefix information is the prefix information of a message to be converted, which is designated by a user. The prefix information of the first network protocol, for example, is that the user designates 64:ff9b:96 as the prefix information of the message needing NAT64 conversion, and any first network protocol message needs to be subjected to protocol conversion if the prefix information is 64:ff9b:96.
The deployment module creates a virtual router, such as OpenvSwitch virtual routers, in the cloud platform. The first network protocol and the second network protocol are added into the virtual router, so that the IPv6/IPv4 network needing to be opened is added into the virtual router. Static routes for the virtual router are created from the prefix information of the first network protocol, e.g., as shown in fig. 6, corresponding static routes are created from IPv6 prefixes.
The deployment module acquires a target cloud platform node from the user configuration information, the target cloud platform node selects a gateway node serving as NAT64 conversion for the user, and a network naming space, such as a Linux network naming space, is created on the designated gateway node. The deployment module creates a preset port, such as OpenvSwitch internal ports, on the target cloud platform node. The lightweight protocol stack is deployed in the naming space, and only an IPv4/IPv6 core module (net.ipv4.conf.all.rp_filter=0, net.ipv6.conf.all.disable_ipv6=0) is loaded, so as to reduce system resource occupation, where the IPv4 core module is used for setting a reverse path filtering function, for example, net.ipv4.conf.all.rp_filter=0, the reverse path filtering function is used for preventing IP spoofing attacks (such as forging data packets of a source address), net indicates that this is a network related parameter, IPv4 indicates that this is a configuration of the IPv4 protocol, conf is an abbreviation of "configuration" (configuration) and indicates that this setting is applicable to all network interfaces in the system, and all indicates that the reverse path filtering is REVERSE PATH FILTER (reverse path filtering) is disabled. The reverse path filtering principle is that when a packet is received, the core will check the source IP address of the packet and then see which route it will go when returning the source address from the host. A packet that might otherwise be considered a fake source address is discarded if the egress interface of the return path coincides with the interface that receives the packet. The IPv6 core module is, for example, net.ipv6.conf.all.disable_ipv 6=0, and is used for controlling whether the IPv6 protocol stack is enabled or not. If the value is set to 1, the IPv6 protocol support on the appointed interface is forbidden, if the value is set to 0, the IPv6 protocol is allowed to be used, wherein IPv6 indicates that the value is the configuration of the IPv6 protocol, disable_IPv6 indicates whether the IPv6 protocol is forbidden, and disable_IPv 6=0 indicates that the IPv6 protocol is not forbidden.
The preset port is added to the network namespace. The preset port is configured according to the first network protocol and the second network protocol, for example, as shown in fig. 6, the first network protocol is an IPv6 protocol, the second network protocol is an IPv4 protocol, an IPv6 address of the preset port is determined according to the IPv6 protocol, an IPv4 address of the preset port is determined according to the IPv4 protocol, and the IPv6 address and the IPv4 address are configured for the preset port.
The deployment module obtains preset protocol conversion rules, such as NAT64 conversion rules, from the user configuration information. A protocol translation module is created in the network namespace according to preset protocol translation rules, for example, a NAT64 translation module is created in the Linux network namespace, and corresponding rules for IPv6 and IPv4 translations are configured for the protocol translation module according to the NAT64 translation rules.
In this embodiment, the NAT64 translation rule is placed in the Linux network namespace, a protocol translation module is generated, and the connection relationship between the protocol translation module and the virtual machine is directly opened through the preset port and the virtual router, so that the NAT64 translation service does not rely on the static forwarding and the physical host network card of the three-layer physical network device any more, and the dependence on the physical device is removed.
The embodiment also provides a virtual machine communication device, which is used for implementing the above embodiment and the preferred implementation, and is not described in detail. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
The embodiment provides a virtual machine communication device deployed in a virtual router, as shown in fig. 7, which comprises a first message sending unit 701, a second message sending unit 702, and a second message sending unit 702, wherein the first message sending unit 701 is configured to send a first request message to a preset port under the condition of receiving the first request message of the first virtual machine, so that the preset port sends the first request message to a protocol conversion module, the protocol conversion module is configured to perform protocol conversion on the first request message to obtain a second request message, the virtual router and the first virtual machine are in the same cloud platform, the preset port and the protocol conversion module are in the same network naming space, the virtual router and the preset port are connected through a virtual network, and the second message sending unit 702 is configured to send the second request message to the second virtual machine under the condition of receiving the second request message sent by the preset port, wherein communication protocols of the first virtual machine and the second virtual machine are different, and the virtual router and the second virtual machine are in the same cloud platform.
The embodiment provides a virtual machine communication device deployed in a protocol conversion module, as shown in fig. 8, which comprises a protocol conversion unit 801, a third message sending unit 802, and a third message sending unit 802, wherein the protocol conversion unit is configured to, when receiving a first request message of a first virtual machine, perform protocol conversion on the first request message to obtain a second request message, the first request message received by the protocol conversion module is sent by a preset port, the first request message received by the preset port is sent by a virtual router, the virtual router and the first virtual machine are in the same cloud platform, the preset port and the protocol conversion module are in the same network namespace, the virtual router and the preset port are connected through a virtual network, and the third message sending unit 802 is configured to send the second request message to the preset port, so that the preset port sends the second request message to the virtual router, wherein the virtual router is configured to send the second request message to the second virtual machine, the communication protocols of the first virtual machine and the second virtual machine are different, and the virtual router and the second virtual machine are in the same cloud platform.
Further functional descriptions of the above respective modules are the same as those of the above corresponding embodiments, and are not repeated here.
The virtual machine communication apparatus in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application SPECIFIC INTEGRATED Circuit) Circuit, a processor and a memory that execute one or more software or firmware programs, and/or other devices that can provide the above functions.
The embodiment of the application also provides computer equipment, which is provided with the virtual machine communication device shown in the figures 7 and 8.
Referring to fig. 9, fig. 9 is a schematic structural diagram of a computer device according to an alternative embodiment of the present application, and as shown in fig. 9, the computer device includes one or more processors 10, a memory 20, and interfaces for connecting components, including a high-speed interface and a low-speed interface. The various components are communicatively coupled to each other using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions executing within the computer device, including instructions stored in or on memory to display graphical information of the GUI on an external input/output device, such as a display device coupled to the interface. In some alternative embodiments, multiple processors and/or multiple buses may be used, if desired, along with multiple memories and multiple memories. Also, multiple computer devices may be connected, each providing a portion of the necessary operations (e.g., as a server array, a set of blade servers, or a multiprocessor system). One processor 10 is illustrated in fig. 9.
The processor 10 may be a central processor, a network processor, or a combination thereof. The processor 10 may further comprise, among other things, an integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general-purpose array logic, or any combination thereof.
Wherein the memory 20 stores instructions executable by the at least one processor 10 to cause the at least one processor 10 to perform a method for implementing the embodiments described above.
The memory 20 may include a storage program area that may store an operating system, application programs required for at least one function, and a storage data area that may store data created according to the use of the computer device, etc. In addition, the memory 20 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, memory 20 may optionally include memory located remotely from processor 10, which may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The memory 20 may comprise volatile memory, such as random access memory, or nonvolatile memory, such as flash memory, hard disk or solid state disk, or the memory 20 may comprise a combination of the above types of memory.
The computer device also includes a communication interface 30 for the computer device to communicate with other devices or communication networks.
The embodiments of the present application also provide a computer readable storage medium, and the method according to the embodiments of the present application described above may be implemented in hardware, firmware, or as a computer code which may be recorded on a storage medium, or as original stored in a remote storage medium or a non-transitory machine readable storage medium downloaded through a network and to be stored in a local storage medium, so that the method described herein may be stored on such software process on a storage medium using a general purpose computer, a special purpose processor, or programmable or special purpose hardware. The storage medium may be a magnetic disk, an optical disk, a read-only memory, a random-access memory, a flash memory, a hard disk, a solid state disk, or the like, and further, the storage medium may further include a combination of the above types of memories. It will be appreciated that a computer, processor, microprocessor controller or programmable hardware includes a storage element that can store or receive software or computer code that, when accessed and executed by the computer, processor or hardware, implements the methods illustrated by the above embodiments.
Portions of the present application may be implemented as a computer program product, such as computer program instructions, which when executed by a computer, may invoke or provide methods and/or aspects in accordance with the present application by way of operation of the computer. Those skilled in the art will appreciate that the existence of computer program instructions in a computer-readable medium includes, but is not limited to, source files, executable files, installation package files, and the like, and accordingly, the manner in which computer program instructions are executed by a computer includes, but is not limited to, the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled programs, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed programs. Herein, a computer-readable medium may be any available computer-readable storage medium or communication medium that can be accessed by a computer.
Although the embodiments of the present application have been described with reference to the accompanying drawings, various modifications and variations may be made by those skilled in the art without departing from the spirit and scope of the application, and such modifications and variations fall within the scope of the application as defined by the claims.

Claims (10)

1. A virtual machine communication method, wherein the method is applied to a virtual router, the method comprising:
Under the condition that a first request message of a first virtual machine is received, the first request message is sent to a preset port, so that the preset port sends the first request message to a protocol conversion module, wherein the protocol conversion module is used for carrying out protocol conversion on the first request message to obtain a second request message, the virtual router and the first virtual machine are located in the same cloud platform, the preset port and the protocol conversion module are located in the same network naming space, and the virtual router and the preset port are connected through a virtual network;
and under the condition that the second request message sent by the preset port is received, the second request message is sent to a second virtual machine, wherein the communication protocols of the first virtual machine and the second virtual machine are different, and the virtual router and the second virtual machine are in the same cloud platform.
2. The method of claim 1, wherein after the sending the second request message to the second virtual machine, the method further comprises:
under the condition that a first reply message of the second virtual machine is received, matching the first reply message with a routing table to obtain a first matching result;
the first reply message is sent to the preset port according to the first matching result, so that the preset port sends the first reply message to the protocol conversion module, wherein the protocol conversion module is used for carrying out protocol conversion on the first reply message to obtain a second reply message;
Under the condition that the second reply message sent by the preset port is received, matching the second reply message with the routing table to obtain a second matching result;
And sending the second reply message to the first virtual machine according to the second matching result.
3. The method of claim 1, wherein the sending the first request message to a preset port comprises:
judging whether the first request message is a message to be subjected to protocol conversion or not;
under the condition that the first request message is determined to be a message to be subjected to protocol conversion, matching the first request message with a routing table to obtain a third matching result;
and sending the first request message to the preset port according to the third matching result.
4. The method of claim 3, wherein the determining whether the first request message is a message to be protocol converted comprises:
Acquiring quintuple information of the first request message;
matching the quintuple information with preset information;
if the matching is successful, determining that the first request message is a message to be subjected to protocol conversion;
if the matching fails, determining that the first request message is not a message to be converted by the protocol.
5. A virtual machine communication method, wherein the method is applied to a protocol conversion module, the method comprising:
under the condition that a first request message of a first virtual machine is received, carrying out protocol conversion on the first request message to obtain a second request message, wherein the first request message received by a protocol conversion module is sent by a preset port, the first request message received by the preset port is sent by a virtual router, the virtual router and the first virtual machine are in the same cloud platform, the preset port and the protocol conversion module are in the same network naming space, and the virtual router and the preset port are connected through a virtual network;
And sending the second request message to the preset port, so that the preset port sends the second request message to the virtual router, wherein the virtual router is used for sending the second request message to a second virtual machine, communication protocols of the first virtual machine and the second virtual machine are different, and the virtual router and the second virtual machine are in the same cloud platform.
6. The method of claim 5, wherein the method further comprises:
under the condition that a first reply message of the second virtual machine is received, carrying out protocol conversion on the first reply message to obtain a second reply message, wherein the first reply message received by the protocol conversion module is sent by the preset port, the first reply message received by the preset port is sent by the virtual router according to a first matching result, and the first matching result is obtained by matching the first reply message with a routing table by the virtual router;
and sending the second reply message to the preset port, so that the preset port sends the second reply message to the virtual router, wherein the virtual router is used for sending the second reply message to the first virtual machine according to a second matching result, and the second matching result is obtained by matching the second reply message with the routing table by the virtual router.
7. The virtual machine communication system is characterized by comprising a virtual router, a preset port and a protocol conversion module;
the virtual router, the first virtual machine and the second virtual machine are positioned in the same cloud platform, and the communication protocols of the first virtual machine and the second virtual machine are different;
The virtual router is connected with the preset port through a virtual network and is used for sending a first request message of a first virtual machine to the preset port under the condition that the first request message is received;
The preset port and the protocol conversion module are in the same network naming space and are used for sending the first request message to the protocol conversion module;
The protocol conversion module is used for carrying out protocol conversion on the first request message to obtain a second request message, and sending the second request message to the preset port;
the preset port is configured to send the second request packet to the virtual router;
the virtual router is configured to send the second request packet to the second virtual machine when receiving the second request packet sent by the preset port.
8. The system of claim 7, further comprising a configuration interface module and a deployment module;
The configuration interface module is used for providing a configuration interface, and the configuration interface is used for acquiring user configuration information;
The deployment module is used for acquiring a first network protocol, a second network protocol and prefix information of the first network protocol from the user configuration information, creating the virtual router, adding the first network protocol and the second network protocol into the virtual router, and creating a static route of the virtual router according to the prefix information;
The deployment module is further configured to obtain a target cloud platform node from the user configuration information, and create the network namespace on the target cloud platform node;
The deployment module is further configured to create the preset port on the target cloud platform node, add the preset port to the network namespace, and configure the preset port according to the first network protocol and the second network protocol;
The deployment module is further configured to obtain a preset protocol conversion rule from the user configuration information, and create the protocol conversion module in the network namespace according to the preset protocol conversion rule.
9. A computer device, comprising:
A memory and a processor, the memory and the processor being communicatively coupled to each other, the memory having stored therein computer instructions, the processor executing the computer instructions to perform the virtual machine communication method of any of claims 1 to 6.
10. A computer-readable storage medium having stored thereon computer instructions for causing a computer to perform the virtual machine communication method of any one of claims 1 to 6.
CN202511071561.5A 2025-07-31 2025-07-31 Virtual machine communication methods, systems, computer equipment and storage media Pending CN120935105A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202511071561.5A CN120935105A (en) 2025-07-31 2025-07-31 Virtual machine communication methods, systems, computer equipment and storage media

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202511071561.5A CN120935105A (en) 2025-07-31 2025-07-31 Virtual machine communication methods, systems, computer equipment and storage media

Publications (1)

Publication Number Publication Date
CN120935105A true CN120935105A (en) 2025-11-11

Family

ID=97597873

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202511071561.5A Pending CN120935105A (en) 2025-07-31 2025-07-31 Virtual machine communication methods, systems, computer equipment and storage media

Country Status (1)

Country Link
CN (1) CN120935105A (en)

Similar Documents

Publication Publication Date Title
CN112470436B (en) Systems, methods, and computer-readable media for providing multi-cloud connectivity
CN112787921B (en) Message transmission method, agent node and storage medium
CN112787931B (en) Message transmission method, proxy node and storage medium
US10541836B2 (en) Virtual gateways and implicit routing in distributed overlay virtual environments
US20090063706A1 (en) Combined Layer 2 Virtual MAC Address with Layer 3 IP Address Routing
WO2020060826A1 (en) Segment routing with fast reroute for container networking
US12028311B2 (en) Methods and systems for efficient virtualization of inline transparent computer networking devices
CN106686085A (en) A load balancing method, device and system
CN116132542A (en) Container network management method, container network plug-in and related equipment
WO2019209516A1 (en) Seamless network characteristics for hardware isolated virtualized environments
EP4418634A1 (en) Packet processing method, apparatus and device
CN116112435A (en) Message transmission method, device, equipment and storage medium
CN120935105A (en) Virtual machine communication methods, systems, computer equipment and storage media
CN117792985A (en) Data communication method, device, data processor and computer storage medium
CN113918326B (en) Method and device for processing request
US20130151679A1 (en) Hybrid virtual computing environments
US20250007752A1 (en) Edge platform management device, operating method of edge platform management device, and edge gateway device
CN118018548A (en) Method and system for isolating CDN gateway based on IPVLAN network
CN116457756A (en) Method and system for efficient virtualization of inline transparent computer network devices

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