Inter-container non-standard ethernet message communication method and system

CN116319167BActive Publication Date: 2026-08-18CHENGDU FIBERHOME CLOUD NETWORK INFORMATION TECH CO
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310259784.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-16
Publication Date
2026-08-18
Estimated Expiration
2043-03-16

AI Technical Summary

Technical Problem

[0003]本发明的主要目的在于提供一种容器间非标准以太网报文通信方法及系统,旨在解决跨主机容器间不支持二层报文通信的技术问题

Benefits of technology

[0030] In this invention, the sending end encapsulates a Layer 2 message from a container in the source pod into a VXLAN message and sends the VXLAN message to the receiving end. The receiving end receives the VXLAN message, decapsulates it to obtain a Layer 2 message, and sends the Layer 2 message to the container in the destination pod based on the VXLAN header information. This invention extends cross-host container network communication from Layer 3 to Layer 2, enabling Layer 2 messages to be transmitted between cross-host pods, solving many problems that rely on Layer 2 communication, and expanding the communication methods for applications within containers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116319167B_ABST
    Figure CN116319167B_ABST
Patent Text Reader

Abstract

The application provides an inter-container non-standard Ethernet message communication method and system, which comprises the following steps: a sending end encapsulates a layer 2 message from a container in a source end pod into a VXLAN message, and sends the VXLAN message to a receiving end; the receiving end receives the VXLAN message, decapsulates the VXLAN message to obtain a layer 2 message, and sends the layer 2 message to a container in a destination end pod according to VXLAN header information of the VXLAN message. Through the application, the inter-host container network communication is expanded from layer 3 to layer 2, so that the layer 2 message can be transmitted between the inter-host pods, many problems depending on the layer 2 communication are solved, and the container application communication mode is expanded.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, and in particular to a method and system for non-standard Ethernet message communication between containers. Background Technology

[0002] Container technology is a lightweight virtualization technology that packages applications and their dependencies into a portable environment that can be deployed on any Linux machine. As an operating system-level virtualization technology, its goal is to deliver multiple isolated environments on a single host. Containers share the same host operating system kernel, but their runtime environments are isolated from each other. However, in cross-host container communication, it has been found that it does not support non-standard Ethernet message communication such as Layer 2 broadcast messages and MACINMAC messages. Summary of the Invention

[0003] The main objective of this invention is to provide a method and system for non-standard Ethernet packet communication between containers, aiming to solve the technical problem that cross-host containers do not support Layer 2 packet communication.

[0004] In a first aspect, the present invention provides a method for non-standard Ethernet packet communication between containers, the method comprising:

[0005] The sending end encapsulates the Layer 2 packets from the container in the source pod into VXLAN packets and sends the VXLAN packets to the receiving end.

[0006] The receiving end receives VXLAN packets, decapsulates the VXLAN packets to obtain Layer 2 packets, and sends the Layer 2 packets to the container in the destination pod according to the VXLAN header information of the VXLAN packets.

[0007] Optionally, the sender encapsulates the Layer 2 packets from the container in the source pod into VXLAN packets, including:

[0008] The sending bridge br0 receives Layer 2 packets from containers in the source pod, wherein the Layer 2 packets arrive at the sending bridge br0 via the network namespace bridge;

[0009] Generate VXLAN header information, and encapsulate Layer 2 packets into VXLAN packets based on the VXLAN header information.

[0010] Optionally, generate VXLAN header information, including:

[0011] The tunnel ID and the receiving IP address are obtained by querying the identification information of the network namespace;

[0012] Obtain the sender's IP address, and use the tunnel ID, sender's IP address, and receiver's IP address to form the VXLAN header information.

[0013] Optionally, sending the Layer 2 packet to the container in the destination pod based on the VXLAN header information of the VXLAN packet includes:

[0014] The identification information of the network namespace is determined based on the tunnel ID in the VXLAN header information of the VXLAN message;

[0015] Based on the identification information of the network namespace, the corresponding bridge sends the Layer 2 message to the container in the destination pod.

[0016] Optionally, the Layer 2 message includes Layer 2 broadcast messages and MAC-in-MAC messages.

[0017] Secondly, the present invention also provides a non-standard Ethernet message communication system between containers, the non-standard Ethernet message communication system between containers including a sending end and a receiving end, wherein:

[0018] The sending end encapsulates the Layer 2 packets from the container in the source pod into VXLAN packets and sends the VXLAN packets to the receiving end.

[0019] The receiving end receives VXLAN packets, decapsulates the VXLAN packets to obtain Layer 2 packets, and sends the Layer 2 packets to the container in the destination pod according to the VXLAN header information of the VXLAN packets.

[0020] Optionally, the sending end is used for:

