Port binding method and related device

By setting the same node identifier and different bound port network addresses for the host nodes of the multi-node server, the compatibility problem of link backup in the multi-node server is solved, and link redundancy and normality of data transmission is achieved.

CN119276834APending Publication Date: 2025-01-07TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202310820331.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-05
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

In multi-node servers, it is difficult for the prior art to realize link backup because the switch's processing logic is incompatible with multiple bound ports corresponding to multiple host nodes, resulting in link redundancy being unable to be realized.

Method used

By setting the same node identifier for different host nodes in the same server and setting different binding port network addresses for different host nodes, multiple ports of the network card belong to the same binding port during link backup, thus the switch Processing logic compatible, implementing link backup of multi-node servers.

Benefits of technology

There is no need to modify the switch software configuration, and link backup of multi-node servers is realized, avoiding data transmission confusion and improving network availability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119276834A_ABST
    Figure CN119276834A_ABST
Patent Text Reader

Abstract

The invention discloses a port binding method and a related device, a server can comprise a first host node and a second host node, and the first host node and the second host node are respectively connected with a first switch through a first port of a network card and are respectively connected with a second switch through a second port of the network card. The first host node and the second host node can have the same node identifier and network addresses of different binding ports, the same node identifier enables the first host node and the second host node not to be differentiated in terms of identification, only one host node interacts with the switch logically and is compatible with interaction logic of the switch, and the interaction logic of the first host node and the second host node is compatible with the interaction logic of the switch. Therefore, the link backup of the multi-node server can be realized without modifying and adapting the software of the switch, and the link backup of the first host node and the link backup of the second host node are realized under the conditions of not modifying the software configuration of the switch and not influencing normal data transmission.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a port binding method and related devices. Background Art

[0002] Data centers usually include multiple servers, which are connected to the network through network interfaces (NICs). In order to improve network availability, the network architecture of data centers is usually set to 1+1 backup. In the link backup scenario, the network interface card can be set to have two ports connected to different switches. These two ports are bound (bonding), and logically they are a bound port. Data packets can be distributed between these two ports according to certain policies. The bandwidth of such a bound port can be regarded as the sum of the bandwidths of the two bound ports, which increases the port bandwidth and realizes link redundancy. Even if one of the ports or switches has a physical failure, normal data transmission can be carried out.

[0003] When each server is configured with a dedicated network card, the server can bind the network port. However, when the server contains multiple host nodes (host) and multiple host nodes share the network card, multiple host nodes are required to bind two ports separately so that each port of the network card belongs to the binding port corresponding to each host node at the same time. This binding method is incompatible with the processing logic of the switch. Therefore, for a multi-node server containing multiple host nodes, link backup is usually not possible. Summary of the invention

[0004] In order to solve the above technical problems, the present application provides a port binding method and related devices. By setting the same node identifier for different host nodes in the same server, multiple ports of the network card can also belong to the same binding port when setting link backup for the server. By setting different network addresses of binding ports for different host nodes to distinguish different host nodes, link backup of multi-node servers can be achieved.

[0005] The embodiments of the present application disclose the following technical solutions:

[0006] On the one hand, the present application provides a port binding method, which is applied to a first host node in a server, wherein the server also includes a second host node, wherein the first host node and the second host node are respectively connected to a first switch through a first port of a network card, and are respectively connected to a second switch through a second port of the network card;

[0007] The method comprises:

[0008] Logically binding the first port and the second port as a binding port of the first host node;

[0009] sending a first protocol message to the first switch and the second switch through the first port and the second port respectively, wherein the first protocol message includes a node identifier of the first host node and a network address of a binding port of the first host node, the node identifier of the first host node is the same as the node identifier of the second host node, the network address of the binding port of the first host node is different from the network address of the binding port of the second host node, and the binding port of the second host node is obtained by logically binding the first port and the second port;

[0010] A second protocol message is obtained from the first switch through the first port, and a third protocol message is obtained from the second switch through the second port, wherein the second protocol message includes a network address of the first switch, and the third protocol message includes a network address of the second switch, so as to access the network through the first switch and the second switch.

[0011] On the other hand, the present application provides a port binding device, which is applied to a first host node in a server, wherein the server also includes a second host node, wherein the first host node and the second host node are respectively connected to a first switch through a first port of a network card, and are respectively connected to a second switch through a second port of the network card;

[0012] The device comprises a binding unit, and a protocol message sending unit and a protocol message receiving unit respectively connected to the binding unit, wherein the protocol message sending unit and the protocol message receiving unit are respectively connected to the network card;

[0013] The binding unit logically binds the first port and the second port as a binding port of the first host node;

[0014] The protocol message sending unit sends a first protocol message to the first switch and the second switch through the first port and the second port respectively, wherein the first protocol message includes a node identifier of the first host node and a network address of a binding port of the first host node, the node identifier of the first host node is the same as the node identifier of the second host node, the network address of the binding port of the first host node is different from the network address of the binding port of the second host node, and the binding port of the second host node is obtained by logically binding the first port and the second port;

[0015] The protocol message receiving unit obtains a second protocol message from the first switch through the first port, and obtains a third protocol message from the second switch through the second port, wherein the second protocol message includes a network address of the first switch, and the third protocol message includes a network address of the second switch, so as to access the network through the first switch and the second switch.

[0016] In another aspect, the present application provides a computer device, the device comprising a processor and a memory:

[0017] The memory is used to store a computer program and transmit the computer program to the processor;

[0018] The processor is used to execute the port binding method described in the above aspect according to the instructions in the computer program.

[0019] On the other hand, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the port binding method described in the above aspect.

[0020] On the other hand, an embodiment of the present application provides a computer program product including a computer program, which, when executed on a computer device, enables the computer device to execute the port binding method.

[0021] It can be seen from the above technical solution that the server may include a first host node and a second host node, the first host node and the second host node are respectively connected to the first switch through the first port of the network card, and are respectively connected to the second switch through the second port of the network card, the first host node logically binds the first port and the second port as the binding port of the first host node, and the second host node logically binds the first port and the second port as the binding port of the second host node, the first host node and the second host node may have the same node identifier and different network addresses of the binding ports, the same node identifier makes there no identification distinction between the first host node and the second host node, from the perspective of the first switch and the second switch, the first host node and the second host node are the same node, logically only one host node interacts with the switch, so that the two ports of the network card do not need to belong to multiple binding ports when setting link backup for multiple host nodes, and are compatible with the interaction logic of the switch, so that the software of the switch does not need to be modified and adapted to achieve link backup of a multi-node server.

[0022] In addition, since the network addresses of the binding ports of different host nodes are different, the network card can identify the first host node and the second host node through the network address of the binding port during the data forwarding process, which will not cause confusion between different host nodes and will not affect normal data transmission. The first host node can send a first protocol message to the first switch and the second switch through the first port and the second port respectively, the first protocol message includes the node identifier of the first host node and the network address of the binding port of the first host node, obtain the second protocol message from the first switch through the first port, and obtain the third protocol message from the second switch through the second port, the second protocol message includes the network address of the first switch, and the third protocol message includes the network address of the second switch, so that according to the network address of the first switch and the network address of the second switch, the network can be accessed through the first switch and the second switch, so that the link backup of the first host node and the link backup of the second host node are realized without modifying the software configuration of the switch and without affecting normal data transmission through the setting of the node identifier and the network address of the binding port. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0024] Figure 1 A schematic diagram of an application scenario of a port binding method provided in an embodiment of the present application;

[0025] Figure 2 A flow chart of a port binding method provided in an embodiment of the present application;

[0026] Figure 3 A schematic diagram of port binding provided in an embodiment of the present application;

[0027] Figure 4 A schematic diagram of server transformation provided in an embodiment of the present application;

[0028] Figure 5 Another port binding schematic diagram provided for an embodiment of the present application;

[0029] Figure 6 A schematic diagram of another port binding provided in an embodiment of the present application;

[0030] Figure 7 A schematic diagram of another port binding provided in an embodiment of the present application;

[0031] Figure 8 A schematic diagram of the format of a first protocol message provided in an embodiment of the present application;

[0032] Fig. 9 A schematic diagram of a protocol message interaction process provided in an embodiment of the present application;

[0033] Fig.10 A data flow diagram provided for an embodiment of the present application;

[0034] Fig.11 Another data flow diagram provided for an embodiment of the present application;

[0035] Fig.12 Another data flow diagram provided for an embodiment of the present application;

[0036] Fig.13 A structural block diagram of a port binding device provided in an embodiment of the present application;

[0037] Fig.14 A structural diagram of a terminal device provided in an embodiment of the present application;

[0038] Fig.15 A structural diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] The embodiments of the present application are described below in conjunction with the accompanying drawings.

