System and method for realizing communication between virtual machine and public network

Network address translation processing is performed through the virtual switch, which solves the problem of the limited number of SNAT/DNAT entries of the hardware gateway, and achieves performance improvement and cost reduction in supporting more virtual machines to communicate with the public network under limited hardware resources.

CN116170406BActive Publication Date: 2024-10-11ALIBABA CLOUD COMPUTING CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202310120457.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-18
Publication Date
2024-10-11
Estimated Expiration
2043-01-18

AI Technical Summary

Technical Problem

When existing technology supports large-scale virtual machines communicating with the public network, the number of SNAT/DNAT entries of the hardware gateway is limited by hardware resources, resulting in performance bottlenecks, which is particularly difficult to meet demand in massive traffic and high-bandwidth scenarios.

Method used

Perform network address translation processing through virtual switches to reduce the burden on hardware gateways and remove SNAT/DNAT entries, thereby supporting more virtual machines to communicate with the public network under limited hardware resources and reducing service costs.

Benefits of technology

It effectively improves the performance of communication between virtual machines and the public network, supports larger-scale virtual machine communication, and reduces the consumption of hardware resources and service costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116170406B_ABST
    Figure CN116170406B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a system and method for realizing communication between a virtual machine and a public network. The system includes: a public network gateway, which is used to realize the interconnection between the private network to which the virtual machine belongs and the public network; and a virtual switch, which is used to forward messages between the virtual machine and the public network gateway. Among them, the virtual switch is configured to perform network address translation processing on the messages transmitted between the virtual machine and the public network gateway, and the network address translation processing includes the conversion processing between the private network IP address of the virtual machine and the public network IP address of the virtual machine. Therefore, the present disclosure can better support large-scale virtual machine and public network communication by using a virtual switch to perform network address translation processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of virtual machine communication, and in particular to a system for realizing communication between a virtual machine and a public network. Background Art

[0002] Cloud servers are virtual server services provided by cloud service providers to users on the cloud. For example, ECS (Elastic Compute Service) cloud servers can realize elastically scalable IaaS (Infrastructure as a Service), eliminating the need for users to purchase IT hardware and enabling ready-to-use and elastic scaling of computing resources.

[0003] Usually, cloud service providers can run multiple VMs (Virtual Machines) on a physical server. Each VM has an independent IP address, but it is generally a private IP address and cannot be used to communicate with the public network (Internet). Therefore, NAT (Network Address Translation) processing is required on the IGW (Internet Gateway) used for public network communication. That is, conversion is performed between the private IP address of the VM and the corresponding public IP address, so as to realize communication between the virtual machine and the public network.

[0004] However, with the development of cloud server technology, an IGW usually needs to support public network communications for a large number of VMs, which means that an IGW usually needs to store a large number of SNAT / DNAT entries for VMIP, where SNAT (Source Network Address Translation) refers to source network address translation and DNAT (Destination Network Address Translation) refers to destination network address translation.

[0005] An excessively large number of entries may affect the performance of the IGW.

[0006] In particular, with the development of cloud network technology, the requirements for the processing power of IGW forwarding are getting higher and higher. The processing power of software is limited by the CPU and is increasingly unable to meet the message processing requirements, especially in scenarios with massive traffic and single-stream large bandwidth. For this reason, it is proposed to use a hardware gateway as an IGW. Hardware gateways can usually offload the parsing and processing of messages to hardware, making full use of the high performance of hardware to achieve network acceleration and large-scale traffic processing. However, when the message parsing and processing part of the IGW is implemented by hardware, the number of SNAT / DNAT entries is also limited by hardware resources.

[0007] Therefore, it is hoped that the system for communicating between VM and the public network can be improved to better support large-scale VMs. Summary of the invention

[0008] A technical problem to be solved by the present disclosure is to provide a system for realizing communication between a virtual machine (VM) and a public network, which can better support large-scale communication between VM and the public network.

[0009] According to a first aspect of the present disclosure, a system for realizing communication between a virtual machine and a public network is provided, comprising: a public network gateway, for realizing interconnection between a private network to which the virtual machine belongs and the public network; and a virtual switch, for forwarding messages between the virtual machine and the public network gateway; wherein the virtual switch is configured to perform network address translation processing on messages transmitted between the virtual machine and the public network gateway, the network address translation processing comprising conversion processing between a private network IP address of the virtual machine and a public network IP address of the virtual machine.

