Method and device for determining corresponding relationship between network card and gateway

By binding the IP address of the target gateway for the network card and conducting network connectivity tests, the problem of inefficiency and omission of determining the correspondence relationship between the network card and the gateway in the existing technology is solved, and the rapid and accurate determination of the correspondence relationship between the network card and the gateway is achieved.

CN116684277BActive Publication Date: 2025-09-02INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310798397.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-30
Publication Date
2025-09-02
Estimated Expiration
2043-06-30

AI Technical Summary

Technical Problem

The prior art cannot quickly determine the correspondence between the network card and the gateway, and it is easy to miss the network card that requires corresponding gateway confirmation, resulting in inefficient network configuration.

Method used

By traversing all network cards in the service node, each network card has the same IP address as the target gateway, and conducts network connectivity tests based on the IP address to determine the network connection between the network card and the target gateway, thereby determining the corresponding gateway to the network card.

Benefits of technology

It improves the processing efficiency of determining the correspondence between the network card and the gateway, avoids the omission of network cards that need to be confirmed, and ensures the accuracy and completeness of network configuration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116684277B_ABST
    Figure CN116684277B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for determining the correspondence between a network card and a gateway. The method and device identify at least one service node in a service cluster, each service node including at least one network card, and the service cluster further including multiple gateways and multiple virtual local area networks, with the gateways and virtual local area networks corresponding one to one; determine the network segment data of the IP address of each gateway; for each service node, traverse all network cards in the service node, and bind an IP address identical to the network segment of a target gateway to each traversed network card; determine whether the network between the network card and the target gateway is connected based on the bound IP address; if the network between the network card and the target gateway is identified to be connected, determine the target gateway to be the gateway corresponding to the network card; the target gateway is any one of the multiple gateways. The present invention improves the efficiency of determining the corresponding gateways of network cards in the cluster, and can ensure that the corresponding gateways are determined for all network cards in the cluster.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for determining a corresponding relationship between a network card and a gateway. Background Art

[0002] In service clusters suitable for AI training scenarios, to improve machine model training efficiency, the cluster network is typically partitioned into multiple networks corresponding to different operational tasks. This multi-network partitioning requires multiple gateways corresponding to each network in the service cluster, and multiple network cards on each service node. The mapping between network cards and gateways must be determined. Based on this mapping, the mapping between network cards and networks is then determined, allowing network configuration to be performed for each service node in the cluster.

[0003] In related technologies, the service node routing table is usually viewed through a command line tool to determine the gateway corresponding to the network card based on the routing table information, or the port information on the switch is viewed to determine the gateway corresponding to the network card based on the port information.

[0004] However, according to the method in the related art, the correspondence between the network card and the gateway cannot be quickly obtained, and the network card for which the correspondence between the network card and the gateway needs to be determined is easily missed. Summary of the Invention

[0005] In view of the above problems, embodiments of the present invention are proposed to provide a method and apparatus for determining a correspondence between a network card and a gateway, which overcomes the above problems or at least partially solves the above problems.

[0006] In a first aspect, an embodiment of the present application discloses a method for determining a correspondence between a network card and a gateway, the method being applied to a cluster management service node, comprising:

[0007] Identifying at least one service node in a service cluster, each service node including at least one network card, the service cluster further including multiple gateways and multiple virtual local area networks, with the gateways and the virtual local area networks corresponding one to one;

[0008] Get the network segment of each gateway's IP address;

[0009] For each service node, all network cards in the service node are traversed, and an IP address identical to the network segment of the target gateway is bound to each traversed network card. Based on the bound IP address, it is determined whether the network between the network card and the target gateway is connected. When it is identified that the network between the network card and the target gateway is connected, the target gateway is determined to be the gateway corresponding to the network card; the target gateway is any one of the multiple gateways.

[0010] In a second aspect, an embodiment of the present application discloses a device for determining a correspondence between a network card and a gateway, the device comprising:

[0011] A first identification module is configured to identify at least one service node in a service cluster, each service node including at least one network card, the service cluster further including multiple gateways and multiple virtual local area networks, with the gateways and the virtual local area networks corresponding one to one;

[0012] The acquisition module is used to obtain the network segment of the IP address of each gateway;

[0013] The first determination module is configured to traverse all network cards in each service node, bind an IP address identical to a network segment of a target gateway to each traversed network card, determine whether a network between the network card and the target gateway is connected based on the bound IP address, and determine that the target gateway is the gateway corresponding to the network card when it is identified that the network between the network card and the target gateway is connected; the target gateway is any one of the multiple gateways.

[0014] In a third aspect, an embodiment of the present application further discloses an electronic device comprising a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.

[0015] In a fourth aspect, an embodiment of the present application further discloses a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0016] In summary, in an embodiment of the present application, for each service node, all network cards in the service node are traversed, and an IP address identical to the network segment of the target gateway is bound to each traversed network card. Based on the bound IP address, it is determined whether the network of the network card and the target gateway is connected. When the network connectivity between the network card and the target gateway is identified, the target gateway is determined to be the gateway corresponding to the network card. Among them, multiple gateways correspond to multiple virtual local area networks. Therefore, after determining the correspondence between the network cards and gateways in the service cluster, the correspondence between the network cards and the virtual local area networks can be determined based on the correspondence. Based on the determined correspondence between the network cards and the virtual local area networks, the network configuration of the network cards in the service cluster can be performed. In related technologies, the service node routing table can be viewed through a command line tool to obtain the gateway corresponding to the network card in the corresponding service node. However, when the service node server has just installed the operating system and the network card information in the service node has not yet been configured, the correspondence between the network card and the gateway is not stored in the service node routing table, which will result in the inability to determine the gateway corresponding to the network card. In the related art, it is also possible to determine the gateway corresponding to the network card by checking the network switch port information. However, this method has the problem of low processing efficiency. In addition, the switch port information does not necessarily include the correspondence between the network card and the gateway, which makes it impossible to determine the gateway corresponding to the network card based on the port information. In the case of a large number of service nodes in the service cluster, determining the correspondence between the network card and the gateway by checking the network switch port information may miss the network card that needs to confirm the corresponding gateway. Compared with the method of the related art, the present method determines the gateway corresponding to each network card in each service node by traversing, and will not miss the network card that needs to confirm the corresponding gateway. In addition, the present method binds the IP address of the same network segment as the target gateway to the network card, performs a network connectivity test between the network card and the target gateway based on the IP address, and determines the corresponding gateway based on the test result. The method does not require checking the routing table information or the network switch port information, thereby improving processing efficiency. That is, the method of the present invention solves the problem of the related art that it is impossible to quickly determine the gateway corresponding to the network card in the cluster and it is easy to miss the network card that needs to confirm the corresponding gateway. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 This is a flowchart of a method for determining a correspondence between a network card and a gateway provided by an embodiment of the present invention;

