Communication method and apparatus

By using flow labels and label forwarding entries between container clusters, the problems of high CPU pressure, low efficiency and complex deployment in Flannel communication are solved, achieving more efficient container communication and cloud/SDN integration, and providing secure isolation and management.

CN116506400BActive Publication Date: 2026-03-10NEW H3C TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-17
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

When implementing cross-host communication in container clusters, Flannel suffers from issues such as high CPU load, low forwarding efficiency, complex network deployment, and low integration with cloud/SDN, and lacks a comprehensive cloud-integrated security isolation and management solution.

Method used

By using flow labels for communication between hosts, tag forwarding entries are generated and utilized, including the IP address and MAC address of the host where the container resides, reducing encapsulation and decapsulation work, optimizing network deployment, and integrating security isolation.

Benefits of technology

It improves the forwarding efficiency of cross-host communication in container clusters, optimizes host performance, reduces network deployment complexity, and achieves higher cloud/SDN integration and security isolation and management capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116506400B_ABST
    Figure CN116506400B_ABST
Patent Text Reader

Abstract

The application provides a communication method and device, the method comprises the following steps: obtaining a second flow label of a second container; obtaining a matched first label forwarding table item from a label forwarding table according to the second flow label, the first label forwarding table item comprising an IP address of a second host where the second container is located and a MAC address of the second host; sending a first message to the second host, the first message comprising a destination address field, a destination MAC address field and a flow label field, the IP address of the second host being stored in the destination address field, the MAC address of the second host being stored in the destination MAC address field, and the second flow label being stored in the flow label field, so that the second host receives the first message and sends the first message to the second container according to the second flow label.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and in particular to a communication method and apparatus. Background Technology

[0002] Container technology, especially the open-source container tool Docker, is now widely used in some data centers. Container technology achieves isolation between applications by standardizing the packaging of software and its dependent environments, and containers can run on most mainstream operating systems.

[0003] When building a container cloud platform, the network and security implementation of containers becomes the most significant challenge. When enterprises begin to migrate critical core applications to container platforms, the lack of sufficient network and security controls will pose a potentially huge threat to business deployment.

[0004] Flannel is a network solution proposed by CoreOS for solving cross-host communication in container clusters. Essentially, Flannel is an overlay network, meaning it encapsulates TCP packets within another network packet for routing and communication. Flannel currently supports data forwarding methods such as UDP, VXLAN, AWS VPC, and GCE routing, with VXLAN being the most popular. Most data centers consider switching their networks to Flannel's VXLAN network implementation when introducing containers.

[0005] Flannel assigns a subnet to each host, and containers can obtain IP addresses from within this subnet. These assigned IP addresses can be routed between hosts, enabling cross-host communication between containers without the need for NAT or port mapping. Flannel's VXLAN technology integrates well with SDN, making it ideal for automated deployment, intelligent operation and management of the entire network, and suitable for new data center network deployments.

[0006] However, when using Flannel to implement cross-host communication in container clusters, the following drawbacks are also exposed: 1) During data forwarding, overlay encapsulation technology needs to be introduced, which generates a large amount of encapsulation and decapsulation work, resulting in high CPU pressure and low forwarding efficiency; 2) When networking, complex network issues such as address planning and networking of overlay and underlay still need to be considered, making deployment complex and difficult; 3) Low integration with cloud / SDN, and there is currently no overall cloud-integrated security isolation and management solution. Summary of the Invention

[0007] In view of this, this application provides a communication method and apparatus to solve the problems of the large amount of encapsulation and decapsulation work generated in the process of cross-host communication of container clusters using Flannel, resulting in high CPU pressure, low forwarding efficiency, complex network deployment, and low integration with cloud / SDN, and the lack of an overall cloud-integrated security isolation and management solution.

[0008] In a first aspect, this application provides a communication method applied to a first host, the first host including a first container having a first stream tag, the method comprising:

[0009] Get the second stream label of the second container;

[0010] Based on the second flow label, a matching first label forwarding table entry is obtained from the label forwarding table. The first label forwarding table entry includes the IP address of the second host where the second container is located and the MAC address of the second host.

[0011] A first message is sent to the second host. The first message includes a destination address field, a destination MAC address field, and a flow label field. The destination address field stores the IP address of the second host, the destination MAC address field stores the MAC address of the second host, and the flow label field stores the second flow label. This allows the second host to send the first message to the second container after receiving it, based on the second flow label.