[0010] Optionally, the network address translation process includes a source network address translation process and a destination network address translation process, wherein the source network address translation process converts the source network address information in the message from the private network IP address of the virtual machine to the public network IP address, and the destination network address translation process converts the destination IP address information in the message from the public network IP address of the virtual machine to the private network IP address. The virtual switch is configured to: when it is confirmed that the message received from the virtual machine is a message flowing to the public network, execute the source network address translation process and then forward it to the public network gateway; when it is confirmed that the message received from the public network gateway is a message flowing from the public network to the virtual machine, execute the destination network address translation process and then forward it to the virtual machine.

[0011] Optionally, a tag field is provided in the message forwarded between the virtual switch and the public network gateway, and the tag field is set to a value indicating that the virtual switch performs network address translation processing. When the public network gateway parses to the tag field, it skips the network address translation processing, and when the virtual switch parses to the tag field, it performs network address translation processing.

[0012] Optionally, the virtual switch communicates with the public network gateway via a tunnel protocol, and the tag field is set in a header added to the message according to the tunnel protocol.

[0013] Optionally, the tunnel protocol is a VXLAN (Virtual eXtensible Local Area Network) protocol, and the tag field is at least a part of a reserved field in a VXLAN header.

[0014] Optionally, the virtual switch is configured to confirm the type of the public IP address of the virtual machine before performing the network address translation process, and perform the network address translation process only when the type of the public IP address is a specified type.

[0015] Optionally, the specified type includes a type in which one public IP address supports only one virtual machine.

[0016] Optionally, the public network gateway includes hardware for parsing and processing messages; and / or one of the public network gateways is responsible for communication between multiple virtual switches and the public network; and / or one of the virtual switches is responsible for communication between multiple virtual machines and the public network gateway.

[0017] According to a second aspect of the present disclosure, a method for implementing communication between a virtual machine and a public network is provided, comprising:

[0018] In the case where the virtual machine accesses the public network: the virtual switch receives a first message sent by the virtual machine to the public network, wherein the source network address information contained in the first message is the private network IP address of the virtual machine; the virtual switch performs source network address conversion processing on the first message and forwards it to the public network gateway, wherein the source network address conversion processing converts the source network address information in the first message into the public network IP address of the virtual machine; the public network gateway communicates with the public network according to the information in the first message;

[0019] And / or, in the case of accessing the virtual machine from the public network: the public network gateway receives a second message sent from the public network to the virtual machine, and forwards the second message to the virtual switch, wherein the destination IP address information in the second message is the public IP address of the virtual machine; the virtual switch performs destination network address conversion processing on the second message and forwards it to the virtual machine, wherein the destination network address conversion processing converts the destination IP address information in the second message into the private IP address of the virtual machine.

[0020] Optionally, a tag field is provided in the message forwarded between the virtual switch and the public network gateway, and the tag field is set to a value indicating that the virtual switch performs network address translation processing, wherein the message includes the first message and / or the second message, and the public network gateway skips the network address translation processing when it parses to the tag field, and the virtual switch performs network address translation processing when it parses to the tag field, and the network address translation processing includes the source network address translation processing and the destination network address translation processing.

[0021] Optionally, the virtual switch communicates with the public network gateway via a tunnel protocol, and the tag field is set in a header added to the message according to the tunnel protocol.

[0022] Optionally, the virtual switch confirms the type of the public IP address of the virtual machine before performing the source network address translation processing or the destination network address translation processing, and only performs the source network address translation processing or the destination network address translation processing when the type of the public IP address is a specified type.

[0023] According to a third aspect of the present disclosure, a method for implementing communication between a virtual machine and a public network is provided, which is executed in a virtual switch, and includes:

[0024] In the case where the virtual machine accesses the public network: receiving a first message sent by the virtual machine to the public network, wherein the source network address information contained in the first message is the private network IP address of the virtual machine; performing source network address translation processing on the first message and forwarding it to the public network gateway, so that the public network gateway communicates with the public network according to the information in the first message, wherein the source network address translation processing converts the source network address information in the first message into the public network IP address of the virtual machine;

[0025] And / or, in the case of accessing the virtual machine from the public network: receiving a second message sent from the public network to the virtual machine from the public network gateway, wherein the destination IP address information in the second message is the public IP address of the virtual machine; performing destination network address conversion processing on the second message and forwarding it to the virtual machine, wherein the destination network address conversion processing converts the destination IP address information in the second message into the private IP address of the virtual machine.

[0026] According to a fourth aspect of the present disclosure, a method for implementing communication between a virtual machine and a public network is provided, which is executed on a public network gateway, and includes:

[0027] In the case where the virtual machine accesses the public network: receiving a first message from the virtual switch; in the case where it is determined that the virtual switch has performed source network address translation processing, skipping the source network address translation processing, and communicating with the public network according to the public network IP address in the first message, wherein the source network address translation processing converts the source network address information in the first message into the public network IP address of the virtual machine,