[0018] Figure 2 This is a flowchart of the steps of another method for determining the correspondence between a network card and a gateway provided by an embodiment of the present invention;

[0019] Figure 3 This is a flowchart of another method for determining a correspondence between a network card and a gateway provided by an embodiment of the present invention;

[0020] Figure 4 This is a block diagram of a device for determining a correspondence between a network card and a gateway provided by an embodiment of the present invention;

[0021] Figure 5 is a block diagram of an electronic device according to an embodiment of the present invention;

[0022] Figure 6 is a block diagram of an electronic device according to another embodiment of the present invention. DETAILED DESCRIPTION

[0023] Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.

[0024] Some nouns or terms appearing in this application are subject to the following interpretations:

[0025] Virtual Local Area Network (VLAN) technology is used to divide a large network into multiple small logical networks. These small logical networks are the virtual local area networks in this application.

[0026] Secure Shell (SSh) is a secure network protocol that ensures the security of data transmission in the network through security mechanisms such as encryption, authentication, and data integrity verification.

[0027] refer to Figure 1 , which shows a flowchart of the steps of the method for determining the correspondence between network cards and gateways provided by an embodiment of the present application. The method is applied to the cluster management service node, which is a service node in the cluster that is used to bind an IP address with the same network segment as the target gateway to each network card and determine the gateway corresponding to each network card based on the bound IP address. The method may include:

[0028] Step 101: Identify at least one service node in a service cluster. Each service node includes at least one network card. The service cluster includes multiple gateways and multiple virtual local area networks. The gateways and virtual local area networks correspond one to one.

[0029] In an embodiment of the present invention, the service cluster may be a service cluster suitable for AI training scenarios, or a cluster suitable for other application scenarios, which is not limited here.

[0030] In an embodiment of the present invention, the number of network cards in the service nodes of the service cluster and the number of gateways included in the service cluster can be determined based on the number of virtual local area networks in the service cluster. For example, the number of network cards in the service nodes can be equal to the number of virtual local area networks in the service cluster.

[0031] The multiple virtual local area networks (VLANs) are obtained by dividing the service cluster network based on VLAN technology. For example, the service cluster network can be divided into a preset number of virtual local area networks based on user needs, and the number of virtual local area networks obtained is not limited. The multiple gateways correspond to the multiple virtual local area networks on a one-to-one basis.

[0032] Taking a service cluster used for AI training scenarios as an example, the correspondence between virtual local area networks (VLANs) and gateways in the cluster is illustrated as follows: In a service cluster used for AI training scenarios, to improve the efficiency of AI model training, the cluster network can be divided into multiple virtual local area networks (VLANs) corresponding to different operations. For example, the cluster network can be divided into a computing network for model training, a storage network for data storage, and a management network for platform access. In this case, three gateways are required in the cluster.

[0033] Step 102: Determine the network segment of the IP address of each gateway.

[0034] In the embodiment of the present invention, there are many methods for determining the network segment data of the IP address of each gateway, which are not limited here. For example, the IP address of the gateway can be obtained and the corresponding network segment can be determined based on the IP address.

[0035] Step 103: For each service node, traverse all network cards in the service node and bind an IP address that is the same as the network segment of the target gateway in step 301 to each traversed network card. Based on the bound IP address, determine whether the network between the network card and the target gateway is connected. If the network between the network card and the target gateway is connected, determine the target gateway as the gateway corresponding to the network card; the target gateway is any one of the multiple gateways.

[0036] In an embodiment of the present invention, the gateway corresponding to each network card in the service node can be determined by traversing all network cards in the service node. In an embodiment of the present invention, the gateway corresponding to each network card in each service node in the service cluster can be determined by traversing all service nodes in the service cluster.

[0037] In the embodiment of the present invention, the identifier of each network card can be obtained, and the IP address with the same network segment as the target gateway can be bound to the corresponding network card by binding the corresponding network card identifier and the IP address with the same network segment as the target gateway.

[0038] In embodiments of the present invention, there are various methods for determining a target gateway, which are not limited herein. For example, for a current network card currently undergoing gateway determination, any gateway in a service cluster that has not yet been determined to correspond with the current network card can be randomly determined as the target gateway. For another example, the multiple gateways in the service cluster can be sorted in execution order, and the gateway with the highest execution order can be determined from among the multiple gateways that have not yet been determined to correspond with the current network card, based on the execution order, and the gateway with the highest execution order can be determined as the target gateway.

[0039] In an embodiment of the present invention, the network connectivity between the network card and the target gateway can be determined by an instruction for performing a network connectivity test based on an IP address. For example, the network connectivity between the network card and the target gateway can be determined by an Internet Packet Groper (ping) instruction.