[0040] Currently, when a server contains multiple host nodes and the multiple host nodes share a network card, the multiple host nodes bind two ports respectively, so that each network port of the network card belongs to the binding port corresponding to each host node. However, this binding method is incompatible with the processing logic of the switch. Therefore, link backup cannot be achieved for a multi-node server containing multiple host nodes.

[0041] In order to solve the above technical problems, an embodiment of the present application provides a port binding method and related devices. By setting the same node identifier for different host nodes in the same server, multiple ports of the network card can also belong to the same binding port when setting link backup for the server. By setting different network addresses of binding ports for different host nodes to distinguish different host nodes, link backup of multi-node servers is achieved.

[0042] The port binding method provided in the embodiment of the present application can be implemented by a computer device, which can be a server, wherein the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can be connected to a terminal device, and the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, an intelligent speaker, a smart watch, etc., but is not limited thereto. The terminal device and the server can be directly or indirectly connected by wired or wireless communication, and this application is not limited here.

[0043] Cloud technology refers to a hosting technology that unifies hardware, software, network and other resources in a wide area network or local area network to achieve data computing, storage, processing and sharing. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool that can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The background services of technical network systems require a large amount of computing and storage resources, such as video websites, picture websites and more portal websites. With the high development and application of the Internet industry, in the future, each item may have its own identification mark, and all need to be transmitted to the background system for logical processing. Data of different levels will be processed separately. All kinds of industry data require strong system backing support, which can only be achieved through cloud computing.

[0044] In order to facilitate understanding of the technical solution provided by the present application, a port binding method provided by an embodiment of the present application will be introduced below in combination with an actual application scenario.

[0045] Figure 1 A schematic diagram of an application scenario of a port binding method provided by an embodiment of the present application is shown, in which a server 10, a network card 20 and a switch are included, and the server 10 may include multiple host nodes, and the multiple host nodes are respectively connected through the network card 20 and the switch, so that the multiple host nodes can be connected to the network through the network card 20 and the switch, and the multiple switches can be respectively recorded as a first switch 31 and a second switch 32. The server 10 can be used as the aforementioned computer device, for example, the first host node in the server 10 can execute the port binding method.

[0046] The server 10 may include a first host node 111 and a second host node 112. The first host node 111 and the second host node 112 are respectively connected to the first switch 31 through the first port of the network card 20, and are respectively connected to the second switch 32 through the second port of the network card 20. The first host node 111 logically binds the first port and the second port as the binding port of the first host node 111, and the second host node 112 logically binds the first port and the second port as the binding port of the second host node 112. The first host node 111 and the second host node 112 may have the same node identifier and different network addresses of the binding ports.

[0047] The same node identifier makes it impossible to distinguish the first host node 111 from the second host node 112 in terms of identification. From the perspective of the first switch 31 and the second switch 32, the first host node 111 and the second host node 112 are the same node. Logically, only one host node is interacting with the switch. In this way, the two ports of the network card 20 do not need to belong to multiple binding ports when setting link backup for multiple host nodes. They are compatible with the interaction logic of the switch. In this way, the switch software does not need to be modified and adapted to achieve link backup of multi-node servers.

[0048] In addition, since the network addresses of the binding ports of different host nodes are different, the network card 20 can identify the first host node 111 and the second host node 112 by the network addresses of the binding ports during data forwarding, which will not cause confusion between different host nodes and will not affect normal data transmission.

[0049] The first host node 111 can send a first protocol message to the first switch 31 and the second switch 32 through the first port and the second port respectively. The first protocol message includes the node identifier of the first host node 111 and the network address of the binding port of the first host node 111. The first host node 111 can obtain the second protocol message from the first switch 31 through the first port, and obtain the third protocol message from the second switch through the second port 32. The second protocol message includes the network address of the first switch 31, and the third protocol message includes the network address of the second switch 32. Therefore, according to the network address of the first switch 31 and the network address of the second switch 32, the network can be accessed through the first switch 31 and the second switch 32. In this way, by setting the node identifier and the network address of the binding port, the link backup of the first host node 111 and the link backup of the second host node 112 are realized without modifying the software configuration of the switch and without affecting the normal data transmission.

[0050] Figure 2A flow chart of a port binding method provided in an embodiment of the present application. In this embodiment, a server is used as the aforementioned computer device for illustration. The port binding method may include:

[0051] S101: Logically bind a first port and a second port to form a bound port of a first host node.

[0052] In the embodiment of the present application, the server can be connected to the network card, and the server can be connected to the switch through the network card. The network card and the server can be set independently or integrated into a server system. In order to improve the availability of the network, link backup can be set for the server, and the two ports (ports) of the network card can be set to connect different switches respectively. For the convenience of distinction, the two ports are recorded as the first port and the second port, and the switch connected to the first port is recorded as the first switch, and the switch connected to the second port is recorded as the second switch. The first port and the second port can be recorded as port1 and port2 respectively. In the server, the first port and the second port can be logically represented as eth0 and eth1 respectively. The first switch can be a top of rack switch (Top Of Rack Switch, TOR) or a middle of rack switch (Middle Of Rack Switch, MOR), and the second switch can be a top of rack switch or a middle of rack switch.

[0053] The two ports of the same network card can be bound through port bonding, so that the two physical ports can be logically regarded as a bound port. The bound port can be recorded as bond0, that is, from the server side, the bound port bond0 includes the first port eth0 and the second port eth1. The bound port bond0 is a protocol group, which can also be called a link aggregation group (LAG). LAG is a logical link formed by bundling several Ethernet links together, also known as an Eth-Trunk link. Data packets can be allocated between the first port and the second port according to a certain allocation strategy. The allocation strategy can be, for example, a hash strategy. In this way, the bandwidth of a bound port can be regarded as the sum of the bandwidths of the two bound ports. For example, the bandwidth of the first port is 100 Gigabit Ethernet (GE), the bandwidth of the second port is 100GE, and the bandwidth of the bound port is 200GE, which realizes the increase of port bandwidth. In addition, this setting realizes link redundancy. Even if a physical failure occurs in one of the ports, switches or the corresponding network of the switch, the impact on the server network is only that the bandwidth is reduced by half, which does not affect normal data transmission.

[0054] Each server may be configured with a network card, and the server may bind a network port (also called a network port). The server may include one host node or multiple host nodes. When the server includes one host node, the server is a single-node server, and when the server includes multiple host nodes, the server is a multi-node server (Multi-Node Server). The number of host nodes in the multi-node server may be two or more. Each host node may include one or more central processing units (CPU). When the host node includes one CPU, the server is a single-channel server, and when the host node includes multiple CPUs, the server is a multi-channel server. The multi-channel server may be, for example, a dual-channel server including two CPUs.

[0055] When a server includes a host node, the host node alone occupies the function of the network card, the network card is a dedicated network card for the host node, and the server acts as a single-socket server. The operating system of the host node can bind the network port, and the port binding on the operating system (OS) of the host node can be implemented by executing the link aggregation standard such as IEEE 802.3ad, and the operating system of the host node supports the Link Aggregation Control Protocol (LACP).

[0056] refer to Figure 3 As shown, it is a port binding schematic diagram provided by an embodiment of the present application, wherein the two servers can be respectively recorded as a first server 11 and a second server 12, and the two network cards can be respectively recorded as a first network card 21 and a second network card 22, the first network card 21 is a dedicated network card of the first server 11, and the second network card 22 is a dedicated network card of the second server 12. The first server 11 and the second server 12 each include a host node, and each host node may include two central processing units: CPU#1 and CPU#2 (not shown in the figure), the first server 11 can be connected to the first switch 31 and the second switch 32 through the first network card 21, and the second server 12 can be connected to the first switch 31 and the second switch 32 through the second network card 22.

[0057] The server 11 / 12 and the network card 21 / 22 connected thereto can be connected via the peripheral component interconnect express (PCIE), which is a high-speed serial computer expansion bus standard, and the number of its channels can be, for example, 16, 32, etc. (16 in the figure), that is, this connection relationship is represented by PCIE×16. The first network card 21 and the first switch 31 are connected via the first port 21A (port1), the first network card 21 and the second switch 32 are connected via the second port 21B (port2), and the first port 21A and the second port 21B can be a Quad Small Form Pluggable (QSFP) interface. Similarly, the second network card 22 and the first switch 31 are connected via the third port 22A (port3), the second network card 22 and the second switch 32 are connected via the fourth port 22B (port4), and the third port and the fourth port can be QSFP interfaces. The first port 21A and the second port 21B are logically bound to each other so as to belong to the bound port of the first server 11 . The third port 22A and the fourth port 22B are logically bound to each other so as to belong to the bound port of the second server 12 .