[0012] Secondly, this application provides a communication device applied to a first host, the first host including a first container having a first stream tag, the device comprising:

[0013] The first acquisition unit is used to acquire the second stream label of the second container;

[0014] The second acquisition unit is used to acquire a matching first label forwarding table entry from the label forwarding table according to the second flow label. The first label forwarding table entry includes the IP address of the second host where the second container is located and the MAC address of the second host.

[0015] The sending unit is configured to send a first message to a second host. The first message includes a destination address field, a destination MAC address field, and a flow label field. The destination address field stores the IP address of the second host, the destination MAC address field stores the MAC address of the second host, and the flow label field stores the second flow label, so that after receiving the first message, the second host sends the first message to the second container according to the second flow label.

[0016] Thirdly, this application provides a network device including a processor and a machine-readable storage medium storing machine-executable instructions that can be executed by the processor, which in turn cause the processor to perform the method provided in the first aspect of this application.

[0017] Therefore, using the communication method and apparatus provided in this application, the first host obtains the second flow label of the second container; based on the second flow label, the first host obtains a matching first label forwarding table entry from the label forwarding table, the first label forwarding table entry including the IP address of the second host where the second container is located and the MAC address of the second host; the first host sends a first message to the second host, the first message including a destination address field, a destination MAC address field and a flow label field, the destination address field storing the IP address of the second host, and the flow label field storing the second flow label, so that after receiving the first message, the second host sends the first message to the second container based on the second flow label.

[0018] Thus, in this application, containers within each host can communicate with each other using the container's flow tag. This solves the problems of existing methods using Flannel for cross-host container cluster communication, which generate a large amount of encapsulation and decapsulation work, resulting in high CPU pressure, low forwarding efficiency, complex network deployment, and low integration with cloud / SDN, and currently lacks a comprehensive cloud-integrated security isolation and management solution. It improves forwarding efficiency, optimizes host performance, and reduces complexity. Attached Figure Description

[0019] Figure 1 A flowchart illustrating the communication method provided in the embodiments of this application;

[0020] Figure 2 A diagram illustrating the format of the stream label field provided in this application embodiment;

[0021] Figure 3 This is a structural diagram of the switching device provided in an embodiment of this application;

[0022] Figure 4 The network device hardware structure provided in the embodiments of this application. Detailed Implementation

[0023] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0024] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the corresponding listed items.

[0025] It should be understood that although the terms first, second, third, etc., may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."

[0026] The communication method provided in the embodiments of this application will be described in detail below. See also... Figure 1 , Figure 1 A flowchart illustrating a communication method provided in an embodiment of this application. This method is applied to a first host, and the communication method provided in this application may include the following steps.

[0027] Step 110: Obtain the second stream label of the second container;

[0028] Specifically, the first host includes multiple containers, each with a flow label. For example, the first container has a first flow label. The second host also includes multiple containers, each with a flow label. For example, the second container has a second flow label.

[0029] When the first container is about to interact and communicate with the second container, the first host obtains the second stream tag of the second container. The first host can obtain the second stream tag of the second container through a locally established tag database.

[0030] Step 120: Based on the second flow label, obtain a matching first label forwarding table entry from the label forwarding table. The first label forwarding table entry includes the IP address of the second host where the second container is located and the MAC address of the second host.

[0031] Specifically, according to the description in step 110, after the first host obtains the second flow label of the second container, it searches the locally established label forwarding table based on the second flow label. If there is a first label forwarding table entry that matches the second flow label, the first host obtains the IP address and MAC address of the second host where the second container is located from the first label forwarding table entry.

[0032] Step 130: Send a first message to the second host. The first message includes a destination address field, a destination MAC address field, and a flow label field. The destination address field stores the IP address of the second host, the destination MAC address field stores the MAC address of the second host, and the flow label field stores the second flow label, so that after receiving the first message, the second host sends the first message to the second container according to the second flow label.

[0033] Specifically, according to the description in step 120, after the first host obtains the IP address and MAC address of the second host, it generates a first packet. This first packet includes a destination address field, a destination MAC address field, and a flow-label field. Specifically, the destination address field stores the IP address of the second host, the destination MAC address field stores the MAC address of the second host, and the flow-label field stores the second flow label.

[0034] It should be noted that the first message includes an IPv6 header and an Ethernet header. The destination address field and flow label field mentioned above are located within the IPv6 header, while the destination MAC address field is located within the Ethernet header.