[0028] And / or, in the case of accessing the virtual machine from the public network: receiving a second message sent from the public network to the virtual machine; when it is determined that the destination network address translation processing is performed by the virtual switch, skipping the destination network address translation processing, and forwarding the second message to the virtual switch, wherein the destination network address translation processing converts the destination IP address information in the second message into the private IP address of the virtual machine.

[0029] According to a fifth aspect of the present disclosure, a computing device is provided, comprising: a processor; and a memory on which executable codes are stored, and when the executable codes are executed by the processor, the processor executes the methods described in the second to fourth aspects above.

[0030] According to a sixth aspect of the present disclosure, a computer program product is provided, comprising an executable code, which, when executed by a processor of an electronic device, enables the processor to execute the methods described in the second to fourth aspects above.

[0031] According to a seventh aspect of the present disclosure, a non-temporary machine-readable storage medium is provided, on which executable code is stored. When the executable code is executed by a processor of an electronic device, the processor executes the method described in the second to fourth aspects above.

[0032] Therefore, the present disclosure can better support large-scale VM and public network communications by utilizing a virtual switch to perform NAT processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The above and other objects, features and advantages of the present disclosure will become more apparent through a more detailed description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, wherein like reference numerals generally represent like components in the exemplary embodiments of the present disclosure.

[0034] Figure 1 A schematic block diagram of a system for implementing communication between a virtual machine and a public network according to an embodiment of the present disclosure is shown.

[0035] Figure 2 The figure shows a portion of a VXLAN header (VXLAN Header) that includes a tag field according to an embodiment of the present disclosure.

[0036] Figure 3 The processing logic of the public network communication part of the virtual switch related to the present invention according to a preferred embodiment of the present disclosure is shown.

[0037] Figure 4 The processing logic of the public network communication part related to the present invention of the public network gateway according to a preferred embodiment of the present disclosure is shown.

[0038] Figure 5 A schematic diagram of the structure of a computing device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0039] The preferred embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the preferred embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.

[0040] As mentioned above, if an IGW needs to support the public network communication of a large number of VMs, especially when the packet parsing and processing part of the IGW is offloaded to the hardware, the number of SNAT / DNAT entries will be limited by hardware resources. In order to effectively support the communication between a larger number of VMs and the public network under limited hardware resources, the following three methods are usually proposed: one is to run multiple groups of devices in parallel, the second is to expand the hardware storage resources of a single device, and the third is to switch to software processing or elephant flow delivery when the hardware configuration is full. However, both method one and method two will face the increase in cost, and if method two cannot simply expand the hardware storage, it may also need to change the hardware design architecture. And method three may face the problem that there is no traffic configuration delivered to the hardware or no configuration is delivered to the hardware, and a large amount of traffic is limited by software, resulting in idle hardware resources.

[0041] In view of the above problems, the present invention proposes a new solution, which changes the SNAT / DNAT processing to be performed by a virtual switch, and can better support large-scale VM and public network communication. In particular, when the message parsing processing part of the IGW is offloaded to the hardware, the solution of the present invention can remove the SNAT / DNAT table entry in the IGW, so that the IGW can well support more VM and public network communication under limited hardware resources, reducing service costs.

[0042] The technical solution of the present invention will be described in detail below by taking the communication between a cloud VM and a public network providing a cloud server service as an example, but those skilled in the art should understand that the present invention is not limited to the cloud VM.

[0043] As mentioned above, cloud service providers usually run multiple VMs on a physical server in order to provide independent ECS cloud servers to multiple tenants. VM refers to a complete computer system with complete hardware system functions and running in a completely isolated environment obtained on a physical machine through virtualization technology. In some cases, multiple containers can be further set up in a VM to provide services to different tenants. In this case, the VM in this article can refer to the container that is using the VM, and VMIP is the IP address of the container.

[0044] Usually, tenants choose to deploy their own cloud server instances in a VPC (Virtual Private Cloud), so VMs are usually assigned private IP addresses. If a VM needs to access the public network, it can apply to the cloud service provider to associate a public IP address, such as an EIP (Elastic IP) address, and then communicate with the public network through NAT processing.

[0045] The so-called elastic public IP address, or EIP address, refers to a public IP address resource that a tenant can independently purchase and hold from a cloud service provider. It can be bound or unbound to a specified VPC type ECS instance based on the tenant's needs.

[0046] NAT processing is the process of converting the IP address in the IP packet header into another IP address, including SNAT processing that converts the source IP address and DNAT processing that converts the destination IP address.