[0021] The sending bridge br0 receives Layer 2 packets from containers in the source pod, wherein the Layer 2 packets arrive at the sending bridge br0 via the network namespace bridge;

[0022] Generate VXLAN header information, and encapsulate Layer 2 packets into VXLAN packets based on the VXLAN header information.

[0023] Optionally, the sending end is used for:

[0024] The tunnel ID and the receiving IP address are obtained by querying the identification information of the network namespace;

[0025] Obtain the sender's IP address, and use the tunnel ID, sender's IP address, and receiver's IP address to form the VXLAN header information.

[0026] Optionally, the receiving end is used for:

[0027] The identification information of the network namespace is determined based on the tunnel ID in the VXLAN header information of the VXLAN message;

[0028] Based on the identification information of the network namespace, the corresponding bridge sends the Layer 2 message to the container in the destination pod.

[0029] Optionally, the Layer 2 message includes Layer 2 broadcast messages and MAC-in-MAC messages.

[0030] In this invention, the sending end encapsulates a Layer 2 message from a container in the source pod into a VXLAN message and sends the VXLAN message to the receiving end. The receiving end receives the VXLAN message, decapsulates it to obtain a Layer 2 message, and sends the Layer 2 message to the container in the destination pod based on the VXLAN header information. This invention extends cross-host container network communication from Layer 3 to Layer 2, enabling Layer 2 messages to be transmitted between cross-host pods, solving many problems that rely on Layer 2 communication, and expanding the communication methods for applications within containers. Attached Figure Description

[0031] Figure 1 This is a flowchart illustrating an embodiment of the non-standard Ethernet packet communication method between containers according to the present invention;

[0032] Figure 2 This is a schematic diagram of the VXLAN message format;

[0033] Figure 3 This is a schematic diagram illustrating a scenario where Layer 2 messages are transmitted between host pods in one embodiment.

[0034] Figure 4 This is a schematic diagram of the execution flow of the k8s-ovs network plugin;

[0035] Figure 5 This is a functional module diagram of an embodiment of the non-standard Ethernet message communication system between containers of the present invention.

[0036] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0037] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0038] In a first aspect, embodiments of the present invention provide a method for non-standard Ethernet message communication between containers.

[0039] In one embodiment, reference is made to Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the non-standard Ethernet message communication method between containers according to the present invention. Figure 1 As shown, non-standard Ethernet packet communication methods between containers include:

[0040] Step S10: The sending end encapsulates the Layer 2 message from the container in the source pod into a VXLAN message and sends the VXLAN message to the receiving end.

[0041] In this embodiment, Layer 2 packets flow from the container in the source pod to the sender. The sender encapsulates the Layer 2 packets to obtain VXLAN packets and sends them to the receiver. The Layer 2 packets are non-standard Ethernet packets, such as Layer 2 broadcast packets or MAC-in-MAC packets. It should be noted that this is only an illustrative description of Layer 2 packets and does not constitute a limitation on Layer 2 packets.

[0042] Furthermore, in one embodiment, the sending end encapsulates the Layer 2 packets from the container in the source pod into VXLAN packets, including:

[0043] The sending bridge br0 receives Layer 2 packets from containers in the source pod, wherein the Layer 2 packets arrive at the sending bridge br0 via the network namespace bridge; generates VXLAN header information, and encapsulates the Layer 2 packets into VXLAN packets based on the VXLAN header information.

[0044] In this embodiment, the bridge br0 of the k8s-ovs network plugin in the sending end receives a Layer 2 packet from a container in the source pod. This Layer 2 packet travels through the network namespace bridge to reach the bridge br0 of the k8s-ovs network plugin in the sending end. After receiving the Layer 2 packet, br0 further generates VXLAN header information based on relevant information and encapsulates the Layer 2 packet into a VXLAN packet based on the VXLAN header information. (Refer to...) Figure 2 , Figure 2 This is a schematic diagram of the VXLAN message format. For example... Figure 2 As shown, taking the mac-inmac packet as an example, the original format of the Layer 2 packet is a mac-inmac packet header + data packet. By adding a VXLAN header before the header, the Layer 2 packet is encapsulated into a VXLAN packet.

[0045] Furthermore, in one embodiment, generating VXLAN header information includes:

[0046] The tunnel ID and the receiving IP address are obtained by querying the identification information of the network namespace; the sending IP address is obtained, and the VXLAN header information is composed of the tunnel ID, the sending IP address, and the receiving IP address.

[0047] In this embodiment, a pre-established association relationship is established between the network namespace identifier information, the network namespace bridge identifier information, the peer tunnel identifier information, and the peer host IP address information. For example, when a Layer 2 packet arrives at the sending bridge br0 via bridge 1 in network namespace 1, based on the above association relationship, the network namespace 1 identifier information is first determined based on the bridge 1 identifier information; then, the peer tunnel identifier information (i.e., tunnel ID) and the peer host IP address information (i.e., receiving IP address) are determined based on the network namespace 1 identifier information.