[0035] After receiving the first packet, the second host first checks whether the MAC address in the destination MAC address field is its own MAC address. If so, it checks whether the IP address in the destination address field is its own IP address. If so, it obtains the second flow label.

[0036] Based on the second flow label, the second host obtains the container number of the container; using the container number, the second host sends the first message to the second container.

[0037] Therefore, using the communication method and apparatus provided in this application, the first host obtains the second flow label of the second container; based on the second flow label, the first host obtains a matching first label forwarding table entry from the label forwarding table, the first label forwarding table entry including the IP address of the second host where the second container is located and the MAC address of the second host; the first host sends a first message to the second host, the first message including a destination address field, a destination MAC address field and a flow label field, the destination address field storing the IP address of the second host, and the flow label field storing the second flow label, so that after receiving the first message, the second host sends the first message to the second container based on the second flow label.

[0038] Thus, in this application, containers within each host can communicate with each other using the container's flow tag. This solves the problems of existing methods using Flannel for cross-host container cluster communication, which generate a large amount of encapsulation and decapsulation work, resulting in high CPU pressure, low forwarding efficiency, complex network deployment, and low integration with cloud / SDN, and currently lacks a comprehensive cloud-integrated security isolation and management solution. It improves forwarding efficiency, optimizes host performance, and reduces complexity.

[0039] Optionally, in this embodiment of the application, the process of the first host generating a tag database is also included.

[0040] Specifically, after all hosts in the Layer 2 network are started, each host enables IPv6 and automatically generates a local link address (which can be formed based on its own link layer address and the default prefix (FE80:: / 10)). At this point, no network planning is required, and the local link address is used for communication between hosts in the Layer 2 network.

[0041] Simultaneously, each host obtains the flow tags of each container within itself. In this embodiment, multiple third hosts are used as an example for illustration. Each third host includes a third container, and the third container has a third flow tag.

[0042] Each third host generates a first neighbor advertisement message, which includes the IP address of the third host and the third flow label of the third container.

[0043] Each third host sends a first neighbor advertisement message to the first host. After receiving multiple first neighbor advertisement messages, the first host obtains the IP address of the third host and the third flow label of the third container from each first neighbor advertisement message.

[0044] The first host obtains the MAC address of each third host from the IP address of each third host. For each third container, the first host generates a corresponding tag information entry and stores multiple tag information entries in the tag database. Each tag information entry includes the IP address, MAC address, and third stream tag of the third host.

[0045] Optionally, in this embodiment of the application, the process of the first host generating a tag information table entry corresponding to the local container is also included.

[0046] Specifically, for each first container included in the first host, the first host generates a corresponding tag information entry and stores multiple tag information entries in the tag database. Each tag information entry includes the IP address of the first host, the MAC address of the first host, and the first stream tag.

[0047] Understandably, the tag information table entries include IP address fields, MAC address fields, and flow label fields. The first host generates tag information table entries and stores them in the tag database based on the acquired / received content.

[0048] In this embodiment of the application, the first host also sends neighbor announcement messages to other hosts so that the other hosts can generate a tag database locally.

[0049] Optionally, in this embodiment of the application, the process of the first host generating a local tag forwarding table using the control policy and the tag database is also included.

[0050] Specifically, after establishing a tag database locally, the first host first obtains the control policy. This control policy is first issued to the host by administrators through configuration commands. The control policy includes multiple policies, such as access policies, forwarding policies, etc.

[0051] Using the control policy, the first host filters out multiple tag information entries that conform to the control policy from multiple tag information entries stored in the tag database. Based on the filtered tag information entries, the first host generates a tag forwarding table. This tag forwarding table includes at least one tag forwarding table entry, and each tag forwarding table entry includes the first host's first identifier, the fourth host's IP address, the fourth host's MAC address, and the fourth flow tag of the container in the fourth host.

[0052] The term "fourth host" is used as an example to refer to hosts in general. As can be seen from the previous example, the fourth host includes the third host and the first host.

[0053] Optionally, in one implementation of this application, the control policy may include an access policy, which is configured such that the first container can access networks with the same VPC number, while networks with different VPC numbers cannot be accessed.

[0054] Furthermore, the aforementioned flow label includes the Virtual Private Cloud (VPC) number; based on multiple label information entries stored in the label database, the first host generates a label forwarding table, the specific process of which is as follows:

[0055] From multiple third-flow labels and multiple first-flow labels, the first host obtains a fourth-flow label with the same VPC number; the first host adds a user identifier field to the label information table entry for each obtained fourth-flow label to obtain multiple label forwarding table entries, and the first identifier is stored in the user identifier field; the first host stores the multiple label forwarding table entries into the label forwarding table.

[0056] Optionally, in this embodiment of the application, the process of the first host creating a container locally according to the container creation instruction and binding the flow tag to the container is also included.

[0057] Specifically, the aforementioned flow label also includes the host number and the container number;

[0058] Administrators create a VPC in the cloud and assign it an ID after creation. The Nova component in the cloud selects hosts from the network based on each host's resource usage and creates at least one container on the selected hosts. The Nova component assigns a host ID to the selected hosts; simultaneously, it also assigns a unique container ID to each container to be created.

[0059] After obtaining the VPC ID, host ID, and container ID, the cloud or SDN controller generates a container creation instruction. The cloud or SDN controller then sends this instruction to the first host. Upon receiving the instruction, the first host retrieves the VPC ID, host ID, and container ID from it. It's understood that the container creation instruction may also include the number of containers to be created, container information (e.g., container name, software resource usage, etc.), with each container ID corresponding to a single container to be created.

[0060] The first host creates a container locally and uses a combination of the VPC number, host number, and container number as the flow label for the created container.

[0061] like Figure 2 As shown, Figure 2 A diagram illustrating the format of the stream label field provided in an embodiment of this application. Figure 2 In the flow label, the VPC number, node number, and container number are included. The total length of the flow label is 20 bits, with the VPC number occupying 5 bits, the node number occupying 5 bits, and the container number occupying 12 bits.

[0062] It is understandable that the above three numbering methods are not fixed. The cloud or SDN controller can customize the allocation of the bits occupied by the above three numbering methods according to the actual network conditions to achieve effective utilization of flow label resources.

[0063] Optionally, in this embodiment of the application, the process of updating the local tag database and the corresponding entries in the tag forwarding table by the first host during the container migration process is also included.

[0064] Specifically, administrators input a first container migration command in the cloud or within the SDN controller. This first migration command includes the flow label (e.g., the fifth flow label) of the container to be migrated, the host number before migration, and the host number after migration (e.g., the fifth host). Based on the first container migration command, the cloud or SDN controller sends a second container migration command to the fifth host indicated by the post-migration host number. It is understood that this second container migration command includes the fifth flow label.

[0065] The fifth host can create a container locally according to the description of the foregoing embodiments and bind a fifth flow label to the created container. When the created container comes online, the fifth host generates a second neighbor advertisement message. This second neighbor advertisement message includes the IP address of the fifth host and the fifth flow label of the container in the fifth host.

[0066] After receiving the second neighbor advertisement message, the first host obtains the IP address and fifth flow label of the fifth host. Based on the fifth flow label, the first host retrieves the first label information entry corresponding to the fifth flow label from the label database. Based on the fifth host's IP address, the first host updates the IP address and MAC address of the host included in the first label information entry. Based on the fifth flow label, the first host retrieves the second label forwarding table entry corresponding to the fifth flow label from the label forwarding table. Based on the fifth host's IP address, the first host updates the IP address and MAC address of the host included in the second label forwarding table entry.

[0067] It should be noted that the host before the migration mentioned above may include the first host, or other hosts besides the first host and the fifth host.

[0068] Optionally, in this embodiment of the application, the first host may also be a host that has been migrated to create a container locally and send a neighbor announcement message to the neighbor.

[0069] Specifically, the cloud or SDN controller sends a third container migration instruction to the first host. This third container migration instruction includes the container's sixth flow tag. After receiving the third container migration instruction, the first host can create a container locally according to the description in the foregoing embodiments and bind the sixth flow tag to the created container.

[0070] When a container is created and started, the first host generates a third neighbor advertisement message, which includes the IP address of the first host and the sixth flow label of the created container.

[0071] The first host sends a third neighbor advertisement message to its neighbors. Upon receiving the second neighbor advertisement message, each neighbor retrieves the first host's IP address and sixth flow label from it. Based on the sixth flow label, each neighbor retrieves the corresponding label information entry from the label database. Based on the first host's IP address, each neighbor updates the label information entry, including the host's IP address and MAC address. Based on the sixth flow label, each neighbor retrieves the corresponding label forwarding entry from the label forwarding table. Based on the sixth host's IP address, each neighbor updates the label forwarding entry, including the host's IP address and MAC address.

