Network communication method and device, storage medium and computer equipment

By implementing traffic takeover of failed gateway equipment in the cluster, the problem of insufficient routing load balancing capabilities in the existing technology is solved, and the load balancing of network traffic and network stability is improved.

CN119484539APending Publication Date: 2025-02-18TENCENT TECH (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311001711.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-09
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

In the prior art clusters based on the open shortest path priority protocol, the routing load balancing capability is weak and the load sharing of traffic cannot be realized, resulting in congestion or interruption of network communication when some gateway devices in the cluster fail.

Method used

When detecting a failed gateway device, the normal gateway device determines its workload status and obtains the Internet protocol address of the failed gateway device, generates an address resolution protocol message and sends it to the switch, and receives the network data returned by the switch based on the message to realize the failed gateway The flow rate of the equipment is taken over.

Benefits of technology

It realizes load balancing of network traffic, improves the network stability and communication efficiency of the cluster, and avoids network interruptions caused by faulty gateway equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119484539A_ABST
    Figure CN119484539A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a network communication method and device, a storage medium and computer equipment. The method can be used in the intelligent traffic field. When the fault gateway device is detected, the working load state of the current gateway device is determined, and the fault gateway device and the current gateway device are gateway devices in the same cluster; obtaining at least one first internet protocol address in the fault gateway equipment according to the working load state; generating a corresponding address resolution protocol message according to the first internet protocol address and a second internet protocol address managed by the current gateway device; sending the address resolution protocol message to a switch; and receiving network data returned by the switch according to the address resolution protocol message. Therefore, the internet protocol address managed by the fault gateway equipment is taken over through the normal gateway equipment, and the fault gateway equipment is replaced by the normal gateway equipment to carry out network data transmission, so that network load balancing is realized, and the efficiency of network communication is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a network communication method, device, storage medium and computer equipment. Background Art

[0002] In existing network technologies, clusters are generally implemented based on the routing layer. Gateway high availability based on routing is flexible, but it is limited by the support of the entire physical network of the switch and depends on the construction of the underlying network. For example, clusters are often established based on the Open Shortest Path First (OSPF) protocol to achieve communication between different devices.

[0003] However, the routing load balancing capability of the cluster based on the Open Shortest Path First protocol is weak. Although the Open Shortest Path First protocol can automatically generate interface routing priorities based on information such as the interface rate and connection reliability, for routes of different priorities leading to the same access address, the Open Shortest Path First protocol only selects routes with higher priorities for forwarding, and cannot forward traffic through routes of different priorities, and cannot achieve traffic load sharing.

[0004] Therefore, when arranging clusters based on existing technologies, there will be a problem of being unable to achieve traffic load sharing. When some gateway devices in the cluster fail, it will cause congestion or interruption of some network communications. Summary of the invention

[0005] The embodiments of the present application provide a network communication method, apparatus, storage medium and computer equipment, which can improve the efficiency of cluster network communication.

[0006] To solve the above technical problems, the present application provides the following technical solutions:

[0007] A network communication method, comprising:

[0008] When a faulty gateway device is detected, determining a workload state of a current gateway device, the faulty gateway device and the current gateway device being gateway devices in the same cluster;

[0009] Obtaining at least one first Internet Protocol address in the faulty gateway device according to the workload status;

[0010] Generate a corresponding address resolution protocol message according to the first Internet Protocol address and the second Internet Protocol address currently managed by the gateway device;

[0011] Sending the address resolution protocol message to the switch;

[0012] Receive the network data returned by the switch based on the address resolution protocol message.

[0013] A network communication device, comprising:

[0014] A detection module, used for determining the workload status of the current gateway device when a faulty gateway device is detected, wherein the faulty gateway device and the current gateway device are gateway devices in the same cluster;

[0015] An acquisition module, configured to acquire at least one first Internet Protocol address in a faulty gateway device according to a workload status;

[0016] A generating module, configured to generate a corresponding address resolution protocol message according to the first Internet Protocol address and the second Internet Protocol address currently managed by the gateway device;

[0017] A sending module, used for sending an address resolution protocol message to a switch;

[0018] The receiving module is used to receive the network data returned by the switch according to the address resolution protocol message.

[0019] In some embodiments, the detection module includes an acquisition submodule and a determination submodule.

[0020] An acquisition submodule, used to acquire the number of second Internet Protocol addresses managed by the current gateway device and the maximum load number of the Internet Protocol address of the current gateway device;

[0021] A determination submodule, configured to determine a corresponding load ratio according to the number of second Internet Protocol addresses and the maximum load number;

[0022] The acquisition module is used to acquire a corresponding number of first Internet Protocol addresses in the faulty gateway device according to the load ratio.

[0023] In some embodiments, the acquisition module is used to:

[0024] Determine a target load ratio range within which the load ratio falls;

[0025] Determine the corresponding number of takeovers that can be taken over according to the target load ratio range;

[0026] A corresponding number of first Internet Protocol addresses in the faulty gateway device is obtained according to the takeover quantity.

[0027] In some implementations, the acquisition submodule is used to: determine the data transmission volume of the current gateway device at the current time and the maximum data transmission volume of the current gateway device;

[0028] A determination submodule is used to determine a corresponding transmission occupancy ratio according to the current data transmission volume and the maximum data transmission volume;

[0029] The acquisition module is used to acquire a corresponding number of first Internet Protocol addresses in the faulty gateway device according to the transmission occupancy ratio.

[0030] In some embodiments, the acquisition module is used to:

[0031] Determine a target transmission occupancy ratio range in which the transmission occupancy ratio falls;

[0032] Determine the corresponding number of takeovers based on the target transmission occupancy ratio range;

[0033] A corresponding number of first Internet Protocol addresses in the faulty gateway device is obtained according to the takeover quantity.

[0034] In some embodiments, the acquisition module is used to:

[0035] Determine the number of Internet Protocol addresses that can be taken over by the current gateway device according to the workload status;

[0036] Within the takeover quantity, determining the received Internet Protocol address managed by the faulty gateway device as the first Internet Protocol address;

[0037] The received Internet Protocol address managed by the faulty gateway device is an Internet Protocol address allocated based on a polling allocation mechanism.

[0038] In some embodiments, a generating module is used to:

[0039] Get the local hardware address of the current gateway device;

[0040] The first Internet Protocol address, the second Internet Protocol address and the local hardware address are bound to generate a corresponding address resolution protocol message.

[0041] In some embodiments, the detection module includes a receiving submodule and a detecting submodule.

[0042] Before obtaining at least one first Internet Protocol address in the faulty gateway device according to the workload status, a receiving submodule is used to receive broadcast information sent by each gateway device in the cluster, where the broadcast information carries a device identifier and a heartbeat message;

[0043] The detection submodule is used to determine the faulty gateway device in each gateway device based on the device identification and the heartbeat message.

[0044] In some implementations, before obtaining at least one first Internet Protocol address in the faulty gateway device, the detection submodule is configured to:

[0045] Determine the interval between the two most recent heartbeat messages for each device identifier:

[0046] The device identification whose interval time exceeds the preset time is determined as the target device identification;

[0047] The gateway device corresponding to the target device identifier is determined as a faulty gateway device.

[0048] In some implementations, before receiving the network data returned by the switch according to the address resolution protocol message, the sending module is used to:

[0049] Determine a first access request corresponding to at least one first Internet Protocol address, and determine a second access request corresponding to a second Internet Protocol address;

[0050] The first access request and the second access request are sent to the switch.

[0051] In some embodiments, the receiving module is configured to:

[0052] The network data returned by the switch according to the address resolution protocol message, the first access request and the second access request is received.

[0053] In some implementations, after obtaining at least one first Internet Protocol address in the faulty gateway device according to the workload status, the sending module is configured to:

[0054] Determining a third Internet Protocol address corresponding to the first access request;

[0055] Generate a correspondence between the first Internet Protocol address, the third Internet Protocol address and the local hardware address of the current gateway device;

[0056] The corresponding relationship is sent to the external switch.

[0057] In some implementations, the sending module is configured to:

[0058] When it is detected that the failed gateway device is restored to a working state, deleting the first Internet Protocol address currently managed by the gateway device;

[0059] Generate a new address resolution protocol message according to the second Internet Protocol address currently managed by the gateway device;

[0060] Send the new ARP message to the switch.

[0061] A computer-readable storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor to execute the steps in the above-mentioned network communication method.

[0062] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the above network communication method when executing the computer program.

[0063] In the embodiment of the present application, when a faulty gateway device is detected, the workload state of the current gateway device is determined, and the faulty gateway device and the current gateway device are gateway devices in the same cluster; at least one first Internet Protocol address in the faulty gateway device is obtained according to the workload state; a corresponding address resolution protocol message is generated according to the first Internet Protocol address and the second Internet Protocol address managed by the current gateway device; the address resolution protocol message is sent to the switch; and the network data returned by the switch according to the address resolution protocol message is received. In this way, when the normal gateway device detects the faulty gateway device, it can take over the Internet Protocol address managed by the faulty gateway device, and then generate an address resolution protocol message to the switch according to the taken-over first Internet Protocol address, so that the switch can determine that the gateway device associated with the first Internet Protocol address is the current normal gateway device according to the address resolution protocol message, so that network data transmission can be carried out through the current normal gateway device, thereby ensuring that the network data corresponding to the faulty gateway device is transmitted through the normally working gateway device. Compared with the cluster solution based on the open shortest path first protocol established in the prior art, the embodiment of the present application realizes load balancing of network traffic transmission, improves the network stability of the cluster, and improves the efficiency of network communication.

[0064] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0066] Figure 1 is a scenario diagram of a network communication system provided by an embodiment of the present application;

[0067] Figure 2 It is a flowchart of a network communication method provided by an embodiment of the present application;

[0068] Figure 3 is another flow chart of the network communication method provided by an embodiment of the present application;

[0069] Figure 4 is another flow chart of the network communication method provided by an embodiment of the present application;

[0070] Figure 5 is another flow chart of the network communication method provided by an embodiment of the present application;

[0071] Figure 6 is a schematic diagram of a network communication scenario provided by an embodiment of the present application;

[0072] Figure 7 is another schematic diagram of a network communication scenario provided by an embodiment of the present application;

[0073] Figure 8 is another schematic diagram of a network communication scenario provided by an embodiment of the present application;

[0074] Fig. 9 is another schematic diagram of a network communication scenario provided by an embodiment of the present application;

[0075] Fig.10 It is a schematic diagram of the interaction between the gateway device and the switch provided in the embodiment of the present application;

[0076] Fig.11 It is another flow chart of the network communication method provided in an embodiment of the present application.

[0077] Fig.12 is another scenario schematic diagram of the network communication system provided in an embodiment of the present application;

[0078] Fig.13 is another scenario schematic diagram of the network communication system provided in an embodiment of the present application;

[0079] Fig.14 is a schematic diagram of the structure of a network communication device provided in an embodiment of the present application;

[0080] Fig.15 is another structural schematic diagram of the network communication device provided in an embodiment of the present application;

[0081] Fig.16 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0082] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0083] It should be noted that in some processes described in the specification, claims and the above-mentioned drawings, multiple steps appearing in a specific order are included, but it should be clearly understood that these steps may not be executed in the order in which they appear in this document or may be executed in parallel. The step numbers are only used to distinguish different steps, and the numbers themselves do not represent any execution order. In addition, descriptions such as "first", "second" or "target" in this document are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0084] It is understandable that in the specific implementation of the present application, related data such as Internet Protocol addresses or network data are involved. When the above embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0085] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations:

[0086] Transmission Control Protocol / Internet Protocol (TCP / IP) refers to a protocol suite that can realize information transmission between multiple different networks. TCP / IP protocol does not only refer to TCP and IP protocols, but also refers to a protocol suite composed of File Transfer Protocol (FTP), Simple Mail Transfer Protocol (SMTP), TCP, User Datagram Protocol (UDP), Internet Protocol (IP) and other protocols. It is called TCP / IP protocol just because TCP and IP are the most representative in TCP / IP protocol. It is also called network communication protocol, which is the most basic communication protocol in the use of network.

[0087] Address Resolution Protocol, or ARP, is a TCP / IP protocol that obtains physical addresses based on IP addresses. When a host sends information, it broadcasts an ARP request containing the target IP address to all hosts on the local area network and receives a return message to determine the target's physical address. After receiving the return message, the IP address and physical address are stored in the local ARP cache and retained for a certain period of time. The next request directly queries the ARP cache to save resources.

[0088] In the embodiment of the present application, the Internet Protocol address is used to forward access requests or network data between the client and the server.

[0089] The Internet is a large network formed by many network connections. If you want to transmit IP packets on the Internet, in addition to ensuring that each device on the network has a unique IP address, there must also be a transmission mechanism between networks to transmit IP packets to the destination through each network. This transmission mechanism is called IP routing.