[0047] Typically, a VM can communicate in a VPC private network via a VS (Virtual Switch), and can be connected to an IGW via the VS. The IGW is used to interconnect the VPC private network to which the VM belongs with the public network.

[0048] As mentioned above, in some embodiments, the IGW may be a hardware gateway that offloads message parsing processing to hardware (e.g., programmable hardware), but the present invention is not limited thereto. Instead, other implementation forms of the IGW may be used, such as a fully software-implemented IGW, or an IGW that offloads other processing parts to hardware.

[0049] VS is usually a switch function device formed on a physical device using virtualization technology, used for communication between VMs and between VMs and other networks (such as the public network). It can be formed entirely by software, by software plus hardware, or by hardware (such as programmable hardware).

[0050] Combine the following Figure 1 A system for implementing communication between a VM and a public network according to an embodiment of the present disclosure is described in detail.

[0051] like Figure 1 As shown, the system for implementing communication between VM 110 and public network 140 includes VS 120 and IGW 130, wherein IGW 130 is used to implement the interconnection between the private network to which the VM belongs and the public network 140, and VS 120 is used to forward messages between VM 110 and IGW 130. Those skilled in the art should understand that in order to more clearly illustrate the present invention, Figure 1 Only one VM 110 and one VS 120 are shown, but the present invention is not limited to this. One VS 120 can be responsible for the communication of multiple (e.g., dozens or even hundreds) VMs 110 (e.g., communication within a private network, communication between private networks and / or communication with a public network, etc.), and one IGW 130 can be responsible for the communication of multiple (e.g., hundreds to tens of thousands) VS 120 (e.g., communication with a public network, etc.).

[0052] Figure 1 The left and right arrows in respectively represent the path of the message flowing from VM 110 to public network 140 and the path of the message flowing from public network 140 to VM 110, wherein the text beside the path simply indicates the current status of the message.

[0053] Specifically, if Figure 1 As shown by the left arrow in the figure, the message flowing from VM 110 to the public network 140 (for example, the message sent by VM 110 when VM 110 accesses the public network 140) is first sent to VS 120, where the SIP (SourceIP) address in the initial message is the private network address VM-IP of VM 110, and then SNAT processing is performed on the message at VS 120, which converts the SIP address from the private network address VM-IP of VM 110 to the public network address (for example, EIP address) of VM 110. Then, the message is forwarded to IGW 130 by VS 120, and the SIP address in the message has become the public network address EIP of VM 110. Then, IGW 130 does not need to perform SNAT processing on the message again, and can forward it to the public network 140 according to the information of the received message.

[0054] Similarly, if Figure 1As shown by the right arrow in the figure, the message flowing from the public network 140 to the VM 110 (for example, the message sent by the public network 140 when the public network 140 accesses the VM 110) is first sent to the IGW 130, where the DIP (Destination IP) address in the initial message is the public network address EIP of the VM 110, and then the message is forwarded to the VS 120 without DNAT processing at the IGW 130, that is, the DIP in the message is still the EIP at this time. Then, the message is DNAT processed at the VS 120, which converts the DIP address from the public network address EIP of the VM 110 to the private network address VM-IP. Then, the message is forwarded to the VM 110 by the VS 120, and the DIP address in the message has become the private network address VM-IP of the VM 110.

[0055] Figure 1 The path shown starting from VM 110 and going from the left arrow to the right arrow can represent a common complete process of VM 110 accessing the public network 140, and conversely, the path starting from the public network 140 and going from the right arrow to the left arrow can represent a common complete process of a device on the public network 140 accessing VM 110. The whole process is described in detail below using VM 110 accessing the public network 140 as an example. Those skilled in the art should understand that the whole process of a device on the public network 140 accessing VM 110 is the same, but in the opposite direction. In addition, it should be understood that the process of VM 110 accessing the public network or the public network accessing VM 110 is not limited to this. For example, in some cases, the other party may not need to return a response content, and the whole process may be different.

[0056] The process of VM 110 accessing public network 140 may include:

[0057] 1. If Figure 1 As shown by the left arrow in the figure, VM 110 sends an access message to VS 120 for accessing public network 140, wherein the SIP address in the access message is the private network address VM-IP of VM 110; then VS 120 performs SNAT processing on the access message and forwards it to IGW 130, and the SNAT processing converts the SIP address from the private network address VM-IP of VM 110 to the public network address (e.g., EIP address) of VM 110; then, IGW 130 does not need to perform SNAT processing on the access message and can forward it to the public network 140 according to the information in the access message;