[0072] Optionally, in this embodiment of the application, the process of the first host receiving a message sent by the second host and forwarding the message to the corresponding container is also included.

[0073] Specifically, when the second container within the second host is about to interact and communicate with the first container within the first host, the second host may generate and send a second message to the first host according to the description of the foregoing embodiments. This second message includes a first stream tag.

[0074] It is understood that the second message also includes a destination address field and a destination MAC address field. These fields can be configured with reference to the descriptions in the foregoing embodiments and existing protocol specifications, and will not be repeated here.

[0075] After receiving the second message, the first host determines the MAC address and IP address of the first host based on the destination MAC address and destination address fields. Then, the first host obtains the first flow label from the second message.

[0076] Based on the first-order label, the first host obtains the container number of the container, for example, the container number indicates the first container; the first host sends a second message to the first container.

[0077] Based on the same inventive concept, embodiments of this application also provide a communication device corresponding to the communication method. See also Figure 3 , Figure 3 The communication apparatus provided in this application embodiment is applied to a first host, the first host including a first container having a first stream tag, the apparatus including:

[0078] The first acquisition unit 310 is used to acquire the second stream label of the second container;

[0079] The second acquisition unit 320 is used to acquire a matching first label forwarding table entry from the label forwarding table according to the second flow label. The first label forwarding table entry includes the IP address of the second host where the second container is located and the MAC address of the second host.

[0080] The sending unit 330 is used to send a first message to a second host. The first message includes a destination address field, a destination MAC address field, and a flow label field. The destination address field stores the IP address of the second host, the destination MAC address field stores the MAC address of the second host, and the flow label field stores the second flow label, so that after receiving the first message, the second host sends the first message to the second container according to the second flow label.

[0081] Optionally, the apparatus further includes: a receiving unit (not shown in the figure), configured to receive first neighbor announcement messages sent by a plurality of third hosts, each first neighbor announcement message including the IP address of the third host and the third flow label of the third container included in the third host;

[0082] The third acquisition unit (not shown in the figure) is used to obtain the MAC address of each third host from the IP address of each third host;

[0083] A storage unit (not shown in the figure) is used to generate a corresponding tag information entry for each third container and store multiple tag information entries in the tag database. Each tag information entry includes the IP address of the third host, the MAC address of the third host, and the third stream tag.

[0084] Optionally, the storage unit (not shown in the figure) is further configured to generate a corresponding tag information entry for each first container included in the first host, and store multiple tag information entries in the tag database, wherein each tag information entry includes the IP address of the first host, the MAC address of the first host, and the first stream tag.

[0085] Optionally, the apparatus further includes: a generation unit (not shown in the figure), configured to generate the tag forwarding table based on a plurality of tag information entries stored in the tag database, the tag forwarding table including at least one tag forwarding table entry, each tag forwarding table entry including a first identifier of the first host, an IP address of the fourth host, a MAC address of the fourth host, and a fourth flow tag of the container in the fourth host.

[0086] Optionally, the flow label includes a Virtual Private Cloud (VPC) number;

[0087] The generation unit (not shown in the figure) is specifically used to obtain a fourth stream tag with the same VPC number from multiple third stream tags and multiple first stream tags;

[0088] Add a user identifier field to the tag information table entry for each fourth-stream tag obtained, resulting in multiple tag forwarding table entries. The first identifier is stored in the user identifier field.

[0089] Store multiple tag forwarding entries into the tag forwarding table.

[0090] Optionally, the flow tag may further include a host number and a container number;

[0091] The receiving unit (not shown in the figure) is also used to receive a container creation instruction sent by the cloud or SDN controller, the container creation instruction including the VPC number, the host number and the container number;

[0092] The apparatus further includes: a creation unit (not shown in the figure), used to create a container locally and use the combination of the VPC number, the host number and the container number as the flow tag of the created container;

[0093] The VPC number is configured by the administrator after creating the VPC on the cloud, and the host number and the container number are assigned by the Nova components included in the cloud.

[0094] Optionally, the receiving unit (not shown in the figure) is further configured to receive a second neighbor advertisement message sent by the fifth host, the second neighbor advertisement message including the IP address of the fifth host and the fifth flow tag of the container in the fifth host;

[0095] The first acquisition unit 310 is further configured to acquire, based on the fifth stream tag, a first tag information table entry corresponding to the fifth stream tag from the tag database;