[0090] A switch is a network device used for forwarding electrical signals. It can provide an exclusive electrical signal path for any two network nodes connected to the switch. The most common switch is the Ethernet switch. Other common switches include telephone voice switches, fiber optic switches, etc.

[0091] Hardware address (Media Access Control Address, MAC), literally translated as media access control address, is also called local area network address (LAN Address), MAC address, Ethernet address (Ethernet Address) or physical address (Physical Address). It is an address used to identify the location of a network device.

[0092] A client is a machine that accesses other people's information on the network. The client part is exclusive to the object and is responsible for executing foreground functions and interacting with the object. In this application, it can be understood as a sending device.

[0093] A server is a machine that provides information for people to access. The server part is information and functions shared by multiple objects, and performs background services. In this application, it can be understood as a receiving device. A server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be 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.

[0094] Gateway is also called network connector or protocol converter. Gateway realizes network interconnection above the network layer. It is a complex network interconnection device and is only used for interconnection between two networks with different high-level protocols. Gateway can be used for both wide area network interconnection and local area network interconnection. Gateway is a computer system or device that performs the important task of conversion. It is used between two systems with different communication protocols, data formats or languages, or even completely different architectures. Gateway is a translator.

[0095] A cluster is a group (or several) of independent computers that form a larger computer service system using a high-speed communication network. Each cluster node (i.e., each computer in the cluster) is an independent server running its own service. These servers can communicate with each other and work together to provide users with applications, system resources, and data, and are managed in a single system mode. When a user requests a cluster system, the cluster gives the user the feeling of a single independent server, but in fact the user is requesting a group of cluster servers.

[0096] Open Shortest Path First (OSPF) is a widely used dynamic routing protocol. It is a link-state routing protocol with the advantages of fast convergence of routing changes, no routing loops, support for variable-length subnet mask (VLSM) and aggregation, and hierarchical regional division. After using the OSPF protocol in the network, most routes will be calculated and generated by the OSPF protocol itself, without the need for manual configuration by the network administrator. When the network topology changes, the protocol can automatically calculate and correct the routes, greatly facilitating network management. However, if it is not combined with the specific network application environment and detailed planning is not done, the effectiveness of the OSPF protocol will be greatly reduced, and even cause failures.

[0097] The network communication method, apparatus, computer-readable storage medium, and computer device provided in this application will be described in detail below.

[0098] In the related technology, the cluster based on the open shortest path first protocol has a weak routing load balancing capability. Although the open shortest path first protocol can automatically generate interface routing priorities based on information such as the interface rate and connection reliability, for routes of different priorities leading to the same access address, the open shortest path first protocol only selects routes with higher priorities for forwarding, and cannot forward through routes of different priorities, and cannot achieve traffic load sharing.

[0099] Therefore, when deploying clusters based on existing technologies, there is a problem that traffic load sharing cannot be achieved. When some gateway devices in the cluster fail, some network communications will be congested or interrupted.

[0100] In order to solve the above problems, the embodiment of the present application proposes a solution for indirectly managing the Internet Protocol address of a faulty gateway device among the gateway devices in the cluster, so that the normal gateway device can take over the traffic of the faulty gateway device, thereby achieving load balancing of the cluster and improving the efficiency of network communication.

[0101] See also Figure 1 , Figure 1It is a scenario diagram of the network communication system provided in an embodiment of the present application.

[0102] A network communication system consisting of multiple gateways, multiple servers, and at least one switch can be considered a cluster. Figure 1 As shown, gateway device A, gateway device B, gateway device C, gateway device D, a switch, server 1, and server 2 can form a cluster.

[0103] In some scenarios, the gateway device in the cluster is used to forward the access request sent by the client to the server, and also to forward the network data sent by the server to the client. Since a large amount of data interaction is required between multiple clients and multiple switches, multiple gateway devices need to be set up to forward the access request or forward the network data.

[0104] Each gateway device is assigned multiple Internet Protocol addresses by default, and the gateway device can use the Internet Protocol addresses to forward access requests sent from the outside to the corresponding servers.

[0105] In some implementations, each gateway device can manage the Internet Protocol address assigned to it. For example, each gateway device can generate a corresponding address resolution protocol message based on the Internet Protocol address managed by itself and the local hardware address, and then send it to the switch. After receiving the address resolution protocol message, the switch can determine the correspondence between the Internet Protocol address managed by each gateway device and the local hardware address from the address resolution protocol message.

[0106] It should be noted that the address resolution protocol message in the embodiment of the present application can be a free address resolution protocol message, that is, the address resolution protocol message generated by the current gateway device according to the Internet address protocol and the local hardware address managed by itself. The gateway device can send the address resolution protocol message to the switch in the form of broadcast, and the switch does not need to respond.

[0107] In some implementations, when a gateway device sends an ARP message to a switch, the two can interact with each other using a preset encrypted communication protocol, thereby ensuring that the ARP message received by the switch is not affected while ensuring security during network communication.

[0108] In some scenarios, some gateway devices may fail due to long working hours, excessive load flow, aging, etc. The failed gateway device cannot forward external access requests, nor can it forward network data returned by the server. This will cause network interruption between the client and server corresponding to the failed gateway.

[0109] The embodiment of the present application takes into account the technical problems arising in this scenario, and therefore the Internet Protocol address managed by the faulty gateway device can be taken over by a normally functioning gateway device. The normally functioning gateway device communicates between the client and server corresponding to the faulty gateway device through the taken-over Internet Protocol address, thereby avoiding network interruption caused by the faulty gateway device and reducing network communication efficiency.

[0110] For example, Figure 1 If gateway device A fails, gateway devices B, C, and D that are working properly can take over the Internet Protocol address of the failed gateway device A. Taking gateway device B that is working properly as an example, gateway device B can bind the taken-over Internet Protocol address and the local hardware address, and then generate an address resolution protocol message and send it to the switch.

[0111] After receiving the ARP message, the switch can update the mapping relationship between the local cached Internet Protocol address and the hardware address according to the ARP message. For example, the Internet Protocol address of the failed gateway device A is ip1, and the Internet Protocol address ip1 is taken over by the gateway device B. The switch can determine the corresponding relationship between the Internet Protocol address ip1 and the hardware address of the gateway device B according to the ARP message sent by the gateway device B. Then, the subsequent switch can determine that the gateway device B is the target gateway device according to the corresponding relationship between the Internet Protocol address ip1 and the hardware address of the gateway device B, and the network data returned by the server can be forwarded through the gateway device B.

[0112] It should be noted that among the multiple normally working gateway devices in the embodiment of the present application, each gateway device can take over the Internet Protocol address of the faulty gateway device without affecting its own normal operation. For example, the Internet Protocol addresses managed by the faulty gateway device A are ip1, ip2 and ip3, and the normally working gateway devices B, C and D can all take over the Internet Protocol addresses managed by the faulty gateway device A, such as gateway device B taking over Internet Protocol address ip1, gateway device C taking over Internet Protocol address ip2, and gateway device C taking over Internet Protocol address ip3.

[0113] Therefore, in an embodiment of the present application, multiple normally functioning gateway devices can take over the Internet Protocol address managed by the faulty gateway device, thereby taking over the traffic corresponding to the faulty gateway device, thereby achieving load balancing of the traffic of the faulty gateway device in the cluster, so as to ensure normal network communication of the cluster, thereby improving the efficiency of network communication.

[0114] To learn more about the network communication method provided by the present invention, please continue to refer to Figure 2 , Figure 21 is a flow chart of a network communication method provided in an embodiment of the present application. The network communication method is described from the perspective of a gateway device that is currently operating normally. The network communication method may include the following steps:

[0115] In step 110, when a faulty gateway device is detected, the workload state of the current gateway device is determined, and the faulty gateway device and the current gateway device are gateway devices in the same cluster.

[0116] Each gateway device is equipped with one or more Internet Protocol addresses, which are used to forward access requests or network data between the client and the server. When the cluster is initialized, a corresponding Internet Protocol address is assigned to each gateway device. For example, the Internet Protocol addresses assigned to gateway device A are ip1, ip2, and ip3, the Internet Protocol addresses assigned to gateway device B are ip4, ip5, and ip6, the Internet Protocol addresses assigned to gateway device C are ip7 and ip8, and the Internet Protocol address assigned to gateway device D is ip9. The number of Internet Protocol addresses assigned to multiple gateway devices can be the same, or the number of Internet Protocol addresses assigned to multiple gateway devices can be different. It needs to be set according to the actual needs of the cluster and is not limited here.

[0117] In some implementations, the gateway device can obtain the currently managed Internet Protocol address, then bind the Internet Protocol address and the local hardware address to generate a corresponding address resolution protocol message, and finally send the address resolution protocol message to the switch. On the switch side, the corresponding relationship between the local Internet Protocol address and the hardware address can be updated according to the address resolution protocol message, thereby updating the address resolution protocol list cached locally.

[0118] For example, the gateway device may send an ARP message to the switch every 3 seconds, wherein the ARP message may be a free ARP message, that is, an ARP message generated by the gateway device according to the Internet address protocol managed by itself and the local hardware address.

[0119] Gateway devices can communicate with each other. For example, gateway devices can send broadcast information to each other. Gateway devices can use the broadcast information to detect the working status of other gateway devices, thereby determining whether other gateway devices are in a normal working state.

[0120] For example, a common communication protocol can be set between each gateway device, through which the gateway devices can send broadcast information to each other. By setting a common communication protocol between different gateway devices to send broadcast information, the security of each gateway device can be guaranteed, such as preventing external devices from attacking the gateway device through false broadcast information.

[0121] It should be noted that the broadcast information of each gateway device includes its own device identification and heartbeat message, where the device identification is the unique identification of each gateway device, such as the device IP address of the gateway device, or the device identification code set by the gateway device when it leaves the factory. The heartbeat message is a message sent by each gateway device at regular intervals, for example, each gateway device sends a heartbeat message to all other gateway devices every two seconds to inform other gateway devices of the working status of the current gateway device.

[0122] In this way, when it is detected that the working state of a certain gateway device is an abnormal working state, the gateway device in the abnormal working state is determined as a faulty gateway device. Further, when a faulty gateway device is detected, the workload state of the current gateway device is determined. The workload state is a state of occupation of the operating resources of the current gateway device, such as the processor occupation rate of the current gateway device, or the load ratio of the number of Internet Protocol addresses, or the transmission occupation ratio of the amount of data, etc., which will be explained in the subsequent content.

[0123] In some implementations, the current gateway device may detect a faulty gateway device through broadcast information of each gateway device, specifically including:

[0124] (1) Receive broadcast information sent by each gateway device in the cluster, which carries the device identification and heartbeat message;

[0125] (2) Determine the faulty gateway device in each gateway device based on the device identification and the heartbeat message.

[0126] Taking the current gateway device as an example, it will receive broadcast information from other gateway devices in the cluster. Since the broadcast information sent by each gateway device contains the device ID and heartbeat message, the current gateway device can identify each gateway device according to the device ID, and can determine which gateway devices are working normally and which gateway devices are faulty gateway devices according to the heartbeat message.

[0127] For example, since the mechanism for the gateway device to send broadcast information is to send the broadcast information once every fixed period of time, the current gateway device can determine the working status of other gateways according to the time of the heartbeat message in the received broadcast information.

[0128] In one embodiment, please also refer to Figure 3 , Figure 3 1 is another flow chart of the network communication method provided by an embodiment of the present application, and the faulty gateway device is determined in each gateway device according to the device identification and the heartbeat message, including:

[0129] In step 201, the interval between the two most recent heartbeat messages of each device identifier is determined:

[0130] In step 202, the device identification whose interval time exceeds the preset time is determined as the target device identification;

[0131] In step 203, the gateway device corresponding to the target device identifier is determined to be a faulty gateway device.

[0132] Among them, for each device identification, the interval between the two most recent heartbeat messages can be obtained. For example, the time of the two most recent heartbeat messages corresponding to device identification a is 1 minute 45 seconds and 1 minute 48 seconds respectively, then the interval between the two most recent heartbeat messages of device identification a is 3 seconds.

[0133] If the preset duration is 2 seconds and the interval duration is 3 seconds, it means that the interval duration exceeds the preset duration, which means that the gateway device corresponding to the device identifier a is abnormal. The device identifier a is confirmed as the target device identifier. Since a device identifier corresponds to a unique gateway device, the gateway device corresponding to the device identifier a can be a faulty gateway device. For example, if the gateway device corresponding to the device identifier a is gateway device A, then gateway device A is a faulty gateway device.

[0134] In some implementations, whether a gateway device is a faulty gateway device may be determined by any gateway device that receives the broadcast information previously sent by the faulty gateway device. For example, among gateway device A, gateway device B, gateway device C, and gateway device D, if any gateway device among gateway device B, gateway device C, and gateway device D determines that gateway device A is a faulty gateway device based on the broadcast information, then all devices except gateway device A consider gateway device A to be a faulty device.