[0040] In summary, in an embodiment of the present application, for each service node, all network cards in the service node are traversed, and an IP address identical to the network segment of the target gateway is bound to each traversed network card. Based on the bound IP address, it is determined whether the network of the network card and the target gateway is connected. When the network connectivity between the network card and the target gateway is identified, the target gateway is determined to be the gateway corresponding to the network card. Among them, multiple gateways correspond to multiple virtual local area networks. Therefore, after determining the correspondence between the network cards and gateways in the service cluster, the correspondence between the network cards and the virtual local area networks can be determined based on the correspondence. Based on the determined correspondence between the network cards and the virtual local area networks, the network configuration of the network cards in the service cluster can be performed. In related technologies, the service node routing table can be viewed through a command line tool to obtain the gateway corresponding to the network card in the corresponding service node. However, when the service node server has just installed the operating system and the network card information in the service node has not yet been configured, the correspondence between the network card and the gateway is not stored in the service node routing table, which will result in the inability to determine the gateway corresponding to the network card. In the related art, it is also possible to determine the gateway corresponding to the network card by checking the network switch port information. However, this method has the problem of low processing efficiency. In addition, the switch port information does not necessarily include the correspondence between the network card and the gateway, which makes it impossible to determine the gateway corresponding to the network card based on the port information. In the case of a large number of service nodes in the service cluster, determining the correspondence between the network card and the gateway by checking the network switch port information may miss the network card that needs to confirm the corresponding gateway. Compared with the method of the related art, the present method determines the gateway corresponding to each network card in each service node by traversing, and will not miss the network card that needs to confirm the corresponding gateway. In addition, the present method binds the IP address of the same network segment as the target gateway to the network card, performs a network connectivity test between the network card and the target gateway based on the IP address, and determines the corresponding gateway based on the test result. The method does not require checking the routing table information or the network switch port information, thereby improving processing efficiency. That is, the method of the present invention solves the problem of the related art that it is impossible to quickly determine the gateway corresponding to the network card in the cluster and it is easy to miss the network card that needs to confirm the corresponding gateway.

[0041] The following is a further example of how to determine the correspondence between the network card and the gateway. Figure 2 , which shows a flowchart of the steps of another method for determining the correspondence between a network card and a gateway provided in an embodiment of the present application. The method may include the following steps:

[0042] Step 201: Identify at least one service node in a service cluster. Each service node includes at least one network card, and the service cluster also includes multiple gateways.

[0043] The service cluster also includes multiple virtual local area networks, and the gateways and virtual local area networks correspond one to one.

[0044] This step can refer to step 101 and will not be repeated here.

[0045] Step 202: Determine the network segment of the IP address of each gateway.

[0046] This step can refer to step 102 and will not be repeated here.

[0047] Step 203: For each service node, all network cards in the service node are traversed, and for each traversed network card, an IP address that is the same as the network segment of the target gateway is determined, the network card name of the network card and the IP address that is the same as the network segment are bound, and based on the bound IP address, whether the network of the network card and the target gateway is connected is determined. When it is identified that the network between the network card and the target gateway is connected, the target gateway is determined to be the gateway corresponding to the network card.

[0048] It should be noted that multiple gateways correspond to multiple virtual LANs one-to-one. Therefore, after determining the correspondence between the network cards and gateways in the service cluster, the correspondence between the network cards and the virtual LANs can be determined based on the correspondence. After determining the correspondence between the network cards and the virtual LANs, the network configuration of the network cards in the service cluster can be performed.

[0049] In one embodiment, the service node is logged in using the service node's IP address, and then the network card names of each network card stored in the service node are obtained. The network card names of the network cards are then bound to the IP address of the same network segment. For example, the operating system of the corresponding service node can be logged in using the service node's IP address, and the network card names of each network card stored therein can be read from the operating system. Alternatively, the module for storing the network card names of each network card in the corresponding service node can be determined based on the service node's IP address, and the network card names of each network card in the corresponding service node can be extracted from the corresponding module.

[0050] In an embodiment of the present invention, after determining that the target gateway is the gateway corresponding to the network card, the network card name of the network card, the name or IP address of the target gateway, and the IP address of the corresponding service node are output to the terminal so that the service cluster manager can perform network configuration on the corresponding service node based on the output information.

[0051] In an embodiment of the present invention, for each service node, all network cards in the service node are traversed, and for each traversed network card, an IP address with the same network segment as the target gateway is determined, and the network card name of the network card is bound to the IP address with the same network segment; based on the bound IP address, whether the network of the network card and the target gateway is connected is determined, and when the network connectivity between the network card and the target gateway is identified, the target gateway is determined to be the gateway corresponding to the network card. By binding the network card name and the IP address with the same network segment as the target gateway, the binding of the network card to the IP address with the same network segment can be quickly achieved. Compared with the methods of the related art, the present method determines the gateway corresponding to each network card in each service node by traversing, and will not miss the network card that needs to confirm the corresponding gateway. The present method binds the IP address with the same network segment as the target gateway to the network card, performs a network connectivity test between the network card and the target gateway based on the IP address, and determines the corresponding gateway based on the test result. The method does not need to check the routing table information or the network switch port information, thereby improving processing efficiency. That is, the method of the present invention solves the problem in the related art that the gateway corresponding to the network card in the cluster cannot be quickly determined and the network card that needs to be confirmed for the corresponding gateway is easily missed.

[0052] In some optional embodiments, after step 202, the following steps may also be included:

[0053] Step 204: When it is identified that the network between the network card and the target gateway is disconnected, the network card is bound to an IP address with the same network segment as another gateway, where the other gateway is a gateway that has not been determined to correspond to the network card.

[0054] In some optional embodiments, when it is identified that the network between the network card and the target gateway is not connected, the IP address bound to the network card with the same network segment as the target gateway can be deleted, and then the network card can be bound to the IP address with the same network segment as another gateway.

[0055] Among them, the method for binding the network card to the same IP address as the network segment of other gateways can refer to the method for binding the network card to the same IP address as the network segment of the target gateway in step 203, which will not be repeated here.

[0056] In the embodiments of the present invention, there are various methods for determining other gateways, which are not limited herein. For example, at least one gateway that has not been associated with a corresponding network card can be determined from multiple gateways, and then a gateway can be randomly determined from the at least one gateway. The randomly determined gateway is the other gateway in the embodiments of the present invention.

[0057] Step 205 , identifying whether the network between the network card and the other gateway is connected. If the network between the network card and the other gateway is connected, determining the other gateway as the gateway corresponding to the network card.