[0096] The device further includes: an update unit (not shown in the figure), used to update the IP address and MAC address of the host included in the first tag information table entry according to the IP address of the fifth host;

[0097] The second acquisition unit 320 is further configured to, based on the fifth flow label, acquire a second label forwarding table entry corresponding to the fifth flow label from the label forwarding table;

[0098] The update unit (not shown in the figure) is also used to update the IP address and MAC address of the host included in the second tag forwarding table entry according to the IP address of the fifth host.

[0099] Optionally, the receiving unit (not shown in the figure) is further configured to receive a container migration instruction sent by the cloud or SDN controller, the container migration instruction including the sixth flow tag of the container;

[0100] The creation unit (not shown in the figure) is also used to create a container locally and bind the created container to the sixth stream tag;

[0101] The sending unit 330 is further configured to send a third neighbor announcement message when the created container starts, the third neighbor announcement message including the IP address of the first host and the sixth flow tag of the created container.

[0102] Optionally, the receiving unit (not shown in the figure) is further configured to receive a second message sent by the second host, the second message including the first stream tag;

[0103] The device further includes: a fourth acquisition unit (not shown in the figure), used to acquire the container number of the container based on the first stream tag;

[0104] The sending unit 330 is further configured to send the second message to the first container using the container number of the container.

[0105] Therefore, using the communication device provided in this application, the first host obtains the second flow label of the second container; based on the second flow label, the first host obtains a matching first label forwarding table entry from the label forwarding table, the first label forwarding table entry including the IP address of the second host where the second container is located and the MAC address of the second host; the first host sends a first message to the second host, the first message including a destination address field, a destination MAC address field and a flow label field, the destination address field storing the IP address of the second host, and the flow label field storing the second flow label, so that after receiving the first message, the second host sends the first message to the second container based on the second flow label.

[0106] Thus, in this application, containers within each host can communicate with each other using the container's flow tag. This solves the problems of existing methods using Flannel for cross-host container cluster communication, which generate a large amount of encapsulation and decapsulation work, resulting in high CPU pressure, low forwarding efficiency, complex network deployment, and low integration with cloud / SDN, and currently lacks a comprehensive cloud-integrated security isolation and management solution. It improves forwarding efficiency, optimizes host performance, and reduces complexity.

[0107] Based on the same inventive concept, embodiments of this application also provide a network device, such as... Figure 4 As shown, the system includes a processor 410, a transceiver 420, and a machine-readable storage medium 430. The machine-readable storage medium 430 stores machine-executable instructions that can be executed by the processor 410. The processor 410 is prompted by the machine-executable instructions to execute the communication method provided in the embodiments of this application. (The foregoing...) Figure 3 The communication device shown can be used as follows: Figure 4 The hardware structure of the network device shown is implemented.

[0108] The aforementioned computer-readable storage medium 430 may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the computer-readable storage medium 430 may also be at least one storage device located remotely from the aforementioned processor 410.

[0109] The processor 410 mentioned above can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0110] In this embodiment of the application, the processor 410 reads the machine-executable instructions stored in the machine-readable storage medium 430, and is prompted by the machine-executable instructions to enable the processor 410 itself and the transceiver 420 to execute the communication method described in the foregoing embodiment of the application.

[0111] In addition, this application provides a machine-readable storage medium 430 that stores machine-executable instructions. When called and executed by the processor 410, the machine-executable instructions cause the processor 410 itself and the transceiver 420 to execute the communication method described in the aforementioned application.

[0112] The specific implementation process of the functions and roles of each unit in the above device can be found in the implementation process of the corresponding steps in the above method, and will not be repeated here.

[0113] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this application according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0114] For the embodiments of communication devices and machine-readable storage media, since the methods involved are basically similar to those of the aforementioned method embodiments, the description is relatively simple, and relevant details can be found in the descriptions of the method embodiments.

[0115] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A communication method characterized by comprising: The method is applied to a first host, the first host comprises a first container, the first container has a first flow label, and the method comprises: obtaining a second flow label of a second container; obtaining a matched first label forwarding table item from a label forwarding table according to the second flow label, the first label forwarding table item comprising an IP address of a second host where the second container is located and a MAC address of the second host; sending a first packet to the second host, the first packet comprising a destination address field, a destination MAC address field and a flow label field, the IP address of the second host being stored in the destination address field, the MAC address of the second host being stored in the destination MAC address field, and the second flow label being stored in the flow label field, so that the second host sends the first packet to the second container according to the second flow label after receiving the first packet; The flow label comprises a virtual private cloud (VPC) number, a node number and a container number.