[0058] 2. Then, if Figure 1As shown by the right arrow in the figure, the public network 140 sends a response message to IGW 130 to be returned to VM 110, wherein the DIP address in the response message is the public network address EIP of VM 110; then, after receiving the response message, IGW 130 does not perform DNAT processing on the response message and forwards it to VS 120, that is, the DIP in the response message is still EIP at this time; then, VS 120 performs DNAT processing on the response message and forwards it to VM 110, and the DNAT processing converts the DIP address from the public network address EIP of VM 110 to the private network address VM-IP.

[0059] From the above, it can be seen that the present invention will sink the NAT processing (including SNAT and DNAT) to be performed when VM 110 communicates with the public network 140 from IGW 130 to VS 120 for implementation. In other words, it is equivalent to distributing the original centralized task of IGW 130 (NAT processing of all related VM 110) to each VS 120 to solve (NAT processing of VM 110 for which VS 120 is responsible). This reduces the burden on IGW 130, helps improve the performance of the entire communication system, and also helps the system support a larger number of VMs communicating with the public network.

[0060] In addition, as mentioned above, when IGW 130 is a hardware gateway that offloads part of the message parsing processing to hardware, since IGW 130 removes the hardware resource consumption caused by the SNAT / DNAT table entries, it is possible to support more VM public network communication tasks without changing the existing hardware architecture when hardware resources are limited, thereby reducing service costs.

[0061] Preferably, in some embodiments, the VS 120 is implemented by software or programmable hardware. Therefore, by modifying the software or programmable hardware program of the VS 120, SNAT / DNAT processing logic and corresponding SNAT / DNAT table entries can be added to the VS 120 to enable it to implement the above NAT function.

[0062] Preferably, in some embodiments, the IGW 130 includes programmable hardware for packet parsing processing. Therefore, the hardware processing logic of the IGW 130 can be modified by modifying the program of the programmable hardware (e.g., the p4 program) to allow it to determine to skip the NAT function, and the corresponding SNAT / DNAT table entry can be removed from the hardware of the IGW 130.

[0063] In addition, although Figure 1Not shown, but preferably, in some embodiments, a tag field can be set in the message forwarded between VS 120 and IGW 130, and when the VM communicates with the public network, the tag field is set to a value indicating that VS 120 performs NAT processing, so that IGW 130 skips NAT processing when parsing the tag field, and VS 120 performs NAT processing when parsing the tag field. Preferably, the tag field can be a TOF (Type of Flow) field, and the TOF field can also identify the traffic type. VS 120 and IGW 130 can agree which one or more traffic types are to be subjected to the NAT processing of the present invention, that is, the value of the TOF field identifying one or more traffic types corresponds to the above-mentioned value indicating that VS 120 performs NAT processing.

[0064] In addition, although Figure 1 Not shown, but preferably, in some embodiments, VS 120 communicates with IGW 130 through a tunnel protocol, and the above-mentioned tag field, such as the TOF field, can be set in the header added to the message according to the tunnel protocol. Preferably, the VXLAN protocol can be used as the tunnel protocol, and the TOF field is placed in a reserved field (Reserved) in the VXLAN header (VXLANHeader). For example, Figure 2 The TOF field is set as shown, wherein the TOF field occupies the first 4 bits (bits) of the last reserved field (8 bits) of the VXLAN header, and the remaining 4 bits of the RES field are still reserved fields. It should be understood by those skilled in the art that the present invention is not limited to the VXLAN protocol, and may also use, for example, the GRE tunnel protocol.

[0065] In addition, although Figure 1 Not shown, but preferably, in some embodiments, VS 120 may perform NAT processing only for a portion of VMs, for example, confirming the type of the public IP address of the VM before performing NAT processing, and performing NAT processing only in the case of a specified type.

[0066] For example, in some embodiments, there are at least three types of EIP public network addresses that a VM can be bound to. Among them, the first EIP type allows multiple ECS instances in a VPC to access the public network using the same public network address, thereby avoiding direct exposure of the ECS instances to the public network and causing security risks. The second EIP type allows the ECS server in the VPC to be accessed by public network users through DNAT to open the specified service port, and the same public network address can be used to open services for multiple ECS servers. The third EIP type allows one public IP address to support public network communication for only one virtual machine.

[0067] That is to say, the first two EIP types support one EIP public network address corresponding to multiple VMs at the same time, which may involve complex processing when communicating with the public network, and may increase the implementation complexity of the solution of the present invention. Therefore, in order to implement the present invention more simply and efficiently, VS 120 can perform NAT processing only in the case of the third EIP type (i.e., one EIP public network address corresponds to only one VM). Please note that here, one EIP public network address only corresponds to (supports) one VM, which means that one EIP public network address is only bound to one VM at a time, and does not mean that one EIP public network address can only be bound to one VM forever.