[0058] The following example illustrates other gateways: In a service cluster, there are three gateways: Gateway A, Gateway B, and Gateway C. The target gateway associated with the network card is Gateway A. After binding the network card with an IP address in the same network segment as Gateway A, network connectivity between Gateway A and the network card is lost. In this case, the IP address in the same network segment as Gateway A, which is bound to the network card, is deleted. Then, Gateway C is randomly selected from Gateways B and C and used as the other gateway associated with the network card. The network card is bound with an IP address in the same network segment as Gateway C. Network connectivity between the network card and Gateway C is then determined. If connectivity is achieved, Gateway C is determined as the gateway corresponding to the network card.

[0059] In an embodiment of the present invention, when it is determined that the network between the target network card and the target gateway is disconnected, the network card is bound to an IP address that is the same as the network segment of another gateway. Then, it is determined whether the network between the network card and the corresponding other gateway is connected. If the network between the network card and the other gateway is connected, the other gateway is determined to be the gateway corresponding to the network card. That is, if the network between the network card and the target gateway is disconnected, or if the target gateway is not the gateway corresponding to the network card, the gateway corresponding to the network card is still confirmed based on the other gateway, thereby ensuring that the gateway corresponding to the network card is obtained, thereby improving the success rate of determining the corresponding gateway for the network card.

[0060] Optionally, before binding the network card name of the network card and the IP address that is the same as the network segment in step 203, the method further includes:

[0061] Step 206: Obtain the IP address of each service node.

[0062] In embodiments of the present invention, there are various methods for obtaining the IP address of a service node. For example, an instruction for obtaining an IP address may be sent to the service node, and the IP address of the corresponding service node may be obtained based on the instruction. For example, the IP address of each service node may be obtained using the ip addr instruction.

[0063] Step 207: For each service node, access the service node according to the corresponding IP address to obtain the network card name of each network card in the service node.

[0064] In the embodiment of the present invention, for each service node, the operating system of the service node can be accessed according to the corresponding IP address, and the pre-stored network card names of each network card can be obtained from the operating system.

[0065] In this embodiment, by accessing the service node according to the IP address, the network card name of each network card in the service node can be automatically and quickly obtained, thereby improving processing efficiency.

[0066] In some optional embodiments, step 207 may include the following sub-steps (sub-step 2071):

[0067] Sub-step 2071: access the service node based on the secure shell protocol according to the corresponding IP address to obtain the network card name of each network card in the service node.

[0068] For example, based on the IP address and SSH instructions, log in to the operating system of the service node corresponding to the IP address, and then send an instruction for obtaining the network card names of all network cards in the service node to the operating system, so that the operating system responds to the network card name acquisition instruction and sends the network card names of all network cards in the service node to the cluster management service node.

[0069] In the embodiment of the present invention, the service node is accessed based on the SSH instruction to obtain the network card name of each network card in the service node, which can ensure the security of data transmission.

[0070] In some optional embodiments, in step 203, for each service node, determining the gateway corresponding to each network card in each service node may include the following sub-steps:

[0071] Sub-step 2031 , sorting the IP addresses of the service nodes to obtain an IP address sorting result.

[0072] In this embodiment of the present invention, the method for obtaining the IP addresses of each service node can be referred to in the description of step 206 and will not be repeated here. There are various methods for sorting the IP addresses of each service node, which are not limited here. For example, sorting can be performed using a random sorting method or according to other user-defined sorting strategies.

[0073] The following is an example of the sorting method: the service cluster includes n IP addresses, and each IP address is sorted to obtain the IP address sorting result, which is represented in array form as {IP1, IP2, ..., IP i ,…,IP n}, where IP1 is the IP address of the first service node, IP2 is the IP address of the second service node, and IP i is the IP address of the i-th service node, IP n The IP address of the nth service node.

[0074] Sub-step 2032: Determine whether the gateways corresponding to the network cards in the current service node have been determined. The current service node is a service node among the multiple service nodes.

[0075] There are multiple service nodes in the cluster, and the current service node may be the service node where the network card corresponding to the gateway is located, which is most recently determined among the multiple service nodes.

[0076] The method for determining the gateway corresponding to each network card in the current service node may refer to the method for determining the gateway corresponding to the network card in the service node in step 203, which will not be repeated here.

[0077] In the embodiment of the present invention, whether the gateways corresponding to the network cards in the current service node have all been determined can be determined based on the number of network cards in the current service node whose corresponding gateways have been determined.

[0078] Sub-step 2033 , when the gateways corresponding to the network cards in the current service node have been determined, determining whether the IP address of the current service node is the last IP address in the IP address sorting result.

[0079] In an embodiment of the present invention, the IP address of the current service node can be compared with the last IP address in the IP address sorting result. When the IP address of the current service node is the same as the last IP address in the IP address sorting result, it is determined that the IP address of the current service node is the last IP address in the IP address sorting result; when the IP address of the current service node is different from the last IP address in the IP address sorting result, it is determined that the IP address of the current service node is not the last IP address in the IP address sorting result.

[0080] Sub-step 2034: If the IP address of the current service node is not the last IP address in the IP address sorting result, determine the next IP address after the IP address of the current service node according to the IP address sorting result.

[0081] The latter IP address is an IP address that is located after the current service node IP address in the IP address sorting result and is adjacent to the current service node IP address.

[0082] In the embodiment of the present invention, the service nodes corresponding to the respective IP addresses are processed in sequence according to the order of the IP address sorting results to determine the gateway corresponding to each network card in each service node.

[0083] When the IP address of the current service node is not the last IP address in the IP address sorting result, it means that the corresponding gateway has not yet been determined for the network card in the service node corresponding to at least one IP address in the IP address sorting result.

[0084] Specifically, when the IP address of the current service node is not the last IP address in the IP address sorting result, the service nodes corresponding to the IP addresses after the IP address of the current service node in the IP address sorting result are all service nodes for which the gateway determination has not been performed for the network card therein.

[0085] It should be noted that when the IP address of the current service node is the last IP address in the IP address sorting result, it means that the corresponding gateways of the network cards in the service nodes corresponding to all IP addresses in the IP address sorting result have been determined, which means that the corresponding gateways have been determined for all network cards in the cluster. In this case, the operation of determining the corresponding gateway of the network card can be terminated.