[0135] For example, when gateway device B determines that gateway device A is a faulty gateway device based on the device identifier and heartbeat message in the broadcast information of gateway device A, when gateway device B sends broadcast information to other gateway devices, it will synchronously send the information that gateway device A is a faulty gateway device to other gateway devices, that is, to gateway device C and gateway device D. After gateway device C and gateway device D receive the information that gateway device A is a faulty gateway device, gateway device C and gateway device D directly confirm that gateway device A is a faulty gateway device.

[0136] In some implementations, in order to more accurately identify a faulty gateway device among multiple gateway devices in a cluster, when a gateway device fails, other gateway devices in the cluster are required to confirm that the gateway device is a faulty gateway device.

[0137] For example, when gateway device B determines that gateway device A is a faulty gateway device based on the device identifier and heartbeat message in the broadcast information of gateway device A, gateway device C determines that gateway device A is a faulty gateway device based on the device identifier and heartbeat message in the broadcast information of gateway device A, and gateway device D determines that gateway device A is a faulty gateway device based on the device identifier and heartbeat message in the broadcast information of gateway device A. Then, when gateway devices B, C, and D send broadcast information to each other, they will broadcast the information that gateway device A is a faulty device to each other, and finally each of gateway devices B, C, and D can determine that gateway device A is a faulty gateway device.

[0138] In some implementations, the judgment of the working status of multiple gateway devices in the cluster can also be made by the switch. For example, each gateway device will periodically send an address resolution protocol message to the switch. When the switch does not receive the address resolution protocol message of a certain gateway device among the multiple gateway devices, it determines that the gateway device is a faulty gateway device. The switch then sends the information of the faulty gateway device to other gateway devices that are working normally, so that the current gateway device can determine the faulty gateway device. It is understandable that when all gateway devices are in normal working state, the switch does not need to inform each gateway device that other gateway devices are in normal working state.

[0139] In some implementations, when the current gateway device determines that a faulty gateway device has occurred in the cluster, the current gateway device's workload state may be determined, wherein the workload state of the current gateway device may be a load ratio. The load ratio is a ratio between the number of currently managed Internet Protocol addresses and the maximum load number of Internet Protocol addresses of the current gateway device.

[0140] It is understandable that, due to the limited performance of each gateway device, the number of Internet Protocol addresses that each gateway device can manage is limited. Therefore, before taking over the Internet Protocol addresses managed by the failed gateway device, each gateway device needs to determine its own workload status. For example, some gateway devices can manage 10 Internet Protocol addresses, and some gateway devices can manage 50 Internet Protocol addresses. The workload status of different gateway devices will be different.

[0141] The workload status may be determined from multiple dimensions, for example, based on the load ratio of the current gateway device.

[0142] In some implementations, when the workload status is a load ratio, determining the workload status of the current gateway device includes:

[0143] (1.1) Obtaining the number of second Internet Protocol addresses managed by the current gateway device and the maximum load number of the Internet Protocol address of the current gateway device;

[0144] (1.2) Determine a corresponding load ratio according to the number of second Internet Protocol addresses and the maximum load number.

[0145] For example, the corresponding load ratio can be determined based on the number of second Internet Protocol addresses managed by the current gateway device and the maximum load number of the current gateway device, where the maximum load number is 100 and the number of second Internet Protocol addresses that have been loaded locally is 60, then the current load ratio is determined to be 60%.

[0146] After the current gateway device determines its own load ratio, the number of Internet Protocol addresses managed by the faulty gateway device that can be taken over can be determined according to the load ratio. Thus, while ensuring the normal operation of the gateway device itself, a corresponding number of first Internet Protocol addresses are taken over from the Internet Protocol addresses managed by the faulty gateway device. Thus, the traffic between the client and the server is transmitted through the taken-over first Internet Protocol addresses, avoiding network communication interruption caused by the faulty gateway device. Thus, the efficiency of network communication is improved.

[0147] In some implementations, when the current gateway device determines that a faulty gateway device has occurred in the cluster, the current gateway device's workload state may be determined, wherein the current gateway device's workload state may be a transmission occupancy ratio. The transmission occupancy ratio is a ratio between the data transmission volume of the current gateway device at the current time and the maximum data transmission volume of the current gateway device.

[0148] It is understandable that due to the limited performance of each gateway, the corresponding data transmission volume of each gateway device is also limited. For example, some gateway devices can transmit 10TB of data at the same time, while some gateway devices can only transmit 5TB of data at the same time. Therefore, the workload status of the current gateway device can be determined by the data transmission volume.

[0149] In some implementations, when the workload status is a transmission occupancy ratio, determining the workload status of the current gateway device includes:

[0150] (2.1) Determine the data transmission volume of the current gateway device at the current time and the maximum data transmission volume of the current gateway device;

[0151] (2.2) Determine the corresponding transmission occupancy ratio according to the current data transmission volume and the maximum data transmission volume.

[0152] For example, the data transmission volume of the current gateway device at the current time is 1 TB, and the local maximum data transmission volume is 2 TB, then the current transmission occupancy ratio is 50%.

[0153] After the current gateway device determines its own transmission occupancy ratio, the number of Internet Protocol addresses managed by the faulty gateway device that can be taken over can be determined based on the transmission occupancy ratio. Under the condition that the gateway device itself is ensured to operate normally, a corresponding number of first Internet Protocol addresses are taken over from the Internet Protocol addresses managed by the faulty gateway device. Thus, the traffic between the client and the server is transmitted through the taken-over first Internet Protocol addresses, avoiding network communication interruption caused by the faulty gateway device. Thus, the efficiency of network communication is improved.

[0154] In step 120, at least one first Internet Protocol address in the faulty gateway device is obtained according to the workload status.

[0155] It is understandable that the current gateway device can determine the number of Internet Protocol addresses managed by the failed gateway device that can be taken over according to its own workload status.

[0156] When the workload status is the load ratio, the current gateway device may acquire a corresponding number of first Internet Protocol addresses in the faulty gateway device according to the load ratio.

[0157] Please also read Figure 4 , Figure 4 is another flow diagram of a network communication method, comprising:

[0158] In step 301, the number of second Internet Protocol addresses managed by the current gateway device and the maximum load number of the Internet Protocol address of the current gateway device are obtained;

[0159] In step 302, a corresponding load ratio is determined according to the number of second Internet Protocol addresses and the maximum load number;

[0160] In step 303, a corresponding number of first Internet Protocol addresses in the faulty gateway device are obtained according to the load ratio.

[0161] It is understandable that, due to the limited performance of each gateway device, the number of Internet Protocol addresses that each gateway device can manage is limited. For example, some gateway devices can manage 10 Internet Protocol addresses, and some gateway devices can manage 50 Internet Protocol addresses.

[0162] Therefore, the current gateway device can determine the number of Internet Protocol addresses managed by the failed gateway device that can be taken over according to the number of second Internet Protocol addresses managed by itself and the maximum load number of the current gateway device.

[0163] For example, the number of the second Internet Protocol addresses of the current gateway device and the maximum load number of the Internet Protocol addresses of the current gateway device can be obtained to determine the corresponding load ratio, where the maximum load number is 100, and the number of second Internet Protocol addresses that have been loaded locally is 60, then the current load ratio is determined to be 60%. Finally, the corresponding takeover number is determined in the mapping relationship between the preset load ratio range and the takeover number based on the current load ratio. For example, each preset load ratio range corresponds to a takeover number. After determining which preset load ratio range the current load ratio is within, the corresponding takeover number can be determined based on the mapping relationship. Finally, the current gateway device obtains the corresponding number of first Internet Protocol addresses in the faulty gateway device based on the load ratio.

[0164] In some implementations, obtaining a corresponding number of first Internet Protocol addresses in the faulty gateway device according to the load ratio includes:

[0165] (1.1) Determine the target load ratio range within which the load ratio falls;

[0166] (1.2) Determine the corresponding number of takeovers based on the target load ratio range;

[0167] (1.3) Obtain a corresponding number of first Internet Protocol addresses in the faulty gateway device according to the number of takeovers.

[0168] It should be noted that before determining the target load ratio range of the load ratio, multiple load ratio ranges can be set for different load ratios of the gateway device, and each load ratio range corresponds to the number of takeovers by an Internet Protocol address.

[0169] For example, the preset load ratio range includes the ranges of 0% to 30%, 30% to 60%, 60% to 85%, and 85% to 100%. Each range includes a lower limit value, but does not include an upper limit value. For example, the preset load ratio range of 30% to 60% includes the value of 30%, but does not include the value of 60%. Each preset load ratio range corresponds to the number of takeovers of an Internet Protocol address. For example, the preset load ratio range of 0% to 30% corresponds to a takeover number of 6, while the preset load ratio range of 30% to 60% corresponds to a takeover number of 4, the preset load ratio range of 60% to 85% corresponds to a takeover number of 2, and the preset load ratio range of 85% to 100% corresponds to a takeover number of 0, that is, different preset load ratio ranges correspond to different takeover numbers. It should be noted that the number of takeovers corresponding to the above preset load ratio ranges can be set according to actual conditions, and the above setting method of the number of takeovers does not limit this application.

[0170] After the load ratio of the gateway device is determined in the above manner, if the determined load ratio is 50%, the corresponding target load ratio range is determined to be 30% to 60% in multiple preset load ratio ranges, and the corresponding takeover quantity of the preset load ratio range of 30% to 60% is determined to be 4. Then, the first Internet Protocol address that does not exceed the takeover quantity can be obtained from the Internet Protocol addresses managed by the faulty gateway device.

[0171] For example, the faulty gateway device manages 10 Internet Protocol addresses, and the number of takeovers corresponding to the current gateway device is 4. Then only the Internet Protocol addresses managed by the 4 faulty gateway devices can be taken over and determined as the first Internet Protocol addresses.

[0172] It should be noted that the number of gateway devices that can be taken over in different preset load ratio ranges is set without affecting the normal operation of the gateway device. For example, if the current load ratio of the gateway device is in the load ratio range of 30% to 60%, then the current gateway device taking over 4 more Internet Protocol addresses will not have a negative impact on its own working performance.

[0173] In some implementations, when the workload status is the transmission occupancy ratio, the current gateway device may acquire a corresponding number of first Internet Protocol addresses in the faulty gateway device according to the transmission occupancy ratio.

[0174] Please also read Figure 5 , Figure 5 is another flow diagram of a network communication method, comprising:

[0175] In step 401, the data transmission volume of the current gateway device at the current time and the maximum data transmission volume of the current gateway device are determined;

[0176] In step 402, a corresponding transmission occupancy ratio is determined according to the data transmission volume at the current time and the maximum data transmission volume;

[0177] In step 403, a corresponding number of first Internet Protocol addresses in the faulty gateway device are obtained according to the transmission occupancy ratio.

[0178] It is understandable that due to the limited performance of each gateway, the corresponding data transmission volume of each gateway device is also limited. For example, some gateway devices can transmit 10TB of data at the same time, while some gateway devices can only transmit 5TB of data at the same time.

[0179] Therefore, the current gateway device can determine the number of Internet Protocol addresses that can be taken over and managed by the failed gateway device according to its own data transmission volume and the maximum data transmission volume of the current gateway device.

[0180] For example, if the current data transmission volume is 1TB, and the local maximum data transmission volume is 2TB, then the current transmission occupancy ratio is 50%. Finally, the corresponding takeover quantity is determined in the mapping relationship between the preset transmission occupancy ratio range and the takeover quantity according to the current transmission occupancy ratio. For example, each preset transmission occupancy ratio range corresponds to a takeover quantity. After determining which preset transmission occupancy ratio range the current transmission occupancy ratio is within, the corresponding takeover quantity can be determined according to the mapping relationship. Finally, the current gateway device obtains the corresponding number of first Internet Protocol addresses in the faulty gateway device according to the load ratio.

[0181] In one embodiment, obtaining a corresponding number of first Internet Protocol addresses in the faulty gateway device according to the transmission occupancy ratio includes:

[0182] (2.1) determining a target transmission occupancy ratio range within which the transmission occupancy ratio falls;

[0183] (2.2) Determine the corresponding number of takeovers according to the target transmission occupancy ratio range;

[0184] (2.3) Obtain a corresponding number of first Internet Protocol addresses in the faulty gateway device according to the number of takeovers.

[0185] It should be noted that before determining the target load ratio range of the load ratio, multiple load ratio ranges can be set for different load ratios of the gateway device, and each load ratio range corresponds to the number of takeovers by an Internet Protocol address.