[0048] Since the local IP address (i.e., the sender's IP address) can be directly obtained, the VXLAN header information is composed of the tunnel ID, the sender's IP address, and the receiver's IP address. The VXLAN packet can then be sent to the receiver based on the receiver's IP address.

[0049] Step S20: The receiving end receives the VXLAN message, decapsulates the VXLAN message to obtain the Layer 2 message, and sends the Layer 2 message to the container in the destination pod according to the VXLAN header information of the VXLAN message.

[0050] In this embodiment, after receiving the VXLAN message, the receiving end decapsulates the VXLAN message to obtain a Layer 2 message, parses the header of the VXLAN message, and sends the Layer 2 message to the container in the destination pod according to the VXLAN header information obtained from the parsing.

[0051] Furthermore, in one embodiment, sending a Layer 2 packet to a container in the destination pod based on the VXLAN header information of the VXLAN packet includes:

[0052] The network namespace identifier is determined based on the tunnel ID in the VXLAN header of the VXLAN packet; the Layer 2 packet is then sent to the container in the destination pod based on the bridge corresponding to the network namespace identifier.

[0053] In this embodiment, the bridge br0 of the k8s-ovs network plugin in the receiving end receives VXLAN packets, parses the VXLAN header of the VXLAN packets, and determines the identification information of the network namespace based on the tunnel ID in the parsed VXLAN header information; and sends the Layer 2 packets to the container in the destination pod according to the bridge corresponding to the identification information of the network namespace.

[0054] In this embodiment, the sending end encapsulates the Layer 2 message from the container in the source pod into a VXLAN message and sends the VXLAN message to the receiving end. The receiving end receives the VXLAN message, decapsulates it to obtain the Layer 2 message, and sends the Layer 2 message to the container in the destination pod according to the VXLAN header information. This embodiment extends cross-host container network communication from Layer 3 to Layer 2, enabling Layer 2 messages to be transmitted between cross-host pods, solving many problems that rely on Layer 2 communication, and expanding the communication methods for applications within containers.

[0055] Reference Figure 3 , Figure 3 This is a schematic diagram illustrating a scenario where Layer 2 messages are transmitted between host pods in one embodiment. For example... Figure 3 As shown, the Layer 2 packets from the container in Pod1 are sent to the k8s-ovs bridge br0 via the namespace bridge. br0 queries the peer's VXLAN tunnel information (including the peer host IP and VNI tunnel ID) based on the bridge's namespace information (namespace name and ID), and encapsulates the Layer 2 packets based on the queried information and its own host IP to obtain VXLAN packets (i.e., the packets shown in the diagram), which are then sent. The peer k8s-ovs br0 receives the VXLAN packets, decapsulates them to obtain Layer 2 packets, and sends the decapsulated Layer 2 packets to the corresponding namespace bridge based on the VNI tunnel ID in the VXLAN header. The bridge then sends the Layer 2 packets to the container in the destination pod.

[0056] By establishing a VXLAN tunnel between pod1 and pod2, the original Layer 2 packets are encapsulated, and MAC address Layer 2 forwarding is performed in the bridge to send the original Layer 2 packets to pod2, thus enabling the transmission of Layer 2 packets between pods on different hosts.

[0057] Furthermore, in one embodiment, reference is made to Figure 4 , Figure 4 This is a diagram illustrating the execution flow of the k8s-ovs network plugin. Figure 4 As shown:

[0058] After the k8s-ovs plugin starts, it begins parsing the configuration parameters;

[0059] Connect to the specified etcd database and connect to the k8s-apiserver to obtain the status information of the k8s cluster;

[0060] Initialize the k8s-ovs interface and bridge based on the cluster's namespace and node information;

[0061] Initialize the server socket and wait for requests from the client;

[0062] Start executing the ADD or DEL action based on the client's request content;

[0063] Configure IPAM based on network information obtained from etcd;

[0064] Create a bridge based on the pod's namespace and configure OVS flow tables;

[0065] Create a veth for the pod container and configure its IP address;

[0066] The pod network information is returned to the client, and the client continues to wait for the next request;

[0067] After the message enters, the OVS flow table is queried for forwarding (i.e., the process shown in the various embodiments of the above non-standard Ethernet message communication method between containers).

[0068] Secondly, embodiments of the present invention also provide a non-standard Ethernet message communication system between containers.

[0069] In one embodiment, reference is made to Figure 5 , Figure 5 This is a functional module diagram of an embodiment of the non-standard Ethernet message communication system between containers according to the present invention. Figure 5 As shown, the non-standard Ethernet packet communication system between containers includes a sender and a receiver, wherein:

[0070] The sending end encapsulates the Layer 2 packets from the container in the source pod into VXLAN packets and sends the VXLAN packets to the receiving end.

[0071] The receiving end receives VXLAN packets, decapsulates the VXLAN packets to obtain Layer 2 packets, and sends the Layer 2 packets to the container in the destination pod according to the VXLAN header information of the VXLAN packets.

[0072] Furthermore, in one embodiment, the sending end is used for:

[0073] The sending bridge br0 receives Layer 2 packets from containers in the source pod, wherein the Layer 2 packets arrive at the sending bridge br0 via the network namespace bridge;

[0074] Generate VXLAN header information, and encapsulate Layer 2 packets into VXLAN packets based on the VXLAN header information.

[0075] Furthermore, in one embodiment, the sending end is used for:

[0076] The tunnel ID and the receiving IP address are obtained by querying the identification information of the network namespace;

[0077] Obtain the sender's IP address, and use the tunnel ID, sender's IP address, and receiver's IP address to form the VXLAN header information.

[0078] Furthermore, in one embodiment, the receiving end is used for:

[0079] The identification information of the network namespace is determined based on the tunnel ID in the VXLAN header information of the VXLAN message;

[0080] Based on the identification information of the network namespace, the corresponding bridge sends the Layer 2 message to the container in the destination pod.

[0081] Furthermore, in one embodiment, the Layer 2 message includes a Layer 2 broadcast message and a MAC-in-MAC message.

[0082] The specific embodiments of the above-mentioned non-standard Ethernet message communication system between containers are basically the same as the various embodiments of the above-mentioned non-standard Ethernet message communication method between containers, and will not be described in detail here.

[0083] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0084] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0085] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device to execute the methods described in the various embodiments of the present invention.