[0086] Sub-step 2035: Access a subsequent service node corresponding to the subsequent IP address according to the subsequent IP address, and obtain the network card name of each network card in the subsequent service node.

[0087] The method of accessing the next service node corresponding to the next IP address and obtaining the network card name of each network card in the next service node according to the next IP address can be referred to step 207 and will not be repeated here.

[0088] Sub-step 2036 , determining the gateway corresponding to each network card in the next service node according to the network card name of each network card in the next service node and the network segments of the multiple gateways.

[0089] The method for determining the gateway corresponding to each network card in the subsequent service node based on the network card name of each network card in the subsequent service node and the network segments of the multiple gateways can be referred to the description of step 203. For example, the method may include: binding the network card name of the network card to an IP address that is the same as the network segment; determining, based on the bound IP address, whether the network of the network card and the target gateway are connected; and if it is identified that the network between the network card and the target gateway is connected, determining the target gateway as the gateway corresponding to the network card.

[0090] Sub-step 2037 , when the gateways corresponding to the network cards in the next service node have been determined, determining whether the next IP address is the last IP address in the IP address sorting result.

[0091] In the embodiment of the present invention, whether the gateways corresponding to the network cards in the last service node have all been determined can be determined based on the number of network cards corresponding to the gateways in the last service node and the number of multiple network cards in the last service node.

[0092] Among them, the method of determining whether the latter IP address is the last IP in the IP address sorting result can be referred to sub-step 2033, which will not be repeated here.

[0093] In summary, in an embodiment of the present invention, by sorting IP addresses to obtain an IP address sorting result, and when the gateway corresponding to each network card in the current service node has been determined, and the IP address of the current service node is not the last IP address in the IP address sorting result, the next IP address after the IP address of the current service node is determined according to the IP address sorting result, and the next service node corresponding to the next IP address is accessed based on the next IP address to obtain the network card names of each network card in the next service node. In this way, the network card names of each network card in the next service node can be quickly obtained. Based on the network card names of each network card in the next service node and the network segments of multiple gateways, the gateway corresponding to each network card in the next service node can be quickly determined. When the gateway corresponding to each network card in the next service node has been determined, it is determined whether the next IP address is the last IP address in the IP address sorting result. Therefore, it can be determined whether the operation of determining the gateway corresponding to the network card in the cluster has been completed and whether it is necessary to determine the gateway of each network card in the service node corresponding to the IP address after the next IP address. According to the IP address sorting results, the correspondence between the network card and the gateway is determined for each service node corresponding to each IP address in turn. Based on the determination of whether the IP address is the last IP address in the IP address sorting results, it is determined whether the corresponding gateway needs to be determined for each network card in the service node corresponding to the next IP address in the IP address sorting results. This ensures that the corresponding gateway is determined for each network card in the service node corresponding to each IP address in the IP address sorting results, ensuring that service nodes requiring the correspondence between the network card and the gateway are not missed. This ensures that the corresponding gateway is determined for all network cards in the cluster, thereby improving the accuracy of determining the corresponding gateway of each network card.

[0094] In step 203, all network cards in the service node are traversed to determine the gateway corresponding to each network card, which may include the following sub-steps:

[0095] Sub-step 2038: Obtain the number of network cards corresponding to gateways in the service node.

[0096] For example, for each service node, a count value for counting the number of network cards in the service node that have been determined to correspond to gateways can be determined, and the count value can be initialized to 0. During the process of confirming the corresponding gateways for the network cards in the service node, each time the gateway corresponding to the network card is confirmed, the count value is incremented by one to obtain an updated count value. The most recently determined updated count value is the number of network cards that have been determined to correspond to gateways.

[0097] Sub-step 2039 , when the number of network cards corresponding to gateways is less than the number of network cards in the service node, corresponding network cards are determined for all network cards that have not yet been determined to correspond to gateways.

[0098] The method for determining the corresponding network card for a network card whose corresponding gateway has not been determined is the same as the method for determining the corresponding gateway of the network card in step 203, which will not be repeated here.

[0099] In the embodiment of the present invention, when it is determined that the number of network cards of the corresponding gateway is equal to the number of the plurality of network cards in the service node, the traversal operation is terminated.

[0100] It should be noted that if the number of network cards of the corresponding network card is determined to be equal to the number of the plurality of network cards in the service node, it means that the corresponding gateways have been determined for all network cards in the corresponding service node. In this case, the traversal operation for each network card in the service node can be terminated.

[0101] In an embodiment of the present invention, the number of network cards with determined corresponding gateways in a service node is obtained; if the number of network cards with determined corresponding gateways is less than the number of network cards in the service node, corresponding network cards are determined for all network cards that have not yet been determined corresponding gateways. If the number of network cards with determined corresponding gateways is equal to the number of network cards in the service node, the traversal operation is terminated. This ensures that corresponding gateways are determined for all network cards in the corresponding service node, and prevents network cards that require corresponding gateway determination from being missed.

[0102] Reference Figure 3 In an optional embodiment, the method for allocating a website address includes the following steps:

[0103] Step 301: Obtain the IP addresses of all service nodes in the service cluster.

[0104] The service cluster includes multiple service nodes, each service node includes at least one network card, and the service cluster also includes multiple gateways and multiple virtual local area networks, and the gateways and the virtual local area networks correspond one to one.

[0105] The method for obtaining the IP addresses of all service nodes in the cluster may refer to step 206 and will not be described in detail here.

[0106] Step 302: Sort the IP addresses of all service nodes in the service cluster to obtain an IP address sorting result.

[0107] Here, this step can refer to step 2031 and will not be repeated here.

[0108] Get the IP addresses of all service nodes in the cluster, sort the IP addresses, and obtain the IP address sorting results.

[0109] Step 303: Initialize the number k of IP addresses, and set the initial value of k to 1.

[0110] Step 304, obtain the IP address of the kth IP k The network card names of all network cards in the corresponding service node.