[0186] For example, the preset transmission occupancy ratio range includes the ranges of 0% to 30%, 30% to 60%, 60% to 85%, and 85% to 100%. Each range includes a lower limit value, but does not include an upper limit value. For example, the preset transmission occupancy ratio range of 30% to 60% includes the value of 30%, but does not include the value of 60%. Each preset transmission occupancy ratio range corresponds to the number of takeovers of an Internet Protocol address. For example, the preset transmission occupancy ratio range of 0% to 30% corresponds to a takeover number of 6, while the preset transmission occupancy ratio range of 30% to 60% corresponds to a takeover number of 4, the preset transmission occupancy ratio range of 60% to 85% corresponds to a takeover number of 2, and the preset transmission occupancy ratio range of 85% to 100% corresponds to a takeover number of 0, that is, different preset transmission occupancy ratio ranges correspond to different takeover numbers. It should be noted that the number of takeovers corresponding to the above preset transmission occupancy ratio ranges can be set according to actual conditions, and the above setting method of the number of takeovers does not limit this application.

[0187] After the transmission occupancy ratio of the gateway device is determined in the above manner, if the determined transmission occupancy ratio is 50%, the corresponding preset target transmission occupancy ratio range is 30% to 60%, and the corresponding takeover quantity of the preset transmission occupancy ratio range of 30% to 60% is determined to be 4. Then, the first Internet Protocol address that does not exceed the takeover quantity can be obtained from the Internet Protocol addresses managed by the faulty gateway device.

[0188] For example, the faulty gateway device manages 10 Internet Protocol addresses, and the number of takeovers corresponding to the current gateway device is 4. Then only the Internet Protocol addresses managed by the 4 faulty gateway devices can be taken over and determined as the first Internet Protocol addresses.

[0189] It should be noted that the number of gateway devices that can be taken over in different preset transmission occupancy ratio ranges is set without affecting the normal operation of the gateway device. For example, if the current transmission occupancy ratio of the gateway device is in the transmission occupancy ratio range of 30% to 60%, then the current gateway device taking over 4 more Internet Protocol addresses will not have a negative impact on its own working performance.

[0190] As can be seen from the above content, the gateway device can take over the Internet Protocol address of the failed gateway device according to its own workload status, thereby taking over the corresponding number of first Internet Protocol addresses without affecting the working performance of the gateway device, thereby preventing the interruption of data transmission between the client and the server due to the failed gateway device. Thereby improving the efficiency of network communication. Each gateway device in the cluster can obtain the corresponding number of first Internet Protocol addresses in the failed gateway device by determining its own workload status.

[0191] It should be noted that the workload status of the gateway device may also be determined by other methods, and the method of obtaining the workload status described above does not limit the present application.

[0192] Please also read Figure 6 , Figure 6 It is a schematic diagram of a network communication scenario provided by the embodiment itself.

[0193] If the gateway devices in the cluster include gateway device A, gateway device B, gateway device C, and gateway device D. When gateway device A, gateway device B, gateway device C, and gateway device D are all in normal working state, the Internet Protocol addresses assigned to gateway device A are fip1, fip2, and fip3. The Internet Protocol addresses assigned to gateway device B are fip4, fip5, and fip6. The Internet Protocol addresses assigned to gateway device C are fip7 and fip8. The Internet Protocol address assigned to gateway device D is fip9. That is, each gateway device is assigned a corresponding Internet Protocol address, and each gateway device can process data transmission between the client and the server according to the assigned Internet Protocol address.

[0194] Each gateway device among gateway device A, gateway device B, gateway device C, and gateway device D generates an address resolution protocol message, such as a free address resolution protocol, according to the Internet Protocol address it manages and its own hardware address, and then sends the address resolution protocol message to the switch. The switch can cache the correspondence between the Internet Protocol address and the hardware address according to the address resolution protocol message.

[0195] Please also read Figure 7 , Figure 7 This is another schematic diagram of a network communication scenario provided in an embodiment of the present application.

[0196] In some scenarios, if gateway device A fails, and gateway device B, gateway device C, and gateway device D learn that gateway device A is a faulty gateway device, at this time, in order to ensure that the data transmission corresponding to the Internet Protocol address managed by gateway device A can proceed normally, the Internet Protocol addresses fip1, fip2, and fip3 managed by gateway device A need to be assigned to at least one of gateway device B, gateway device C, and gateway device D.

[0197] The Internet Protocol addresses fip1, fip2, and fip3 managed by the faulty gateway device A will be defined as tip1, tip2, and tip3 by the switch respectively. Tip1 and fip1, tip2 and fip2, and tip3 and fip3 are actually the same, and are all Internet Protocol addresses allocated on gateway device A. In order to distinguish the normal state and fault state of gateway device A, the Internet Protocol address managed by gateway device A in the normal state is defined as fip, and the Internet Protocol address managed by gateway device A in the fault state is defined as tip.

[0198] On the switch side, when it is determined that gateway device A is a faulty device, the switch can define the Internet Protocol addresses fip1, fip2, and fip3 managed by gateway device A in normal working state as Internet Protocol addresses tip1, tip2, and tip3, respectively. Then the switch can assign Internet Protocol addresses tip1, tip2, and tip3 to gateway devices in the cluster that are working normally.

[0199] Please also read Figure 8 , Figure 8 This is another schematic diagram of a network communication scenario provided in an embodiment of the present application.

[0200] If gateway devices B, C, and D are working normally, they can determine to take over the Internet protocol address managed by gateway device A according to their own load conditions while ensuring their own normal working conditions.

[0201] For example, the number of Internet Protocol addresses that gateway device B can load is 3. At this time, if gateway device B is allowed to take over the Internet Protocol addresses managed by gateway device A, the working performance of gateway device B will be reduced. At this time, gateway device B may not take over the Internet Protocol addresses managed by gateway device A.

[0202] The number of Internet Protocol addresses that gateway device C can load is 3, and the number of Internet Protocol addresses that gateway device C has already loaded is 2. The number of Internet Protocol addresses that gateway device C can take over managed by gateway device A is 1, so gateway device C can take over Internet Protocol address tip1.

[0203] The number of Internet Protocol addresses that gateway device D can load is 3, and the number of Internet Protocol addresses that gateway device D has already loaded is 1. The number of Internet Protocol addresses that gateway device C can take over managed by gateway device A is 2, so gateway device D can take over Internet Protocol addresses tip2 and tip3.

[0204] It should be noted that in an embodiment of the present application, a gateway device that operates normally can determine the number of Internet Protocol addresses that it can take over from a faulty gateway device based on the above-mentioned implementation method, and then take over the corresponding number of Internet Protocol addresses. The Internet Protocol addresses taken over by the gateway device that operates normally are defined as first Internet Protocol addresses, and the Internet Protocol addresses managed by the gateway device that operates normally by default are defined as local second Internet Protocol addresses.

[0205] In some implementations, when gateway devices A, B, C, and D send broadcast information to each other, each gateway device can send the Internet Protocol address information managed by itself to other gateway devices. If each gateway device is in a normal working state, each gateway device does not need to take over the Internet Protocol addresses of other gateway devices. If gateway device A fails, gateway devices B, C, and D can determine the number of Internet Protocol addresses that can be taken over according to their own load conditions, and then gateway devices B, C, and D send broadcast information to each other again to inform other gateway devices of the number of Internet Protocol addresses that they can take over.

[0206] Gateway device B, gateway device C, and gateway device D have a corresponding numbering sequence. At the same time, gateway device B, gateway device C, and gateway device D all have the order of Internet Protocol addresses managed by gateway device A. According to the order and numbering sequence, each gateway device takes over the Internet Protocol address of gateway device A without exceeding the number that can be taken over. When the previous gateway device takes over the Internet Protocol address of gateway device A, it will inform other gateway devices by broadcasting, and then the next gateway device can take over the Internet Protocol address of gateway device A that has not been taken over according to its own number of takeovers.

[0207] For example, the Internet Protocol addresses managed by gateway device A are tip1, tip2, and tip3. Gateway device B takes over Internet Protocol address tip1 according to its own takeover quantity, then gateway device B broadcasts the message of taking over Internet Protocol address tip1 to gateway devices C and D, and gateway devices C and D will not take over Internet Protocol address tip1 in the future.

[0208] In some implementations, obtaining at least one first Internet Protocol address in a faulty gateway device according to a workload state includes:

[0209] (1) Determine the number of Internet Protocol addresses that can be taken over by the current gateway device according to the workload status;

[0210] (2) within the takeover quantity, determining the received Internet Protocol address managed by the faulty gateway device as the first Internet Protocol address;

[0211] The received Internet Protocol address managed by the faulty gateway device is an Internet Protocol address allocated based on a polling allocation mechanism.

[0212] It can be understood that the corresponding number of first Internet Protocol addresses taken over by the gateway device can be allocated through the switch using a polling allocation mechanism, wherein the polling allocation mechanism is to number each gateway device in the normally working gateway device, and then allocate the Internet Protocol addresses managed by the faulty gateway device to each gateway device in sequence according to the number, so that each gateway device can be allocated the corresponding first Internet Protocol address.

[0213] For example, on the switch side, the Internet Protocol addresses managed by the faulty gateway device may be sorted, for example, the Internet Protocol addresses may be sorted from small to large, or from large to small.

[0214] Then the sorted first Internet Protocol address is allocated to the first gateway device, and then the sorted second Internet Protocol address is allocated to the second gateway device, and so on, until all the Internet Protocol addresses managed by the failed gateway are allocated to the normally working gateway devices, and the normally working gateway devices thus obtain the corresponding number of first Internet Protocol addresses.

[0215] It should be noted that, taking the current gateway device as an example, the number of Internet Protocol addresses that can be taken over by the current gateway device can be determined based on the workload status. Within the number that can be taken over, the current gateway device can receive the Internet Protocol address of the faulty gateway device allocated under the polling allocation mechanism. For example, in the above content, the number of Internet Protocol addresses that can be taken over by the current gateway device is determined by the load ratio or the transmission occupancy ratio. For another example, the processor occupancy rate of the current gateway device can be determined as the workload status, and the number of Internet Protocol addresses that can be taken over can be determined based on the processor occupancy rate.

[0216] When the number of Internet Protocol addresses participating in the sorting is greater than the number of gateway devices participating in the sorting that are working normally, for example, the number of Internet Protocol addresses participating in the sorting is m, the number of gateway devices participating in the sorting that are working normally is n, and m>n, then when the nth Internet Protocol address after sorting is assigned to the nth gateway device after sorting that is working normally, when it is determined to take over the n+1th gateway device after sorting that is working normally, the n+1th Internet Protocol address after sorting is assigned to the 1st gateway device after sorting, and then the n+2th Internet Protocol address after sorting is assigned to the 2nd gateway device after sorting, and so on.

[0217] In the process of allocating the sorted Internet Protocol addresses, if the number of Internet Protocol addresses that the current gateway device can still take over is 4, and the number of Internet Protocol addresses allocated based on the polling mechanism is 6, then the current gateway can refuse to take over the extra 2 Internet Protocol addresses, thereby ensuring that the current gateway will not be overloaded, so as to ensure normal operation.

[0218] Please also read Fig. 9 , Fig. 9 This is another schematic diagram of a network communication scenario provided in an embodiment of the present application.

[0219] If the gateway devices in the cluster include gateway device A, gateway device B, gateway device C, and gateway device D. When gateway device A, gateway device B, gateway device C, and gateway device D are all in normal working state, the Internet Protocol addresses assigned to gateway device A are fip1, fip2, and fip3. The Internet Protocol addresses assigned to gateway device B are fip4, fip5, and fip6. The Internet Protocol addresses assigned to gateway device C are fip7 and fip8. The Internet Protocol address assigned to gateway device D is fip9. That is, each gateway device is assigned a corresponding Internet Protocol address, and each gateway device can process data transmission between the client and the server according to the assigned Internet Protocol address.

[0220] In some scenarios, if gateway device A fails, and gateway devices B, C, and D learn that gateway device A is a failed gateway device, in order to ensure that the data transmission corresponding to the Internet Protocol address managed by gateway device A can proceed normally, it is necessary to allocate the Internet Protocol addresses fip1, fip2, and fip3 managed by gateway device A to at least one of gateway devices B, C, and D. The Internet Protocol addresses fip1, fip2, and fip3 managed by the failed gateway device A will be defined as tip1, tip2, and tip3 by the switch. Tip1 and fip1, tip2 and fip2, tip3 and fip3 are actually the same, and are all Internet Protocol addresses allocated on gateway device A. In order to distinguish the normal state and the failed state of gateway device A, the Internet Protocol address managed by gateway device A in the normal state is defined as fip, and the Internet Protocol address managed by gateway device A in the failed state is defined as tip.

[0221] When gateway device B, gateway device C, and gateway device D can all take over the Internet Protocol address of the failed gateway device A, gateway device B, gateway device C, and gateway device D can be sorted, and Internet Protocol addresses tip1, tip2, and tip3 corresponding to the failed gateway device A can be sorted, and then Internet Protocol addresses tip1, tip2, and tip3 can be sequentially allocated to gateway device B, gateway device C, and gateway device D according to the polling allocation mechanism. For example, gateway device B is allocated to Internet Protocol address tip1, gateway device C is allocated to Internet Protocol address tip2, and gateway device C is allocated to Internet Protocol address tip3, thereby completing the allocation of Internet Protocol addresses to the failed gateway devices.