[0068] VS 120 can confirm the public IP address type of the VM related to the received message by parsing message information (such as VM information and / or EIP information (such as EIP type field)), etc., and perform NAT processing on the message only when the type is specified.

[0069] Combine the following Figure 3 A VS (eg Figure 1 The processing logic of the public network communication part of VS 120) related to the present invention.

[0070] like Figure 3 As shown, after the VS receives the message, it confirms the EIP type and traffic type to which the message belongs at step S310. As mentioned above, in some embodiments, the message information can be parsed, for example, by checking a specific field in the header (such as a TOF field), to confirm whether the EIP type and traffic type to which the message belongs are the types for which corresponding NAT processing should be performed. As mentioned above, in some embodiments, the VS performs NAT processing only when the EIP type is a type that only supports one virtual machine with a public IP address. In other cases, other processing procedures are followed as shown in step S340.

[0071] When it is confirmed that the traffic is of the type flowing from the VM to the public network, the VS enters step S320, that is, performs SNAT processing to convert the source IP address from the private network address VM-IP to the corresponding EIP public network address, encapsulates the message according to the VXLAN protocol, and forwards it to the IGW, where the TOF field can be set in the VXLAN encapsulation header as described above to tell the subsequent IGW to skip the SNAT processing.

[0072] When the traffic is confirmed to be from the public network to the VM, the VS enters step S330, that is, DNAT processing is performed to convert the destination IP address from the EIP public network address to the corresponding private network address VM-IP, and the VXLAN encapsulation header is stripped before forwarding to the VM. Please note that although the DNAT processing and the stripping of the VXLAN encapsulation header are described sequentially here, it does not mean to limit the execution order of these two operations, and these operations can be performed in parallel, partially in parallel, or sequentially according to actual conditions.

[0073] In addition, please note that although only the NAT processing and encapsulation / decapsulation processing of the VS are described here, in actual situations, the VS may also need to perform other operations required for the VM to communicate with the public network, which are not related to the present invention and are omitted here.

[0074] Combine the following Figure 4 The IGW (eg Figure 1 The processing logic of the public network communication part of IGW130) related to the present invention.

[0075] like Figure 4 As shown, after receiving the message, the IGW confirms the EIP type and traffic type to which the message belongs at step S410. As mentioned above, in some embodiments, the message information can be parsed, for example, by checking a specific field (such as a TOF field) in the header to confirm whether the EIP type and traffic type to which the message belongs are types for which the corresponding NAT processing should be skipped. As mentioned above, in some embodiments, in the case where the EIP type is a type that only supports one virtual machine with a public IP address, the IGW skips the NAT processing, and in the case of other types, other processing procedures are followed as shown in step S440.

[0076] When the traffic is confirmed to be from the VM to the public network, the IGW enters step S420, that is, skipping the SNAT process, stripping the VXLAN encapsulation header, and forwarding it to the public network. Please note that although the operations of skipping the SNAT process and stripping the VXLAN encapsulation header are described in sequence here, it does not mean to limit the execution order of these two operations, and these operations can be performed in parallel, partially in parallel, or sequentially according to actual conditions.

[0077] When it is confirmed that the traffic is of the type flowing from the public network into the VM, the IGW enters step S430, that is, skips the DNAT processing, encapsulates the message according to the VXLAN protocol, and then forwards it to the VS, where the TOF field can be set in the VXLAN encapsulation header as described above to tell the subsequent VS to perform DNAT processing.

[0078] In addition, please note that although only the NAT skipping processing and encapsulation / decapsulation processing of the IGW are described here, in actual situations, the IGW usually also needs to perform other operations required for the VM to communicate with the public network, which are not related to the present invention and are omitted here.

[0079] Figure 5 A schematic diagram of the structure of a computing device that can be used to implement the method for communicating between a virtual machine and a public network according to an embodiment of the present disclosure is shown. As mentioned above, the computing device that implements the method of the present disclosure can be a hardware device belonging to a public network gateway and / or a hardware device belonging to a virtual switch in the communication system, or other computing devices in the system that are independent of these hardware devices.

[0080] See also Figure 5 , the computing device 500 includes a memory 510 and a processor 520 .

[0081] The processor 520 may be a multi-core processor or may include multiple processors. In some embodiments, the processor 520 may include a general-purpose main processor and one or more special coprocessors, such as a graphics processing unit (GPU), a digital signal processor (DSP), etc. In some embodiments, the processor 520 may be implemented using a customized circuit, such as an application-specific integrated circuit (ASIC) or a field programmable gate array (FPGA).