[0111] This step can refer to step 2071 and will not be repeated here.

[0112] Step 305: Bind the current network card to an IP address in the same network segment as the target gateway.

[0113] The current network card is the network card that is currently determining the corresponding gateway, and the target gateway is the gateway that is currently determining whether it is the gateway corresponding to the current network card.

[0114] Step 306 , detecting whether the network between the current network card and the target gateway is connected, if not, proceeding to step 307 , otherwise proceeding to step 308 .

[0115] If the current network card is bound to an IP address in the same network segment as the target gateway, and the network between the current network card and the target gateway is connected, it means that the target gateway is the gateway corresponding to the current network card.

[0116] In one embodiment, the current network card name is bound to an IP address in the same network segment as the target gateway. In one embodiment, the current network card name is interface_name k, and the current gateway IP address information is 192.168.0.x. Then, by executing the following command, the current network card name is bound to an IP address in the same network segment as the target gateway:

[0117] ip adds add 192.168.0.y dev${interface_name k}

[0118] ifconfig${interface_name k}up

[0119] Where x and y are the host number information of the target gateway and the current network card IP address respectively, and x≠y. The value range of x and y is between 1 and 254. ip adds is the command used to obtain the IP address.

[0120] After binding the current network card name to an IP address in the same network segment as the target gateway, you can use the ping command to detect whether the network between the current network card and the target gateway is connected. Specifically, in the above embodiment, the ping command used to detect whether the network is connected is: ping 192.168.0.x. In other words, in this embodiment, you can use the ping command to obtain a confirmation result of whether the network is connected.

[0121] Step 307 , delete the IP address information of the same network segment as the target gateway bound to the current network card, determine any other gateway as the target gateway, and return to step 305 .

[0122] After deleting the IP address information configured for the current network card, any other gateway is used as the target gateway and the process returns to step 305. Thus, the method from step 305 to step 306 can be referred to determine whether the gateway is the gateway corresponding to the network card.

[0123] Step 308: Output the network card name of the current network card, the name of the target gateway, and the IP address of the corresponding service node. K .

[0124] The network card name, target gateway name, and corresponding service node IP address are output to the terminal, allowing service cluster administrators to configure the network for the corresponding service node based on the output information. After determining the gateway corresponding to the current network card, the IP address configured for the current network card is deleted to facilitate subsequent network configuration.

[0125] Step 309 : adding 1 to the count value used to record the number of network cards of determined gateways in the corresponding service node to obtain an updated count value.

[0126] Step 310 , determining whether the updated count value is equal to the number of all network cards in the corresponding service node, if not, proceeding to step 311 , if equal, proceeding to step 312 .

[0127] Step 311 : Determine that another network card in the corresponding service node is the current network card, and return to step 305 .

[0128] Based on step 305 to step 311, the IP address IP is completed. k A traversal operation is performed on all network cards in the corresponding service node, and based on the traversal operation, a corresponding gateway is determined for each network card in the service node.

[0129] Step 312, determine IP k Is it the last IP address in the IP address sorting result? If not, go to step 313; if yes, go to step 314.

[0130] In this embodiment, according to the IP address sorting result, the corresponding gateway is determined for the network card in the service node corresponding to each IP address.

[0131] Step 313 , set k=k+1, and return to step 304 .

[0132] In IP k If it is not the last IP address in the IP address sorting result, it means that the corresponding gateway of the network card in the service node corresponding to each IP address in the IP address sorting result has not been determined yet. In this case, it is necessary to continue to determine the correspondence between the network card and the gateway. The serial number k of the service node is increased by one, and when the updated serial number k is reached, the service node corresponding to the updated serial number k is the next service node of the kth service node before the update in the IP address sorting result. The original serial number k is replaced with the updated serial number, and then the process returns to step 304. According to steps 304 to 312, the corresponding gateway of each network card in the next service node can be determined. In this way, each service node in the cluster can be traversed to ensure that each network card in each service node in the cluster has its corresponding gateway determined.

[0133] Step 314, end the operation.

[0134] In an embodiment of the present invention, the network card names of all network cards in each service node can be automatically obtained through instructions, and the network card names and the IP addresses of the corresponding gateways in the same network segment can be bound. Then, a network connectivity test can be performed, and the gateway corresponding to the network card can be determined based on the test results. After the corresponding gateway is determined, the bound temporary IP address is deleted for subsequent network configuration. The method ensures that the corresponding gateways are determined for all network cards in the service nodes by traversing each network card in the service node. By traversing each service node in the cluster, it is ensured that the corresponding gateways are determined for the network cards in each service node. In this way, it can be ensured that the corresponding gateways are determined for all network cards in the cluster, which solves the problem of easily missing network cards that need to determine the corresponding gateways in the related art, and improves the efficiency and accuracy of determining the corresponding gateways of network cards.

[0135] refer to Figure 4 , which shows a device 40 for determining a correspondence between a network card and a gateway provided in an embodiment of the present application, the device comprising:

[0136] A first identification module 401 is configured to identify at least one service node in a service cluster, each service node including at least one network card, and the service cluster further including multiple gateways and multiple virtual local area networks, with a one-to-one correspondence between the gateways and the virtual local area networks;

[0137] Acquisition module 402, used to obtain the network segment of the IP address of each gateway;

[0138] The first determination module 403 is used to traverse all network cards in each service node, and bind an IP address that is the same as the network segment of the target gateway to each traversed network card, and determine whether the network between the network card and the target gateway is connected based on the bound IP address. When it is identified that the network between the network card and the target gateway is connected, the target gateway is determined to be the gateway corresponding to the network card; the target gateway is any gateway among the multiple gateways.

[0139] Optionally, the device for determining the correspondence between the network card and the gateway further includes:

[0140] The second identification module is used to bind the network card to an IP address with the same network segment as another gateway when it is identified that the network between the network card and the target gateway is not connected, where the other gateway is a gateway that has not been determined to correspond to the network card among the multiple gateways;

[0141] The second determining module is configured to identify whether the network between the network card and the other gateway is connected, and if the network between the network card and the other gateway is connected, determine the other gateway as the gateway corresponding to the network card.