[0086] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A method for non-standard Ethernet message communication between containers, characterized in that, The non-standard Ethernet packet communication method between containers includes: The sending end encapsulates the Layer 2 packets from the container in the source pod into VXLAN packets and sends the VXLAN packets to the receiving end. The sending end encapsulates the Layer 2 packets from the container in the source pod into VXLAN packets, including: The sending bridge br0 receives Layer 2 packets from containers in the source pod, wherein the Layer 2 packets arrive at the sending bridge br0 via the network namespace bridge; Generate VXLAN header information, and encapsulate Layer 2 packets into VXLAN packets based on the VXLAN header information; The generation of VXLAN header information includes: The tunnel ID and the receiving IP address are obtained by querying the identification information of the network namespace; Obtain the sender's IP address and use the tunnel ID, sender's IP address, and receiver's IP address to form the VXLAN header information; The receiving end receives VXLAN packets, decapsulates the VXLAN packets to obtain Layer 2 packets, and sends the Layer 2 packets to the container in the destination pod according to the VXLAN header information of the VXLAN packets. The step of sending the Layer 2 packet to the container in the destination pod based on the VXLAN header information of the VXLAN packet includes: The identification information of the network namespace is determined based on the tunnel ID in the VXLAN header information of the VXLAN message; Based on the identification information of the network namespace, the corresponding bridge sends the Layer 2 message to the container in the destination pod.

2. The non-standard Ethernet packet communication method between containers as described in claim 1, characterized in that, The Layer 2 messages include Layer 2 broadcast messages and MAC-in-MAC messages.

3. A non-standard Ethernet message communication system between containers, characterized in that, The non-standard Ethernet packet communication system between containers includes a sender and a receiver, wherein: The sending end encapsulates the Layer 2 packets from the container in the source pod into VXLAN packets and sends the VXLAN packets to the receiving end. The sending end is used for: The sending bridge br0 receives Layer 2 packets from containers in the source pod, wherein the Layer 2 packets arrive at the sending bridge br0 via the network namespace bridge; The sending end is used for: Generate VXLAN header information, and encapsulate Layer 2 packets into VXLAN packets based on the VXLAN header information; The tunnel ID and the receiving IP address are obtained by querying the identification information of the network namespace; Obtain the sender's IP address and use the tunnel ID, sender's IP address, and receiver's IP address to form the VXLAN header information; The receiving end receives VXLAN packets, decapsulates the VXLAN packets to obtain Layer 2 packets, and sends the Layer 2 packets to the container in the destination pod according to the VXLAN header information of the VXLAN packets. The receiving end is used for: The identification information of the network namespace is determined based on the tunnel ID in the VXLAN header information of the VXLAN message; Based on the identification information of the network namespace, the corresponding bridge sends the Layer 2 message to the container in the destination pod.

4. The non-standard Ethernet message communication system between containers as described in claim 3, characterized in that, The Layer 2 messages include Layer 2 broadcast messages and MAC-in-MAC messages.

Citation Information

Patent Citations

  • Cross-host communication method and system for Docker container

    CN107070691A