[0082] The memory 510 may include various types of storage units, such as system memory, read-only memory (ROM), and permanent storage devices. Among them, ROM can store static data or instructions required by the processor 520 or other modules of the computer. The permanent storage device may be a readable and writable storage device. The permanent storage device may be a non-volatile storage device that does not lose the stored instructions and data even after the computer is powered off. In some embodiments, the permanent storage device uses a large-capacity storage device (such as a magnetic or optical disk, flash memory) as a permanent storage device. In some other embodiments, the permanent storage device may be a removable storage device (such as a floppy disk, optical drive). The system memory may be a readable and writable storage device or a volatile readable and writable storage device, such as a dynamic random access memory. The system memory may store some or all instructions and data required by the processor at runtime. In addition, the memory 510 may include any combination of computer-readable storage media, including various types of semiconductor memory chips (DRAM, SRAM, SDRAM, flash memory, programmable read-only memory), and disks and / or optical disks may also be used. In some embodiments, the memory 510 may include a readable and / or writable removable storage device, such as a laser disc (CD), a read-only digital versatile disc (e.g., DVD-ROM, double-layer DVD-ROM), a read-only Blu-ray disc, an ultra-density optical disc, a flash memory card (e.g., SD card, mini SD card, Micro-SD card, etc.), a magnetic floppy disk, etc. The computer-readable storage medium does not include carrier waves and transient electronic signals transmitted wirelessly or wired.

[0083] The memory 510 stores executable codes, and when the executable codes are processed by the processor 520 , the processor 520 can execute the method for the virtual machine to communicate with the public network mentioned above.

[0084] The system and method for implementing communication between a virtual machine and a public network according to the present invention have been described in detail above with reference to the accompanying drawings.

[0085] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0086] In addition, the method according to the present invention may also be implemented as a computer program or a computer program product, which includes computer program code instructions for executing the above steps defined in the above method of the present invention.

[0087] Alternatively, the present invention may also be implemented as a non-temporary machine-readable storage medium (or computer-readable storage medium, or machine-readable storage medium) on which executable code (or computer program, or computer instruction code) is stored. When the executable code (or computer program, or computer instruction code) is executed by a processor of an electronic device (or computing device, server, etc.), the processor executes the various steps of the above-mentioned method according to the present invention.

[0088] Those skilled in the art will further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein may be implemented as electronic hardware, computer software, or a combination of both.

[0089] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system and method according to multiple embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0090] The embodiments of the present invention have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terms used herein are selected to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A system for realizing communication between a virtual machine and a public network, comprising: Public network gateway, used to realize the interconnection between the private network to which the virtual machine belongs and the public network; as well as A virtual switch, used to forward messages between the virtual machine and the public network gateway; The virtual switch is configured to perform network address translation processing on messages transmitted between the virtual machine and the public network gateway, wherein the network address translation processing includes a conversion process between the private network IP address of the virtual machine and the public network IP address of the virtual machine; A tag field is provided in the message forwarded between the virtual switch and the public network gateway. The tag field is set to a value and traffic type indicating the network address translation processing performed by the virtual switch. When the public network gateway parses the tag field, the network address translation processing is skipped, while when the virtual switch parses the tag field, the network address translation processing is performed.

2. The system according to claim 1, wherein: The network address translation process includes a source network address translation process and a destination network address translation process, wherein the source network address translation process converts the source network address information in the message from the private network IP address of the virtual machine to the public network IP address, and the destination network address translation process converts the destination IP address information in the message from the public network IP address of the virtual machine to the private network IP address, The virtual switch is configured as: When the message received from the virtual machine is a message flowing to the public network, forwarding the message to the public network gateway after performing the source network address translation process; In the case where the message received from the public network gateway is a message flowing from the public network to the virtual machine, the destination network address translation process is performed and then forwarded to the virtual machine.

3. The system according to claim 1, wherein: The virtual switch communicates with the public network gateway via a tunnel protocol, and The tag field is set in a header added to the message according to the tunnel protocol.

4. The system according to claim 3, wherein: The tunnel protocol is a VXLAN protocol, and the tag field is at least a portion of a reserved field in a VXLAN header.

5. The system according to claim 1, wherein: The virtual switch is configured to confirm the type of the public IP address of the virtual machine before performing the network address translation process, and perform the network address translation process only when the type of the public IP address is a specified type.

6. The system according to claim 5, wherein: The specified type includes a type in which one public IP address supports only one virtual machine.