[0142] Optionally, the first determining module 403 further includes:

[0143] The first determination submodule is used to determine the IP address with the same network segment as the target gateway;

[0144] The first binding submodule is used to bind the network card name of the network card and the IP address that is the same as the network segment.

[0145] Optionally, the first determining module 403 further includes:

[0146] The first acquisition submodule is used to obtain the IP address of each service node;

[0147] The second acquisition submodule accesses each service node according to the corresponding IP address to obtain the network card name of each network card in the service node.

[0148] Optionally, the second acquisition submodule includes:

[0149] The acquisition unit is used to access the service node based on the corresponding IP address and the secure shell protocol instruction to obtain the network card name of each network card in the service node.

[0150] Optionally, the first determining module 403 further includes:

[0151] The third acquisition submodule is used to sort the IP addresses of each service node and obtain the IP address sorting result;

[0152] The second determining submodule is used to determine whether the gateways corresponding to the network cards in the current service node have all been determined, and the current service node is a service node among the multiple service nodes;

[0153] The third determination submodule is used to determine whether the IP address of the current service node is the last IP address in the IP address sorting result when the gateway corresponding to each network card in the current service node has been determined;

[0154] a fourth determining submodule, configured to determine, if the IP address of the current service node is not the last IP address in the IP address sorting result, the next IP address after the IP address of the current service node according to the IP address sorting result;

[0155] The fourth acquisition submodule is used to access the next service node corresponding to the next IP address according to the next IP address, and obtain the network card name of each network card in the next service node;

[0156] a fifth determining submodule, configured to determine, based on the network card name of each network card in the subsequent service node and the network segments of the plurality of gateways, the gateway corresponding to each network card in the subsequent service node;

[0157] The sixth determining submodule is configured to determine whether the next IP address is the last IP address in the IP address sorting result when the gateways corresponding to the network cards in the next service node have been determined.

[0158] Optionally, the first determining module 403 further includes:

[0159] The fifth acquisition submodule is used to obtain the number of network cards corresponding to the gateway in the service node;

[0160] The second binding submodule is configured to determine corresponding network cards for the network cards that have not yet been determined to correspond to gateways when the number of network cards that have been determined to correspond to gateways is not equal to the number of the multiple network cards in the service node.

[0161] In an embodiment of the present application, for each service node, all network cards in the service node are traversed, and an IP address identical to the network segment of the target gateway is bound to each traversed network card. Based on the bound IP address, it is determined whether the network of the network card and the target gateway is connected. When the network connectivity between the network card and the target gateway is identified, the target gateway is determined to be the gateway corresponding to the network card. Multiple gateways correspond to multiple virtual local area networks (VLANs). Therefore, after determining the correspondence between the network cards and gateways in the service cluster, the correspondence between the network cards and the virtual local area networks can be determined based on the correspondence. After determining the correspondence between the network cards and the virtual local area networks, the network configuration of the network cards in the service cluster is then performed. In related technologies, the service node routing table can be viewed through a command line tool to obtain the gateway corresponding to the network card in the corresponding service node. However, when the service node server has just installed the operating system and the network card information in the service node has not yet been configured, the correspondence between the network card and the gateway is not stored in the service node routing table, which makes it impossible to determine the gateway corresponding to the network card. In the related art, it is also possible to determine the gateway corresponding to the network card by checking the network switch port information. However, this method has the problem of low processing efficiency. In addition, the switch port information does not necessarily include the correspondence between the network card and the gateway, which makes it impossible to determine the gateway corresponding to the network card based on the port information. In the case of a large number of service nodes in the service cluster, determining the correspondence between the network card and the gateway by checking the network switch port information may miss the network card that needs to confirm the corresponding gateway. Compared with the method of the related art, the present method determines the gateway corresponding to each network card in each service node by traversing, and will not miss the network card that needs to confirm the corresponding gateway. In addition, the present method binds the IP address of the same network segment as the target gateway to the network card, performs a network connectivity test between the network card and the target gateway based on the IP address, and determines the corresponding gateway based on the test result. The method does not require checking the routing table information or the network switch port information, thereby improving processing efficiency. That is, the method of the present invention solves the problem of the related art that it is impossible to quickly determine the gateway corresponding to the network card in the cluster and it is easy to miss the network card that needs to confirm the corresponding gateway.

[0162] Figure 5 is a block diagram of an electronic device 600. For example, the electronic device 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like.

[0163] Reference Figure 5 , the electronic device 600 may include one or more of the following components: a processing component 602 , a memory 604 , a power component 606 , a multimedia component 608 , an audio component 610 , an input / output (I / O) interface 612 , a sensor component 614 , and a communication component 616 .

[0164] The processing component 602 generally controls the overall operation of the electronic device 600, such as operations associated with display, phone calls, data communications, camera operation, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to perform all or part of the steps of the above-described method. In addition, the processing component 602 may include one or more modules to facilitate interaction between the processing component 602 and other components. For example, the processing component 602 may include a multimedia module to facilitate interaction between the multimedia component 608 and the processing component 602.

[0165] The memory 604 is used to store various types of data to support operations on the electronic device 600. Examples of such data include instructions for any application or method operating on the electronic device 600, contact data, phone book data, messages, pictures, multimedia, etc. The memory 604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.

[0166] The power supply assembly 606 provides power to the various components of the electronic device 600. The power supply assembly 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 600.

[0167] The multimedia component 608 includes a screen that provides an output interface between the electronic device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor can not only sense the boundaries of touch or slide actions, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front camera and / or a rear camera. When the electronic device 600 is in an operating mode, such as a shooting mode or a multimedia mode, the front camera and / or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capabilities.

[0168] The audio component 610 is used to output and / or input audio signals. For example, the audio component 610 includes a microphone (MIC), which is used to receive external audio signals when the electronic device 600 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 604 or transmitted via the communication component 616. In some embodiments, the audio component 610 also includes a speaker for outputting audio signals.