[0058] However, with the rapid growth of the number of CPU cores and memory channels, servers have gradually developed from single-node servers to multi-node servers, and each host node in a multi-node server can independently process data. Multiple host nodes belonging to the same server can share a network card, which is called a shared NIC (Shared NIC), and can also be called a multi-host network interface card (Multi-host NIC). Each host node can achieve the functions that a single-node server can achieve, and the host nodes are interconnected at high speed, and the performance can be better than a single-node server. Each host node can be used as a single-slot server. In other words, a multi-node server can achieve the functions of multiple single-node servers, and compared with multiple single-node servers having multiple network cards, multiple host nodes in a multi-node server share a network card, which reduces the number of network cards and saves costs. In addition, a multi-node server has a higher-speed path and lower power consumption than multiple single-node servers, so it has relatively high performance.

[0059] refer to Figure 4 As shown, it is a schematic diagram of a server transformation provided by an embodiment of the present application, Figure 4The servers in A are single-node servers, each of which (taking the first server 11, the second server 12, the third server 13 and the fourth server 14 as examples) can include a host node, and each server has a dedicated network card (taking the first network card 21, the second network card 22, the third network card 23 and the fourth network card 24 as examples). Multiple single-node servers are connected to the first switch 31 through their respective dedicated network cards, and thus connected to the network. Figure 4 The server in B is a multi-node server, denoted as the first server. The first server 11 includes multiple host nodes (taking the first host node 111, the second host node 112, the third host node 113 and the fourth host node 114 as examples). A multi-node server can be configured with a first network card 21 shared by multiple host nodes. The first network card 21 can be connected to multiple host nodes respectively, and the first network card 21 is connected to the first switch 31, so that multiple host nodes are connected to the first switch 31 through the first network card 21, and thus connected to the network. It can be seen from the figure that when multiple host nodes can realize the functions of multiple single-node servers, network access of multiple host nodes can be achieved through a shared first network card 21, which reduces the number of network cards and saves costs.

[0060] When the server includes multiple host nodes, to achieve link redundancy, multiple host nodes need to bind the two ports of the network card respectively. Figure 5 As shown, it is another port binding schematic diagram provided by an embodiment of the present application, wherein the first server 11 includes a first host node 111 and a second host node 112, the second server 12 includes a fifth host node 121 and a sixth host node 122, the first server 11 is connected to the first network card 21, and the second server 12 is connected to the second network card 22. Each host node is a single-node server, and it can be connected to the corresponding network card 21 / 22 through PCIE, and the number of channels can be 8, for example, that is, this connection relationship is expressed as PCIE×8, the sum of the number of channels between the two host nodes in the first server 11 and the first network card 21 is 16, and the sum of the number of channels between the two host nodes in the second server 12 and the second network card 22 is 16. The first network card 21 and the first switch 31 are connected through the first port 21A, the first network card 21 and the second switch 32 are connected through the second port 21B, the first port 21A and the second port 21B can be QSFP interfaces, the second network card 22 and the first switch 31 are connected through the third port 22A, the second network card 22 and the second switch 32 are connected through the fourth port 22B, and the third port 22A and the fourth port 22B can be QSFP interfaces.

[0061] In order to realize the link redundancy setting of multiple host nodes in the shared network card scenario, it is necessary that multiple host nodes can respectively bind the two ports of the network card connected thereto, so that each port of the network card connected thereto belongs to the binding port corresponding to each host node at the same time. For example, the binding port bond0 of the first host node includes the first port eth0 and the second port eth1 (corresponding to port1 and port2 respectively), and the binding port bond1 of the second host node includes the first port eth0 and the second port eth1 (corresponding to port1 and port2 respectively), that is, the first port eth0 belongs to both the binding port bond0 of the first host node and the binding port bond1 of the second host node. Similarly, the second port eth1 belongs to both the binding port bond0 of the first host node and the binding port bond1 of the second host node. The same is true for the fifth and sixth host nodes.

[0062] However, the processing logic of the switch limits a port to only one LACP protocol group, and cannot belong to two LACP protocol groups at the same time, that is, each port can only belong to the same binding port, and cannot belong to multiple binding ports corresponding to multiple host nodes at the same time. Therefore, the binding mode in which each port of the network card belongs to the binding port corresponding to each host node at the same time is incompatible with the processing logic of the switch, making it usually impossible to implement link backup for a multi-node server containing multiple host nodes. This is equivalent to multiple host nodes using a single-port network card, and multiple host nodes share the bandwidth of the same port, which reduces the availability of the server network to a certain extent.

[0063] In actual operation, multiple host nodes included in the same server can have their own node identifiers, wherein the node identifier of the host node is used to uniquely identify the host node, the node identifier of the host node can be recorded as ActorSystemID, the node identifier of the host node can be a physical address, or other identifiers, the switch identifier of the switch can be recorded as Partner System ID, the switch identifier of the switch can be a physical address (MAC address) or other identifiers, and multiple switching nodes can have the same identifier during link backup.