[0222] In step 130, a corresponding address resolution protocol message is generated according to the first Internet Protocol address and the local second Internet Protocol address.

[0223] For a more detailed understanding of the address protocol message between the gateway device and the switch in the embodiment of the present application, please refer to Fig.10 , Fig.10 It is a schematic diagram of the interaction between the gateway device and the switch provided in the embodiment of the present application.

[0224] When gateway devices A, B, C, and D are all in normal working state, each gateway device can generate corresponding address resolution protocol messages according to its managed Internet Protocol address and its own hardware address, and then send the address resolution protocol messages to the switch. For example, if the local Internet Protocol address of gateway device B is fip4, fip5, or fip6, then fip4, fip5, or fip6 is bound to the hardware address of gateway device B, and the address resolution protocol is generated and sent to the switch.

[0225] The address resolution protocol message in the embodiment of the present application can be a free address resolution protocol message, that is, an address resolution protocol message generated by the current gateway device according to the Internet address protocol and the local hardware address managed by itself. The gateway device can send the address resolution protocol message to the switch in the form of broadcast, and the switch does not need to respond. The gateway device can also send the address resolution protocol message to the switch at a fixed time.

[0226] The switch can update the correspondence between the locally cached Internet Protocol address and the hardware address according to the address resolution protocol, so that when forwarding data subsequently, the switch can determine the corresponding target gateway device according to the hardware address, and then forward the data between the client and the server through the target gateway device.

[0227] like Fig.10As shown, if a faulty gateway device appears in the cluster, the normally working gateway device can obtain the corresponding number of first Internet Protocol addresses of the faulty gateway, and generate corresponding address resolution protocol messages based on the first Internet Protocol addresses and the local second Internet Protocol addresses and resend them to the switch.

[0228] In some implementations, generating a corresponding address resolution protocol message according to the first Internet Protocol address and the local second Internet Protocol address includes:

[0229] (1) Obtain the local hardware address of the current gateway device;

[0230] (2) Bind the first Internet Protocol address, the second Internet Protocol address, and the local hardware address to generate a corresponding address resolution protocol message.

[0231] For example, a gateway device that works normally is gateway device B, and the first Internet Protocol address taken over by gateway device B is tip1, and the second Internet Protocol address local to gateway device B is fip4, fip5, and fip6. Gateway device B can bind fip4, fip5, fip6, tip1 and the local hardware address to generate the corresponding address resolution protocol message.

[0232] In step 140, the address resolution protocol message is sent to the switch.

[0233] After the gateway device generates an address resolution protocol message corresponding to the first Internet Protocol address and the local second Internet Protocol address, the address resolution protocol message may be sent to the switch in a broadcasting form.

[0234] On the switch side, the switch can update the correspondence between the Internet Protocol address and the hardware address according to the ARP message, thereby determining that the hardware address bound to the Internet Protocol address tip1 is the hardware address of the gateway device B. Then the switch can forward the data subsequently through the gateway device B.

[0235] In some implementations, before receiving the network data returned by the switch according to the address resolution protocol message, the network communication method further includes:

[0236] (1) determining a first access request corresponding to at least one first Internet Protocol address, and determining a second access request corresponding to a second Internet Protocol address;

[0237] (2) Send the first access request and the second access request to the switch.

[0238] The current gateway device can obtain the first access request corresponding to the first Internet Protocol address through the broadcast information between gateway devices, that is, when the faulty gateway device is working normally, the broadcast information sent periodically includes the first access request corresponding to the first Internet Protocol address. Of course, the first access request can also be obtained in other ways. For example, the upstream switch device cannot send the first access request corresponding to the first Internet Protocol address to the faulty gateway device, and then broadcasts the first access request corresponding to the first Internet Protocol address to other gateway devices. Since the current gateway device has taken over the first Internet Protocol address, the current gateway can obtain the first access request corresponding to the first Internet Protocol address. Among them, the upstream switch is a switch facing the client side, which is used to forward the access request sent by the client to the server, and is also used to forward the network data sent by the server to the client.

[0239] Since the current gateway device is locally allocated with the second Internet Protocol address, the current gateway device can directly obtain the second access request sent by the upstream switch. The current gateway device sends the first access request and the second access request to the switch.

[0240] In step 150, the network data returned by the switch according to the address resolution protocol message is received.

[0241] Among them, the switch can determine the target gateway device among multiple gateway devices based on the address resolution protocol message. For example, the network data returned by the server contains the corresponding Internet Protocol address. Then the switch can determine the target hardware address based on the correspondence between the Internet Protocol address and the hardware address cached locally. The gateway device corresponding to the target hardware address is the target gateway device, and the switch can forward the network data to the target gateway device.

[0242] When the current gateway device is the target gateway device determined by the switch, the network data returned by the switch according to the address resolution protocol message is received.

[0243] It is understandable that when the client wants to obtain corresponding network data from the server, it needs to send an access request. After receiving the access request, the server can retrieve the corresponding network data and finally send the network data to the client.

[0244] In some implementations, receiving network data returned by the switch according to the address resolution protocol message includes:

[0245] The network data returned by the switch according to the address resolution protocol message, the first access request and the second access request is received.

[0246] The gateway device can determine the first access request corresponding to the first Internet Protocol address, for example, by obtaining the first access request in the broadcast information of the faulty gateway device, and then determine the second access request corresponding to the local second Internet Protocol address, and finally send the first access request and the second access request to the switch.

[0247] After receiving the first access request and the second access request, the switch can find the corresponding server according to the server identifier because the access request includes the corresponding server identifier, and then send the access request to the corresponding server.

[0248] The server generates first network data according to the first access request, generates second network data according to the second access request, and then sends the first network data and the second network data to the switch, which then forwards the first network data and the second network data to the gateway device. The network data returned by the server received by the gateway device includes the first network data and the second network data.

[0249] For example, after the server generates the first network data, the server will set the first Internet Protocol address therein so that the switch can obtain the first Internet Protocol address from the returned first network data. The switch can then determine the hardware address corresponding to the first Internet Protocol address based on the hardware relationship between the locally cached Internet Protocol address and the hardware address of the gateway device, and then determine the gateway device corresponding to the first Internet Protocol address based on the hardware address, and then the switch forwards the first network data to the corresponding network device, thereby completing the forwarding of the first network data.

[0250] In the above manner, after receiving the first network data and the second network data, the gateway device can forward the first network data and the second network data to the corresponding client, respectively. This avoids the interruption of network communication caused by the failure of the gateway device to forward the first network data, and the traffic of the failed gateway device is taken over by the gateway device that works normally to take over the Internet Protocol address managed by the failed gateway device, thereby improving the efficiency of network communication.

[0251] In some implementations, after obtaining at least one first Internet Protocol address in the faulty gateway device, the network communication method further includes:

[0252] (1) determining a third Internet Protocol address corresponding to the first access request;

[0253] (2) generating a correspondence between the first Internet Protocol address, the third Internet Protocol address, and the local hardware address of the current gateway device;

[0254] (3) Send the corresponding relationship to the external switch.

[0255] It should be noted that the external switch is a switch facing the client side, used to forward the network data sent by the gateway device to the client. The switch described above is a switch facing the server side, which can also be understood as an internal switch, used to forward the access request sent by the gateway device to the server.

[0256] It is understandable that when a gateway device fails, when a normally functioning gateway device is used to take over the Internet Protocol address of the failed gateway device, the external switch needs to be informed so that the external switch knows how to forward the network data returned by the gateway device to the client.

[0257] The gateway device may obtain a third Internet Protocol address corresponding to the first access request, where the third Internet Protocol address is the Internet Protocol address of the client sending the first access request, and then generate a correspondence between the first Internet Protocol address, the third Internet Protocol address, and the local hardware address of the current gateway device, for example, generating an address resolution protocol message between the first Internet Protocol address, the third Internet Protocol address, and the local hardware address.

[0258] Then the gateway device sends the correspondence between the first Internet Protocol address, the third Internet Protocol address and the local hardware address to the external switch, and the external switch can store the correspondence locally.

[0259] When the gateway device receives the network data returned by the server, it forwards the network data to the external switch. The external switch can obtain the third Internet Protocol address (client Internet Protocol address) in the network data, and the first Internet Protocol address managed by the gateway device that sends the network data to the external switch, and then determine the first Internet Protocol address to determine that the current gateway device is the gateway device that forwards the first access request, and then determine the client corresponding to the network data based on the third Internet Protocol address, and finally send the network data to the client corresponding to the first access request. When the client sends an access request again, the external switch can determine the current gateway device based on the Internet Protocol address of the client in the access request and the corresponding relationship stored locally, and then send the new access request to the server through the current gateway device again.

[0260] This avoids the interruption of network communication between the client and the server caused by a faulty gateway device, and the traffic corresponding to the faulty gateway device is taken over by a normally working gateway device, thereby improving the stability of network communication and ultimately improving the efficiency of network communication.

[0261] In some implementations, after obtaining at least one first Internet Protocol address in the faulty gateway device according to the workload status, the network communication method further includes:

[0262] (1) when it is detected that the faulty gateway device has recovered to a working state, deleting the first Internet Protocol address currently managed by the gateway device;

[0263] (2) generating a new address resolution protocol message according to the second Internet Protocol address;

[0264] (3) Send the new address resolution protocol message to the switch.

[0265] It is understandable that when the failed gateway device returns to a working state, other gateway devices can no longer take over the Internet Protocol addresses managed by the failed gateway device, because the failed gateway device can handle data transmission between the client and the server by itself after it returns to normal.

[0266] When it is detected that the failed gateway device recovers to a working state, the current gateway device may delete the first Internet Protocol address managed locally, so that the current gateway device will no longer take over the data transmission corresponding to the first Internet Protocol address.

[0267] At the same time, in order for the switch to not forward the network data corresponding to the first Internet Protocol address to the current gateway device in the future, the current gateway device generates a new address resolution protocol message again according to the locally managed second Internet Protocol address and the local hardware address, and then sends the new address resolution protocol message to the switch.

[0268] After receiving a new address resolution protocol message, the switch will update the correspondence between the local cached Internet Protocol address and the hardware address, that is, the switch will only save the binding relationship between the second Internet Protocol address and the hardware address of the current gateway device. Instead of saving the binding relationship between the first Internet Protocol address and the hardware address of the current gateway device, the switch is prevented from forwarding the network data corresponding to the first Internet Protocol address to the current gateway device. This avoids network data forwarding errors during network communication, thereby improving the efficiency of network communication.

[0269] It should be noted that in the embodiment of the present application, since the cluster adopts the address resolution protocol mechanism, the established cluster is highly available and has good load balancing capabilities, and the cluster scale can also be larger than the scale of the cluster established based on the open shortest path first protocol. For example, the maximum next hops supported by this cluster are 128, while the cluster established based on the open shortest path first protocol only supports a maximum next hop of 16.

[0270] In addition, when a routing device fails, the cluster established by the open shortest path first protocol only selects the route with a higher priority for forwarding, and cannot forward through routes with different priorities, resulting in the inability to achieve load balancing of network transmission traffic through multiple routes of different levels. The solution provided in the embodiment of the present application can achieve the load balancing of the network transmission traffic of multiple gateway devices to the failed gateway device, thereby achieving network load balancing.

[0271] As can be seen from the above, in the embodiment of the present application, when a faulty gateway device is detected, the workload state of the current gateway device is determined, and the faulty gateway device and the current gateway device are gateway devices in the same cluster; at least one first Internet Protocol address in the faulty gateway device is obtained according to the workload state; a corresponding address resolution protocol message is generated according to the first Internet Protocol address and the second Internet Protocol address managed by the current gateway device; the address resolution protocol message is sent to the switch; and the network data returned by the switch according to the address resolution protocol message is received. In this way, when the normal gateway device detects the faulty gateway device, it can take over the Internet Protocol address managed by the faulty gateway device, and then generate an address resolution protocol message to the switch according to the taken-over first Internet Protocol address, so that the switch can determine that the gateway device associated with the first Internet Protocol address is the current normal gateway device according to the address resolution protocol message, so that network data can be transmitted through the current normal gateway device, thereby ensuring that the network data corresponding to the faulty gateway device is transmitted through the normally working gateway device. Compared with the cluster solution based on the open shortest path first protocol established in the prior art, the embodiment of the present application realizes load balancing of network traffic transmission, improves the network stability of the cluster, and improves the efficiency of network communication.

[0272] The network communication method provided in the embodiment of the present application can be applied to the field of smart transportation.

[0273] Please continue reading Fig.11 , Fig.11 1 is another flow chart of the network communication method provided by the embodiment of the present application. The network communication method may include the following steps:

[0274] In step 501, broadcast information sent by each gateway device is received, where the broadcast information carries a device identifier and a heartbeat message.