[0169] I / O interface 612 provides an interface between processing component 602 and peripheral interface modules, such as a keyboard, click wheel, buttons, etc. These buttons may include but are not limited to: a home button, volume buttons, a start button, and a lock button.

[0170] The sensor assembly 614 includes one or more sensors for providing various aspects of status assessment for the electronic device 600. For example, the sensor assembly 614 can detect the open / closed state of the electronic device 600, the relative positioning of components, such as the display and keypad of the electronic device 600. The sensor assembly 614 can also detect changes in the position of the electronic device 600 or a component of the electronic device 600, the presence or absence of user contact with the electronic device 600, the orientation or acceleration / deceleration of the electronic device 600, and temperature changes of the electronic device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0171] The communication component 616 is used to facilitate wired or wireless communication between the electronic device 600 and other devices. The electronic device 600 can access a wireless network based on a communication standard, such as WiFi, an operator network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 616 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0172] In an exemplary embodiment, the electronic device 600 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to implement a method for determining a correspondence between a network card and a gateway provided in an embodiment of the present application.

[0173] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, which can be executed by a processor 620 of an electronic device 600 to perform the above method. For example, the non-transitory storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0174] Figure 6 FIG. 7 is a block diagram of an electronic device 700 according to another embodiment of the present invention. For example, the electronic device 700 may be provided as a server. Figure 6 The electronic device 700 includes a processing component 722, which further includes one or more processors, and a memory resource represented by a memory 732 for storing instructions executable by the processing component 722, such as an application. The application stored in the memory 732 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 722 is configured to execute instructions to perform a method for determining a correspondence between a network card and a gateway provided in an embodiment of the present application.

[0175] The electronic device 700 may further include a power supply component 726 configured to perform power management of the electronic device 700, a wired or wireless network interface 750 configured to connect the electronic device 700 to a network, and an input / output (I / O) interface 758. The electronic device 700 may operate based on an operating system stored in the memory 732, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or the like.

[0176] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present application that follow the general principles of the present application and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0177] It should be understood that the present application is not limited to the exact structures described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A method for determining the correspondence between a network card and a gateway, characterized in that: The method is applied to a cluster management service node, and includes: Identifying at least one service node in a service cluster, each service node including at least one network card, the service cluster including multiple gateways and multiple virtual local area networks, with the gateways and the virtual local area networks corresponding one to one; Determine the network segment of each gateway's IP address; For each service node, all network cards in the service node are traversed, and an IP address identical to the network segment of the target gateway is bound to each traversed network card. Based on the bound IP address, it is determined whether the network between the network card and the target gateway is connected. When it is identified that the network between the network card and the target gateway is connected, the target gateway is determined to be the gateway corresponding to the network card; the target gateway is any one of the multiple gateways.

2. The method according to claim 1, characterized in that Also includes: When it is identified that the network between the network card and the target gateway is not connected, binding the network card with an IP address in the same network segment as another gateway, where the other gateway is a gateway among the multiple gateways that has not been determined to correspond to the network card; Identify whether the network between the network card and the other gateway is connected, and if the network between the network card and the other gateway is connected, determine that the other gateway is the gateway corresponding to the network card.

3. The method according to claim 1, characterized in that Bind the network card to an IP address that is the same as the target gateway's network segment, including: Determine an IP address that is in the same network segment as the target gateway; Bind the network card name of the network card to the IP address that is the same as the network segment.

4. The method according to claim 3, characterized in that Before binding the network card name of the network card and the IP address that is the same as the network segment, the method further includes: Get the IP address of each service node; For each service node, access the service node according to the corresponding IP address to obtain the network card name of each network card in the service node.

5. The method according to claim 4, characterized in that Accessing the service node according to the corresponding IP address to obtain the network card name of each network card in the service node includes: According to the corresponding IP address, the service node is accessed based on the secure shell protocol instruction to obtain the network card name of each network card in the service node.

6. The method according to claim 4, characterized in that For each service node, determine the gateway corresponding to each network card in each service node, including: Sort the IP addresses of each service node to obtain the IP address sorting result; Determining whether gateways corresponding to network cards in a current service node have been determined, where the current service node is a service node among multiple service nodes; When the gateway corresponding to each network card in the current service node has been determined, determining whether the IP address of the current service node is the last IP address in the IP address sorting result; If the IP address of the current service node is not the last IP address in the IP address sorting result, determine the next IP address after the IP address of the current service node according to the IP address sorting result; Accessing a subsequent service node corresponding to the subsequent IP address according to the subsequent IP address, and obtaining a network card name of each network card in the subsequent service node; Determining the gateway corresponding to each network card in the subsequent service node according to the network card name of each network card in the subsequent service node and the network segments of the IP addresses of the multiple gateways; When the gateways corresponding to the network cards in the subsequent service node have been determined, it is determined whether the subsequent IP address is the last IP address in the IP address sorting result.

7. The method according to any one of claims 1 to 6, characterized in that Traverse all network cards in the service node and determine the gateway corresponding to each network card, including: Get the number of network cards corresponding to the gateway in the service node; In a case where the number of network cards that have been determined to correspond to gateways is less than the number of the plurality of network cards in the service node, corresponding network cards are determined for the network cards that have not been determined to correspond to gateways among all the network cards.

8. A device for determining the correspondence between a network card and a gateway, characterized in that: The device comprises: A first identification module is configured to identify at least one service node in a service cluster, each service node including at least one network card, the service cluster further including multiple gateways and multiple virtual local area networks, with the gateways and the virtual local area networks corresponding one to one; The acquisition module is used to obtain the network segment of the IP address of each gateway; The first determination module is configured to traverse all network cards in each service node, bind an IP address identical to a network segment of a target gateway to each traversed network card, determine whether a network between the network card and the target gateway is connected based on the bound IP address, and determine that the target gateway is the gateway corresponding to the network card when it is identified that the network between the network card and the target gateway is connected; the target gateway is any one of the multiple gateways.

9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Network card connectivity detection method and device, electronic device and storage medium

    CN115297028A

  • Cloud gateway, cloud gateway management device, and method thereof

    US20150106812A1