A communication method and a forwarding device
Patent Information
- Application Number
- CN202310161813.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-23
- Publication Date
- 2026-08-18
- Estimated Expiration
- 2043-02-23
AI Technical Summary
但是,租户在虚拟计算节点和物理服务器中的服务之间如何互通成为问题
[0046]在本申请中,通过接收租户对应的待转发报文,从待转发报文中获得源MAC地址及目标MAC地址,将目标MAC地址与预设的第一MAC地址进行匹配,得到匹配结果,基于匹配结果,确定转发规则,基于转发规则,转发待转发报文,实现租户的服务基于租户的物理服务器和租户对应的虚拟计算节点之间的数据链路层进行互通。
Smart Images

Figure CN116319787B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a communication method and a forwarding device. Background Technology
[0002] Currently, with the development of virtualization technology, tenant services can be deployed on virtual compute nodes and physical servers that are different from the physical nodes used to deploy the virtual compute nodes. However, how tenant services can communicate with each other between virtual compute nodes and physical servers has become a problem. Summary of the Invention
[0003] This application provides the following technical solution:
[0004] This application provides a communication method, including:
[0005] Receive a message to be forwarded corresponding to a tenant, wherein the message to be forwarded comes from the tenant’s physical server or the virtual computing node corresponding to the tenant;
[0006] Obtain the source MAC address and destination MAC address from the packet to be forwarded;
[0007] The target MAC address is matched with a preset first MAC address to obtain a matching result;
[0008] Based on the matching results, the forwarding rules are determined;
[0009] Based on the forwarding rules, the message to be forwarded is forwarded.
[0010] Based on the matching results, the forwarding rules are determined, including:
[0011] If the matching result indicates that the target MAC address matches a preset first MAC address, the first forwarding rule corresponding to the source MAC address and the target MAC address is obtained. The first forwarding rule is used to indicate that a specified type of packet is forwarded.
[0012] Based on the forwarding rules, the message to be forwarded is forwarded, including:
[0013] Determine whether the message to be forwarded is a message of the specified type indicated by the first forwarding rule;
[0014] If so, the message to be forwarded is forwarded based on the first forwarding rule.
[0015] If the preset first MAC address contains the MAC address of the physical server and the MAC address of the virtual computing node;
[0016] The MAC address of the physical server is obtained in the following way:
[0017] In response to the access cluster request from the physical server, obtain the target IP address and the IP address and MAC address of the physical server;
[0018] Determine whether the IP address of at least one virtual computing node corresponding to the tenant contains a first IP address that is consistent with the target IP address and belongs to the same subnet as the IP address of the physical server;
[0019] If so, and it is determined that the IP address of the physical server is not occupied by any virtual computing node in the tenant's subnet, the MAC address of the physical server is recorded as one of the preset first MAC addresses.
[0020] The method further includes:
[0021] Configure a first forwarding rule corresponding to the preset first MAC address. The first forwarding rule is used to instruct the forwarding of packets of a specified type.
[0022] The method further includes:
[0023] Add a notification message to the information corresponding to the tenant's subnet. The notification message is used to indicate that the IP address of the physical server has been used.
[0024] The method further includes:
[0025] Record the IP address of the physical server;
[0026] The IP address and MAC address of the physical server are synchronized with the forwarding devices in other physical nodes, so that the forwarding devices in other physical nodes can configure the first forwarding rule corresponding to the MAC address of the physical server.
[0027] The method further includes:
[0028] Obtain the change information corresponding to the virtual computing node;
[0029] Based on the changed information, at least the forwarding rules should be updated.
[0030] The change information includes: information associated with newly created virtual computing nodes, information associated with deleted virtual computing nodes, or information associated with migrated virtual computing nodes;
[0031] The step of updating the forwarding rules based on the changed information includes:
[0032] Based on the information associated with the newly created virtual computing node, configure the forwarding rules corresponding to the newly created virtual computing node;
[0033] Alternatively, based on the information associated with the deleted virtual computing node, delete the forwarding rule corresponding to the deleted virtual computing node;
[0034] Alternatively, based on the information associated with the migrated virtual computing node, delete the forwarding rule corresponding to the migrated virtual computing node;
[0035] The information associated with the migrated virtual computing node is forwarded to the forwarding device of the target physical node to which the migrated virtual computing node is migrated, so that the forwarding device of the target physical node configures the forwarding rules corresponding to the migrated virtual computing node.
[0036] The method further includes:
[0037] The MAC address of the newly created virtual computing node is forwarded to the physical server, so that the physical server updates the packet forwarding path based on the MAC address of the newly created virtual computing node.
[0038] This application also provides a forwarding device, including: a forwarding module and a management module;
[0039] The forwarding module is used for:
[0040] Receive a message to be forwarded corresponding to a tenant, wherein the message to be forwarded comes from the tenant’s physical server or the virtual computing node corresponding to the tenant;
[0041] Obtain the source MAC address and destination MAC address from the packet to be forwarded;
[0042] The target MAC address is matched with a preset first MAC address to obtain a matching result;
[0043] Based on the matching results, the forwarding rules are determined;
[0044] Based on the forwarding rules, the message to be forwarded is forwarded;
[0045] The management module is used to configure the forwarding rules.
[0046] In this application, by receiving the packet to be forwarded corresponding to the tenant, obtaining the source MAC address and the destination MAC address from the packet to be forwarded, matching the destination MAC address with a preset first MAC address to obtain the matching result, determining the forwarding rule based on the matching result, and forwarding the packet to be forwarded based on the forwarding rule, the tenant's service is realized to achieve interconnection between the tenant's physical server and the virtual computing node corresponding to the tenant at the data link layer. Attached Figure Description
[0047] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0048] Figure 1 This is a flowchart illustrating a communication method provided in Embodiment 1 of this application;
[0049] Figure 2 This is a schematic diagram of an implementation scenario of a communication method provided in this application;
[0050] Figure 3 This is a flowchart illustrating a communication method provided in Embodiment 2 of this application;
[0051] Figure 4 This is a flowchart illustrating a scheme for obtaining the MAC address of a physical server according to Embodiment 3 of this application;
[0052] Figure 5 This is a flowchart illustrating a configuration scheme for a first forwarding rule provided in Embodiment 4 of this application;
[0053] Figure 6 This is a schematic diagram illustrating another implementation scenario of the communication method provided in this application;
[0054] Figure 7 This is a schematic diagram illustrating another implementation scenario of the communication method provided in this application;
[0055] Figure 8 This is a flowchart illustrating a communication method provided in Embodiment 5 of this application;
[0056] Figure 9 This is a flowchart illustrating a communication method provided in Embodiment 6 of this application;
[0057] Figure 10 This is a schematic diagram of a forwarding device provided in this application;
[0058] Figure 11 This is another schematic diagram of a forwarding device provided in this application. Detailed Implementation
[0059] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0060] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0061] Reference Figure 1 This is a flowchart illustrating a communication method provided in Embodiment 1 of this application, as shown below. Figure 1 As shown, the method may include, but is not limited to, the following steps:
[0062] Step S101: Receive the message to be forwarded corresponding to the tenant. The message to be forwarded comes from the tenant's physical server or the virtual computing node corresponding to the tenant.
[0063] In this embodiment, the tenant's services (e.g., applications) can be deployed on the tenant's physical server and the corresponding virtual computing node as needed. The services deployed on the tenant's physical server and the corresponding virtual computing node are not limited in this application, but it should be noted that the services on the tenant's physical server and the corresponding virtual computing node belong to the same tenant.
[0064] A tenant can have at least one virtual compute node. If a tenant has multiple virtual compute nodes, these nodes can be deployed on one physical node or on multiple physical nodes.
[0065] Virtual compute nodes can include, but are not limited to, virtual machines (VMs) (e.g., virtual machines managed by OpenStack) or containers (e.g., pods managed by Kubernetes).
[0066] The tenant's physical server is different from the physical node on which the virtual computing node corresponding to the tenant is deployed.
[0067] A tenant's physical server can execute the services deployed by the tenant and send messages to be forwarded to the virtual computing nodes corresponding to the tenant.
[0068] The virtual compute node corresponding to a tenant can also execute the services deployed by that tenant and send packets to be forwarded to the tenant's physical server. Specifically, packets to be forwarded can be sent to the tenant's physical server through the network interface of the virtual compute node (e.g., a veth pair interface).
[0069] The message to be forwarded can encapsulate the source MAC address and the destination MAC address. In the implementation where the message originates from a tenant's physical server, the source MAC address belongs to the tenant's physical server, and the destination MAC address is the virtual computing node that the tenant's physical server needs to communicate with. In the implementation where the message originates from a tenant's corresponding virtual computing node, the source MAC address belongs to the tenant's corresponding virtual computing node, and the destination MAC address is the physical server that the tenant's corresponding virtual computing node needs to communicate with.
[0070] In this embodiment, a forwarding device can be deployed in the physical node where the virtual computing node corresponding to the tenant is deployed. The forwarding device receives the packets to be forwarded from the physical server of the tenant or the virtual computing node corresponding to the tenant.
[0071] The forwarding device can connect to the tenant's physical server via VLAN (Virtual Local Area Network) to receive packets to be forwarded from the physical server, or send packets to be forwarded from the virtual computing node to the physical server.
[0072] The implementation method involves deploying multiple virtual computing nodes corresponding to a tenant across multiple physical nodes, with each physical node capable of deploying a forwarding device.
[0073] The forwarding device stores the IP and MAC addresses of the virtual compute nodes corresponding to the tenant, as well as the IP and MAC addresses of the tenant's physical server. The IP and MAC addresses of the virtual compute nodes corresponding to the tenant may, but are not limited to, being stored by the forwarding device when the virtual compute nodes are created. For example, if a tenant has multiple virtual compute nodes including pod1, VM2, pod3, and VM4, then... Figure 2 As shown, pod1 and VM2 are deployed on physical node Host1, and pod3 and VM4 are deployed on physical node Host2. Both physical nodes Host1 and Host2 have forwarding devices. The forwarding device deployed on physical node Host1 stores the IP address and MAC address of pod1 and VM2, and the forwarding device deployed on physical node Host2 stores the IP address and MAC address of pod3 and VM4.
[0074] Step S102: Obtain the source MAC address and destination MAC address from the packet to be forwarded.
[0075] In this embodiment, the forwarding device can be used to parse the packet to be forwarded and obtain the source MAC address and the destination MAC address from the packet to be forwarded.
[0076] Step S103: Match the target MAC address with the preset first MAC address to obtain the matching result.
[0077] In this embodiment, the forwarding device can match the target MAC address with a preset first MAC address to obtain a matching result.
[0078] The preset first MAC address is the MAC address of the tenant's physical server and the MAC address of the virtual computing node corresponding to the tenant, which are stored in the forwarding device.
[0079] Step S104: Determine the forwarding rules based on the matching results.
[0080] If the matching result indicates that the target MAC address matches the preset first MAC address, the forwarding device can determine the forwarding rules based on the matching result.
[0081] Forwarding rules are used to instruct the forwarding device to forward packets to virtual computing nodes or physical servers based on the target MAC address.
[0082] If the matching result indicates that the target MAC address does not match the preset first MAC address, the forwarding device may, but is not limited to, discarding the packet to be forwarded.
[0083] Step S105: Based on the forwarding rules, forward the message to be forwarded.
[0084] In this embodiment, for the implementation where the packet to be forwarded originates from the tenant's physical server, the forwarding device can forward the packet to be forwarded to the virtual computing node corresponding to the tenant based on forwarding rules. Specifically, the forwarding device can forward the packet to be forwarded to the network interface of the virtual computing node corresponding to the tenant based on forwarding rules, and the network interface will then send the packet to be forwarded to the virtual computing node.
[0085] In an implementation where the message to be forwarded originates from the virtual computing node corresponding to the tenant, the forwarding device can forward the message to be forwarded to the tenant's physical server based on forwarding rules.
[0086] In this embodiment, by receiving the packet to be forwarded corresponding to the tenant, the source MAC address and the target MAC address are obtained from the packet to be forwarded. The target MAC address is matched with a preset first MAC address to obtain the matching result. Based on the matching result, the forwarding rule is determined. Based on the forwarding rule, the packet to be forwarded is forwarded, so that the tenant's service can be interconnected based on the data link layer between the tenant's physical server and the virtual computing node corresponding to the tenant.
[0087] Furthermore, in scenarios where a tenant has multiple virtual computing nodes, each physical node is equipped with a forwarding device. This eliminates the need for a single physical node to forward packets to other physical nodes, preventing excessive packet reception or forwarding on any single physical node. Additionally, if one physical node fails, it ensures that the virtual computing nodes deployed on other physical nodes do not affect the data link layer communication between the tenant's physical server and the services provided. For example, if... Figure 2 The tenant's physical server encapsulates a forwarding packet 1 containing the MAC address of pod3 and the physical server's MAC address. The physical server forwards this packet 1 to the forwarding device in physical node Host2 via an external gateway device. The forwarding device in physical node Host2 receives packet 1, obtains the source MAC address (i.e., the physical server's MAC address) and the destination MAC address (i.e., pod3's MAC address) from it, matches pod3's MAC address with a preset first MAC address (i.e., the MAC addresses of pod3 and VM4), determines the matching result, establishes forwarding rules based on the matching result, and forwards the packet to pod3. Physical node Host1 does not need to receive packet 1, reducing the amount of packets received by Host1. Furthermore, if physical node Host1 fails, it will not affect the data link layer communication between pod3 or VM4 deployed in physical node Host2 and the tenant's physical server.
[0088] Furthermore, the communication method adopted in this application enables tenant services to communicate with each other at the data link layer between the tenant's physical server and the corresponding virtual computing node. This does not require reliance on the IP address configured for the virtual computing node's network interface using a CNI (container network interface). Therefore, there are no restrictions on the CNI used to configure the virtual computing node's network interface, allowing for the deployment of various CNIs (e.g., fannel, kube-ovn, and ovn), and unrestricted upgrades or switching of CNIs. For example, as... Figure 2 As shown, tenant services do not need to communicate with each other based on the paths corresponding to routers and CINs, and therefore do not need to rely on the IP addresses configured for the network interfaces of pod1, VM2, pod3 or VM4 by CNI.
[0089] As another optional embodiment of this application, refer to Figure 3 This is a flowchart illustrating a communication method provided in Embodiment 2 of this application. This embodiment is mainly a refinement of the communication method described in Embodiment 1 above. The method may include, but is not limited to, the following steps:
[0090] Step S201: Receive the message to be forwarded corresponding to the tenant. The message to be forwarded comes from the tenant's physical server or the virtual computing node corresponding to the tenant.
[0091] Step S202: Obtain the source MAC address and destination MAC address from the packet to be forwarded.
[0092] Step S203: Match the target MAC address with the preset first MAC address to obtain the matching result.
[0093] For a detailed description of steps S201-S203, please refer to the relevant description of steps S101-S103 in Example 1, which will not be repeated here.
[0094] Step S204: If the matching result indicates that the target MAC address matches the preset first MAC address, obtain the first forwarding rule corresponding to the source MAC address and the target MAC address. The first forwarding rule is used to indicate that the specified type of packet is forwarded.
[0095] The specified message type can correspond to the source MAC address and the destination MAC address, and this application does not impose any restrictions. For example, the specified message type can be, but is not limited to, a message with a destination port number of 80 in the transport layer.
[0096] Step S205: Determine whether the message to be forwarded is a message of the specified type indicated by the first forwarding rule.
[0097] If yes, proceed to step S206; otherwise, discard the message to be forwarded.
[0098] Step S206: Based on the first forwarding rule, forward the message to be forwarded.
[0099] In an implementation where the packet to be forwarded originates from the tenant's physical server, the forwarding device can forward the packet of a specified type to the virtual computing node to which the target MAC address belongs, based on a first forwarding rule.
[0100] In an implementation where the packet to be forwarded originates from the virtual computing node corresponding to the tenant, the forwarding device can forward a packet of a specified type to the physical server of the tenant whose target MAC address belongs.
[0101] In this embodiment, by receiving the packet to be forwarded corresponding to the tenant, the source MAC address and the destination MAC address are obtained from the packet to be forwarded. The destination MAC address is matched with a preset first MAC address to obtain a matching result. If the matching result indicates that the destination MAC address matches the preset first MAC address, the first forwarding rule corresponding to the source MAC address and the destination MAC address is obtained. It is determined whether the packet to be forwarded is a packet of a specified type indicated by the first forwarding rule. If so, the packet to be forwarded is forwarded based on the first forwarding rule, so that the tenant's service can communicate the specified type of packet to be forwarded based on the data link layer between the tenant's physical server and the virtual computing node corresponding to the tenant.
[0102] As another optional embodiment of this application, refer to Figure 4 This is a flowchart illustrating a scheme for obtaining the MAC address of a physical server according to Embodiment 3 of this application. The method may include, but is not limited to, the following steps:
[0103] Step S11: In response to the physical server's access cluster request, obtain the target IP address and the physical server's IP address and MAC address.
[0104] In this embodiment, when a tenant's physical server needs to access the virtual network, it can encapsulate a probe packet containing the target IPD address and the physical server's IP address and MAC address, and send the access cluster request carrying the probe packet to the virtual network.
[0105] It is understandable that in a virtual network where multiple virtual computing nodes corresponding to a tenant are deployed on multiple physical nodes, the forwarding module in the forwarding device deployed on each physical node can receive access cluster requests.
[0106] In the forwarding device, the forwarding module can respond to the access cluster request from the physical server, obtain the target IP address and the IP address and MAC address of the physical server from the probe packet, and send the target IP address and the IP address and MAC address of the physical server to the management module in the forwarding device. Alternatively, the forwarding module can directly send the access cluster request carrying the probe packet to the management module.
[0107] Step S12: Determine whether the IP address of at least one virtual computing node corresponding to the tenant contains a first IP address that is consistent with the target IP address and belongs to the same subnet as the physical server's IP address.
[0108] In this embodiment, the management module stores the IP address of at least one virtual computing node corresponding to a tenant.
[0109] The corresponding implementation method is to send the target IP address and the IP address and MAC address of the physical server to the management module in the forwarding device. The management module obtains the target IP address and the IP address and MAC address of the physical server by receiving the target IP address and the IP address and MAC address of the physical server.
[0110] The corresponding forwarding module directly sends the access cluster request carrying the probe packet to the management module. The management module obtains the target IP address and the IP address and MAC address of the physical server from the probe packet.
[0111] After obtaining the target IP address and the IP address and MAC address of the physical server sent by the forwarding module, the management module can check the legitimacy of the physical server based on the physical server's IP address and / or MAC address. If the physical server is legitimate, the management module can determine whether the IP address of at least one virtual computing node corresponding to the tenant contains a first IP address that is consistent with the target IP address and belongs to the same subnet as the physical server's IP address.
[0112] If yes, it means that the virtual computing node to which the first IP address belongs can communicate with the tenant's physical server via MAC address, then proceed to step S13; if no, the probe packet can be discarded.
[0113] Step S13: Determine that the IP address of the physical server is not occupied by any virtual computing node in the tenant's subnet, and record the MAC address of the physical server as one of the preset first MAC addresses.
[0114] In this embodiment, the management module can determine whether the physical server's IP address is not occupied by any virtual computing node in the tenant's subnet. If it is not occupied by any virtual computing node in the tenant's subnet, it means that there is no IP address conflict. At the very least, the forwarding module can be instructed to record the physical server's MAC address as one of the preset first MAC addresses.
[0115] Of course, in addition to instructing the forwarding module to record the physical server's MAC address as one of the preset first MAC addresses, the management module can also record the physical server's MAC address as one of the preset first MAC addresses.
[0116] If the virtual computing nodes within the tenant's subnet are not occupied, a notification message can be added to the information corresponding to the tenant's subnet. This notification message indicates that the physical server's IP address has been used.
[0117] When creating a new virtual computing node, you can configure an IP address that does not conflict with the physical server's IP address based on the prompt information.
[0118] In this embodiment, the IP address of the physical server can also be recorded; the IP address and MAC address of the physical server can be synchronized with the forwarding devices in other physical nodes so that the forwarding devices in other physical nodes can configure the first forwarding rule corresponding to the MAC address of the physical server.
[0119] Specifically, the management modules in the forwarding device can interact with each other. The management module synchronizes the IP address and MAC address of the physical server with the management modules of the forwarding devices in other physical nodes, so that the management modules of the forwarding devices in other physical nodes can configure the first forwarding rule corresponding to the MAC address of the physical server.
[0120] It should be noted that the forwarding module also needs to forward the probe message to at least one virtual computing node deployed in its physical node. The virtual computing node obtains the target IP address from the probe message, determines whether the target IP address is consistent with its own IP address, and if they are consistent, encapsulates a response message containing the MAC address and IP address of the virtual computing node and the IP address and MAC address of the tenant's physical server, and sends the response message to the forwarding module, which then forwards it to the tenant's physical server.
[0121] The tenant's physical server obtains the MAC address of the virtual compute node to which the target IP address belongs through the response message. For example, if... Figure 2 The physical server of the tenant shown needs to be connected to Figure 2 For pod3 to communicate, the tenant's physical server encapsulates a probe packet containing the tenant's physical server's IP address and MAC address, as well as the IP address of pod3 (i.e., the target IP address). This probe packet is then sent to the forwarding devices in physical nodes Host1 and Host2. The forwarding device in Host1 discards the probe packet, while the forwarding device in Host2 forwards it to pod3 and VM4. VM4 discards the probe packet after comparing the IP addresses. pod3, after comparing the IP addresses, encapsulates a response packet containing its own IP address and MAC address, as well as the IP address and MAC address of the tenant's physical server. This response packet is then sent to the forwarding module, which forwards it to the tenant's physical server. The tenant's physical server obtains the MAC address of pod3 from the response packet.
[0122] As another optional embodiment of this application, refer to Figure 5This is a flowchart illustrating a configuration scheme for a first forwarding rule provided in Embodiment 4 of this application. The method may include, but is not limited to, the following steps:
[0123] Step S21: In response to the physical server's access cluster request, obtain the target IP address and the physical server's IP address and MAC address.
[0124] Step S22: Determine whether the IP address of at least one virtual computing node corresponding to the tenant contains a first IP address that is consistent with the target IP address and belongs to the same subnet as the physical server's IP address.
[0125] If so, proceed to step S23.
[0126] Step S23: Determine that the IP address of the physical server is not occupied by any virtual computing node in the tenant's subnet, and record the MAC address of the physical server as one of the preset first MAC addresses.
[0127] For detailed procedures of steps S21-S23, please refer to the relevant description of steps S11-S13 in Example 3, which will not be repeated here.
[0128] Step S24: Configure the first forwarding rule corresponding to the preset first MAC address. The first forwarding rule is used to indicate that packets of a specified type should be forwarded.
[0129] The first forwarding rule corresponding to the first MAC address can be understood as: the first forwarding rule corresponding to the MAC address of the physical server and the MAC address of the virtual computing node that need to communicate.
[0130] In this embodiment, the management module can configure a first forwarding rule corresponding to a preset first MAC address based on the service requirements of tenants between physical servers and virtual computing nodes that need to communicate.
[0131] The management module can pre-deploy the first forwarding rule corresponding to the first MAC address to the forwarding module. For example, if... Figure 2 The tenant's physical server needs to communicate with pod3. The tenant's physical server encapsulates a probe packet containing the tenant's physical server's IP address and MAC address, as well as pod3's IP address (i.e., the target IP address). This probe packet-carrying access request is then sent to the forwarding devices in physical nodes Host1 and Host2. Figure 6 As shown, the management module in the physical node Host2 can send the first forwarding rule corresponding to the preset first MAC address to the forwarding module after responding to the tenant's physical server's access cluster request.
[0132] The management module can also respond to the forwarding module's request by sending the first forwarding rules corresponding to the source MAC address and destination MAC address from the preset first forwarding rules for the first MAC address to the forwarding module. For example, if... Figure 2 The tenant's physical server needs to communicate with pod3. The tenant's physical server encapsulates a forwarding packet containing the IP and MAC addresses of both the physical server and pod3. The physical server sends this packet to the forwarding module in the physical node Host2. The forwarding module receives the packet, retrieves the MAC addresses of the physical server and pod3, matches pod3's MAC address with a preset first MAC address, and sends the matching result to the management module. Figure 7 As shown, in response to the request, the management module sends the first forwarding rule corresponding to the MAC address of the physical server and the MAC address of pod3 to the forwarding module.
[0133] As another optional embodiment of this application, refer to Figure 8 This is a flowchart illustrating a communication method provided in Embodiment 5 of this application. This embodiment is mainly an extension of the communication method described in Embodiment 1 above. The method may include, but is not limited to, the following steps:
[0134] Step S301: Receive the message to be forwarded corresponding to the tenant. The message to be forwarded comes from the tenant's physical server or the virtual computing node corresponding to the tenant.
[0135] Step S302: Obtain the source MAC address and destination MAC address from the packet to be forwarded.
[0136] Step S303: Match the target MAC address with the preset first MAC address to obtain the matching result.
[0137] Step S304: Determine the forwarding rules based on the matching results.
[0138] Step S305: Based on the forwarding rules, forward the message to be forwarded.
[0139] For detailed procedures of steps S301-S305, please refer to the relevant description of steps S101-S105 in Example 1, which will not be repeated here.
[0140] Step S306: Obtain the change information corresponding to the virtual computing node.
[0141] In this embodiment, the forwarding device can monitor the virtual computing nodes deployed in its physical node. If a change is detected in the virtual computing node, the device can obtain the change information corresponding to the virtual computing node.
[0142] Specifically, the monitoring module in the forwarding device can monitor the virtual computing nodes deployed in its physical node. If a change is detected in the virtual computing node, the corresponding change information of the virtual computing node can be obtained.
[0143] If a change is detected in a virtual computing node, the information obtained regarding the change in the virtual computing node may include, but is not limited to:
[0144] S3061. If a newly created virtual computing node is detected, obtain the information associated with the newly created virtual computing node.
[0145] The information associated with a newly created virtual computing node may include, but is not limited to, the IP address, MAC address, and network interface information of the newly created virtual computing node.
[0146] If changes are detected in virtual computing nodes, the information on these changes can be obtained, including but not limited to:
[0147] S3062. If a virtual computing node is detected to be deleted, obtain information associated with the deleted virtual computing node.
[0148] Information associated with a deleted virtual compute node may include, but is not limited to, the IP address, MAC address, and network interface information of the deleted virtual compute node.
[0149] If changes are detected in virtual computing nodes, the information on these changes can be obtained, including but not limited to:
[0150] S3063. If a virtual computing node migration is detected, obtain information associated with the migrated virtual computing node.
[0151] Information associated with the migrated virtual compute node may include, but is not limited to, the IP address, MAC address, and network interface information of the migrated virtual compute node.
[0152] The monitoring module can send change information to the management module.
[0153] Step S307: Based on the changed information, at least update the forwarding rules.
[0154] In this embodiment, the management module can update the forwarding rules based on the changed information.
[0155] Corresponding to step S3061, this step may include, but is not limited to:
[0156] S3071. Based on the information associated with the newly created virtual computing node, configure the forwarding rules corresponding to the newly created virtual computing node.
[0157] Step S3071 may include, but is not limited to:
[0158] Based on the MAC address of the newly created virtual computing node, configure the forwarding module to match the forwarding rules corresponding to the MAC address of the tenant's physical server and the MAC address of the newly created virtual computing node, and configure the extraction rules for the network interface of the newly created virtual computing node based on the network interface information of the newly created virtual computing node.
[0159] The forwarding module has forwarding rules corresponding to the MAC address of the tenant's physical server and the MAC address of the newly created virtual computing node. These rules are used to instruct whether to forward packets from the tenant's physical server to the network interface of the newly created virtual computing node based on the MAC address of the newly created virtual computing node, or to forward packets from the newly created virtual computing node to the tenant's physical server based on the MAC address of the tenant's physical server.
[0160] The extraction rules for the network interface of the newly created virtual computing node are used to instruct the network interface to receive packets forwarded to the newly created virtual computing node and send the packets to the newly created virtual computing node; or, to receive packets sent by the newly created virtual computing node to the tenant's physical server and send the packets sent to the tenant's physical server to the forwarding module.
[0161] Corresponding to step S3062, step S307 may include, but is not limited to:
[0162] S3072. Based on the information associated with the deleted virtual computing node, delete the forwarding rule corresponding to the deleted virtual computing node.
[0163] Step S3072 may include, but is not limited to:
[0164] Based on the MAC address of the deleted virtual computing node, obtain the forwarding rule corresponding to the MAC address of the deleted virtual computing node, and delete the forwarding rule corresponding to the MAC address of the deleted virtual computing node.
[0165] Corresponding to step S3063, step S307 may include, but is not limited to:
[0166] S3073. Based on the information associated with the migrated virtual computing node, delete the forwarding rule corresponding to the migrated virtual computing node.
[0167] Step S3073 may include, but is not limited to:
[0168] Based on the MAC address of the migrated virtual computing node, obtain the forwarding rules corresponding to the MAC address of the migrated virtual computing node, and delete the forwarding rules corresponding to the MAC address of the migrated virtual computing node.
[0169] S3074. Forward the information associated with the migrated virtual computing node to the forwarding device of the target physical node to which the migrated virtual computing node is migrated, so that the forwarding device of the target physical node configures the forwarding rules corresponding to the migrated virtual computing node.
[0170] The forwarding rules configured on the target physical node for the migrated virtual computing node may include, but are not limited to:
[0171] Based on the MAC address of the migrated virtual computing node, configure the forwarding rules in the forwarding module of the target physical node that correspond to the MAC address of the tenant's physical server and the MAC address of the migrated virtual computing node, and configure the extraction rules for the network interface of the migrated virtual computing node based on the network interface information of the migrated virtual computing node.
[0172] The forwarding rules in the forwarding module of the target physical node, corresponding to the MAC address of the tenant's physical server and the MAC address of the migrated virtual computing node, are used to instruct that, based on the MAC address of the migrated virtual computing node, packets from the tenant's physical server are forwarded to the network interface of the migrated virtual computing node, or, based on the MAC address of the tenant's physical server, packets from the migrated virtual computing node are forwarded to the tenant's physical server.
[0173] The extraction rules for the network interface of the migrated virtual computing node are used to instruct the network interface to receive packets forwarded to the migrated virtual computing node and send the packets to the migrated virtual computing node; or, to receive packets sent by the migrated virtual computing node to the tenant's physical server and send the packets sent to the tenant's physical server to the forwarding module in the forwarding device of the target physical node.
[0174] In this embodiment, the monitoring module can also monitor the status of the tenant's physical server. If the tenant's physical server is unavailable, it can notify the management module to delete the forwarding rule corresponding to the tenant's physical server.
[0175] In this embodiment, by obtaining the change information corresponding to the virtual computing node, and based on the change information, at least the forwarding rules are updated to ensure that the services in the tenant's physical server and the virtual computing node corresponding to the tenant can communicate with each other.
[0176] As another optional embodiment of this application, refer to Figure 9This is a flowchart illustrating a communication method provided in Embodiment 6 of this application. This embodiment is mainly an extension of the communication method described in Embodiment 5 above. The method may include, but is not limited to, the following steps:
[0177] Step S401: Receive the message to be forwarded corresponding to the tenant. The message to be forwarded comes from the tenant's physical server or the virtual computing node corresponding to the tenant.
[0178] Step S402: Obtain the source MAC address and destination MAC address from the packet to be forwarded.
[0179] Step S403: Match the target MAC address with the preset first MAC address to obtain the matching result.
[0180] Step S404: Determine the forwarding rules based on the matching results.
[0181] Step S405: Based on the forwarding rules, forward the message to be forwarded.
[0182] Step S406: Obtain information associated with the newly created virtual computing node.
[0183] Step S407: Based on the information associated with the newly created virtual computing node, configure the forwarding rules corresponding to the newly created virtual computing node.
[0184] For a detailed description of steps S401-S407, please refer to the relevant description of steps S301-S307 in Example 5, which will not be repeated here.
[0185] Step S408: Forward the MAC address of the newly created virtual computing node to the physical server so that the physical server updates the packet forwarding path based on the MAC address of the newly created virtual computing node.
[0186] In this embodiment, the management module can send the MAC address of the newly created virtual computing node to the forwarding module, instructing the forwarding module to forward the MAC address of the newly created virtual computing node to the physical server.
[0187] Accordingly, the forwarding module forwards the MAC address of the newly created virtual computing node to the physical server.
[0188] The physical server updates the packet forwarding path based on the MAC address of the newly created virtual computing node, enabling the physical server to communicate with the newly created virtual computing node at the data link layer based on the updated packet forwarding path.
[0189] The following section describes a forwarding device provided in this application. The forwarding device described below can be referred to in correspondence with the communication method described above.
[0190] Please see Figure 10 The forwarding device includes: a forwarding module 100 and a management module 200.
[0191] Forwarding module 100 is used for:
[0192] Receive the message to be forwarded corresponding to the tenant. The message to be forwarded comes from the tenant's physical server or the virtual computing node corresponding to the tenant.
[0193] Obtain the source MAC address and destination MAC address from the packet to be forwarded;
[0194] The target MAC address is matched with a preset first MAC address to obtain the matching result;
[0195] Based on the matching results, the forwarding rules are determined;
[0196] Based on the forwarding rules, forward the message to be forwarded.
[0197] The management module 200 is used to configure the forwarding rules.
[0198] In this embodiment, the process by which the forwarding module 100 determines forwarding rules based on the matching results may specifically include:
[0199] If the matching result indicates that the target MAC address matches the preset first MAC address, the first forwarding rule corresponding to the source MAC address and the target MAC address is obtained. The first forwarding rule is used to indicate that the specified type of packet is forwarded.
[0200] The forwarding module 100 forwards the message to be forwarded based on the forwarding rules, which may specifically include:
[0201] Determine whether the message to be forwarded is a message of the specified type indicated by the first forwarding rule;
[0202] If so, forward the message to be forwarded based on the first forwarding rule.
[0203] In this embodiment, if the preset first MAC address includes the MAC address of the physical server and the MAC address of the virtual computing node, the management module 200 can also be used for:
[0204] In response to the physical server's cluster access request, obtain the target IP address and the physical server's IP address and MAC address;
[0205] Determine whether the IP address of at least one virtual computing node corresponding to the tenant contains a first IP address that is consistent with the target IP address and belongs to the same subnet as the IP address of the physical server;
[0206] If so, and it is determined that the physical server's IP address is not occupied by any virtual computing node within the tenant's subnet, the physical server's MAC address is recorded as one of the preset first MAC addresses.
[0207] The management module can also be used to configure the first forwarding rule corresponding to the preset first MAC address. The first forwarding rule is used to indicate that packets of a specified type should be forwarded.
[0208] The management module 200 can also be used to add prompts to the information corresponding to the tenant's subnet, which are used to indicate that the physical server's IP address has been used.
[0209] The management module 200 can also be used to record the IP address of the physical server;
[0210] The IP address and MAC address of the physical server are synchronized with the forwarding devices in other physical nodes, so that the forwarding devices in other physical nodes can configure the first forwarding rule corresponding to the MAC address of the physical server.
[0211] In this embodiment, as Figure 11 As shown, the relay device may further include:
[0212] The monitoring module 300 is used to obtain change information corresponding to the virtual computing nodes.
[0213] Change information may include, but is not limited to: information associated with newly created virtual computing nodes, information associated with deleted virtual computing nodes, or information associated with migrated virtual computing nodes;
[0214] The management module 200 can also be used to update forwarding rules based on changes in information.
[0215] The management module 200 updates the forwarding rules based on the changed information, which may include:
[0216] Configure the forwarding rules corresponding to the newly created virtual computing node based on the information associated with the newly created virtual computing node;
[0217] Alternatively, based on the information associated with the deleted virtual computing node, delete the forwarding rule corresponding to the deleted virtual computing node;
[0218] Alternatively, based on the information associated with the migrated virtual computing node, delete the forwarding rule corresponding to the migrated virtual computing node;
[0219] The information associated with the migrated virtual computing node is forwarded to the forwarding device of the target physical node to which the migrated virtual computing node is migrated, so that the forwarding device of the target physical node can configure the forwarding rules corresponding to the migrated virtual computing node.
[0220] In this embodiment, the management module 200 can also be used to send the MAC address of the newly created virtual computing node to the forwarding module 100.
[0221] The forwarding module 100 can also be used to forward the MAC address of the newly created virtual computing node to the physical server, so that the physical server can update the packet forwarding path based on the MAC address of the newly created virtual computing node.
[0222] It should be noted that each embodiment focuses on describing the differences from other embodiments, and the same or similar parts between the embodiments can be referred to accordingly. For the device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments.
[0223] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus 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 apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0224] For ease of description, the above devices are described in terms of function, divided into various modules. Of course, in implementing this application, the functions of each module can be implemented in one or more software and / or hardware.
[0225] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, 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 can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.
[0226] The communication method and forwarding device provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A communication method, comprising: The forwarding device receives a packet to be forwarded corresponding to a tenant. The packet to be forwarded comes from the tenant's physical server or the virtual computing node corresponding to the tenant. The forwarding device is deployed in the physical node of the virtual computing node corresponding to the tenant. The forwarding device obtains the source MAC address and the destination MAC address from the packet to be forwarded; The forwarding device matches the target MAC address with a preset first MAC address to obtain a matching result. The preset first MAC address is the MAC address of the tenant's physical server and the MAC address of the virtual computing node corresponding to the tenant stored in the forwarding device. The IP address of the tenant's physical server and the IP address of the virtual computing node corresponding to the tenant stored in the forwarding device belong to the same subnet. The forwarding device determines the forwarding rules based on the matching results; The forwarding device forwards the message to be forwarded based on the forwarding rules.
2. The method according to claim 1, wherein determining forwarding rules based on the matching result includes: If the matching result indicates that the target MAC address matches a preset first MAC address, the first forwarding rule corresponding to the source MAC address and the target MAC address is obtained. The first forwarding rule is used to indicate that a specified type of packet is forwarded. Based on the forwarding rules, the message to be forwarded is forwarded, including: Determine whether the message to be forwarded is a message of the specified type indicated by the first forwarding rule; If so, the message to be forwarded is forwarded based on the first forwarding rule.
3. The method according to claim 1, wherein the preset first MAC address includes the MAC address of the physical server and the MAC address of the virtual computing node; The MAC address of the physical server is obtained in the following way: In response to the access cluster request from the physical server, obtain the target IP address and the IP address and MAC address of the physical server; Determine whether the IP address of at least one virtual computing node corresponding to the tenant contains a first IP address that is consistent with the target IP address and belongs to the same subnet as the IP address of the physical server; If so, and it is determined that the IP address of the physical server is not occupied by any virtual computing node in the tenant's subnet, the MAC address of the physical server is recorded as one of the preset first MAC addresses.
4. The method according to claim 3, further comprising: Configure a first forwarding rule corresponding to the preset first MAC address. The first forwarding rule is used to instruct the forwarding of packets of a specified type.
5. The method according to claim 3, further comprising: Add a notification message to the information corresponding to the tenant's subnet. The notification message is used to indicate that the IP address of the physical server has been used.
6. The method according to claim 3, further comprising: Record the IP address of the physical server; The IP address and MAC address of the physical server are synchronized with the forwarding devices in other physical nodes, so that the forwarding devices in other physical nodes can configure the first forwarding rule corresponding to the MAC address of the physical server.
7. The method according to claim 1, further comprising: Obtain the change information corresponding to the virtual computing node; Based on the changed information, at least the forwarding rules should be updated.
8. The method according to claim 7, wherein the change information includes: Information associated with newly created virtual computing nodes, information associated with deleted virtual computing nodes, or information associated with migrated virtual computing nodes; The step of updating the forwarding rules based on the changed information includes: Based on the information associated with the newly created virtual computing node, configure the forwarding rules corresponding to the newly created virtual computing node; Alternatively, based on the information associated with the deleted virtual computing node, delete the forwarding rule corresponding to the deleted virtual computing node; Alternatively, based on the information associated with the migrated virtual computing node, delete the forwarding rule corresponding to the migrated virtual computing node; The information associated with the migrated virtual computing node is forwarded to the forwarding device of the target physical node to which the migrated virtual computing node is migrated, so that the forwarding device of the target physical node configures the forwarding rules corresponding to the migrated virtual computing node.
9. The method according to claim 8, further comprising: The MAC address of the newly created virtual computing node is forwarded to the physical server, so that the physical server updates the packet forwarding path based on the MAC address of the newly created virtual computing node.
10. A forwarding device, the forwarding device being deployed in the physical node of a virtual computing node corresponding to a tenant, comprising: Forwarding module and management module; The forwarding module is used for: Receive a message to be forwarded corresponding to a tenant, wherein the message to be forwarded comes from the tenant’s physical server or the virtual computing node corresponding to the tenant; Obtain the source MAC address and destination MAC address from the packet to be forwarded; The target MAC address is matched with a preset first MAC address to obtain a matching result. The preset first MAC address is the MAC address of the tenant's physical server and the MAC address of the virtual computing node corresponding to the tenant stored in the forwarding device. The IP address of the tenant's physical server and the IP address of the virtual computing node corresponding to the tenant stored in the forwarding device belong to the same subnet. Based on the matching results, the forwarding rules are determined; Based on the forwarding rules, the message to be forwarded is forwarded; The management module is used to configure the forwarding rules.
Citation Information
Patent Citations
Physical device and virtual network communication method and system based on SDN (Software Defined Network)
CN109660443A
Data transmission method and device, flow table configuration method and device, equipment and storage medium
CN114422471A