[0275] Taking the current gateway device as an example, it will receive broadcast information from other gateway devices. Since the broadcast information sent by each gateway device contains the device identification and heartbeat message, the current gateway device can identify each gateway device according to the device identification, and can determine which gateway devices are working normally and which gateway devices are faulty gateway devices according to the heartbeat message.

[0276] For example, since the mechanism for the gateway device to send broadcast information is to send the broadcast information once every fixed period of time, the current gateway device can determine the working status of other gateways according to the time of the heartbeat message in the received broadcast information.

[0277] In step 502, the interval between the two most recent heartbeat messages of each device identifier is determined.

[0278] Among them, for each device identification, the interval between the two most recent heartbeat messages can be obtained. For example, the time of the two most recent heartbeat messages corresponding to device identification a is 1 minute 45 seconds and 1 minute 48 seconds respectively, then the interval between the two most recent heartbeat messages of device identification a is 3 seconds.

[0279] In step 503, the device identification whose interval duration exceeds the preset duration is determined as the target device identification.

[0280] If the preset duration is 2 seconds and the interval duration is 3 seconds, it means that the interval duration exceeds the preset duration, and the gateway device corresponding to the device identification a is a faulty gateway device. The device identification a is confirmed as the target device identification.

[0281] In step 504, the gateway device corresponding to the target device identifier is determined to be a faulty gateway device.

[0282] Since a device identifier corresponds to a unique gateway device, the gateway device corresponding to the device identifier a can be identified as a faulty gateway device. For example, if the gateway device corresponding to the device identifier a is gateway device A, then gateway device A is a faulty gateway device.

[0283] In step 505, the received Internet Protocol address managed by the faulty gateway device is determined as the first Internet Protocol address.

[0284] The received Internet Protocol address managed by the faulty gateway device is an Internet Protocol address allocated based on a polling allocation mechanism.

[0285] It can be understood that the corresponding number of first Internet Protocol addresses taken over by the gateway device can be allocated through the switch using a polling allocation mechanism, wherein the polling allocation mechanism is to number each gateway device in the normally working gateway device, and then allocate the Internet Protocol addresses managed by the faulty gateway device to each gateway device in sequence according to the number, so that each gateway device can be allocated the corresponding first Internet Protocol address.

[0286] For example, on the switch side, the Internet Protocol addresses managed by the faulty gateway device may be sorted, for example, the Internet Protocol addresses may be sorted from small to large, or from large to small.

[0287] Then the sorted first Internet Protocol address is allocated to the first gateway device, and then the sorted second Internet Protocol address is allocated to the second gateway device, etc., until all the Internet Protocol addresses managed by the failed gateway device are allocated to the normally working gateway devices, and the normally working gateway devices thus obtain the corresponding number of first Internet Protocol addresses.

[0288] It should be noted that, taking the current gateway device as an example, the number of Internet Protocol addresses that can be taken over by the current gateway device can be determined based on the workload status. Within the number that can be taken over, the current gateway device can receive the Internet Protocol address of the faulty gateway device allocated under the polling allocation mechanism. For example, in the above content, the number of Internet Protocol addresses that can be taken over by the current gateway device is determined by the load ratio or the transmission occupancy ratio. For another example, the processor occupancy rate of the current gateway device can be determined as the workload status, and the number of Internet Protocol addresses that can be taken over can be determined based on the processor occupancy rate.

[0289] When the number of Internet Protocol addresses participating in the sorting is greater than the number of gateway devices participating in the sorting that are working normally, for example, the number of Internet Protocol addresses participating in the sorting is m, the number of gateway devices participating in the sorting that are working normally is n, and m>n, then when the nth Internet Protocol address after sorting is assigned to the nth gateway device after sorting that is working normally, when it is determined to take over the n+1th gateway device after sorting that is working normally, the n+1th Internet Protocol address after sorting is assigned to the 1st gateway device after sorting, and then the n+2th Internet Protocol address after sorting is assigned to the 2nd gateway device after sorting, and so on.

[0290] In the process of allocating the sorted Internet Protocol addresses, if the number of Internet Protocol addresses that the current gateway device can still take over is 4, and the number of Internet Protocol addresses allocated based on the polling mechanism is 6, then the current gateway can refuse to take over the extra 2 Internet Protocol addresses, thereby ensuring that the current gateway will not be overloaded, so as to ensure normal operation.

[0291] In step 506, the local hardware address of the current gateway device is obtained, the first Internet Protocol address, the second Internet Protocol address and the local hardware address are bound, and a corresponding address resolution protocol message is generated.

[0292] For example, a gateway device that works normally is gateway device B, and the first Internet Protocol address taken over by gateway device B is tip1, and the second Internet Protocol address local to gateway device B is fip4, fip5, and fip6. Gateway device B can bind fip4, fip5, fip6, tip1 and the local hardware address to generate the corresponding address resolution protocol message.

[0293] In step 507, the address resolution protocol message is sent to the switch.

[0294] In step 508, a first access request corresponding to at least one first Internet Protocol address is determined, and a second access request corresponding to a second Internet Protocol address is determined.

[0295] It is understandable that when the client wants to obtain corresponding network data from the server, it needs to send an access request. After receiving the access request, the server can retrieve the corresponding network data and finally send the network data to the client.

[0296] The gateway device can determine the first access request corresponding to the first Internet Protocol address, for example, by obtaining the first access request in the broadcast information of the faulty gateway device, and then determine the second access request corresponding to the local second Internet Protocol address, and finally send the first access request and the second access request to the switch.

[0297] In step 509, the first access request and the second access request are sent to the switch.

[0298] In step 510, network data returned by the switch according to the address resolution protocol message, the first access request and the second access request is received.

[0299] After receiving the first access request and the second access request, the switch can find the corresponding server according to the server identifier because the access request includes the corresponding server identifier, and then send the access request to the corresponding server.

[0300] The server generates first network data according to the first access request, generates second network data according to the second access request, and then sends the first network data and the second network data to the switch, which then forwards the first network data and the second network data to the gateway device. The network data returned by the server received by the gateway device includes the first network data and the second network data.

[0301] For example, after the server generates the first network data, the server will set the first Internet Protocol address therein so that the switch can obtain the first Internet Protocol address from the returned first network data. The switch can then determine the hardware address corresponding to the first Internet Protocol address based on the hardware relationship between the locally cached Internet Protocol address and the hardware address of the gateway device, and then determine the gateway device corresponding to the first Internet Protocol address based on the hardware address, and then the switch forwards the first network data to the corresponding network device, thereby completing the forwarding of the first network data.

[0302] In the above manner, after receiving the first network data and the second network data, the gateway device can forward the first network data and the second network data to the corresponding client, respectively. This avoids the interruption of network communication caused by the failure of the gateway device to forward the first network data, and the traffic of the failed gateway device is taken over by the gateway device that works normally to take over the Internet Protocol address managed by the failed gateway device, thereby improving the efficiency of network communication.

[0303] As can be seen from the above, in the embodiment of the present application, the gateway device receives the broadcast information sent by each gateway device, and the broadcast information carries the device identification and heartbeat message. Then, the faulty gateway device is determined in each gateway device according to the device identification and the heartbeat message, and the Internet Protocol address managed by the received faulty gateway device is determined as the first Internet Protocol address. Then the local hardware address of the current gateway device is obtained, the first Internet Protocol address, the second Internet Protocol address and the local hardware address are bound, the corresponding address resolution protocol message is generated, and the address resolution protocol message is sent to the switch. The gateway device determines the first access request corresponding to at least one first Internet Protocol address, determines the second access request corresponding to the second Internet Protocol address, and sends the first access request and the second access request to the switch. Finally, the switch receives the network data returned according to the address resolution protocol message, the first access request and the second access request. The gateway device can forward the network data to the client, realize the flow takeover of the faulty gateway device, thereby improving the efficiency of network communication. Compared with the cluster solution based on the open shortest path first protocol established in the prior art, the embodiment of the present application realizes the load balancing of network traffic transmission, improves the network stability of the cluster, and improves the efficiency of network communication.

[0304] To learn more about the network communication method provided by the present invention, please continue to refer to Fig.12 , Fig.12 This is another scenario diagram of the network communication system provided in an embodiment of the present application.

[0305] like Fig.12 As shown, it includes multiple clients, such as client 1, client 2, and client 3. It includes multiple gateway devices, such as gateway device A, gateway device B, gateway device C, and gateway device D. Between the gateway device and the client, data forwarding needs to be performed through an external switch. For example, the external switch will send the client's access request to the corresponding gateway device, or the external switch will forward the network data sent by the gateway device to the corresponding client. The server can include multiple servers, such as server 1 and server 2.

[0306] The switch is a switch facing the server side, which can also be understood as an inline switch. The switch can send the access request sent by the gateway device to the corresponding server, and the switch can also forward the network data returned by the server according to the access request to the corresponding gateway device.

[0307] In some scenarios, when gateway device A, gateway device B, gateway device C, and gateway device D are all in normal working state, gateway device A, gateway device B, gateway device C, and gateway device D will respectively generate address address resolution protocol messages for the Internet Protocol addresses they manage and send them to the switch.

[0308] For example, the gateway device may send an ARP message to the switch every 3 seconds, wherein the ARP message may be a free ARP message, that is, an ARP message generated by the gateway device according to the Internet address protocol managed by itself and the local hardware address.

[0309] When gateway device A, gateway device B, gateway device C, and gateway device D are all in normal working state, the Internet Protocol addresses assigned to gateway device A are fip1, fip2, and fip3. The Internet Protocol addresses assigned to gateway device B are fip4, fip5, and fip6. The Internet Protocol addresses assigned to gateway device C are fip7 and fip8. The Internet Protocol address assigned to gateway device D is fip9. That is, each gateway device is assigned a corresponding Internet Protocol address, and each gateway device can process data transmission between the client and the server according to the assigned Internet Protocol address.

[0310] Since gateway device A, gateway device B, gateway device C, and gateway device D will respectively send resolution protocol messages to the switch, for example, each gateway device will send a free ARP message to the switch, then the switch will store the Internet Protocol address managed by each gateway device and the hardware address of the gateway device associated with each Internet Protocol address.

[0311] In some implementations, gateway device A, gateway device B, gateway device C, and gateway device D can detect faults with each other. Any gateway device receives broadcast information sent by each gateway device, the broadcast information carries a device identifier and a heartbeat message; and determines the faulty gateway device in each gateway device according to the device identifier and the heartbeat message.

[0312] For example, the current gateway device can determine the interval between the two most recent heartbeat messages of each device identifier: determine the device identifier whose interval exceeds the preset duration as the target device identifier; and determine the gateway device corresponding to the target device identifier as the faulty gateway device.

[0313] If gateway device A fails, gateway device A is determined as a failed gateway device, and gateway devices B, C, and D are determined as normal working gateway devices. In order to ensure that the data transmission service corresponding to gateway device A can be carried out normally, gateway devices B, C, and D can take over the Internet Protocol address managed by gateway device A.

[0314] For example, any gateway device among gateway device B, gateway device C, and gateway device D may obtain the number of second Internet Protocol addresses managed by the current gateway device and the maximum load number of the Internet Protocol address of the current gateway device;

[0315] Determining a corresponding load ratio according to the number of second Internet Protocol addresses and the maximum load number;

[0316] A corresponding number of first Internet Protocol addresses in the faulty gateway device are obtained according to the load ratio.

[0317] Specifically, any gateway device among gateway device B, gateway device C, and gateway device D may determine a target load ratio range in which the load ratio is located;

[0318] Determine the corresponding number of takeovers that can be taken over according to the target load ratio range;

[0319] A corresponding number of first Internet Protocol addresses in the faulty gateway device is obtained according to the takeover quantity.

[0320] For another example, any gateway device among gateway device B, gateway device C, and gateway device D may determine the data transmission volume of the current gateway device at the current time and the maximum data transmission volume of the current gateway device;

[0321] Determine the corresponding transmission occupancy ratio according to the current data transmission volume and the maximum data transmission volume;

[0322] A corresponding number of first Internet Protocol addresses in the faulty gateway device are obtained according to the transmission occupancy ratio.

[0323] Specifically, any gateway device among the gateway device B, the gateway device C, and the gateway device D may determine a target transmission occupancy ratio range in which the transmission occupancy ratio is located;

[0324] Determine the corresponding number of takeovers based on the target transmission occupancy ratio range;

[0325] A corresponding number of first Internet Protocol addresses in the faulty gateway device is obtained according to the takeover quantity.

[0326] For another example, the switch can allocate the Internet Protocol address managed by gateway device A to gateway device B, gateway device C, and gateway device D through a polling allocation mechanism. The polling allocation mechanism is to number each gateway device among the normally working gateway devices, and then allocate the Internet Protocol address managed by the faulty gateway device to each gateway device in sequence according to the number, so that each gateway device can be allocated the corresponding first Internet Protocol address.