2. The method of claim 1, wherein, Before the step of obtaining the second flow label of the second container, the method further comprises: receiving first neighbor advertisement packets sent by a plurality of third hosts, each first neighbor advertisement packet comprising an IP address of the third host and a third flow label of a third container comprised in the third host; obtaining a MAC address of each third host from the IP address of the third host; generating a corresponding label information table item for each third container, and storing a plurality of label information table items in a label database, each label information table item comprising the IP address of the third host, the MAC address of the third host and the third flow label.

3. The method of claim 2, wherein, Before the step of obtaining the second flow label of the second container, the method further comprises: generating a corresponding label information table item for each first container comprised in the first host, and storing a plurality of label information table items in the label database, each label information table item comprising the IP address of the first host, the MAC address of the first host and the first flow label.

4. The method of claim 3, wherein, After the step of storing the plurality of label information table items in the label database, the method further comprises: generating the label forwarding table according to the plurality of label information table items stored in the label database, the label forwarding table comprising at least one label forwarding table item, each label forwarding table item comprising a first identifier of the first host, an IP address of a fourth host, a MAC address of the fourth host and a fourth flow label of a container in the fourth host.

5. The method of claim 4, wherein, The step of generating the label forwarding table according to the plurality of label information table items stored in the label database specifically comprises: obtaining a fourth flow label with the same VPC number from the plurality of third flow labels and the plurality of first flow labels; adding a user identifier field to each label information table item where each obtained fourth flow label is located to obtain a plurality of label forwarding table items, the user identifier field storing the first identifier; storing the plurality of label forwarding table items in the label forwarding table.

6. The method of claim 5, wherein, The flow label further comprises a host number and a container number. Before the step of obtaining the second flow label of the second container, the method further comprises: receiving a container creation instruction sent by a cloud or an SDN controller, the container creation instruction comprising the VPC number, the host number and the container number; locally creating a container and taking the combination of the VPC number, the host number and the container number as a flow label of the created container; wherein the VPC number is configured by an administrator after creating a VPC on the cloud, and the host number and the container number are allocated by a Nova component included in the cloud.

7. The method of claim 2, wherein, The method further comprises: receiving a second neighbor advertisement packet sent by a fifth host, the second neighbor advertisement packet comprising an IP address of the fifth host and a fifth flow label of a container in the fifth host; according to the fifth flow label, obtaining a first label information entry corresponding to the fifth flow label from the label database; according to the IP address of the fifth host, updating the IP address of the host and the MAC address of the host included in the first label information entry; and according to the fifth flow label, obtaining a second label forwarding entry corresponding to the fifth flow label from the label forwarding table; according to the IP address of the fifth host, updating the IP address of the host and the MAC address of the host included in the second label forwarding entry.

8. The method of claim 1, wherein, The method further comprises: receiving a container migration instruction sent by a cloud or an SDN controller, the container migration instruction comprising a sixth flow label of a container; locally creating a container and binding the created container with the sixth flow label; when the created container is started, sending a third neighbor advertisement packet, the third neighbor advertisement packet comprising an IP address of the first host and the sixth flow label of the created container.

9. The method of claim 1, wherein, The method further comprises: receiving a second packet sent by the second host, the second packet comprising the first flow label; according to the first flow label, obtaining a container number of a container; sending the second packet to the first container by using the container number of the container.

10. A communications device, characterized by The device is applied to a first host, the first host comprising a first container, the first container having a first flow label, and the device comprising: a first obtaining unit configured to obtain a second flow label of a second container; a second obtaining unit configured to, according to the second flow label, obtain a matched first label forwarding entry from a label forwarding table, the first label forwarding entry comprising an IP address of a second host where the second container is located and a MAC address of the second host; a sending unit configured to send a first packet to the second host, the first packet comprising a destination address field, a destination MAC address field and a flow label field, the destination address field storing the IP address of the second host, the destination MAC address field storing the MAC address of the second host, and the flow label field storing the second flow label, so that, after receiving the first packet, the second host sends the first packet to the second container according to the second flow label; the flow label comprising a virtual private cloud (VPC) number, a node number and a container number.

Citation Information

Patent Citations

  • Container communication method and system, controller and computer readable storage medium

    CN110769075A