[0064] refer to Figure 6As shown, it is another port binding schematic diagram provided by an embodiment of the present application, the node identifier of the first host node 111 (Host#1) is recorded as System ID#1, and the node identifier of the second host node 112 (Host#2) is recorded as System ID#2. When the first host node 111 and the second host node 112 do not share a network card, the first host node 111 and the second host node 112 can access the network through different network cards (the first network card 21 and the fifth network card 25). The first network card 21 connected to the first host node 111 has two virtual ports, whose addresses are recorded as MAC#1 and MAC#2, respectively, for connecting to the first host node 111; the fifth network card 25 connected to the second host node 112 has two virtual ports, whose addresses can be represented as MAC#3 and MAC#4, respectively, for connecting to the second host node 112.

[0065] When the first host node 111 and the second host node 112 share a network card, assuming that the first host node 111 and the second host node 112 are both connected to the first network card 21, the binding port bond0 of the first host node 111 (Host#1) includes the first port eth0 and the second port eth1, and the binding port bond1 of the second host node 112 (Host#2) includes the first port eth0 and the second port eth1, that is, the first port eth0 belongs to both the binding port bond0 of the first host node 111 and the binding port bond1 of the second host node 112, and the second port eth1 also belongs to both the binding port bond0 of the first host node 111 and the binding port bond1 of the second host node 112, and therefore is incompatible with the processing logic of the switch. In this case, if the protocol software of the switch is not modified and adapted accordingly, a stable Bonding link cannot be established between the host and the switch through the traditional LACP protocol, and link redundancy cannot be achieved.

[0066] In order to achieve link backup of multi-node servers, the switch software can be adapted and modified, and the LACP protocol stack and binding related instructions in the host operating system can be modified so that the entire system can support network card binding of multi-node servers. However, this requires a large amount of software development and adaptation work, and is not compatible with the previous network architecture or cannot reuse the original mature LACP software protocol stack in the operating system. In order to achieve link backup of multi-node servers, the protocol and operation of port binding can also be processed by the network card, similar to setting the network card to a smart network card (Smart Network Interface Card, SmartNIC), the network card presents only one physical port to each host, and the host's operating system does not need to perform port binding related operations. However, this setting method is more suitable for smart network cards, because the CPU of the smart network card is fully capable of processing LACP protocol and port binding related operations, but the computing power and memory resources of the embedded CPU inside the ordinary network card without intelligent processing capability are very limited. The slow processing speed may affect the real-time performance of the server's data processing. Due to the performance limitation of ordinary network cards, the entire LACP protocol is usually offloaded to the network card, which may not be supported by the embedded CPU inside the network card, or the LACP protocol needs to be tailored, and the network card firmware needs to be customized. The tailored LACP protocol may introduce some uncertainty, and improving the performance of the embedded CPU will increase the cost of the network card.

[0067] In the embodiment of the present application, the same node identifier can be set for multiple host nodes belonging to the same server, so that there is no distinction between the multiple host nodes in terms of identifiers, and they can be regarded as the same host node from the perspective outside the server. In this way, the two ports of the network card only need to belong to the binding port corresponding to the same host node, and do not need to belong to the multiple binding ports corresponding to multiple host nodes, that is, they belong to the same protocol group, which is compatible with the processing logic of the switch. The software of the switch does not need to be modified and adapted to achieve link backup of multi-node servers, and can fully reuse the mature LACP software protocol stack in the current operating system, while supporting LACPv1 and LCAPv2 protocols, and all host nodes can have the same LAG behavior, which is conducive to batch configuration. Of course, there are no excessive requirements for the functions of the network card. Both ordinary network cards or smart network cards can be used as shared network cards without increasing the cost of the network card.

[0068] The following is an example of taking the first server 11 as the server 10, the first network card 21 connected to the first server 11 as the network card 20, the first server 11 includes multiple host nodes, that is, the first server 11 can be a multi-node server, and the first network card 21 is a shared network card for multiple host nodes.

[0069] The first server 11 includes a first host node and a second host node. The first server 11 may include more host nodes. The first host node and the second host node may be any two host nodes among the multiple host nodes. The characteristics of other host nodes may refer to the first host node and the second host node. The first host node and the second host node may each include a CPU, or may each include multiple CPUs, or at least one of the first host node and the second host node includes multiple CPUs. The CPU may be used to process the acquired data to be processed and generate data to be sent. The data to be processed is obtained from the network through a switch, and the data to be sent is sent to the network through the switch. The following description is based on the example that the first host node and the second host node each include a CPU.

[0070] The first host node and the second host node can have the same node identifier and different binding port addresses. The same node identifier makes it impossible to distinguish the first host node from the second host node in terms of identification. From the perspective of the first switch and the second switch, the first host node and the second host node are the same node. Logically, only one node is interacting with the switch through the LACP protocol. In this way, the two ports of the network card do not need to belong to multiple binding ports, and are compatible with the interaction logic of the switch. The software of the switch does not need to be modified and adapted to achieve link backup of a multi-node server. In addition, since the network addresses of the binding ports are different, the network card can identify the first host node and the second host node through the binding port addresses, which will not cause confusion of data packets and will not affect normal data transmission. Among them, the binding port of the first host node is obtained by logically binding the first port and the second port, and the binding port of the second host node is obtained by logically binding the first port and the second port.

[0071] refer to Figure 7As shown, it is another port binding schematic diagram provided by an embodiment of the present application, the node identifiers of the first host node 111 (Host#1) and the second host node 112 (Host#2) are both System ID#1, when the first host node 111 and the second host node 112 share a network card, the first host node 111 and the second host node 112 can access the network through the same network card (i.e., the first network card 21), the first network card 21 has two virtual ports 21C / 21D, MAC#1 and MAC#2, each of which is used to connect to the first host node 111 and the second host node 112 respectively. Since the node identifiers of the first host node 111 and the second host node 112 are the same, the binding port bond0 of the first host node 111 includes the first port eth0 and the second port eth1 (corresponding to port1 and port2, respectively), and the binding port of the second host node 112 is also bond0, including the first port eth0 and the second port eth1 (corresponding to port1 and port2, respectively), that is, the first port eth0 and the second port eth1 belong only to the binding port bond0, which is compatible with the processing logic of the switch.

[0072] The first host node 111 and the second host node 112 are respectively connected to the first switch 31 through the first port 21A of the first network card 21, and are respectively connected to the second switch 32 through the second port 21B of the first network card 21, so that the first host node 111, the first port 21A of the first network card 21 and the first switch 31 constitute a link for the first host node 111 to access the network, the first host node, the second port 21B of the first network card 21 and the second switch 32 constitute another link for the first host node 111 to access the network, the second host node 112, the first port 21A of the first network card 21 and the first switch 31 constitute a link for the second host node 112 to access the network, and the second host node 112, the second port 21B of the first network card 21 and the second switch 32 constitute another link for the second host node 112 to access the network, refer to Figure 5 shown.

[0073] In the embodiment of the present application, the first host node and the second host node may further include a LACP processing unit, the LACP processing unit includes a controller and an aggregator, wherein the controller is used for the operation configuration of the LAG and the processing of the LACP protocol. Figure 6 and Figure 7As shown, for the convenience of distinction, the LACP processing unit in the first host node is taken as the first LACP processing unit 111B, the controller in the first LACP processing unit 111B is recorded as the first controller 111C, the aggregator is recorded as the first aggregator 111D (identified by ID1), and the first aggregator 111D corresponds to the binding port of the first host node; the LACP processing unit in the second host node is taken as the second LACP processing unit 112B, the controller in the second LACP processing unit 112B is recorded as the second controller 112C, the aggregator is recorded as the second aggregator 112D (identified by ID2), and the second aggregator 112D corresponds to the binding port of the second host node. The node identifier of the first host node 111 can be used to indicate the first controller 111C in the first host node 111, and the node identifier of the second host node 112 can be used to indicate the second controller 112C in the second host node 112. The aggregator includes a data packet collector and a distributor, the data packet collector is used for collecting data packets, and the distributor is used for distributing data packets. The LACP processing unit may further include a parser, which may extract information from the data packet and interpret its content, such as identifying fields in the data packet.

[0074] The LACP processing unit may further include a multiplexer (MUX), and the controller may control the workflow of the multiplexer. Figure 6 and Figure 7 As shown, the MUX in the first host node is used to divide the path between the first host node 111 and the first network card 21 into multiple paths, and send data packets to a specific port and obtain data packets from a specific port. The MUX in the first host node includes a first MUX 111E and a second MUX 111F. The first MUX 111E is connected to the virtual port 21C in the first network card 21, and the second MUX 111F is connected to the virtual port 21D in the first network card 21.

[0075] The MUX in the second host node is used to divide the path between the second host node 112 and the network card connected thereto into multiple paths, and to send data packets to a specific port and obtain data packets from a specific port. Figure 6 , the MUX in the second host node is recorded as the third MUX 112E and the fourth MUX 112F, the third MUX 112E is connected to the virtual port 25C in the fifth network card, and the fourth MUX 112F is connected to the virtual port 25D in the fifth network card. When the first host node and the second host node do not share a network card, refer to Figure 7The MUXs in the second host node are recorded as the third MUX 112E and the fourth MUX 112F. The third MUX 112E is connected to the virtual port 21C in the first network card, and the fourth MUX 112F is connected to the virtual port 21D in the fifth network card.

[0076] S102: Send a first protocol message to the first switch and the second switch through the first port and the second port respectively.

[0077] S103, obtaining a second protocol message from the first switch through the first port, and obtaining a third protocol message from the second switch through the second port.

[0078] From the perspective of the first host node, the first host node can send the first protocol message to the first switch and the second switch through the first port and the second port respectively. At this time, the first host node acts as a link aggregation control protocol data unit (Link Aggregation Control Protocol Data Unit, LACPDU), and the first switch and the second switch act as its opposite ends. The first protocol message is the first LACPDU message.

[0079] The first protocol message may include a node identifier of the first host node and a network address of a binding port of the first host node, wherein the network address of the binding port of the first host node may be used as the source address of the first protocol message, and the destination address of the first protocol message is used to indicate the addresses of the first switch and the second switch. In specific implementation, the node identifier of the first host node (Host#1) may be represented as System ID#1, the source address and the destination address of the first protocol message may both be a physical address (Physical Address), which may also be referred to as a Media Access Control Address (MAC) address or an Ethernet address (Ethernet Address), the source address may be represented as SMAC (Source MAC), the destination address may be represented as DMAC (Destination MAC), the network address of the binding port of the first host node may be the physical address of the binding port of the first host node, represented as Bond MAC#1, the destination address of the first protocol message may be a public protocol address, which may be a LACP protocol address, represented as LACP MAC. That is, the source address and the destination address of the first LACPDU message are represented as: [SMAC=Bond MAC#1, DMAC=LACP MAC].

[0080] refer to Figure 8As shown, it is a schematic diagram of the format of a first protocol message provided by an embodiment of the present application, wherein Src indicates that the source address SMAC (Bond MAC#1) is aa:bb:cc:01:03:00, Dst indicates that the destination address DMAC is 01:80:c2:00:00:02, the node identifier (Actor System ID#1) is aa:bb:cc:81:03:00, and the switch identifier (PartnerSystem) is aa:bb:cc:81:13:00. Among them, the node information (Actor Information) and the switch information (Partner Information) are 0x01 and 0x02 respectively, and the node information length (Actor Information Length) and the switch information length (Partner Information Length) are both 0x14.

[0081] The first host node can also obtain a second protocol message from the first switch through the first port. The second protocol message is a second LACPDU message. Fig. 9 As shown, it is a schematic diagram of a protocol message interaction process provided by an embodiment of the present application. The second protocol message may include the network address of the first switching node, wherein the network address of the first switch can be used as the source address of the second protocol message, and the destination address of the second protocol message is used to indicate the address of the first host node. In a specific implementation, the source address and the destination address of the second protocol message can both be physical (MAC) addresses, the source address is represented as SMAC, the destination address is represented as DMAC, the network address of the first switch can be the physical address of the first switch, identified as switch MAC#1, the destination address can be a public protocol address, and the public protocol address can be: LACP protocol address, represented as LACP MAC. That is, the source address and destination address of the second LACPDU message are represented as [SMAC=switch MAC#1, DMAC=LACP MAC].

[0082] Among them, the first switch can send the second protocol message to the first host node after first obtaining the first protocol message from the first host node, and can also send the second protocol message to the first host node after first obtaining the fourth protocol message from the second host node. The first host node sends the first protocol message to the switch, and the first switch sends the second protocol message to the first host node, indicating that communication between the first host node and the first switch is smooth.

[0083] The first host node can also obtain a third protocol message from the second switch through the second port, and the third protocol message is a third LACPDU message. The third protocol message includes the network address of the second switch, wherein the network address of the second switch can be used as the source address of the third protocol message, and the destination address of the third protocol message is used to indicate the address of the first host node. In specific implementation, the source address and destination address of the third protocol message can be physical (MAC) addresses, the source address is represented as SMAC, the destination address is represented as DMAC, the communication address of the second switch can be the physical address of the second switch, identified as switch MAC#2, the destination address can be a public protocol address, and the public protocol address can be: LACP protocol address, represented as LACP MAC. That is, the source address and destination address of the third LACPDU message are represented as [SMAC=switchMAC#2, DMAC=LACP MAC].

[0084] The second switch may send a third protocol message to the first host node after first acquiring the first protocol message from the first host node, or may send a third protocol message to the first host node after first acquiring the fourth protocol message from the second host node. The first host node sends the first protocol message to the second switch, and the second switch sends the third protocol message to the first host node, indicating that the communication between the first host node and the second switch is smooth. The first switch and the second switch may have the same switch identifier.

[0085] In this way, after obtaining the second protocol message and the third protocol message, the first host node can access the network through the first switch and the second switch according to the network address of the first switch and the network address of the second switch, and the first switch and the second switch are divided into different links to provide a redundant link for the first host node.

[0086] Similarly, from the perspective of the second host node, the second host node can send a fourth protocol message to the first switch and the second switch through the first port and the second port respectively. At this time, the second host node acts as a LACPDU, the first switch and the second switch act as its opposite ends, and the fourth protocol message is a fourth LACPDU message. The fourth protocol message may include the node identifier of the second host node and the network address of the binding port of the second host node, wherein the network address of the binding port of the second host node can be used as the source address of the fourth protocol message, and the destination address of the fourth protocol message is used to indicate the address of the first switch and the second switch. In specific implementation, the node identifier of the second host node (Host#2) can be represented as System ID#1, the source address and the destination address of the fourth protocol message can both be physical (MAC) addresses, the source address can be represented as SMAC, the destination address can be represented as DMAC, the network address of the binding port of the second host node can be the physical address of the binding port of the second host node, represented as Bond MAC#2, the destination address can be a public protocol address, and the public protocol address can be a LACP protocol address, represented as LACP MAC. That is, the source address and destination address of the fourth LACPDU message are expressed as: [SMAC=Bond MAC#2, DMAC=LACP MAC].

[0087] The second host node can also obtain a second protocol message from the first switch through the first port, and the second protocol message is a second LACPDU message. The second protocol message may include the network address of the first switch node, wherein the network address of the first switch can be used as the source address of the second protocol message, and the destination address of the second protocol message is used to indicate the address of the second host node. In specific implementation, the source address and the destination address of the second protocol message can both be physical addresses, the source address is represented as SMAC, the destination address is represented as DMAC, the network address of the first switch can be the physical address of the first switch, identified as switch MAC#1, the destination address can be a public protocol address, and the public protocol address can be: LACP protocol address, represented as LACP MAC. That is, the source address and the destination address of the second LACPDU message are represented as [SMAC=switchMAC#1, DMAC=LACP MAC].

[0088] Among them, the first switch can send the second protocol message to the second host node after first obtaining the first protocol message from the first host node, and can also send the second protocol message to the second host node after first obtaining the fourth protocol message from the second host node. The second host node sends the fourth protocol message to the switch, and the first switch sends the second protocol message to the second host node, indicating that communication between the second host node and the first switch is smooth.

[0089] The second host node can also obtain a third protocol message from the second switch through the second port, and the third protocol message is a third LACPDU message. The third protocol message includes the network address of the second switch, wherein the network address of the second switch can be used as the source address of the third protocol message, and the destination address of the third protocol message is used to indicate the address of the second host node. In specific implementation, the source address and destination address of the third protocol message can be physical addresses, the source address is represented as SMAC, the destination address is represented as DMAC, the network address of the second switch can be the physical address of the second switch, identified as switch MAC#2, the destination address can be a public protocol address, and the public protocol address can be: LACP protocol address, represented as LACP MAC. That is, the source address and destination address of the third LACPDU message are represented as [SMAC=switch MAC#2, DMAC=LACP MAC].

[0090] The second switch may send a third protocol message to the second host node after first acquiring the first protocol message from the first host node, or may send a third protocol message to the second host node after first acquiring the fourth protocol message from the second host node, the second host node sends the fourth protocol message to the second switch, and the second switch sends the third protocol message to the second host node, indicating that the communication between the second host node and the second switch is smooth. When the destination addresses of the second protocol message and the third protocol message are public protocol addresses, the second protocol message and the third protocol message may be sent to the host nodes connected thereto in the form of broadcast, that is, the first host node and the second host node may simultaneously acquire the second protocol message, and may also simultaneously acquire the third protocol message.

[0091] In this way, after obtaining the second protocol message and the third protocol message, the second host node can access the network through the first switch and the second switch according to the network address of the first switch and the network address of the second switch, and the first switch and the second switch are divided into different links to provide a redundant link for the second host node.

[0092] The first protocol message may further include a first preset duration, which is used to indicate a period for sending the second protocol message and the third protocol message to the first host node. The first preset duration is a short duration, for example, it may be 3 seconds. The first switch may send the second protocol message to the first host node every first preset duration, and the second switch may send the third protocol message to the first host node every first preset duration. If the first host node does not receive a new second protocol message within the first preset duration after receiving the second protocol message, it is determined that the first switch has a short timeout (ShortTimeout). If the first host node does not receive a new third protocol message within the first preset duration after receiving the third protocol message, it is determined that the second switch has a short timeout.

[0093] The first preset time length can be used to monitor the working status of the first port and the second port. Specifically, if the first host node fails to obtain a new second protocol message after receiving the second protocol message for a preset multiple of the first preset time length, it can be determined that a physical fault occurs in the first port; if the first host node fails to obtain a new third protocol message after receiving the third protocol message for a preset multiple of the first preset time length, it can be determined that a physical fault occurs in the second port. In this way, the first host node can monitor the working status of the first port and the second port in a timely manner, and adjust the link in a timely manner to avoid data packet loss, wherein the preset multiple can be, for example, 2 times, etc.

[0094] Correspondingly, the fourth protocol message may further include a fourth preset duration, the fourth preset duration is used to indicate the period of sending the second protocol message and the third protocol message to the second host node, the fourth preset duration is a short duration, and the fourth preset duration may be the same as the first preset duration, refer to Fig. 9 As shown, the fourth preset time length and the first preset time length may also be different. For example, the fourth preset time length may be 3 seconds. The first switch may send the second protocol message to the second host node every fourth preset time length, and the second switch may send the third protocol message to the second host node every fourth preset time length. If the second host node does not receive a new second protocol message after receiving the second protocol message for more than the fourth preset time length, it is determined that the first switch has a short time length timeout. If the second host node does not receive a new third protocol message after receiving the third protocol message for more than the fourth preset time length, it is determined that the second switch has a short time length timeout.

[0095] The fourth preset time length can be used to monitor the working status of the first port and the second port. Specifically, if the second host node fails to obtain a new second protocol message after receiving the second protocol message for a preset multiple of the second preset time length, it can be determined that a physical fault occurs in the first port; if the second host node fails to obtain a new third protocol message after receiving the third protocol message for a preset multiple of the second preset time length, it can be determined that a physical fault occurs in the second port. In this way, the second host node can monitor the working status of the first port and the second port in a timely manner, and adjust the link in a timely manner to avoid data packet loss, wherein the preset multiple can be, for example, 2 times, etc.

[0096] In the embodiment of the present application, the second protocol message may further include a second preset duration, and the first host node may periodically send the first protocol message to the first switch through the first port of the network card according to the second preset duration, and correspondingly, the second host node may periodically send the fourth protocol message to the first switch through the first port of the network card according to the second preset duration, referring to Fig. 9 As shown. In this way, the first switch can determine the working state of the first port according to the reception interval duration of the first protocol message, the second preset duration and the reception interval duration of the fourth protocol message. For example, when the reception interval duration of the first protocol message is greater than the preset multiple of the second preset duration, it indicates that the first port may have a physical fault, or the first port is disabled by the first host node. At this time, if the reception interval duration of the fourth protocol message is greater than the preset multiple of the second preset duration, it can be determined that there is a physical fault in the first port, and the first switch cannot transmit data through the first port; conversely, if the reception interval duration of the fourth protocol message is not greater than the preset multiple of the second preset duration, it indicates that there is no physical fault in the first port, and the reason why the reception interval duration of the first protocol message is large is that the first port is disabled by the first host node. Then, the first switch can send data through the first port, and it can send the data to be processed to the network card through the first port, and the network card will divert the data to be processed to the first host node.

[0097] In the embodiment of the present application, the third protocol message may also include a third preset duration. Then, the first host node may periodically send the first protocol message to the second switch through the second port of the network card according to the third preset duration. Correspondingly, the second host node may periodically send the fourth protocol message to the second switch through the second port of the network card according to the third preset duration. In this way, the second switch can determine the working status of the second port according to the reception interval duration of the first protocol message, the third preset duration, and the reception interval duration of the fourth protocol message. For example, when the reception interval duration of the first protocol message is greater than a preset multiple of the third preset duration, it indicates that a physical fault may exist in the second port, or the second port is disabled by the first host node. At this time, if the reception interval duration of the fourth protocol message is greater than a preset multiple of the third preset duration, it can be determined that a physical fault exists in the second port, and the first switch cannot receive the fourth protocol message through the second protocol message. data transmission; on the contrary, if the receiving interval duration of the fourth protocol message is not greater than the preset multiple of the third preset time duration, it means that there is no physical failure in the second port, and the reason why the receiving interval duration of the first protocol message is longer is that the second port is disabled by the second host node. The second switch can send data through the second port, and it can send the data to be processed to the network card through the second port, and the network card will direct the data to be processed to the first host node.

[0098] During the continuous sending of the first protocol message, the second protocol message and the fourth protocol message, the first host node and the first switch, the first host node and the second switch establish a communication link, through which data can be sent, and the second host node and the first switch, the second host node and the second switch establish a communication link, through which data can be sent.

[0099] Specifically, the first host node can determine the target port corresponding to the data to be sent from the first port and the second port based on the preset rules. The source address of the data to be sent is the network address of the binding port of the first host node. The data to be sent can be sent to the target switch connected to the target port in the first switch and the second switch through the target port, and the second host node is similar. In this way, the data to be sent can be sent through the target port and the target switch. The preset rules can be hash strategies or other strategies, so that the link where the first port is located and the link where the second port is located can obtain reasonable flow control and achieve flow balance.

[0100] The data to be sent may be generated by the first CPU 111A in the first host node 111, see Figure 6 and Figure 7As shown, the data generated by the first CPU 111A contains data to be sent, which can be distributed via the first aggregator 111D and sent to the first network card 21 by the first MUX 111E and the second MUX 111F. In addition, the data to be processed from the first network card 21 can also be obtained via the first MUX 111E and the second MUX 111F. The data to be processed is collected via the first aggregator 111D and provided to the first CPU 111A, so that the CPU 111A processes the data to be processed.

[0101] refer to Fig.10 As shown, a data flow diagram is provided for an embodiment of the present application, wherein the binding port of the first host node 111 and the binding port of the second host node 112 can serve as the same LAG, denoted as Bond0, both of which include a first port Eth0 and a second port Eth1 (corresponding to port1 and port2, respectively), and the network address of the binding port of the first host node (denoted as Bond MAC#1) and the network address of the binding port of the second host node (denoted as Bond MAC#2) are different.

[0102] The first network card 21 serves as a shared network card for the first host node 111 and the second host node 112, including a first port port1 and a second port port1. The first network card 21 serves as a peripheral module of the host node and can be functionally divided into a first module 21C (PCIe End Point#1) and a second module 21D (PCIe End Point#2). The first module 21C is used to connect to the first host node 111, and the second module 21D is used to connect to the second host node 112. The first module 21C and the second module 21D are used to process the data to be sent from the first port Eth0 and the second port Eth1, and send the data to be processed to the first port Eth0 and the second port Eth1.

[0103] The first network card 21 also has physical functions 21E / 21F / 21G / 21H, which are respectively recorded as: PF0, PF1, PF2 and PF3, which are respectively used as virtual ports inside the first network card 21 for realizing data scheduling, wherein the physical functions 21E and 21F are both connected to the first module 21C, the physical functions 21G and 21H are both connected to the second module 21D, and the physical functions 21E and 21G are connected to the first port 21A, and the physical functions 21F and 21H are connected to the second port 21B. The first port 21A (port1) and the second port 21B (port2) are used as physical interfaces to realize the connection between the network card and the first switch 31 and the second switch 32 respectively.

[0104] In this way, after the data to be sent of the first host node 111 is generated by the first CPU 111A, the first LACP processing unit 111B can determine the first port or the second port in the binding port (Bond0) at the logical level through its internal processing logic, and send the data to be sent to the first module 21C and the second module 21D of the first network card 21 according to the target port determined in the binding port (Bond0) at the logical level of LACP, and send the data to be sent via the physical functions PF0 and PF1 to the physical ports: the first port 21A (port1) and the second port 21B (port2), and then send them to the first switch 31 and the second switch 32 respectively. The same is true for the data to be sent of the second host node 112. Correspondingly, the data to be processed from the first switch 31 and the second switch 32 can be sent to the physical functions PF0 and PF1 via the physical ports: the first port 21A (port1) and the second port 21B (port2), and sent to the first module 21C and the second module 21D of the first network card 21, thereby sending the data to be processed to the first port or the second port in the binding port (Bond0) of the first host node for processing by the first CPU 111A in the first host node. The same applies to the data to be processed of the second host node 112.

[0105] In the process of determining the target port for the data to be sent, the working status of the first port and the second port can also be considered. If it is determined that the first port has a physical fault, the second port is determined as the target port corresponding to the data to be sent. If it is determined that the second port has a physical fault, the first port is determined as the target port corresponding to the data to be sent. In this way, when a physical fault occurs in the first port or the second port, the data to be sent can be directed to the port where the physical fault does not occur, thereby achieving normal sending of the data to be sent.

[0106] refer to Fig.11 As shown, it is another data flow diagram provided for an embodiment of the present application, wherein the dotted line with an arrow indicates a link that cannot perform data communication, and there is a physical fault in the second port 21B (port2). At this time, the data flow that needs to pass through the second port 21B (port2) is directed to the first port 21A (port1). Specifically, all data to be sent are directed to the first port 21A (port1) through the first port eth0, and the data to be processed received by the first host node 111 and the second host node 112 from the first network card 21 also only comes from the first port 21A (port1), and is sent to the bound port bond0 through the first port eth0.

[0107] The first host node determines whether a physical fault occurs in the first port by comparing the first host node's reception interval duration of the second protocol message with the first preset duration, or by monitoring the working status of the first port, or by determining the port status in the second protocol message and the third protocol message, where the port status in the second protocol message is provided by the first switch, and the port status in the third protocol message is provided by the second switch; the first host node determines whether a physical fault occurs in the second port by comparing the first host node's reception interval duration of the third protocol message with the first preset duration, or by monitoring the working status of the second port, or by determining the port status in the second protocol message and the third protocol message, where the port status in the second protocol message is provided by the first switch, and the port status in the third protocol message is provided by the second switch.

[0108] In the process of determining the target port for the data to be sent, the disabled state of the first port and the second port can also be considered. The first host node and the second host node can both disable the first port. The first port disabled by the first host node will no longer exchange data between the first host node and the first switch, and the first port disabled by the second host node will no longer exchange data between the second host node and the first switch. Similarly, the first host node and the second host node can both disable the second port. The second port disabled by the first host node will no longer exchange data between the second host node and the first switch, and the second port disabled by the second host node will no longer exchange data between the second host node and the second switch. The disabling of the first port or the second port is achieved by a disabling indication, such as ifconfig down. The indication for disabling the first host node is the first disabling indication ifconfig down eth0, and the indication for disabling the second port is the second disabling indication ifconfig down eth0.

[0109] Specifically, the first host node can determine the second port as the target port for the data to be sent in response to a first disabling indication for the first port, or determine the first port as the target port corresponding to the data to be sent in response to a second disabling indication for the second port. In this way, the first host node can divert data according to its own disabling indications for the first port and the second port, thereby realizing control over a specific port.

[0110] For the data to be processed, when the first port is disabled by the first host node but not by the second host node, since the first switch can still receive the fourth protocol message from the second host node, it is determined that there is no physical fault in the first port, and thus the data to be processed can be sent to the network card normally through the first port. Therefore, the disabling of the first port by the first host node will not affect the use of the first port by the second host node. Similarly, the disabling of the first port by the second host node will not affect the use of the first port by the first host node. The disabling of the second port is similar.

[0111] In an embodiment of the present application, in response to a first disabling indication to the first port, the data to be processed can be obtained through the logical link corresponding to the second port, the destination address of the data to be processed is the network address of the binding port of the first host node, the network card obtains the data to be processed through the first port, and the data to be processed is allocated to the logical link corresponding to the second port by the network card according to the first disabling indication; or, in response to a second disabling indication to the second port, the data to be processed is obtained through the logical link corresponding to the first port, the destination address of the data to be processed is the network address of the binding port of the first host node, the network card obtains the data to be processed through the second port, and the data to be processed is allocated to the logical link corresponding to the first port by the network card according to the second disabling indication. In other words, the first switch can send the data to be processed to the first port normally, and the network card can divert the data to be processed according to the first disabling indication or the second disabling indication, so that the data to be processed from the disabled port can be diverted to the logical link where the non-disabled port is located.

[0112] refer to Fig.12 As shown, it is another data flow diagram provided by an embodiment of the present application, wherein the dotted line with an arrow indicates a link that cannot perform data communication, the second port 21B (port2) is disabled by the first host node 111, and its corresponding logical port eth1 is disabled. At this time, the data flow of the first host node 11 that needs to pass through the second port 21B (port2) is directed to the link where the first port 21A (port1) is located. Specifically, all data to be sent in the first host node 111 are directed to the first port 21A (port1) through the first port eth0, and the data to be processed received by the first host node 111 can come from the first port 21A (port1) or from the second port 21B (port2), but the first network card 21 directs the data to be processed to the logical link where the first port 21A (port1) is located, that is, it is sent to the bound port bond0 through the first port eth0. The second host node 112 does not disable the second port 21B (port2), so the second port 21B (port2) can be used normally.

[0113] Based on a port binding method provided in an embodiment of the present application, an embodiment of the present application also provides a port binding device, referring to Fig.13 As shown, it is a structural block diagram of a port binding device provided in an embodiment of the present application, which is applied to a first host node in a server, and the server also includes a second host node. The first host node and the second host node are respectively connected to the first switch through the first port of the network card, and are respectively connected to the second switch through the second port of the network card.

[0114] The port binding device 1300 includes a binding unit 1301, and a protocol message sending unit 1302 and a protocol message receiving unit 1303 respectively connected to the binding unit 1301, and the protocol message sending unit 1302 and the protocol message receiving unit 1303 are respectively connected to the network card.

[0115] The binding unit 1301 is used to logically bind the first port and the second port as a binding port of the first host node;

[0116] The protocol message sending unit 1302 is configured to send a first protocol message to the first switch and the second switch respectively through the first port and the second port, wherein the first protocol message includes a node identifier of the first host node and a network address of a binding port of the first host node, the node identifier of the first host node is the same as the node identifier of the second host node, the network address of the binding port of the first host node is different from the network address of the binding port of the second host node, and the binding port of the second host node is obtained by logically binding the first port and the second port;

[0117] The protocol message receiving unit 1303 is configured to obtain a second protocol message from the first switch through the first port, and obtain a third protocol message from the second switch through the second port, wherein the second protocol message includes a network address of the first switch, and the third protocol message includes a network address of the second switch, so as to access the network through the first switch and the second switch.

[0118] Optionally, the device further comprises:

[0119] a port determination unit, configured to determine a target port corresponding to the data to be sent from the first port and the second port based on a preset rule, wherein the source address of the data to be sent is the network address of the binding port of the first host node;

[0120] The data sending unit connected to the network card is used to send the to-be-sent data to a target switch connected to the target port among the first switch and the second switch through the target port.

[0121] Optionally, the port determination unit is specifically used to:

[0122] If it is determined that a physical fault occurs on the second port, determining the first port as a target port corresponding to the data to be sent;

[0123] If it is determined that a physical failure occurs on the first port, the second port is determined as a target port corresponding to the data to be sent.

[0124] Optionally, the first protocol message further includes a first preset duration, and the device further includes:

[0125] a fault determination unit, configured to determine that a physical fault occurs on the first port if no new second protocol message is obtained after a preset multiple of the first preset time length has passed after the second protocol message is received; and to determine that a physical fault occurs on the second port if no new third protocol message is obtained after a preset multiple of the first preset time length has passed after the third protocol message is received.

[0126] Optionally, the port determination unit is specifically used to:

[0127] In response to a first disabling indication of the first port, determining the second port as a target port corresponding to data to be sent; or,

[0128] In response to a second disabling indication for the second port, the first port is determined as a target port corresponding to data to be sent.

[0129] Optionally, the second protocol message further includes a second preset duration, the third protocol message further includes a third preset duration, the second host node is used to periodically send a fourth protocol message to the first switch and the second switch through the first port and the second port respectively according to the second preset duration, the fourth protocol message includes a node identifier of the second host node and a network address of a binding port, and obtains the second protocol message from the first switch through the first port, and obtains the third protocol message from the second switch through the second port, and the binding port of the second host node is obtained by performing a comparison of the first port and the second port;

[0130] The data sending unit is specifically used for:

[0131] The first protocol message is periodically sent to the first switch through the first port according to the second preset time period, and the first protocol message is periodically sent to the second switch through the second port according to the third preset time period.

[0132] Optionally, the device further includes a data acquisition unit, configured to:

[0133] In response to a first disabling indication for the first port, data to be processed is obtained through a logical link corresponding to the second port, the destination address of the data to be processed is a network address of a bound port of the first host node, the network card obtains the data to be processed through the first port, and the data to be processed is allocated by the network card to the logical link corresponding to the second port according to the first disabling indication; or,

[0134] In response to a second disabling indication for the second port, the data to be processed is obtained through the logical link corresponding to the first port, the destination address of the data to be processed is the network address of the binding port of the first host node, the network card obtains the data to be processed through the second port, and the data to be processed is allocated by the network card to the logical link corresponding to the first port according to the second disabling indication.

[0135] Optionally, the source address of the first protocol message is the network address of the binding port of the first host node, the source address of the second protocol message is the network address of the first switch, the source address of the third protocol message is the network address of the second switch, and the destination address of the first protocol message, the destination address of the second protocol message, and the destination address of the third protocol message are public protocol addresses.

[0136] Optionally, at least one of the first host node and the second host node includes a plurality of central processing units, and the central processing units are used to process the acquired data to be processed and generate data to be sent.

[0137] It can be seen from the above technical solution that the server may include a first host node and a second host node, the first host node and the second host node are respectively connected to the first switch through the first port of the network card, and are respectively connected to the second switch through the second port of the network card, the first host node logically binds the first port and the second port as the binding port of the first host node, and the second host node logically binds the first port and the second port as the binding port of the second host node, the first host node and the second host node may have the same node identifier and different network addresses of the binding ports, the same node identifier makes there no identification distinction between the first host node and the second host node, from the perspective of the first switch and the second switch, the first host node and the second host node are the same node, logically only one node is interacting with the switch, so that the two ports of the network card do not need to belong to multiple binding ports when setting link backup for multiple host nodes, and are compatible with the interaction logic of the switch, so that the software of the switch does not need to be modified and adapted to achieve link backup of a multi-node server.

[0138] In addition, since the network addresses of the binding ports of different host nodes are different, the network card can identify the first host node and the second host node through the network address of the binding port during the data forwarding process, which will not cause confusion between different host nodes and will not affect normal data transmission. The first host node can send a first protocol message to the first switch and the second switch through the first port and the second port respectively, the first protocol message includes the node identifier of the first host node and the network address of the binding port of the first host node, obtain the second protocol message from the first switch through the first port, and obtain the third protocol message from the second switch through the second port, the second protocol message includes the network address of the first switch, and the third protocol message includes the network address of the second switch, so that according to the network address of the first switch and the network address of the second switch, the network can be accessed through the first switch and the second switch, so that the link backup of the first host node and the link backup of the second host node are realized without modifying the software configuration of the switch and without affecting normal data transmission through the setting of the node identifier and the network address of the binding port.

[0139] The embodiment of the present application also provides a computer device, which is the computer device described above and can include a server, which can access a network and connect to a terminal device through the network. The aforementioned port binding device can be configured in the computer device. The computer device is described below in conjunction with the accompanying drawings.

[0140] See also Fig.14 As shown, the embodiment of the present application provides a terminal device, taking the terminal device as a mobile phone as an example:

[0141] Fig.14 FIG. 1 is a block diagram showing a partial structure of a mobile phone related to a terminal device provided in an embodiment of the present application. Fig.14 The mobile phone includes: a radio frequency (RF) circuit 1410, a memory 1420, an input unit 1430, a display unit 1440, a sensor 1450, an audio circuit 1460, a wireless fidelity (WiFi) module 1470, a processor 1480, and a power supply 1490. Those skilled in the art can understand that Fig.14 The mobile phone structure shown in the figure does not constitute a limitation on the mobile phone, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0142] Combine the following Fig.14 A detailed introduction to the various components of the mobile phone:

[0143] The RF circuit 1410 may be used for receiving and sending signals during information transmission or communication or during a call. In particular, after receiving downlink information from a base station, the information is sent to the processor 1480 for processing. In addition, the uplink data is sent to the base station.

[0144] The memory 1420 can be used to store software programs and modules. The processor 1480 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 1420. The memory 1420 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 1420 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0145] The input unit 1430 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the mobile phone. Specifically, the input unit 1430 may include a touch panel 1431 and other input devices 1432 .

[0146] The display unit 1440 may be used to display information input by the user or information provided to the user and various menus of the mobile phone. The display unit 1440 may include a display panel 1441.

[0147] The mobile phone may also include at least one sensor 1450, such as a light sensor, a motion sensor, and other sensors.

[0148] The audio circuit 1460 , the speaker 1461 , and the microphone 1462 can provide an audio interface between the user and the mobile phone.

[0149] WiFi is a short-range wireless transmission technology. The mobile phone can help users send and receive emails, browse web pages and access streaming media through the WiFi module 1470. It provides users with wireless broadband Internet access.

[0150] Processor 1480 is the control center of the mobile phone. It uses various interfaces and lines to connect various parts of the entire mobile phone. It executes various functions of the mobile phone and processes data by running or executing software programs and / or modules stored in memory 1420 and calling data stored in memory 1420.

[0151] The mobile phone also includes a power source 1490 (such as a battery) for supplying power to various components.

[0152] The present application also provides a server. Fig.15 As shown, Fig.15 The structural diagram of the server 1500 provided in the embodiment of the present application, the server 1500 may have relatively large differences due to different configurations or performances, and may include one or more processors 1522, such as central processing units (CPU), memory 1532, and one or more storage media 1530 (e.g., one or more mass storage devices) storing application programs 1542 or data 1544. Among them, the memory 1532 and the storage medium 1530 can be short-term storage or permanent storage. The program stored in the storage medium 1530 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the processor 1522 can be configured to communicate with the storage medium 1530 and execute a series of instruction operations in the storage medium 1530 on the server 1500.

[0153] The server 1500 may also include one or more power supplies 1526, one or more wired or wireless network interfaces 1550, one or more input and output interfaces 1558, and / or one or more operating systems 1541, such as Windows Server 2003 or Windows Server 2008. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM etc.

[0154] The steps performed by the server in the above embodiment can be based on Fig.15 The server structure shown.

[0155] In addition, an embodiment of the present application further provides a storage medium, wherein the storage medium is used to store a computer program, and the computer program is used to execute the method provided in the above embodiment.

[0156] The embodiments of the present application also provide a computer program product including instructions, which, when executed on a computer, enables the computer to execute the method provided in the above embodiments.

[0157] A person of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium can be at least one of the following media: read-only memory (English: Read-only Memory, abbreviated: ROM), RAM, magnetic disk or optical disk, etc. Various media that can store program codes.

[0158] It should be noted that each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiments. The device and system embodiments described above are merely schematic, in which the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.

[0159] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a technician familiar with the technical field within the technical scope disclosed in the present application should be included in the protection scope of the present application. Moreover, based on the implementation methods provided in the above aspects, the present application can also be further combined to provide more implementation methods. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A port binding method, characterized in that: The method is applied to a first host node in a server, wherein the server further includes a second host node, wherein the first host node and the second host node are respectively connected to a first switch through a first port of a network card, and are respectively connected to a second switch through a second port of the network card; the method includes: Logically binding the first port and the second port as a binding port of the first host node; sending a first protocol message to the first switch and the second switch through the first port and the second port respectively, wherein the first protocol message includes a node identifier of the first host node and a network address of a binding port of the first host node, the node identifier of the first host node is the same as the node identifier of the second host node, the network address of the binding port of the first host node is different from the network address of the binding port of the second host node, and the binding port of the second host node is obtained by logically binding the first port and the second port; A second protocol message is obtained from the first switch through the first port, and a third protocol message is obtained from the second switch through the second port, wherein the second protocol message includes a network address of the first switch, and the third protocol message includes a network address of the second switch, so as to access the network through the first switch and the second switch.

2. The method according to claim 1, characterized in that The method further comprises: Determine a target port corresponding to the data to be sent from the first port and the second port based on a preset rule, wherein the source address of the data to be sent is the network address of the binding port of the first host node; The to-be-sent data is sent to a target switch connected to the target port among the first switch and the second switch through the target port.

3. The method according to claim 2, characterized in that The determining, based on a preset rule, a target port corresponding to the to-be-sent data from the first port and the second port includes: If it is determined that a physical fault occurs on the second port, determining the first port as a target port corresponding to the data to be sent; If it is determined that a physical failure occurs on the first port, the second port is determined as a target port corresponding to the data to be sent.

4. The method according to claim 3, characterized in that The first protocol message also includes a first preset duration, and the method further includes: If no new second protocol message is obtained after the preset multiple of the first preset time length has passed after the second protocol message is received, it is determined that a physical fault occurs on the first port; If no new third protocol message is obtained after the third protocol message is received for a preset multiple of the first preset time period, it is determined that a physical fault occurs on the second port.

5. The method according to claim 2, characterized in that: The determining, based on a preset rule, a target port corresponding to the to-be-sent data from the first port and the second port includes: In response to a first disabling indication of the first port, determining the second port as a target port corresponding to data to be sent; or, In response to a second disabling indication for the second port, the first port is determined as a target port corresponding to data to be sent.

6. The method according to claim 5, characterized in that The second protocol message further includes a second preset duration, the third protocol message further includes a third preset duration, the second host node is used to periodically send a fourth protocol message to the first switch and the second switch through the first port and the second port respectively according to the second preset duration, the fourth protocol message includes a node identifier of the second host node and a network address of a bound port, and obtains the second protocol message from the first switch through the first port, and obtains the third protocol message from the second switch through the second port; The sending the first protocol message to the first switch and the second switch through the first port and the second port respectively includes: The first protocol message is periodically sent to the first switch through the first port according to the second preset time period, and the first protocol message is periodically sent to the second switch through the second port according to the third preset time period.

7. The method according to claim 5, characterized in that The method further comprises: In response to a first disabling indication for the first port, data to be processed is obtained through a logical link corresponding to the second port, the destination address of the data to be processed is a network address of a bound port of the first host node, the network card obtains the data to be processed through the first port, and the data to be processed is allocated by the network card to the logical link corresponding to the second port according to the first disabling indication; or, In response to a second disabling indication for the second port, the data to be processed is obtained through the logical link corresponding to the first port, the destination address of the data to be processed is the network address of the binding port of the first host node, the network card obtains the data to be processed through the second port, and the data to be processed is allocated by the network card to the logical link corresponding to the first port according to the second disabling indication.

8. The method according to any one of claims 1 to 7, characterized in that: The source address of the first protocol message is the network address of the binding port of the first host node, the source address of the second protocol message is the network address of the first switch, the source address of the third protocol message is the network address of the second switch, and the destination address of the first protocol message, the destination address of the second protocol message, and the destination address of the third protocol message are public protocol addresses.

9. The method according to any one of claims 1 to 7, characterized in that: At least one of the first host node and the second host node includes a plurality of central processing units, and the central processing units are used to process the acquired data to be processed and generate data to be sent.

10. A port binding device, characterized in that: The method is applied to a first host node in a server, wherein the server further comprises a second host node, wherein the first host node and the second host node are respectively connected to a first switch via a first port of a network card, and are respectively connected to a second switch via a second port of the network card; The device comprises a binding unit, and a protocol message sending unit and a protocol message receiving unit respectively connected to the binding unit, wherein the protocol message sending unit and the protocol message receiving unit are respectively connected to the network card; The binding unit logically binds the first port and the second port as a binding port of the first host node; The protocol message sending unit sends a first protocol message to the first switch and the second switch through the first port and the second port respectively, wherein the first protocol message includes a node identifier of the first host node and a network address of a binding port of the first host node, the node identifier of the first host node is the same as the node identifier of the second host node, the network address of the binding port of the first host node is different from the network address of the binding port of the second host node, and the binding port of the second host node is obtained by logically binding the first port and the second port; The protocol message receiving unit obtains a second protocol message from the first switch through the first port, and obtains a third protocol message from the second switch through the second port, wherein the second protocol message includes a network address of the first switch, and the third protocol message includes a network address of the second switch, so as to access the network through the first switch and the second switch.

11. The device according to claim 10, characterized in that The device also includes: a port determination unit, configured to determine a target port corresponding to the data to be sent from the first port and the second port based on a preset rule, wherein the source address of the data to be sent is the network address of the binding port of the first host node; The data sending unit connected to the network card is used to send the to-be-sent data to a target switch connected to the target port among the first switch and the second switch through the target port.

12. The device according to claim 11, characterized in that The port determination unit is specifically used for: If it is determined that a physical fault occurs on the second port, determining the first port as a target port corresponding to the data to be sent; If it is determined that a physical failure occurs on the first port, the second port is determined as a target port corresponding to the data to be sent.

13. A computer device, characterized in that: The computer device comprises a processor and a memory: The memory is used to store a computer program and transmit the computer program to the processor; The processor is used to execute the port binding method according to any one of claims 1 to 9 according to the instructions in the computer program.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and the computer program is used to execute the port binding method according to any one of claims 1 to 9.

15. A computer program product comprising a computer program, characterized in that When the method is run on a computer device, the computer device is enabled to execute the port binding method described in any one of claims 1 to 9.

Citation Information

Cited By

  • Link processing method, electronic device, storage medium and computer program product

    CN119854242A

  • Link Processing Method, Electronic Device, Storage Medium, and Computer Program Product

    CN119854242B