7. The system according to claim 1, wherein: The public network gateway includes hardware for parsing and processing messages; and / or One of the public network gateways is responsible for the communication between the multiple virtual switches and the public network; and / or One virtual switch is responsible for the communication between the multiple virtual machines and the public network gateway.

8. A method for realizing communication between a virtual machine and a public network, comprising: When the virtual machine accesses the public network: The virtual switch receives a first message sent by the virtual machine to the public network, wherein the source network address information contained in the first message is the private network IP address of the virtual machine; The virtual switch performs source network address translation processing on the first message and then forwards it to the public network gateway, wherein the source network address translation processing converts the source network address information in the first message into the public network IP address of the virtual machine; The public network gateway communicates with the public network according to the information in the first message, And / or, if the VM is accessed from the public network: The public network gateway receives a second message sent from the public network to the virtual machine, and forwards the second message to the virtual switch, wherein the destination IP address information in the second message is the public network IP address of the virtual machine; The virtual switch performs a destination network address translation process on the second message and then forwards it to the virtual machine, wherein the destination network address translation process converts the destination IP address information in the second message into a private network IP address of the virtual machine; Wherein, a tag field is provided in the message forwarded between the virtual switch and the public network gateway, and the tag field is set to a value and a traffic type indicating the network address translation processing performed by the virtual switch, wherein the message includes the first message and / or the second message; The public network gateway skips the network address translation process when parsing to the tag field, while the virtual switch performs the network address translation process when parsing to the tag field, wherein the network address translation process includes the source network address translation process and the destination network address translation process.

9. The method according to claim 8, wherein: The virtual switch communicates with the public network gateway via a tunnel protocol, and The tag field is set in a header added to the message according to the tunnel protocol.

10. The method according to claim 8, wherein: The virtual switch confirms the type of the public IP address of the virtual machine before performing the source network address translation process or the destination network address translation process, and performs the source network address translation process or the destination network address translation process only when the type of the public IP address is a specified type.

11. A method for realizing communication between a virtual machine and a public network, executed in a virtual switch, the method comprising: When the virtual machine accesses the public network: Receive a first message sent by the virtual machine to the public network, wherein the source network address information contained in the first message is the private network IP address of the virtual machine; performing source network address translation processing on the first message and then forwarding it to a public network gateway so that the public network gateway communicates with the public network according to information in the first message, wherein the source network address translation processing converts the source network address information in the first message into the public network IP address of the virtual machine, And / or, if the VM is accessed from the public network: Receiving, from the public network gateway, a second message sent from the public network to the virtual machine, wherein the destination IP address information in the second message is the public network IP address of the virtual machine; Performing a destination network address translation process on the second message and then forwarding it to the virtual machine, wherein the destination network address translation process converts the destination IP address information in the second message into a private network IP address of the virtual machine; Wherein, a tag field is provided in the message forwarded between the virtual switch and the public network gateway, and the tag field is set to a value and a traffic type indicating the network address translation processing performed by the virtual switch, wherein the message includes the first message and / or the second message; If the tag field is parsed, a network address translation process is performed, wherein the network address translation process includes the source network address translation process and the destination network address translation process.

12. A method for realizing communication between a virtual machine and a public network, executed at a public network gateway, the method comprising: When the virtual machine accesses the public network: Receive a first message from the virtual switch; In the case where it is determined that the virtual switch has performed source network address translation processing, skipping the source network address translation processing, and communicating with the public network according to the public IP address in the first message, wherein the source network address translation processing converts the source network address information in the first message into the public IP address of the virtual machine, And / or, if the VM is accessed from the public network: Receive a second message sent from the public network to the virtual machine; In the case where it is determined that the destination network address translation process is performed by the virtual switch, the destination network address translation process is skipped, and the second message is forwarded to the virtual switch, wherein the destination network address translation process converts the destination IP address information in the second message into the private network IP address of the virtual machine; Wherein, a tag field is provided in the message forwarded between the virtual switch and the public network gateway, and the tag field is set to a value and a traffic type indicating the network address translation processing performed by the virtual switch, wherein the message includes the first message and / or the second message; If the tag field is parsed, the network address translation process is skipped, and the network address translation process includes the source network address translation process and the destination network address translation process.

Citation Information

Patent Citations

  • Method and device for transmitting message

    CN104601432A

  • Message transmission method and device

    CN108566445A

  • Network traffic control method, VTEP device and storage medium

    CN110868357A

  • Network address translation method and device, gateway equipment and storage medium

    CN111327720A

  • Data forwarding method, cabinet top type switch and storage medium

    CN112242952A