[0327] Any gateway device among gateway device B, gateway device C, and gateway device D can obtain the local hardware address of the current gateway device, bind the first Internet Protocol address, the second Internet Protocol address, and the local hardware address, generate a corresponding address resolution protocol message, and then send the address resolution protocol message to the switch.

[0328] The switch can update the correspondence between the locally stored Internet Protocol address and the hardware address of each gateway device according to the Address Resolution Protocol message.

[0329] Any gateway device among gateway device B, gateway device C, and gateway device D can determine a first access request corresponding to at least one first Internet Protocol address, and determine a second access request corresponding to a second Internet Protocol address; and send the first access request and the second access request to the switch.

[0330] The switch can forward the first access request and the second access request to the corresponding server. After receiving the first access request and the second access request, the server can generate corresponding network data according to the first access request and the second access request, and return the network data to the switch, and the switch returns the network data to each gateway device. The network data includes the first network data and the second network data, the first network data corresponds to the first access request, and the second network data corresponds to the second network request.

[0331] For example, after the server generates the first network data, the server will set the first Internet Protocol address therein so that the switch can obtain the first Internet Protocol address from the returned first network data. The switch can then determine the hardware address corresponding to the first Internet Protocol address based on the hardware relationship between the locally cached Internet Protocol address and the hardware address of the gateway device, and then determine the gateway device corresponding to the first Internet Protocol address based on the hardware address, and then the switch forwards the first network data to the corresponding network device, thereby completing the forwarding of the first network data.

[0332] After obtaining at least one first Internet Protocol address in the faulty gateway device, any gateway device among gateway device B, gateway device C, and gateway device D determines the third Internet Protocol address corresponding to the first access request before sending network data to the external switch; generates a correspondence between the first Internet Protocol address, the third Internet Protocol address, and the local hardware address; and sends the correspondence to the external switch.

[0333] Any gateway device among gateway device B, gateway device C, and gateway device D sends network data to the external switch. When any gateway device among gateway device B, gateway device C, and gateway device D sends network data, it will also send additional information such as the first Internet Protocol address and local hardware address managed by itself. Or if the network data contains the first Internet Protocol address, when the gateway device forwards the network data, it will also forward the first Internet Protocol address.

[0334] The external switch determines the gateway device as the gateway device for forwarding the first access request based on the additional information and the above correspondence, then determines the corresponding client based on the third Internet Protocol address in the network data, and finally forwards the network data to the corresponding client. When the client sends an access request next time, the external switch can determine the target gateway device based on the third Internet Protocol address of the client and the above correspondence, and then forward the access request sent again by the client through the target gateway device.

[0335] As can be seen from the above, when a faulty gateway device is detected, the workload state of the current gateway device is determined, and the faulty gateway device and the current gateway device are gateway devices in the same cluster; at least one first Internet Protocol address in the faulty gateway device is obtained according to the workload state; a corresponding address resolution protocol message is generated according to the first Internet Protocol address and the second Internet Protocol address managed by the current gateway device; the address resolution protocol message is sent to the switch; and the network data returned by the switch according to the address resolution protocol message is received. In this way, when a normal gateway device detects a faulty gateway device, it can take over the Internet Protocol address managed by the faulty gateway device, and then generate an address resolution protocol message to the switch according to the taken-over first Internet Protocol address, so that the switch can determine that the gateway device associated with the first Internet Protocol address is the current normal gateway device according to the address resolution protocol message, so that network data can be transmitted through the current normal gateway device, thereby ensuring that the network data corresponding to the faulty gateway device is transmitted through the normally working gateway device. Compared with the cluster solution based on the open shortest path first protocol established in the prior art, the embodiment of the present application realizes load balancing of network traffic transmission, improves the network stability of the cluster, and improves the efficiency of network communication.

[0336] Please also read Fig.13 , Fig.13 This is another scenario diagram of the network communication system provided in an embodiment of the present application.

[0337] In some implementation scenarios, if gateway device A fails and gateway devices B, C, and D are all fully loaded, gateway devices B, C, and D cannot take over the Internet Protocol addresses managed by gateway device A. This may cause the data transmission service corresponding to gateway device A to be interrupted, and ultimately lead to the interruption of network communication between the client and the server.

[0338] In order to avoid this problem, a backup switch is provided in the embodiment of the present application, such as Fig.10 As shown, the standby switch corresponds to the associated gateway device E and gateway device F. If gateway device A fails and gateway device B, gateway device C, and gateway device D are all fully loaded, any gateway device among gateway device B, gateway device C, and gateway device D can send the full load information to the switch and the standby switch, and then the switch can send the Internet Protocol address managed by gateway device A to the standby switch, and then the standby switch assigns the Internet Protocol address managed by gateway device A to gateway device E and gateway device F. After gateway device E and gateway device F obtain the Internet Protocol address managed by gateway device A, gateway device E and gateway device F can take over the business corresponding to gateway device A, thereby avoiding the interruption of network communication between the client and the server due to the failure of gateway device A, so that the client and the server can communicate through other gateway devices, thereby improving the efficiency of network communication.

[0339] In some implementation scenarios, the failed device may not be the gateway device, and the switch may also fail. Therefore, a timed broadcast message can be set between the switch and the backup switch, and the switch can send the address resolution protocol table stored in itself to the backup switch. The address resolution protocol table contains the correspondence between different Internet address protocols and the hardware address of the gateway device.

[0340] In addition, gateway devices A, B, C, and D associated with the switch are all equipped with corresponding interfaces with the backup switch. When the switch is normal, the interfaces between gateway devices A, B, C, and D and the backup switch will not be enabled.

[0341] If the switch fails, the interfaces between gateway device A, gateway device B, gateway device C, and gateway device D and the standby switch are enabled respectively. The standby switch can cooperate with gateway device A, gateway device B, gateway device C, and gateway device D according to the received address resolution protocol table to achieve correct access request forwarding and network data forwarding, thereby achieving normal communication between the client and the server, thereby avoiding network communication interruption caused by the switch and improving the efficiency of network communication.

[0342] See also Fig.14 , Fig.14 The schematic diagram of the structure of the network communication device provided in the embodiment of the present application is applied to a gateway device. The meanings of the terms are the same as those in the above-mentioned network communication method, and the specific implementation details can refer to the description in the method embodiment.

[0343] The network communication device 600 may include: a detection module 610 , an acquisition module 620 , a generation module 630 , a sending module 640 , and a receiving module 650 .

[0344] A detection module 610 is used to determine the workload status of the current gateway device when a faulty gateway device is detected, and the faulty gateway device and the current gateway device are gateway devices in the same cluster;

[0345] An acquisition module 620, configured to acquire at least one first Internet Protocol address of a faulty gateway device according to a workload status;

[0346] A generating module 630, configured to generate a corresponding address resolution protocol message according to the first Internet Protocol address and the second Internet Protocol address currently managed by the gateway device;

[0347] The sending module 640 is used to send the address resolution protocol message to the switch;

[0348] The receiving module 650 is used to receive the network data returned by the switch according to the address resolution protocol message.

[0349] In some embodiments, please refer to Fig.15 , Fig.15 Another structural diagram of the network communication device provided in the embodiment of the present application is shown in FIG. 6. The detection module 610 includes a receiving submodule 611 , a detection submodule 612 , an acquisition submodule 613 and a determination submodule 614 .

[0350] An acquisition submodule 613 is used to acquire the number of second Internet Protocol addresses managed by the current gateway device and the maximum load number of the Internet Protocol address of the current gateway device;

[0351] A determination submodule 614, configured to determine a corresponding load ratio according to the number of second Internet Protocol addresses and the maximum load number;

[0352] The acquisition module 620 is used to acquire a corresponding number of first Internet Protocol addresses in the faulty gateway device according to the load ratio.

[0353] In some implementations, the acquisition module 620 is configured to:

[0354] Determine a target load ratio range within which the load ratio falls;

[0355] Determine the corresponding number of takeovers that can be taken over according to the target load ratio range;

[0356] A corresponding number of first Internet Protocol addresses in the faulty gateway device is obtained according to the takeover quantity.

[0357] In some implementations, the acquisition submodule 613 is used to: determine the data transmission volume of the current gateway device at the current time and the maximum data transmission volume of the current gateway device;

[0358] The determination submodule 614 is used to determine the corresponding transmission occupancy ratio according to the data transmission volume and the maximum data transmission volume at the current time;

[0359] The acquisition module 620 is used to acquire a corresponding number of first Internet Protocol addresses in the faulty gateway device according to the transmission occupancy ratio.

[0360] In some implementations, the acquisition module 620 is configured to:

[0361] Determine a target transmission occupancy ratio range in which the transmission occupancy ratio falls;

[0362] Determine the corresponding number of takeovers based on the target transmission occupancy ratio range;

[0363] A corresponding number of first Internet Protocol addresses in the faulty gateway device is obtained according to the takeover quantity.

[0364] In some implementations, the acquisition module 620 is configured to:

[0365] Determine the number of Internet Protocol addresses that can be taken over by the current gateway device according to the workload status;

[0366] Within the takeover quantity, determining the received Internet Protocol address managed by the faulty gateway device as the first Internet Protocol address;

[0367] The received Internet Protocol address managed by the faulty gateway device is an Internet Protocol address allocated based on a polling allocation mechanism.

[0368] In some implementations, the generating module 630 is configured to:

[0369] Get the local hardware address of the current gateway device;

[0370] The first Internet Protocol address, the second Internet Protocol address and the local hardware address are bound to generate a corresponding address resolution protocol message.

[0371] In some implementations, the detection module 610 includes a receiving submodule 611 and a detecting submodule 612 .

[0372] Before obtaining at least one first Internet Protocol address in the faulty gateway device according to the workload status, the receiving submodule 611 is used to receive broadcast information sent by each gateway device in the cluster, where the broadcast information carries a device identifier and a heartbeat message;

[0373] The detection submodule 612 is used to determine a faulty gateway device in each gateway device based on the device identifier and the heartbeat message.

[0374] In some implementations, before obtaining at least one first Internet Protocol address in the faulty gateway device, the detection submodule 612 is configured to:

[0375] Determine the interval between the two most recent heartbeat messages for each device identifier:

[0376] The device identification whose interval time exceeds the preset time is determined as the target device identification;

[0377] The gateway device corresponding to the target device identifier is determined as a faulty gateway device.

[0378] In some implementations, before receiving the network data returned by the switch according to the address resolution protocol message, the sending module 640 is configured to:

[0379] Determine a first access request corresponding to at least one first Internet Protocol address, and determine a second access request corresponding to a second Internet Protocol address;

[0380] The first access request and the second access request are sent to the switch.

[0381] In some implementations, the receiving module 650 is configured to:

[0382] The network data returned by the switch according to the address resolution protocol message, the first access request and the second access request is received.

[0383] In some implementations, after obtaining at least one first Internet Protocol address in the faulty gateway device according to the workload status, the sending module 640 is configured to:

[0384] Determining a third Internet Protocol address corresponding to the first access request;

[0385] Generate a correspondence between the first Internet Protocol address, the third Internet Protocol address and the local hardware address of the current gateway device;

[0386] The corresponding relationship is sent to the external switch.

[0387] In some implementations, the sending module 640 is configured to:

[0388] When it is detected that the failed gateway device is restored to a working state, deleting the first Internet Protocol address currently managed by the gateway device;

[0389] Generate a new address resolution protocol message according to the second Internet Protocol address currently managed by the gateway device;

[0390] Send the new ARP message to the switch.

[0391] As can be seen from the above, when a faulty gateway device is detected, the workload state of the current gateway device is determined, and the faulty gateway device and the current gateway device are gateway devices in the same cluster; at least one first Internet Protocol address in the faulty gateway device is obtained according to the workload state; a corresponding address resolution protocol message is generated according to the first Internet Protocol address and the second Internet Protocol address managed by the current gateway device; the address resolution protocol message is sent to the switch; and the network data returned by the switch according to the address resolution protocol message is received. In this way, when a normal gateway device detects a faulty gateway device, it can take over the Internet Protocol address managed by the faulty gateway device, and then generate an address resolution protocol message to the switch according to the taken-over first Internet Protocol address, so that the switch can determine that the gateway device associated with the first Internet Protocol address is the current normal gateway device according to the address resolution protocol message, so that network data can be transmitted through the current normal gateway device, thereby ensuring that the network data corresponding to the faulty gateway device is transmitted through the normally working gateway device. Compared with the cluster solution based on the open shortest path first protocol established in the prior art, the embodiment of the present application realizes load balancing of network traffic transmission, improves the network stability of the cluster, and improves the efficiency of network communication.

[0392] The specific implementation of each of the above modules can be found in the previous embodiments and will not be described in detail here.

[0393] The present application also provides a computer device, which may be a terminal. Fig.16 As shown, it shows a schematic diagram of the structure of the terminal involved in the embodiment of the present application, specifically:

[0394] The computer device may include a radio frequency (RF) circuit 701, a memory 702 including one or more computer-readable storage media, an input unit 703, a display unit 704, a sensor 705, an audio circuit 706, a wireless fidelity (WiFi) module 707, a processor 708 including one or more processing cores, and a power supply 709. Those skilled in the art will appreciate that Fig.16 The terminal structure shown in the figure does not constitute a limitation on the terminal, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0395] The RF circuit 701 can be used for receiving and sending signals during the process of sending and receiving information or making calls. In particular, after receiving the downlink information of the base station, it is handed over to one or more processors 708 for processing; in addition, the data related to the uplink is sent to the base station. Usually, the RF circuit 701 includes but is not limited to an antenna, at least one amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 701 can also communicate with the network and other devices through wireless communication. Wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile Communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.

[0396] The memory 702 can be used to store software programs and modules. The processor 708 executes various functional applications and information retrieval by running the software programs and modules stored in the memory 702. The memory 702 may mainly include a program storage area and a data storage area, wherein the program storage area may 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 may store data created according to the use of the terminal (such as audio data, a phone book, etc.), etc. In addition, the memory 702 may include a high-speed random access memory, and may 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. Accordingly, the memory 702 may also include a memory controller to provide the processor 708 and the input unit 703 with access to the memory 702.

[0397] The input unit 703 can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to object setting and function control. Specifically, in a specific embodiment, the input unit 703 may include a touch-sensitive surface and other input devices. The touch-sensitive surface, also known as a touch display screen or a touch pad, can collect touch operations of an object on or near it (such as operations of an object using any suitable object or accessory such as a finger, a stylus, etc. on or near the touch-sensitive surface), and drive the corresponding connection device according to a pre-set program. Optionally, the touch-sensitive surface may include a touch detection device and a touch controller. Among them, the touch detection device detects the touch orientation of the object, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 708, and can receive and execute commands sent by the processor 708. In addition, the touch-sensitive surface can be implemented using multiple types such as resistive, capacitive, infrared and surface acoustic waves. In addition to the touch-sensitive surface, the input unit 703 may also include other input devices. Specifically, other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.

[0398] The display unit 704 can be used to display information input by the object or information provided to the object and various graphic object interfaces of the terminal, which can be composed of graphics, text, icons, videos and any combination thereof. The display unit 704 may include a display panel. Optionally, the display panel may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch-sensitive surface may cover the display panel. When the touch-sensitive surface detects a touch operation on or near it, it is transmitted to the processor 708 to determine the type of touch event. The processor 708 then provides a corresponding visual output on the display panel according to the type of touch event. Although in Fig.16 In the embodiment, the touch-sensitive surface and the display panel are used as two independent components to realize input and output functions, but in some embodiments, the touch-sensitive surface and the display panel can be integrated to realize input and output functions.

[0399] The terminal may also include at least one sensor 705, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel according to the brightness of the ambient light, and the proximity sensor may turn off the display panel and / or backlight when the terminal is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can be configured in the terminal, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be repeated here.

[0400] The audio circuit 706, the speaker, and the microphone can provide an audio interface between the object and the terminal. The audio circuit 706 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 706 and converted into audio data, and then the audio data is output to the processor 708 for processing, and then sent to another terminal through the RF circuit 701, or the audio data is output to the memory 702 for further processing. The audio circuit 706 may also include an earplug jack to provide communication between an external headset and the terminal.

[0401] WiFi is a short-range wireless transmission technology. The terminal can help the object to send and receive emails, browse web pages and access streaming media through the WiFi module 707. It provides wireless broadband Internet access for the object. Fig.16 A WiFi module 707 is shown, but it is understandable that it is not an essential component of the terminal and can be omitted as required without changing the essence of the invention.

[0402] The processor 708 is the control center of the terminal. It uses various interfaces and lines to connect various parts of the entire mobile phone. By running or executing software programs and / or modules stored in the memory 702 and calling data stored in the memory 702, it executes various functions of the terminal and processes data, thereby monitoring the mobile phone as a whole. Optionally, the processor 708 may include one or more processing cores; preferably, the processor 708 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, object interface and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 708.

[0403] The terminal also includes a power supply 709 (such as a battery) for supplying power to each component. Preferably, the power supply can be logically connected to the processor 708 through a power management system, so that the power management system can manage charging, discharging, and power consumption management. The power supply 709 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0404] Although not shown, the terminal may also include a camera, a Bluetooth module, etc., which will not be described in detail here. Specifically in this embodiment, the processor 708 in the terminal will load the executable files corresponding to the processes of one or more applications into the memory 702 according to the following instructions, and the processor 708 will run the applications stored in the memory 702 to implement various functions:

[0405] When a faulty gateway device is detected, determining a workload state of a current gateway device, the faulty gateway device and the current gateway device being gateway devices in the same cluster;

[0406] Obtaining at least one first Internet Protocol address in the faulty gateway device according to the workload status;

[0407] Generate a corresponding address resolution protocol message according to the first Internet Protocol address and the second Internet Protocol address currently managed by the gateway device;

[0408] Sending the address resolution protocol message to the switch;

[0409] Receive the network data returned by the switch based on the address resolution protocol message.

[0410] In the above embodiments, the description of each embodiment has its own emphasis. For the part that is not described in detail in a certain embodiment, please refer to the detailed description of the network communication method above, and will not be repeated here.

[0411] As can be seen from the above, when a faulty gateway device is detected, the workload state of the current gateway device is determined, and the faulty gateway device and the current gateway device are gateway devices in the same cluster; at least one first Internet Protocol address in the faulty gateway device is obtained according to the workload state; a corresponding address resolution protocol message is generated according to the first Internet Protocol address and the second Internet Protocol address managed by the current gateway device; the address resolution protocol message is sent to the switch; and the network data returned by the switch according to the address resolution protocol message is received. In this way, when a normal gateway device detects a faulty gateway device, it can take over the Internet Protocol address managed by the faulty gateway device, and then generate an address resolution protocol message to the switch according to the taken-over first Internet Protocol address, so that the switch can determine that the gateway device associated with the first Internet Protocol address is the current normal gateway device according to the address resolution protocol message, so that network data can be transmitted through the current normal gateway device, thereby ensuring that the network data corresponding to the faulty gateway device is transmitted through the normally working gateway device. Compared with the cluster solution based on the open shortest path first protocol established in the prior art, the embodiment of the present application realizes load balancing of network traffic transmission, improves the network stability of the cluster, and improves the efficiency of network communication.

[0412] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0413] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any one of the network communication methods provided in the embodiments of the present application. For example, the instructions can execute the following steps:

[0414] When a faulty gateway device is detected, determining a workload state of a current gateway device, the faulty gateway device and the current gateway device being gateway devices in the same cluster;

[0415] Obtaining at least one first Internet Protocol address in the faulty gateway device according to the workload status;

[0416] Generate a corresponding address resolution protocol message according to the first Internet Protocol address and the second Internet Protocol address currently managed by the gateway device;

[0417] Sending the address resolution protocol message to the switch;

[0418] Receive the network data returned by the switch based on the address resolution protocol message.

[0419] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in various optional implementations provided in the above embodiments.

[0420] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0421] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0422] Since the instructions stored in the computer-readable storage medium can execute the steps in any one of the network communication methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the network communication methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0423] The above is a detailed introduction to a network communication method, device, computer-readable storage medium and computer equipment provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A network communication method, characterized in that: include: When a faulty gateway device is detected, determining a workload state of a current gateway device, the faulty gateway device and the current gateway device being gateway devices in the same cluster; Acquire at least one first Internet Protocol address in the faulty gateway device according to the workload status; Generate a corresponding address resolution protocol message according to the first Internet Protocol address and the second Internet Protocol address managed by the current gateway device; Sending the address resolution protocol message to the switch; Receive network data returned by the switch according to the address resolution protocol message.

2. The network communication method according to claim 1, characterized in that: The workload state is a load ratio, and determining the workload state of the current gateway device includes: Obtaining the number of second Internet Protocol addresses managed by the current gateway device and the maximum load number of the Internet Protocol address of the current gateway device; Determining a corresponding load ratio according to the number of the second Internet Protocol addresses and the maximum load number; The acquiring at least one first Internet Protocol address of the faulty gateway device according to the workload status comprises: A corresponding number of first Internet Protocol addresses in the faulty gateway device are acquired according to the load ratio.

3. The network communication method according to claim 2, characterized in that: The acquiring a corresponding number of first Internet Protocol addresses in the faulty gateway device according to the load ratio includes: Determining a target load ratio range within which the load ratio lies; Determine the corresponding number of takeovers that can be taken over according to the target load ratio range; A corresponding number of first Internet Protocol addresses in the faulty gateway device is obtained according to the takeover quantity.

4. The network communication method according to claim 1, characterized in that: The workload state is a transmission occupancy ratio, and determining the workload state of the current gateway device includes: Determine the data transmission volume of the current gateway device at the current time and the maximum data transmission volume of the current gateway device; Determine a corresponding transmission occupancy ratio according to the data transmission volume at the current time and the maximum data transmission volume; The acquiring at least one first Internet Protocol address of the faulty gateway device according to the workload status comprises: A corresponding number of first Internet Protocol addresses in the faulty gateway device are acquired according to the transmission occupancy ratio.

5. The network communication method according to claim 4, characterized in that: The acquiring a corresponding number of first Internet Protocol addresses in the faulty gateway device according to the transmission occupancy ratio includes: Determine a target transmission occupancy ratio range within which the transmission occupancy ratio falls; Determine the corresponding number of takeovers according to the target transmission occupancy ratio range; A corresponding number of first Internet Protocol addresses in the faulty gateway device is obtained according to the takeover quantity.

6. The network communication method according to claim 1, characterized in that: The acquiring at least one first Internet Protocol address of the faulty gateway device according to the workload status comprises: Determine the number of Internet Protocol addresses that can be taken over by the current gateway device according to the workload status; Within the takeover quantity, determining the received Internet Protocol address managed by the faulty gateway device as the first Internet Protocol address; The received Internet Protocol address managed by the faulty gateway device is an Internet Protocol address allocated based on a polling allocation mechanism.

7. The network communication method according to claim 1, characterized in that: The generating a corresponding address resolution protocol message according to the first Internet Protocol address and the local second Internet Protocol address includes: Obtaining the local hardware address of the current gateway device; The first Internet Protocol address, the second Internet Protocol address and the local hardware address are bound to generate a corresponding address resolution protocol message.

8. The network communication method according to claim 1, characterized in that: Before acquiring at least one first Internet Protocol address in the faulty gateway device according to the workload status, the method further includes: Receive broadcast information sent by each gateway device in the cluster, wherein the broadcast information carries a device identifier and a heartbeat message; A faulty gateway device is determined in each gateway device according to the device identifier and the heartbeat message.

9. The network communication method according to claim 8, characterized in that: The step of determining a faulty gateway device in each gateway device according to the device identifier and the heartbeat message includes: Determine the interval between the two most recent heartbeat messages of each device identifier: Determine the device identification whose interval duration exceeds the preset duration as the target device identification; The gateway device corresponding to the target device identifier is determined as a faulty gateway device.

10. The network communication method according to claim 1, characterized in that: Before receiving the network data returned by the switch according to the address resolution protocol message, the method further includes: Determine a first access request corresponding to the at least one first Internet Protocol address, and determine a second access request corresponding to the second Internet Protocol address; sending the first access request and the second access request to the switch; The receiving the network data returned by the switch according to the address resolution protocol message includes: Receive network data returned by the switch according to the address resolution protocol message, the first access request and the second access request.

11. The network communication method according to claim 10, characterized in that: After acquiring at least one first Internet Protocol address in the faulty gateway device according to the workload status, the method further includes: Determining a third Internet Protocol address corresponding to the first access request; Generate a correspondence between the first Internet Protocol address, the third Internet Protocol address and the local hardware address of the current gateway device; The corresponding relationship is sent to the external switch.

12. The network communication method according to claim 1, characterized in that: After acquiring at least one first Internet Protocol address in the faulty gateway device according to the workload status, the method further includes: When it is detected that the faulty gateway device is restored to a working state, deleting the first Internet Protocol address managed by the current gateway device; Generate a new address resolution protocol message according to the second Internet Protocol address managed by the current gateway device; The new address resolution protocol message is sent to the switch.

13. A network communication device, characterized in that: include: A detection module, configured to determine a workload state of a current gateway device when a faulty gateway device is detected, wherein the faulty gateway device and the current gateway device are gateway devices in the same cluster; an acquisition module, configured to acquire at least one first Internet Protocol address of the faulty gateway device according to the workload status; A generating module, configured to generate a corresponding address resolution protocol message according to the first Internet Protocol address and the second Internet Protocol address managed by the current gateway device; A sending module, used for sending the address resolution protocol message to the switch; The receiving module is used to receive the network data returned by the switch according to the address resolution protocol message.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the network communication method according to any one of claims 1 to 12.

15. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps in the network communication method according to any one of claims 1 to 12 are implemented.