Fault recovery method and related device
By adopting a ring-breaking mechanism based on unique identification in the communication network, using the message tags in the broadcast message to determine whether the message is received repeatedly, so as to learn the forwarding port and the backup forwarding port in the main MAC address table and the backup MAC address table. The problem of failure recovery in the prior art requires pre-calculation of alternate paths, and the effect of rapid failure recovery and saving computing resources is achieved.
Patent Information
- Application Number
- CN202311079112.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-23
- Publication Date
- 2025-02-25
AI Technical Summary
The prior art requires pre-calculation of backup paths when network failure recovery, resulting in high computing resource consumption.
By adopting a unique identification-based loop breaking mechanism in the first switching network, the message tag in the broadcast message is used to determine whether the message is received repeatedly, so as to learn the forwarding port and the backup forwarding in the main MAC address table and the backup MAC address table. port to achieve failure recovery.
No need to pre-calculate backup paths, save computing resources, enable fast failure recovery, and avoid broadcast storms.
Smart Images

Figure CN119520236A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of communications, and in particular to a fault recovery method and related devices. Background Art
[0002] In modern communication network scenarios, network reliability is crucial. When a switch node or link fails in the network, it is necessary to quickly restore normal network communication to reduce data loss.
[0003] At present, the fault recovery method mainly implements fault recovery by pre-storing backup paths. When a fault is detected, the switch will forward the corresponding message through the pre-stored backup path, thereby bypassing the faulty switch or link and completing the data communication process.
[0004] However, the method of pre-storing the backup paths requires pre-calculating the backup paths, which consumes computing resources. Summary of the invention
[0005] The embodiments of the present application provide a fault recovery method and related devices, which can perform fault recovery without pre-calculating backup paths, thereby saving computing resources.
[0006] The first aspect of the present application provides a fault recovery method, which is applied to a first network device, the first network device is in a first switching network, and the first switching network is composed of multiple first network devices; in the first switching network, the first network device adopts a loop breaking mechanism based on a unique identifier to forward broadcast messages, that is, the first network device determines whether to receive the broadcast message repeatedly through the unique identifier in the broadcast message, and discards the broadcast message if it is received repeatedly to avoid broadcast storms. Therefore, the broadcast message in the first switching network is not forwarded along the tree path obtained by calculating or pruning the topology, but is forwarded through all ports except the port that receives the broadcast message. At this time, the first network device can receive the same broadcast message from different ports.
[0007] The first switching network may be any redundant topology, and a redundant link exists between at least two first network devices in the first switching network, and the first network devices in the first switching network form a ring network through the redundant link. The embodiment of the present application does not limit the specific topology of the first switching network.
[0008] The broadcast message includes a first broadcast message, the first network device includes a first port and a second port, and the first port and the second port are different ports. In the first switching network, the unique identifier may be a message tag.
[0009] The method includes:
[0010] The first network device receives a first broadcast message through a first port, and writes a corresponding relationship between a source media access control (MAC) address of the first broadcast message and the first port into a main MAC address table.
[0011] When receiving the first broadcast message, the first network device can first determine whether it is a repeated reception based on the message tag of the first broadcast message; if it is the first time to receive the first broadcast message, the message tag can be recorded in a preset message tag cache table; and the correspondence between the source MAC address of the first broadcast message and the first port is written into the main MAC address table.
[0012] The first network device repeatedly receives the first broadcast message through the second port, and writes the corresponding relationship between the source MAC address of the first broadcast message and the second port into the standby MAC address table.
[0013] Due to the loop breaking mechanism of the first switching network, the first network device can receive broadcast messages repeatedly. When the first network device finds the message label of the first broadcast message from its own message label cache table, it can be determined that the first broadcast message is received repeatedly; the second port and the first port are different ports, indicating that the source MAC address of the first broadcast message can also be reached from the second port. At this time, the corresponding relationship between the source MAC address and the second port is written into the standby MAC address table, and the standby forwarding port to the source MAC address of the first broadcast message can be obtained.
[0014] It can be understood that repeated reception indicates that the time when the second port receives the first broadcast message is later than the time when the first port receives the first broadcast message, that is, the time from the source MAC address to the first port is shorter than the time from the source MAC address to the second port, so the correspondence between the first port and the source MAC address is recorded in the main MAC address table as the preferred forwarding port; and the correspondence between the second port and the source MAC address is recorded in the backup MAC address table as the backup forwarding port.
[0015] It can be understood that after writing the correspondence between the source MAC address and the second port into the standby MAC address table, the first network device can discard the repeatedly received first broadcast message.
[0016] After completing the learning of the preferred forwarding port and the backup forwarding port corresponding to the source MAC address of the first broadcast message, that is, recording the correspondence between the source MAC address and the first port and the correspondence between the source MAC address and the second port respectively, the first network device can forward the first unicast message according to the main MAC address table or the backup MAC address table.
[0017] The destination MAC address of the first unicast message is the source MAC address of the first broadcast message.
[0018] In the embodiment of the present application, when the first network device receives the first message through the first port, the correspondence between the source MAC address and the first port is written into the main MAC address table, and the correspondence between the source MAC address and the second port is written into the backup MAC address table after the first message is repeatedly received through the second port, so that when forwarding the first unicast message with the destination MAC address as the source MAC address, the first unicast message can be forwarded through the first port in the main MAC address table or the second port in the backup MAC address table. In this way, when the link corresponding to the first port or the connected device fails, the second port can be used as a backup path for fault recovery, without the need to pre-calculate the backup path, which can save computing resources.
[0019] In a possible implementation, forwarding the first unicast message according to the primary MAC address table or the backup MAC address table includes: if the first port corresponding to the source MAC address of the first broadcast message in the primary MAC address table is available, forwarding the first unicast message through the first port.
[0020] In one possible implementation, the first unicast message is forwarded according to the main MAC address table or the backup MAC address table, including: if the first port corresponding to the source MAC address of the first broadcast message in the main MAC address table is unavailable, the first unicast message is forwarded through the second port corresponding to the source MAC address of the first broadcast message in the backup MAC address table.
[0021] When receiving the first unicast message with the destination MAC address as the source MAC address, the first network device can first search the port corresponding to the source MAC address in the main MAC table, that is, the first port; if it is detected that the first port is available, the first unicast message is forwarded through the first port; if it is detected that the network device or link connected to the first port fails, causing the first port to be unavailable for forwarding messages, the first network device then searches the second port corresponding to the source MAC address from the backup MAC address table for message forwarding.
[0022] It can be understood that the port being available means that the network device or link connected to the port has no faults, and the message can normally reach the network device through the port and the link.
[0023] After determining that the first port is unavailable, the first network device can modify the correspondence between the source MAC address and the first port in the main MAC address table to the correspondence between the source MAC address and the second port, and remove the corresponding table entry in the backup MAC address table, so that subsequent unicast messages sent to the source MAC address can be forwarded through the second port, thereby achieving rapid fault recovery.
[0024] In an embodiment of the present application, when the network device or link corresponding to the first port in the main MAC address table fails and the first unicast message cannot be forwarded through the first port, the first unicast message can be forwarded through the second port in the backup MAC address table to quickly recover from the fault.
[0025] In one possible implementation, the message tag includes an operation code; after the correspondence between the source MAC address of the first broadcast message and the second port is written into the backup MAC address table, the method further includes: receiving a second unicast message through the first port; when the port corresponding to the destination MAC address of the second unicast message in the main MAC address table is unavailable or does not exist, and the port corresponding to the destination MAC address of the second unicast message in the backup MAC address table is unavailable or does not exist, adding a message tag with an operation code of the first operation code to the second unicast message, and then forwarding the second unicast message through all ports of the first network device.
[0026] The message label is used to determine whether the message is received repeatedly, and the message can be a unicast message or a broadcast message; the first operation code is used to instruct the first network device that receives the second unicast message to maintain its own primary MAC address table and the backup MAC address table, and flood the second unicast message. It can be understood that the "first network device that receives the second unicast message" here refers to the first network device that receives the second unicast message after adding the message label, and does not include the first network device that adds the message label to the second unicast message.
[0027] Optionally, the first network device may add a message label generated in real time to the Ethernet frame header of the second unicast message, and the operation code of the message label is a default value at this time; and then modify the operation code to the first operation code.
[0028] Optionally, the first network device may also directly generate a message label whose operation code is the first operation code, and then add the message label to the Ethernet frame header of the second unicast message.
[0029] Among them, when no available port corresponding to the destination MAC address of the second unicast message can be found in the main MAC address table and the backup MAC address table, the first network device can forward the second unicast message with the message tag added through all ports of the first network device, and instruct the first network device that receives the second unicast message to flood the second unicast message through the first operation code in the message tag to ensure that the second unicast message can reach its destination MAC address.
[0030] Specifically, flooding the second unicast message refers to forwarding the second unicast message through all ports except the port receiving the second unicast message.
[0031] It is understandable that when the first network device cannot find a port that can be used to forward the second unicast message in both the primary MAC address table and the backup MAC address table, it may be that the first network device has no available ports except the port for receiving the second unicast message. At this time, the first network device cannot flood the second unicast message and needs to perform fault recovery through the port for receiving the second unicast message.
[0032] Therefore, when the first network device cannot find a port that can be used to forward the second unicast message in both the primary MAC address table and the backup MAC address table, the second unicast message can be forwarded through all ports to ensure that the second unicast message can reach its destination MAC address as much as possible.
[0033] Among them, under the loop breaking mechanism of the first switching network, the message label can be used as a unique identifier of the second unicast message to avoid the formation of a broadcast storm in the process of forwarding the second unicast message.
[0034] The message label can be added to the Ethernet frame header of the second unicast message, and the operation code is a part of the message label. Since the second unicast message starts from the first network device and is flooded in the first switching network, the ports and order in which the second unicast message is received by other first network devices in the first switching network cannot indicate the quality of the path to the source MAC address of the second unicast message. Therefore, by setting the first operation code, other first network devices can maintain the MAC address table unchanged when receiving the second unicast message containing the first operation code, so as to avoid interfering with the path selection of these first network devices when sending messages to the source MAC address of the second unicast message.
[0035] In an embodiment of the present application, when the first network device detects that the port corresponding to the destination MAC address of the second unicast message is unavailable or does not exist, that is, when the backup path or the backup forwarding port is unavailable, there is no need to notify other first network devices of the fault, wait for other network devices to complete the clearing of table entries, and there is no need to re-converge the topology and calculate the message path. The second unicast message can be forwarded directly through all ports, and the first operation code can be used to instruct other first network devices that receive the second unicast message to flood the second unicast message, thereby reducing the fault recovery time and completing the fault recovery more quickly; and then the message label and the first operation code are used to ensure that no broadcast storm occurs and no interference is caused to the MAC address table of other first network devices.
[0036] In a possible implementation, after writing the correspondence between the source MAC address of the first broadcast message and the second port into the backup MAC address table, the method further includes: receiving a third unicast message through the first port, the third unicast message including a message label, and the operation code of the message label of the third unicast message is a first operation code; according to the first operation code, maintaining the main MAC address table and the backup MAC address table, and flooding the third unicast message.
[0037] When a third unicast message including a first operation code is received, it can be determined whether the third unicast message is received repeatedly according to the message label; if so, the third unicast message is discarded; if not, an operation is performed according to the first operation code.
[0038] Specifically, according to the first operation code, the first network device can directly flood the third unicast message without searching for the corresponding port in the primary MAC address table or the backup MAC address table, so as to avoid directing the third unicast message to the faulty node and delaying the fault recovery time.
[0039] It is understandable that if the first network device has no available ports except the port for receiving the third unicast message, there is no need to send the third unicast message to the previous hop for fault recovery, which wastes communication resources.
[0040] In an embodiment of the present application, even if the MAC address table of the first network device indicates that there is a path to the destination MAC address of the third unicast message, the first network device also floods the third unicast message to try as many paths as possible to forward the message and deliver the message as quickly as possible, while avoiding directing the third unicast message back to the faulty node.
[0041] In one possible implementation, the first network device also includes a third port, which is used to connect to a second network device or terminal, and the second network device is a network device outside the first switching network, and the first switching network is composed of multiple first network devices; the broadcast message includes a second broadcast message, and the source MAC address of the second broadcast message is the destination MAC address of the third unicast message; after flooding the third unicast message, the method also includes: if in the main MAC address table or the backup MAC address table, the port corresponding to the destination MAC address of the third unicast message is the third port, then broadcasting the second broadcast message.
[0042] Among them, the second broadcast message includes a message tag, the operation code of the message tag of the second broadcast message is a second operation code, and the second operation code is used to instruct the first network device receiving the second broadcast message to update the main MAC address table or the backup MAC address table according to the source MAC address of the second broadcast message.
[0043] Among them, after flooding the third unicast message, the first network device can search the main MAC address table and the backup MAC address to determine whether there is a port corresponding to the destination MAC address of the third unicast message in the two tables; if there is, and the port is the third port, then the first network device can determine that the message in the first switching network must pass through the first network device to reach the destination MAC address. In other words, the first network device can determine that it is the access switching device or proxy switching device of the destination MAC address.
[0044] At this time, the first network device can act on behalf of the terminal corresponding to the destination MAC address of the third unicast message and broadcast the second broadcast message in the first switching network, so that other first network devices learn the path for communicating with the MAC address of the terminal according to the second broadcast message.
[0045] When the first network device forwards the third unicast message through the third port, the first network device first deletes the message label in the third unicast message, restores the third unicast message to the Ethernet standard message format, and then forwards it.
[0046] It is understandable that the default operation code in the message tag may be the second operation code, so that the first network device can learn the source MAC address of the broadcast message when receiving the broadcast message.
[0047] In an embodiment of the present application, after determining that it is the access switching device or proxy switching device of the third unicast message, the first network device can send a second broadcast message on behalf of the destination MAC address of the third unicast message to refresh the MAC table entries of each first network device in the first switching network regarding the destination MAC address, so that subsequent messages sent to the destination MAC address can be forwarded according to the new path, completing the entire fault recovery process.
[0048] In one possible implementation, the first network device also includes a third port; after receiving the first broadcast message through the first port, the method also includes: if there is no message tag in the Ethernet frame header of the first broadcast message, adding the message tag to the Ethernet frame header; if the message tag exists in the Ethernet frame header, when forwarding the first broadcast message through the third port, deleting the message tag in the Ethernet frame header, and then forwarding the first broadcast message through the third port.
[0049] When the first network device in the first switching network receives the first broadcast message that does not include a message tag, it will add a message tag to the first broadcast message. It is understandable that the first broadcast message originates from a terminal or a second network device outside the first switching network, and the format of the first broadcast message is an Ethernet standard message format, and there is no message tag in its Ethernet frame header. By adding a message tag to the Ethernet frame header, other first network devices in the first switching network can determine whether to repeatedly receive the broadcast message based on the message tag.
[0050] When the first network device detects that the first broadcast message needs to be forwarded through the third port, that is, detects that the next hop of the first broadcast message will leave the first switching network, it restores it to the Ethernet standard message format and then forwards it.
[0051] In an embodiment of the present application, by adding and deleting message labels when the first broadcast message enters and exits the first switching network, broadcast storms can be avoided without changing the network topology, and transmission of the first broadcast message in other Ethernet switching networks is not affected.
[0052] In a possible implementation, after writing the correspondence between the source MAC address of the first broadcast message and the second port into the standby MAC address table, the method further includes: when the first broadcast message is repeatedly received, maintaining the standby MAC address table.
[0053] Among them, the order in which the first network device receives the same message through different ports represents the length of the path and the forwarding time for different ports to reach the source MAC address of the message; the earlier the port receives the message, the shorter the forwarding time of the path corresponding to the port.
[0054] Therefore, after the correspondence between the source MAC address of the first broadcast message and the second port has been recorded in the backup MAC address table, the path for repeatedly receiving the first broadcast message is no better than the path corresponding to the second port. At this time, the backup MAC address table can be maintained to prevent the table entry corresponding to the second port from being overwritten by other paths, which increases the time it takes to send the message to the source MAC address.
[0055] Optionally, the first network device also includes a fourth port; after the correspondence between the source MAC address and the second port is written into the backup MAC address table, the first network device repeatedly receives the first broadcast message through the fourth port; if the time difference between the first moment of receiving the first broadcast message through the second port and the second moment of receiving the first broadcast message through the fourth port is less than a preset lock time, the backup MAC address table is maintained.
[0056] Among them, since the communication conditions of the network are constantly changing, the forwarding time of the same path may change. Therefore, the first network device can preset a locking time. During the preset locking time, the forwarding time order of the path is relatively stable. At this time, the second port that repeatedly receives the first broadcast message for the first time can be used as a backup path. When the first broadcast message is repeatedly received subsequently, the backup MAC address table is maintained, and the backup path is locked so as not to be covered.
[0057] The term "maintaining the standby MAC address table" here means not updating the standby MAC address table due to subsequent repeated first broadcast messages received. It is understandable that if other broadcast messages whose source MAC addresses need to be learned are received at this time, the first network device will normally update the standby MAC address table according to the broadcast message.
[0058] In the embodiment of the present application, a preset lock time is used to prevent the suboptimal path in the standby MAC table from being covered by other paths, thereby avoiding delays in the delivery time of the message.
[0059] In a possible implementation, the first broadcast message is an Address Resolution Protocol (ARP) request message; after the correspondence between the source MAC address and the second port is written into the standby MAC address table, the method further includes: receiving an ARP reply message corresponding to the ARP request message; modifying the destination MAC address of the ARP reply message to the destination MAC address of the broadcast message; and broadcasting the ARP reply message after the destination MAC address is modified.
[0060] In the embodiment of the present application, by broadcasting the ARP reply message, the address learning of the primary MAC address table and the backup MAC address table of each first network device in the first switching network can be accelerated without affecting the original function of the ARP reply message.
[0061] In a possible implementation, the message label includes a first identifier and a second identifier, the first identifier is used to indicate the first network device that generates the message label in the first switching network, and the second identifier is used to indicate the generation time of the message label.
[0062] In the embodiment of the present application, through the device information reflected by the first identifier and the time information reflected by the second identifier, the message label can uniquely identify the first broadcast message in time and space, so that the first network device in the first switching network can determine whether to repeatedly receive the first broadcast message based on the message label.
[0063] In a possible implementation, the first identifier is a MAC address or a device number of a first network device that generates the message label.
[0064] In a possible implementation, the second identifier is a loop variable preset in the first network device that generates the message label, or a timestamp.
[0065] A second aspect of the present application provides a first network device, the first network device being used to discard the repeatedly received broadcast message according to a unique identifier in the broadcast message when repeatedly receiving the broadcast message; the broadcast message includes a first broadcast message, the first network device includes a first port and a second port, the first port and the second port are different ports; the first network device also includes:
[0066] A receiver is used to receive the first broadcast message through the first port; a processor is used to write the correspondence between the source media access control MAC address of the first broadcast message and the first port into a main MAC address table; the receiver is also used to repeatedly receive the first broadcast message through the second port; the processor is also used to write the correspondence between the source MAC address of the first broadcast message and the second port into a standby MAC address table; the processor is also used to forward a first unicast message according to the main MAC address table or the standby MAC address table, the destination MAC address of the first unicast message being the source MAC address of the first broadcast message.
[0067] In a possible implementation, the processor is specifically configured to forward the first unicast message through the first port when the first port corresponding to the source MAC address of the first broadcast message in the main MAC address table is available.
[0068] In a possible implementation, the processor is specifically used to forward the first unicast message through the second port corresponding to the source MAC address of the first broadcast message in the backup MAC address table when the first port corresponding to the source MAC address of the first broadcast message in the main MAC address table is unavailable.
[0069] In one possible implementation, the unique identifier includes a message tag, which includes an operation code; the receiver is also used to receive a second unicast message through the first port; when the port corresponding to the destination MAC address of the second unicast message in the main MAC address table is unavailable or does not exist, and the port corresponding to the destination MAC address of the second unicast message in the backup MAC address table is unavailable or does not exist, the processor is also used to add the message tag with the operation code being the first operation code to the second unicast message, and then forward the second unicast message through all ports of the first network device.
[0070] The message tag is used to determine whether the message is received repeatedly, and the first operation code is used to instruct the first network device receiving the second unicast message to maintain its own primary MAC address table and the backup MAC address table and flood the second unicast message.
[0071] In one possible implementation, the receiver is also used to receive a third unicast message through the first port, the third unicast message includes a message label, and the operation code of the message label of the third unicast message is the first operation code; the processor is also used to maintain the main MAC address table and the backup MAC address table according to the first operation code, and flood the third unicast message.
[0072] In one possible implementation, the first network device also includes a third port, which is used to connect to a second network device or terminal, and the second network device is a network device outside the first switching network, and the first switching network is composed of multiple first network devices; the broadcast message includes a second broadcast message, and the source MAC address of the second broadcast message is the destination MAC address of the third unicast message; if in the main MAC address table or the backup MAC address table, the port corresponding to the destination MAC address of the third unicast message is the third port, then the processor is also used to broadcast the second broadcast message.
[0073] Among them, the second broadcast message includes a message tag, the operation code of the message tag of the second broadcast message is a second operation code, and the second operation code is used to instruct the first network device receiving the second broadcast message to update the main MAC address table or the backup MAC address table according to the source MAC address of the second broadcast message.
[0074] In one possible implementation, the first network device also includes a third port; if there is no message tag in the Ethernet frame header of the first broadcast message, the processor is also used to add the message tag in the Ethernet frame header; if the message tag exists in the Ethernet frame header, when forwarding the first broadcast message through the third port, the processor is also used to delete the message tag in the Ethernet frame header, and then forward the message through the third port.
[0075] In a possible implementation, after the receiver repeatedly receives the first broadcast message through the second port, if the receiver repeatedly receives the first broadcast message, the processor is further configured to maintain the backup MAC address table.
[0076] In one possible implementation, the first broadcast message is an Address Resolution Protocol ARP request message; the receiver is also used to receive an ARP reply message corresponding to the ARP request message; the processor is also used to modify the destination MAC address of the ARP reply message to the destination MAC address of the broadcast message; the processor is also used to broadcast the ARP reply message after the destination MAC address is modified.
[0077] In a possible implementation, the message label includes a first identifier and a second identifier, the first identifier is used to indicate the first network device that generates the message label in the first switching network, and the second identifier is used to indicate the generation time of the message label.
[0078] In a possible implementation, the first identifier is a MAC address or a device number of the first network device that generates the message label.
[0079] In a possible implementation, the second identifier is a loop variable preset in the first network device that generates the message label, or a timestamp.
[0080] A third aspect of the present application provides a computer-readable storage medium, which includes instructions. When the instructions are executed on a computer, the computer executes a method as in any possible implementation of the first aspect.
[0081] A fourth aspect of the present application provides a computer program product, comprising computer-readable instructions, which, when executed on a computer device, causes the computer device to execute a method as in any possible implementation of the first aspect.
[0082] The technical effects obtained in the above-mentioned second to fourth aspects are similar to the technical effects obtained by the technical means in the first aspect. The technical effects of each aspect can be referenced to each other and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0083] Figure 1A network topology diagram provided for an embodiment of the present application;
[0084] Figure 2 A schematic diagram of a message format provided in an embodiment of the present application;
[0085] Figure 3 A schematic diagram of a broadcast message format change during a communication process provided by an embodiment of the present application;
[0086] Figure 4 A flowchart of a fault recovery method provided in an embodiment of the present application;
[0087] Figure 5 A schematic diagram of a workflow of a first network device provided in an embodiment of the present application
[0088] Figure 6 A message flow diagram of a second unicast message provided in an embodiment of the present application;
[0089] Figure 7 A flowchart of another fault recovery method provided in an embodiment of the present application;
[0090] Figure 8 A schematic diagram of the structure of a first network device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0091] In order to make the purpose, technical solutions and advantages of the present application clearer, the embodiments of the present application are described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only embodiments of a part of the present application, rather than all embodiments. It is known to those of ordinary skill in the art that with the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0092] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the descriptions used in this way can be interchanged where appropriate, so that the embodiments can be implemented in a sequence other than that illustrated or described in the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or modules is not necessarily limited to those steps or modules that are clearly listed, but may include other steps or modules that are not clearly listed or inherent to these processes, methods, products or devices. The naming or numbering of the steps that appear in the present application does not mean that the steps in the method flow must be executed in the time / logical sequence indicated by the naming or numbering. The process steps that have been named or numbered can change the execution order according to the technical purpose to be achieved, as long as the same or similar technical effects can be achieved. The division of units in this application is a logical division. There may be other division methods when it is implemented in actual applications. For example, multiple units can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection between units can be electrical or other similar forms, which are not limited in this application. In addition, the units or sub-units described as separate components may or may not be physically separated, may or may not be physical units, or may be distributed in multiple circuit units, and some or all of the units may be selected according to actual needs to achieve the purpose of the present application.
[0093] In modern communication network scenarios, fault recovery refers to the technology of restoring message forwarding by bypassing the failed node or link through a redundant path when a node or link in the communication network fails, so that the message can arrive correctly.
[0094] It can be seen that the more redundant paths there are between different nodes in the communication network, the easier it is to recover from a fault. However, the increase in the number of redundant paths will increase the probability of nodes in the communication network forming a ring. When the nodes are networked into a ring, sending broadcast messages in the ring will cause a broadcast storm, causing the entire network to fail.
[0095] The common technology for breaking loops and avoiding broadcast storms is the spanning tree protocol (STP) and its extended protocols. STP can prune the mesh topology into a tree topology by blocking the ports of nodes, thereby preventing nodes from forming loops and causing broadcast storms.
[0096] However, the tree topology is not compatible with redundant links. Based on this loop-breaking mechanism, in order to recover from a fault, it is necessary to pre-calculate and store backup paths, or to calculate in real time a tree path that can bypass the fault point for message forwarding when a fault is detected, which consumes a lot of computing resources.
[0097] An embodiment of the present application provides a fault recovery method, which learns a backup forwarding port by receiving duplicate messages. When the forwarding port in the main MAC address table is unavailable, forwarding can be performed through the corresponding backup forwarding port in the backup MAC address table without pre-calculating the backup path.
[0098] See also Figure 1 , Figure 1 A network topology diagram provided in an embodiment of the present application, and the fault recovery method provided in an embodiment of the present application can be applied to the network topology. The network topology includes terminals 11 to 13 (hereinafter collectively referred to as terminals 10), a first switching network 20 and a second network device 30, and the first switching network 20 includes first network devices SW1 to SW6 (hereinafter collectively referred to as first network devices SW).
[0099] The terminal 10 may be a server, or a smart terminal such as a personal computer (PC), a laptop or a tablet computer. The embodiment of the present application does not limit the specific form of the management terminal. The terminal 10 may be directly connected to the first network device SW in the first switching network, or may be connected to the first network device SW through the second network device 30. The terminals 10 may communicate with each other through the first switching network 20, the second network device, or a combination of the two.
[0100] The first switching network 20 is composed of a plurality of first network devices SW, and the first network device SW can be any one of a router, a base station, a digital subscriber line access multiplexer (DSLAM), a switch, and a digital subscriber line (DSL) gateway.
[0101] Specifically, in the first switching network 20, the first network device SW uses the message label as a unique identifier to forward the broadcast message as a loop breaking mechanism, that is, the first network device SW determines whether the broadcast message is received repeatedly through the message label in the broadcast message. If it is received repeatedly, the broadcast message is discarded to avoid broadcast storms.
[0102] In a possible implementation, the message label is used for internal communication of the first switching network 20. When a broadcast message outside the first switching network 20 enters the first switching network 20, the first network device SW that first receives the broadcast message adds a message label so that other first network devices SW in the first switching network 20 can determine whether to receive the broadcast message repeatedly based on the message label; when the broadcast message leaves the first switching network 20, the last first network device SW that receives the broadcast message deletes the message label in the broadcast message, restores the broadcast message to the Ethernet standard format and then forwards it so that it can be transmitted in the Ethernet.
[0103] The first network device SW has a message label cache table for recording message labels of broadcast messages passing through the first network device SW. The message label cache table may be a preset table or a table temporarily generated when message labels need to be recorded.
[0104] The message processing method and loop breaking method executed by the above-mentioned first network device SW can be defined as a message communication protocol. The specific protocol name can be the connection and forwarding protocol (CFP). The first network device SW carrying the CFP protocol capability can be used to form a network with the second network device 30 or terminal 10 that does not carry the CFP protocol capability.
[0105] The first network device SW includes a plurality of ports, wherein the port directly connected to the terminal 10 or the second network device 30 may be referred to as a connect and forward protocol access (CFA). Specifically, the CFA port may be obtained by configuring the port when the staff determines that the port is used to connect to the second network device 30 or the terminal 10; or may be obtained by configuring the first network device SW to perform a preset port configuration according to a feedback message from the second network device 30 or the terminal 10 after the second network device 30 or the terminal 10 is connected.
[0106] The message label may include a first identifier and a second identifier, the first identifier is used to indicate the first network device SW in the first switching network 20 that adds the message label to the message, and the second identifier is used to indicate the generation time of the message label.
[0107] Optionally, the first identifier is the media access control (MAC) address of the first network device SW that adds the message label to the broadcast message. In this case, the first network device SW may be a network device working in a layer 2 network, such as a layer 2 switch. The first identifier may also be the device number of the first network device SW. In this case, the first network device may also be a network device working in a layer 3 network, such as a layer 3 switch.
[0108] Optionally, the first identifier may also be a networking number assigned to the first network device SW when networking.
[0109] Optionally, the second identifier is a loop variable preset in the first network device SW for adding the message label to the broadcast message, for example, a loop variable with an initial value of 0 and a maximum value of 65535, and the loop variable is increased by 1 each time the first network device SW performs an operation of adding a message label.
[0110] Optionally, the second identifier may also be a timestamp.
[0111] Through the device information reflected by the first identifier and the time information reflected by the second identifier, the message tag uniquely identifies the broadcast message in time and space, so that the first network device SW in the first switching network 20 can determine whether to repeatedly receive the broadcast message according to the message tag.
[0112] The first network device SW may add a message label to the Ethernet frame header of the broadcast message; the message label may be added at any position of the Ethernet frame header. The broadcast message with the message label added may be called a CFP protocol message. The message format of the CFP protocol message may be specifically referred to in Figure 2 , Figure 2 A schematic diagram of a message format provided in an embodiment of the present application, in Figure 2 In the specific example of , the message label is added to the end of the Ethernet frame header.
[0113] The message format of the CFP protocol message includes a CFP Ethernet frame header, payload data, and a frame check sequence (FCS). The CFP Ethernet frame header includes a message label in addition to the destination MAC address, source MAC address, and protocol type of the upper layer protocol included in the traditional Ethernet frame header.
[0114] The message tag may include a tag name, a first identifier, a second identifier, an operation code, and a reserved bit. Specifically, the size of the tag name may be 2 bytes, the size of the first identifier may be 6 bytes, the size of the second identifier may be 2 bytes, and the size of the operation code and the reserved bit may share 2 bytes.
[0115] Specifically, the operation code may be used to instruct the first network device SW that receives the operation code to execute a preset action to achieve fault recovery or other functions.
[0116] See also Figure 3 , Figure 3 The following is a schematic diagram of a broadcast message format change during a communication process provided by an embodiment of the present application. The network topology corresponding to the communication process is as follows: Figure 3 As shown, the network topology includes terminals 14 to 15 and a first switching network 20, and the first switching network 20 includes first network devices SW7 to SW9. It can be understood that Figure 3 The terminal and the first network device in the network topology shown are Figure 1 The terminal in the network topology shown is similar to the first network device, and can refer to Figure 1 Please refer to the relevant description for understanding, and no further details will be given here.
[0117] in, Figure 3 It is shown that the format of the broadcast message changes during the process of the broadcast message starting from the terminal 14 and passing through the first switching network 20 to the terminal 15.
[0118] Specifically, the terminal 14 creates a broadcast message, which includes the destination MAC address ( Figure 3 The destination MAC address is the unified address of the broadcast message, that is, FFFFFFFFFFFF; it also includes the source MAC address ( Figure 3 Marked as S), that is, the MAC address of terminal 14; it also includes payload data DATA and FCS.
[0119] After the broadcast message is received by the first network device SW7, the first network device SW7 can determine that the broadcast message enters the first switching network from the external network or terminal. At this time, the first network device SW7 can add a message tag ( Figure 3 The message label is then recorded in the message label cache table, and then the broadcast is forwarded to the first network devices SW8 and SW9. It can be understood that Figure 3 The first identifier of the message label shown in can be the MAC address of the first network device SW7, and the second identifier is the serial number of the message label generated by the first network device SW7. Figure 3 The message label in is marked as MS, which means media access control address and sequence number (MS). In some other possible implementations, the message label can use other abbreviations or names as the name or mark of the message label.
[0120] After receiving the broadcast message, the first network device SW8 records the message label of the broadcast message in the message label cache table, and then forwards the broadcast message to the first network device SW9.
[0121] The first network device SW9 first receives the broadcast message directly sent by the first network device SW7, then records the message label of the broadcast message in the message label cache table, and then forwards the broadcast message to the terminal 15; since the port connecting the first network device SW9 and the terminal 15 is a CFA port, the first network device SW9 can determine that the broadcast message is about to leave the first switching network. At this time, the first network device SW9 can delete the message label in the broadcast message and then forward it to the terminal 15.
[0122] Since the forwarding path has one more hop, the time when the first network device SW9 receives the broadcast message forwarded by the first network device SW8 is later than the time when the first network device SW9 receives the broadcast message forwarded by the first network device SW7; at this time, the first network device SW9 can discard the repeatedly received broadcast message according to the message label of the broadcast message recorded in the message label cache table.
[0123] By adding and deleting message labels when broadcast messages enter and exit the first switching network 20, broadcast storms can be avoided without changing the network topology, and transmission of broadcast messages in other Ethernet switching networks is not affected.
[0124] Compared with the solution of using message content as message label, using a short message label as the unique identifier of the broadcast message can reduce the cache burden of the first network device and speed up the forwarding speed of the broadcast message; at the same time, it can also avoid erroneous operations caused by the same message content.
[0125] In another possible implementation, the message label may be the source MAC address and message content of the broadcast message.
[0126] In this possible implementation, there is no need to modify the broadcast message. The first network device SW records the corresponding content of the broadcast message passing through to generate a message tag, so as to determine whether the broadcast message is received repeatedly when receiving the broadcast message subsequently.
[0127] The second network device 30 may be any one of a router, a base station, a DSLAM, a switch, and a DSL gateway, and the second network device 30 does not carry the CFP protocol capability. It is understandable that in some other possible implementations, the first network device SW may also be connected to the second switching network, and the terminal 10 may be connected via the second switching network; wherein the second switching network is composed of the second network device 30.
[0128] It can be understood that the second switching network where the second network device 30 is located can break the loop through other protocols or technical solutions besides the CFP protocol, such as the STP protocol, rapid spanning tree protocol (RSTP), transparent interconnection of lots of links (TRILL) and meshed tree protocol (MTP).
[0129] It should be noted that when the first network device SW in the first switching network 20 is connected to the second switching network, a ring network cannot be formed between the first network device SW and the second network device 30 to avoid a broadcast storm in the second switching network.
[0130] Optionally, the first switching network 20 is a layer-2 network, and the second network device 30 is a layer-3 router, or the second switching network is a layer-3 network.
[0131] It is worth noting that Figure 1 It is just a schematic diagram of a network topology. Figure 1 The positional and quantitative relationships between the devices, components, modules, etc. shown in the figure do not constitute any limitations.
[0132] See also Figure 4 The present application embodiment provides a fault recovery method, which can be applied to Figure 1 The first network device in the network topology shown includes a first port and a second port, and the first port and the second port are different ports; the method specifically includes steps 401 to 403.
[0133] Step 401: A first network device receives a first broadcast message through a first port, and writes a corresponding relationship between a source MAC address of the first broadcast message and the first port into a main MAC address table.
[0134] Among them, after receiving the first broadcast message, the first network device can determine whether it is received repeatedly according to the message tag of the first broadcast message. If the first broadcast message is received for the first time, it means that among the paths from the source MAC address of the first broadcast message to the first network device, the path corresponding to the first port is the shortest. At this time, the source MAC address of the first broadcast message can be learned, and the correspondence between the source MAC address and the first port can be written into the main MAC address table; if the first broadcast message is received repeatedly, execute step 402.
[0135] It is understandable that when there is no message label in the first broadcast message, or the message label does not exist in the message label cache table of the first network device, the first network device may determine that the first broadcast message is received for the first time.
[0136] If there is no message label in the Ethernet frame header of the first broadcast message, it means that the first broadcast message is a broadcast message entering from outside the first switching network. At this time, the first network device can add a message label in its Ethernet frame header, transform it into the CFP protocol message format, and record the message label in its own message label cache table, and finally broadcast the first broadcast message.
[0137] Broadcasting the first broadcast message refers to the first network device forwarding the first broadcast message through all its ports.
[0138] If there is a message label in the Ethernet frame header of the first broadcast message, and the message label does not exist in the message label cache table of the first network device, the first network device may record the message label in the message label cache table and broadcast the first broadcast message.
[0139] Optionally, the first network device also includes a third port, which is a CFA port directly connected to the second network device or terminal; when forwarding the first broadcast message through the third port, the first network device can first delete the message label, and then forward the first broadcast message after deleting the message label through the third port.
[0140] First logo Second mark Cache time MAC1 0 11:04:01 MAC2 1 12:44:12 MAC3 2 02:11:14 … … …
[0141] Table 1 Message label cache table
[0142] As shown in Table 1, Table 1 is an example of a message label cache table in a possible implementation, and the message label cache table is specifically used to cache the first identifier and the second identifier of the message label, and the time when the message label table entry is cached in the table. In the specific example of Table 1, the first identifier is the MAC address of the first network device to add the message label, and the second identifier is a loop variable from 0 to 65535.
[0143] In a possible implementation, the maximum cache quantity of the message label cache table can be configured according to the network scale. When the number of message label entries cached in the table reaches the maximum cache quantity, the new message label will overwrite the message label entry with the earliest cache time.
[0144] Among them, the coverage and update of the message label table entries can be achieved by setting a sliding window of a fixed size.
[0145] In another possible implementation, if the time that the message label entry exists in the message label cache table is greater than a preset aging time, the first network device may delete the message label.
[0146] The first network device may determine whether to age the message label entry by comparing the cache time of the message label entry in the message label cache table with the current time.
[0147] Through the maximum cache quantity mechanism or aging mechanism, on the one hand, the cache space occupied by the cache message label can be controlled to reduce the memory burden of the first network device; on the other hand, it can prevent erroneous discarding due to the same second identifier when the second identifier is a loop variable.
[0148] In one possible implementation, the first network device can map the position of the message label in the message label cache table to a keyword through a preset hash function. When the first network device needs to search for the message label in the message label cache table, it can directly locate the message label by obtaining the keyword of the message label to quickly determine whether the message label exists in the message label cache table.
[0149] Step 402: The first network device repeatedly receives the first broadcast message through the second port, and writes the corresponding relationship between the source MAC address of the first broadcast message and the second port into the standby MAC address table.
[0150] When the first broadcast message contains a message tag, and the message tag exists in a message tag cache table of the first network device, the first network device may determine to repeatedly receive the first broadcast message.
[0151] Among them, the first broadcast message is repeatedly received through the second port, which means that the zeroth time of receiving the first broadcast message through the first port is earlier than the first time of receiving the first broadcast message through the second port, that is, in the path from the source MAC address to the first network device, the path corresponding to the second port is longer than the path corresponding to the first port. At this time, the correspondence between the source MAC address and the second port can be written into the backup MAC address table, and the second port can be used as a backup forwarding port to the source MAC address.
[0152] When it is determined that the first broadcast message is a repeatedly received message, the first network device may discard it to avoid a broadcast storm.
[0153] Optionally, there are multiple second ports, and the number of standby MAC address tables corresponds to the number of the second ports.
[0154] For example, the number of second ports can be set to 3, that is, the second, third and fourth ports in the first network device that receive the first broadcast message are second ports, and the correspondence between these ports and the source MAC address can be written into the first backup MAC address table to the third backup MAC address table respectively.
[0155] By controlling the number of the second ports and the standby MAC address tables, the number of standby forwarding ports can be controlled, thereby achieving a better balance between the recoverability of fault recovery and the occupancy of storage space.
[0156] In a possible implementation, after step 402, when the first broadcast message is repeatedly received again, the first network device maintains the backup MAC address table.
[0157] Among them, the storage space of the first network device is limited. After the backup MAC address table has completed the learning of the backup forwarding port, the path corresponding to the port that repeatedly receives the first broadcast message is inferior to the path corresponding to the second port. At this time, the backup MAC address table can be maintained, and the MAC address table is not refreshed and learned to prevent the inferior backup forwarding port from covering the better backup forwarding port.
[0158] In a specific possible implementation, the first network device also includes a fourth port; after step 402, the first network device repeatedly receives the first broadcast message through the fourth port; if the time difference between the first moment of receiving the first broadcast message through the second port and the second moment of receiving the first broadcast message through the fourth port is less than a preset lock time, the backup MAC address table is maintained.
[0159] Among them, since the communication conditions of the network are constantly changing, the forwarding time of the same path may change. Therefore, the first network device can preset a locking time. During the preset locking time, the forwarding time order of the path is relatively stable. At this time, the second port that repeatedly receives the first broadcast message for the first time can be used as a backup path. When the first broadcast message is repeatedly received subsequently, the backup MAC address table is maintained, and the backup path is locked so as not to be covered.
[0160] It is understandable that if the first broadcast message is received through the fourth port after the lock time, the first network device can regard the first broadcast message as a new round of broadcast, and refresh the main MAC address table and the backup MAC address table according to the first broadcast message; or the first broadcast message can be regarded as a message that takes a very long time to deliver, and thus the first broadcast message is discarded. The administrator can set a processing strategy according to the frequency and cause of occurrence of this situation.
[0161] In a possible implementation, the first broadcast message is an Address Resolution Protocol (ARP) request message; after step 402, the first network device can receive an ARP reply message corresponding to the ARP request message through a first port; modify the destination MAC address of the ARP reply message to a unified destination MAC address of the broadcast message; and broadcast the AARP reply message after the modified destination MAC address through a second port.
[0162] The ARP request message is a broadcast message, and each first network device in the first switching network can learn the forwarding port and the standby forwarding port leading to the source MAC address of the ARP request message through the ARP request message.
[0163] Among them, the ARP reply message is a unicast message. At this time, the destination MAC address of the ARP reply message is changed to the unified destination MAC address of the broadcast message: FFFFFFFFFFFF, and the ARP reply message can be transformed into a broadcast message; then the transformed ARP reply message is broadcast, so that each first network device in the first switching network can learn the forwarding port and the backup forwarding port leading to the source MAC address of the ARP reply message through the ARP reply message.
[0164] By broadcasting the ARP reply message, the address learning of the primary MAC address table and the standby MAC address table of each first network device in the first switching network can be accelerated without affecting the original function of the ARP reply message.
[0165] Step 403: The first network device forwards the first unicast message according to the primary MAC address table and the backup MAC address table.
[0166] When receiving the first unicast message, the first network device may first obtain the destination MAC address of the first unicast message, and search for an entry corresponding to the destination MAC address in the main MAC address table.
[0167] The destination MAC address of the first unicast message is the source MAC address of the first broadcast message.
[0168] When the entry corresponding to the destination MAC address in the main MAC address table, that is, the first port, is available, the first network device can forward the first unicast message through the first port.
[0169] It can be understood that the port being available means that messages can be forwarded through the port to a network device, communication device or terminal connected to the port.
[0170] It is understandable that in some other possible implementations, when the first port is available, the first network device can further determine whether to forward the first unicast message by the first port or the second port based on factors such as the utilization rate and forwarding speed of the first port and the second port.
[0171] When a network device connected to the first port or a link between the first port and the network device fails, resulting in failure to forward messages through the first port, the first port is in an unavailable state.
[0172] Among them, when the entry in the main MAC address table corresponding to the destination MAC address of the first unicast message, that is, the first port is unavailable, the corresponding entry can be searched in the backup MAC table according to the destination MAC address of the first unicast message, that is, the second port; and the first unicast message is forwarded through the second port.
[0173] It is understandable that in some other possible implementations, there are multiple second ports; when the first port is unavailable, the first network device can further consider factors such as the utilization rate and forwarding speed of each second port to determine which second port forwards the first unicast message.
[0174] In an embodiment of the present application, when the first network device receives the first message through the first port, it writes the correspondence between the source MAC address and the first port into the main MAC address table, and subsequently repeatedly receives the first message through the second port and writes the correspondence between the source MAC address and the second port into the backup MAC address table. Therefore, when the network device or link corresponding to the first port in the main MAC address table fails and cannot forward the first unicast message through the first port, the first unicast message can be forwarded through the second port in the backup MAC address table to perform fault recovery without pre-calculating the backup path.
[0175] The above introduces a fault recovery method provided in an embodiment of the present application. The following describes the workflow of the first network device provided in an embodiment of the present application to more comprehensively understand the fault recovery method provided in an embodiment of the present application.
[0176] See also Figure 5 , Figure 5 A schematic diagram of the working process of the first network device provided in the embodiment of the present application is as follows: Figure 5 As shown, the workflow may include steps 501 to 515.
[0177] Among them, in order to make the accompanying drawings clearer and more intuitive, the same main MAC address table, backup MAC address table and message label cache table are drawn on both sides of the accompanying drawings. It can be understood that the tables with the same name point to the same object, that is, the main MAC address table on the left and the main MAC address table on the right are the same table, and the same applies to the backup MAC table and the message label cache table.
[0178] Step 501: The first network device receives and decapsulates a message.
[0179] After receiving the message, the first network device decapsulates the frame encapsulation of the message and obtains the source MAC address and destination MAC address of the message from the Ethernet frame header of the message; if the Ethernet frame header also includes a message label, the first network device obtains the message label.
[0180] Step 502: The first network device determines whether the message is a broadcast message.
[0181] The processing flow of unicast messages and broadcast messages is different, so it is necessary to first determine the type of the message. Specifically, the first network device can make a judgment based on the destination MAC address of the message. If the destination MAC address is the unified MAC address of the broadcast message (FFFFFFFFFFFF), it can be determined that the message is a broadcast message, and step 508 is executed; otherwise, it can be determined that the message is a unicast message, and step 503 is executed.
[0182] Step 503: The first network device learns the source MAC address of the unicast message into the main MAC address table.
[0183] Among them, when it is determined that the message is a unicast message and there is no message label in the unicast message, the first network device can consider that the unicast message is received for the first time. At this time, the source MAC address of the unicast message can be learned into the main MAC table, that is, the correspondence between the source MAC address and the port receiving the unicast message is written into the main MAC table.
[0184] It is understandable that when there are special marks such as message labels in the unicast message, the first network device can perform special processing such as broadcasting it, in which case it is possible to repeatedly receive the unicast message; such situations will be explained in the embodiments below and will not be repeated here.
[0185] Step 504: The first network device determines whether there is a port that can be used to forward the unicast message.
[0186] After learning the source MAC address of the unicast message, the first network device can prepare to forward the unicast message. First, the first network device can sequentially search its own primary MAC address table and standby MAC table to see if there is an available port corresponding to the destination MAC address of the unicast message.
[0187] If it exists, execute step 515; if it does not exist, execute step 505.
[0188] Step 505: The first network device determines a forwarding port.
[0189] When the first network device cannot find an available port corresponding to the destination MAC address of the unicast message from the primary MAC address table and the backup MAC address table, the first network device can process it as a broadcast message and forward the unicast message to all first network devices in the first switching network.
[0190] Specifically, the first network device may determine that all ports of the first network device except the third port are forwarding ports, and execute step 506 .
[0191] Step 506: The first network device adds a message label to the Ethernet frame header of the unicast message.
[0192] The first network device may add a message tag to the Ethernet frame header of the unicast message to prevent the unicast message from forming a broadcast storm when broadcasting in the first switching network. At this time, the first network device may write a specific operation code to the operation code bit of the message tag so that other first network devices can continue to broadcast the unicast message after receiving the unicast message until the egress port corresponding to the unicast message in the first network device that arrives is the third port.
[0193] Step 507: The first network device records the message label of the unicast message in a message label cache table.
[0194] The first network device may record the message label of the unicast message in a message label cache table to avoid repeated processing when receiving the unicast message broadcasted back by other first network devices.
[0195] Afterwards, the first network device may execute step 515 .
[0196] Step 508: The first network device determines whether the broadcast message has a message label.
[0197] If the first network device obtains the message label in the Ethernet frame header of the message, step 509 is executed; if the first network device does not obtain the message label, step 506 can be executed.
[0198] Among them, the failure to obtain the message label indicates that the first network device receives the broadcast message for the first time, and the previous hop of the broadcast message is the second network device or terminal. At this time, the first network device can transform it into the CFP protocol format through step 506, record the added message label through step 507 to prevent repeated reception, and then broadcast it in the first switching network.
[0199] Step 509: The first network device determines whether the broadcast message is received repeatedly.
[0200] Among them, the first network device can search for the message label in the message label cache table; if the message label exists in the message label cache table, it can be determined that the broadcast message is received repeatedly, and step 510 is executed; if not, it can be determined that the broadcast message is received for the first time, and step 512 is executed.
[0201] It is understandable that when the format of the message label cache table is as shown in Table 1 above, the first network device can search for an entry in the message label cache table according to the first identifier and the second identifier of the message label to determine whether the message label exists in the table.
[0202] Step 510: The first network device learns the source MAC address of the broadcast message into a backup MAC address table.
[0203] When it is determined that the broadcast message is received repeatedly, the first network device may write the corresponding relationship between the source MAC address of the broadcast message and the port receiving the broadcast message into the standby MAC address table.
[0204] Step 511: The first network device discards the broadcast message.
[0205] After the first network device completes learning of the backup forwarding port according to the repeatedly received broadcast message, it can discard the broadcast message to prevent a broadcast storm.
[0206] Step 512: The first network device learns the source MAC address of the broadcast message into the main MAC address table, and records the message label of the broadcast message in the message label cache table.
[0207] The specific execution process of step 512 is similar to that of step 503 and step 507, and will not be repeated here.
[0208] Step 513: The first network device determines whether there is a third port in the forwarding port of the broadcast message.
[0209] After completing the learning of the source MAC address of the broadcast message and recording the message label, the first network device can broadcast the broadcast message. During the broadcast process, if the forwarding port is the third port, it means that the next hop of the broadcast message will leave the first switching network. At this time, the first network device can execute step 514 to restore the broadcast message to the Ethernet standard format; if the forwarding port is not the third port, step 515 can be directly executed.
[0210] If yes, execute step 514 and step 515; if no, execute step 515.
[0211] Step 514: The first network device deletes the message label in the broadcast message.
[0212] The first network device may delete the message label in the Ethernet frame header of the broadcast message.
[0213] Step 515: The first network device encapsulates and forwards the message.
[0214] The first network device may encapsulate the source MAC address, the destination MAC address, and the processing result of the above process of the message into a data frame, and forward it through the forwarding port determined in the above process.
[0215] After understanding the workflow of the first network device above, another fault recovery method provided by the embodiment of the present application will be described below. The fault recovery method can be applied to Figure 1 In the network topology shown in the figure, please refer to Figure 6 , Figure 6 For Figure 1 The diagram of the message flow of the second unicast message from terminal 13 to terminal 12 in the network topology shown is shown below. Taking this as an example, the fault recovery method performed by the first network device SW1, the first network device SW2 and the first network device SW4 when forwarding the second unicast message in the process is described below.
[0216] in, Figure 6 In the network topology shown, a link between the first network devices SW2 and SW3 fails, and a link between the first network devices SW2 and SW5 also fails.
[0217] Specific participation Figure 7 , Figure 7 This is a flow chart of another fault recovery method provided in an embodiment of the present application. The method specifically includes steps 701 to 710.
[0218] Step 701: The first network device SW2 receives a second unicast message sent by the terminal 13 through the first port.
[0219] The first port may be any port of the first network device SW2 ; the destination MAC address of the second unicast message is the MAC address of the terminal 12 .
[0220] Among them, the communication between terminal 13 and terminal 12 needs to pass through the first switching network 20 and the second network device 30; therefore, terminal 13 can send a second unicast message to the first network device SW2 in the first switching network 20 connected to it, and the first network device SW2 selects a forwarding port and forwards it.
[0221] It should be noted that before step 701, the first network devices SW1, SW2 and SW4 have all completed port learning leading to the terminal 12. The port corresponding to the terminal 12 in the main MAC address table of the first network device SW2 is the port connected to the first network device SW3. The message can start from the first network device SW2, pass through the first network devices SW3, SW4 and the second network device 30 to reach the terminal 12; the port corresponding to the terminal 12 in the backup MAC address table is the port connected to the first network device SW5. The message can start from the first network device SW2, pass through the first network devices SW5, SW3, SW4 and the second network device 30 to reach the terminal 12.
[0222] After receiving the second unicast message, the first network device SW2 searches the forwarding port in the primary MAC address table and the backup forwarding port in the backup MAC address table according to its destination MAC address, which are the port connected to the first network device SW3 and the port connected to the first network device SW5 respectively.
[0223] Step 702: When there is no port available for forwarding the second unicast message in the MAC address table of the first network device SW2, the first network device SW2 adds a message tag to the second unicast message.
[0224] Among them, Figure 6 As shown, in the network topology, the link between the first network devices SW2 and SW3 fails, and the link between the first network devices SW2 and SW5 also fails, resulting in that the port of the first network device SW2 connected to the first network device SW3 and the port connected to the first network device SW5 are both unavailable for forwarding messages. At this time, the first network device SW2 needs to forward the second unicast message through all its ports, and instruct other first network devices SW that receive the second unicast message to broadcast the second unicast message, so that the second unicast message can reach the terminal 12 in time.
[0225] Specifically, the first network device SW2 can add a message tag with an operation code of the first operation code in the Ethernet frame header of the second unicast message; the first operation code is used to instruct the first network device SW that subsequently receives the second unicast message to flood the second unicast message and maintain its own primary MAC address table and backup MAC address table unchanged; the message tag is used as a basis for determining whether to repeatedly receive the second unicast message, so as to avoid the first network device SW generating a broadcast storm in the process of flooding the second unicast message. At the same time, the first network device SW2 records the message tag in the message tag cache table.
[0226] It is understandable that in some other embodiments, when forwarding the second unicast message, if the first network device SW2 has not learned the port leading to the terminal 12, or has only learned the forwarding port in the main MAC address table and the forwarding port is unavailable, the first network device SW2 also executes step 702.
[0227] Step 703: The first network device SW2 forwards the second unicast message through all its ports.
[0228] The first network device SW2 forwards the second unicast message with the message tag added through all its ports. At this time, since the ports connecting the first network devices SW3 and SW5 are unavailable, the first network device SW2 forwards the second unicast message through the port connected to SW1 and the port connected to the terminal 13.
[0229] It can be understood that the purpose of step 703 is to perform fault recovery so that the second unicast message can reach terminal 12. Therefore, for the port of the device corresponding to the source MAC address directly connected to the second unicast message, that is, the port connected to terminal 13, the first network device SW2 may not forward the second unicast message.
[0230] Step 704: After receiving the second unicast message forwarded by the first network device SW2, the first network device SW1 floods the second unicast message.
[0231] After receiving the second unicast message, the first network device SW1 obtains the message label and the first operation code during the decapsulation process; the first network device SW1 can first determine whether it is received repeatedly based on the message label; if so, discard the second unicast message; if not, the first network device SW1 can maintain its main MAC address table and backup MAC address table based on the first operation code.
[0232] Then, the first network device SW1 may flood the second unicast message according to the first operation code.
[0233] Step 705: The first network device SW1 determines whether there is a port that can be used to forward the second unicast message.
[0234] Step 706: If the port exists, the first network device SW1 determines whether the port is the third port.
[0235] After flooding the second unicast message, the first network device SW1 can query its own primary MAC address table or backup MAC address table to see whether there is a port that can be used to forward the second unicast message; and if such a port exists, further determine whether the port is a third port.
[0236] If the port that can be used to forward the second unicast message is the third port for connecting to the second network device 30 or the terminal 10, it means that the first network device SW1 is the access switching device or proxy switching device of the terminal 12. At this time, the first network device SW1 can determine that the second unicast message arrives at the terminal 12 normally and perform subsequent fault recovery operations; if the port that can be used to forward the second unicast message does not exist, or exists but the port is not the third port, the first network device SW1 does not perform additional operations.
[0237] exist Figure 6 In the specific example, the first network device SW1 includes, in addition to the port for receiving the second unicast message, a port connected to the terminal 11 and a port connected to the first network device SW6.
[0238] Among them, Figure 6 As shown, in this network topology, the path from the first network device SW1 to the terminal 12 is one through the first network device SW6, SW5 to SW3, and then from SW3 to the terminal 12; the other is through the first network device SW2 to SW3, and then from SW3 to the terminal 12. Therefore, in the main MAC table and the standby MAC table of the first network device SW1, the port that can be used to forward the second unicast message is the port connected to the first network device SW2 and SW6; and because the second unicast message is sent by the first network device SW2, the port that can be used to forward the second unicast message is the port connected to the first network device SW6, which is not the third port.
[0239] On the other hand, the port of the first network device SW1 connected to the terminal 11 is the third port, but in the network topology, the second unicast message cannot reach the terminal 12 through this port, so this port is not a port that can be used to forward the second unicast message. Therefore, the first network device SW1 will not perform additional operations.
[0240] It is understandable that the first network device SW1 may execute step 705 first and then execute step 706, or may execute step 706 first and then execute step 705. The embodiment of the present application does not specifically limit the execution order of the two steps.
[0241] Step 707: After receiving the second unicast message flooded by the first network device SW1, the first network device SW4 floods the second unicast message.
[0242] The second unicast message can reach the first network device SW4 after passing through the first network devices SW6, SW5 and SW3.
[0243] Step 708: The first network device SW4 determines whether there is a port that can be used to forward the second unicast message.
[0244] Step 709: If so, the first network device SW4 determines whether the port is the third port.
[0245] Among them, steps 707 to 709 are similar to steps 704 to 706 in this embodiment and are not repeated here.
[0246] exist Figure 6 In the specific example, the first network device SW4 is connected to the terminal 12 through the second network device 30, and the port of the first network device SW4 connected to the second network device 30 is the third port, that is, the first network device is the access switching device of the terminal 12. At the same time, in the network topology, the port connected to the second network device 30 is also the port leading to the terminal 12, and the link from the first network device SW4 to the second network device 30 is fault-free, that is, the port is in an available state. At this time, the first network device SW4 can execute step 710.
[0247] It can be understood that when the second unicast message is forwarded through the third port, the first network device SW4 can delete the message label in the second unicast message according to the forwarding rule configured by the third port, restore the second unicast message to a unicast message in the Ethernet standard format, and then forward the second unicast message.
[0248] Step 710: The first network device SW4 broadcasts a second broadcast message.
[0249] Among them, after the first network device SW4 floods and forwards the second unicast message and determines that its own port that can be used to forward the second unicast message is the third port, it can determine that itself is the access switching device or proxy switching device of the terminal 12 in the first switching network; that is, the order in which the messages sent by the terminal 12 arrive at the different ports of each first network device SW is consistent with the order in which the messages sent by the first network device SW4 arrive at the different ports of other first network devices SW.
[0250] At this time, the first network device SW4 can act as a proxy for the terminal 12, broadcasting a second broadcast message in the first switching network 20, the source MAC address of the second broadcast message being the MAC address of the terminal 12, and a message tag being added to the second broadcast message, the message tag can include a second operation code. The second operation code is used to indicate that each first network device SW can update the forwarding port leading to the terminal 12 according to the source MAC address of the second broadcast message, so that there is no need to repeat the process of the above-mentioned fault recovery method when forwarding a message whose destination MAC address is the terminal 12.
[0251] In the embodiment of the present application, when the first network device detects that the ports corresponding to the destination MAC address of the second unicast message in the primary MAC address table and the backup MAC address table are unavailable or do not exist, there is no need to notify other first network devices of the fault, wait for other first network devices to complete the clearing of table entries, and there is no need to re-converge the topology and calculate the message path. The second unicast message can be directly forwarded through all ports, and the first operation code can be used to instruct other first network devices that receive the second unicast message to flood the second unicast message, thereby reducing the fault recovery time and completing the fault recovery faster; then, the message label and the first operation code are used to ensure that no broadcast storm occurs and the MAC address tables of other first network devices are not interfered with; finally, the second broadcast message is broadcast through the proxy terminal to refresh the MAC tables of each first network device, thereby avoiding a large number of repeated fault recovery processes and wasting communication resources.
[0252] The above describes the fault recovery method in the embodiment of the present application. The following describes the first network device in the embodiment of the present application. Figure 8 In the embodiment of the present application, the port 803 of the first network device 800 includes a first port and a second port; the first network device 800 also includes:
[0253] The receiver 801 is used to receive the first broadcast message through the first port; the processor 802 is used to write the correspondence between the source media access control MAC address of the first broadcast message and the first port into the main MAC address table; the receiver 801 is also used to repeatedly receive the first broadcast message through the second port; the processor 802 is also used to write the correspondence between the source MAC address of the first broadcast message and the second port into the backup MAC address table; the processor 802 is also used to forward the first unicast message according to the main MAC address table or the backup MAC address table, and the destination MAC address of the first unicast message is the source MAC address of the first broadcast message.
[0254] In a possible implementation, the processor 802 is specifically configured to forward the first unicast message through the first port when the first port corresponding to the source MAC address of the first broadcast message in the main MAC address table is available.
[0255] In a possible implementation, the processor 802 is specifically used to forward the first unicast message through the second port corresponding to the source MAC address of the first broadcast message in the backup MAC address table when the first port corresponding to the source MAC address of the first broadcast message in the main MAC address table is unavailable.
[0256] In one possible implementation, the unique identifier includes a message tag, which includes an operation code; the receiver 801 is also used to receive a second unicast message through the first port; when the port corresponding to the destination MAC address of the second unicast message in the main MAC address table is unavailable or does not exist, and the port corresponding to the destination MAC address of the second unicast message in the backup MAC address table is unavailable or does not exist, the processor 802 is also used to add the message tag with the operation code of the first operation code to the second unicast message, and then forward the second unicast message through all ports of the first network device.
[0257] The message tag is used to determine whether the message is received repeatedly, and the first operation code is used to instruct the first network device receiving the second unicast message to maintain its own primary MAC address table and the backup MAC address table and flood the second unicast message.
[0258] In one possible implementation, the receiver 801 is also used to receive a third unicast message through the first port, the third unicast message includes a message label, and the operation code of the message label of the third unicast message is the first operation code; the processor 802 is also used to maintain the main MAC address table and the backup MAC address table according to the first operation code, and flood the third unicast message.
[0259] In one possible implementation, the first network device also includes a third port, which is used to connect to a second network device or terminal, and the second network device is a network device outside the first switching network, and the first switching network is composed of multiple first network devices; the broadcast message includes a second broadcast message, and the source MAC address of the second broadcast message is the destination MAC address of the third unicast message; if in the main MAC address table or the backup MAC address table, the port corresponding to the destination MAC address of the third unicast message is the third port, then the processor 802 is also used to broadcast the second broadcast message.
[0260] Among them, the second broadcast message includes a message tag, the operation code of the message tag of the second broadcast message is a second operation code, and the second operation code is used to instruct the first network device receiving the second broadcast message to update the main MAC address table or the backup MAC address table according to the source MAC address of the second broadcast message.
[0261] In one possible implementation, the first network device also includes a third port; if there is no message tag in the Ethernet frame header of the first broadcast message, the processor 802 is also used to add the message tag in the Ethernet frame header; if the message tag exists in the Ethernet frame header, when forwarding the first broadcast message through the third port, the processor 802 is also used to delete the message tag in the Ethernet frame header, and then forward the message through the third port.
[0262] In a possible implementation, after the receiver 801 repeatedly receives the first broadcast message through the second port, if the receiver 801 repeatedly receives the first broadcast message, the processor 802 is further configured to maintain the standby MAC address table.
[0263] In one possible implementation, the first broadcast message is an Address Resolution Protocol ARP request message; the receiver 801 is also used to receive an ARP reply message corresponding to the ARP request message; the processor 802 is also used to modify the destination MAC address of the ARP reply message to the destination MAC address of the broadcast message; the processor 802 is also used to broadcast the ARP reply message after the destination MAC address is modified.
[0264] In a possible implementation, the message label includes a first identifier and a second identifier, the first identifier is used to indicate the first network device that generates the message label in the first switching network, and the second identifier is used to indicate the generation time of the message label.
[0265] In a possible implementation, the first identifier is a MAC address or a device number of the first network device that generates the message label.
[0266] In a possible implementation, the second identifier is a loop variable preset in the first network device that generates the message label, or a timestamp.
[0267] The first network device 800 provided in the embodiment of the present application can be understood by referring to the corresponding contents of the aforementioned fault recovery method embodiment part, and will not be repeated here.
[0268] like Figure 8 800 is a possible logical structure diagram of the first network device 800 provided in an embodiment of the present application. The computer device 800 includes: a receiver 801, a processor 802, a port 803, a memory 804 and a bus 805. The receiver 801, the processor 802, the port 803 and the memory 804 are interconnected via the bus 805. In the embodiment of the present application, the processor 802 is used to control and manage the actions of the first network device 800. For example, the processor 801 is used to execute Figure 4 , Figure 5 or Figure 7 Steps other than receiving and / or other processes for the technology described herein in the embodiments. Port 803 is used to support the first network device 800 to communicate. Memory 804 is used to store program codes and data of computer device 800.
[0269] Among them, the processor 802 can be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a transistor logic device, a hardware component or any combination thereof. It can implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, and so on. The bus 805 can be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0270] In another embodiment of the present application, a computer-readable storage medium is further provided, wherein the computer-readable storage medium stores computer-executable instructions. When at least one processor of the device executes the computer-executable instructions, the device executes the above Figure 4 or Figure 7 Some embodiments describe the fault recovery method.
[0271] In another embodiment of the present application, a computer program product is also provided. The computer program product includes computer-executable instructions, which are stored in a computer-readable storage medium; at least one processor of the device can read the computer-executable instructions from the computer-readable storage medium, and at least one processor executes the computer-executable instructions so that the device performs the above Figure 4 or Figure 7 Some embodiments describe the fault recovery method.
[0272] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0273] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0274] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0275] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0276] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.
Claims
1. A fault recovery method, characterized in that: Applied to a first network device, the first network device is used to discard the repeatedly received broadcast message according to a unique identifier in the broadcast message when repeatedly receiving the broadcast message; the broadcast message includes a first broadcast message, the first network device includes a first port and a second port, and the first port and the second port are different ports; the method includes: receiving the first broadcast message through the first port, and writing a correspondence between a source media access control MAC address of the first broadcast message and the first port into a main MAC address table; repeatedly receiving the first broadcast message through the second port, and writing a correspondence between a source MAC address of the first broadcast message and the second port into a standby MAC address table; According to the primary MAC address table or the backup MAC address table, a first unicast message is forwarded, wherein the destination MAC address of the first unicast message is the source MAC address of the first broadcast message.
2. The method according to claim 1, characterized in that The forwarding of the first unicast message according to the primary MAC address table or the backup MAC address table includes: If the first port corresponding to the source MAC address of the first broadcast message in the primary MAC address table is available, the first unicast message is forwarded through the first port.
3. The method according to claim 1, characterized in that The forwarding of the first unicast message according to the primary MAC address table or the backup MAC address table includes: If the first port corresponding to the source MAC address of the first broadcast message in the primary MAC address table is unavailable, the first unicast message is forwarded through the second port corresponding to the source MAC address of the first broadcast message in the backup MAC address table.
4. The method according to any one of claims 1 to 3, characterized in that The unique identifier includes a message tag, and the message tag includes an operation code; after writing the corresponding relationship between the source MAC address of the first broadcast message and the second port into the standby MAC address table, the method further includes: receiving a second unicast message through the first port; When the port corresponding to the destination MAC address of the second unicast message in the primary MAC address table is unavailable or does not exist, and the port corresponding to the destination MAC address of the second unicast message in the standby MAC address table is unavailable or does not exist, adding the message tag whose operation code is the first operation code to the second unicast message, and then forwarding the second unicast message through all ports of the first network device; The message tag is used to determine whether a message is received repeatedly, and the first operation code is used to instruct the first network device that receives the second unicast message to maintain its own primary MAC address table and the backup MAC address table, and flood the second unicast message.
5. The method according to any one of claims 1 to 4, characterized in that After writing the correspondence between the source MAC address of the first broadcast message and the second port into the standby MAC address table, the method further includes: receiving a third unicast message through the first port, wherein the third unicast message includes a message label, and an operation code of the message label of the third unicast message is a first operation code; According to the first operation code, the primary MAC address table and the backup MAC address table are maintained, and the third unicast message is flooded.
6. The method according to claim 5, characterized in that The first network device further includes a third port, the third port is used to connect to a second network device or a terminal, the second network device is a network device outside the first switching network, and the first switching network is composed of a plurality of the first network devices; the broadcast message includes a second broadcast message, and the source MAC address of the second broadcast message is the destination MAC address of the third unicast message; After flooding the third unicast message, the method further includes: If the port corresponding to the destination MAC address of the third unicast message in the primary MAC address table or the backup MAC address table is the third port, broadcasting the second broadcast message; Among them, the second broadcast message includes the message tag, the operation code of the message tag of the second broadcast message is a second operation code, and the second operation code is used to instruct the first network device that receives the second broadcast message to update its own main MAC address table or the backup MAC address table according to the source MAC address of the second broadcast message.
7. The method according to any one of claims 1 to 6, characterized in that The first network device further includes a third port; after receiving the first broadcast message through the first port, the method further includes: If the message label does not exist in the Ethernet frame header of the first broadcast message, adding the message label to the Ethernet frame header; If the Ethernet frame header has the message tag, when forwarding the first broadcast message through the third port, the message tag in the Ethernet frame header is deleted, and then the first broadcast message is forwarded through the third port.
8. The method according to any one of claims 1 to 6, characterized in that After writing the correspondence between the source MAC address of the first broadcast message and the second port into the standby MAC address table, the method further includes: When the first broadcast message is repeatedly received, the standby MAC address table is maintained.
9. The method according to any one of claims 1 to 6, characterized in that: The first broadcast message is an address resolution protocol ARP request message; after writing the corresponding relationship between the source MAC address of the first broadcast message and the first port into the main MAC address table, the method further includes: Receiving an ARP reply message corresponding to the ARP request message; Modify the destination MAC address of the ARP reply message to the destination MAC address of the broadcast message; The ARP reply message after modifying the destination MAC address is broadcasted.
10. The method according to any one of claims 4 to 7, characterized in that: The message label includes a first identifier and a second identifier, the first identifier is used to indicate the first network device that generates the message label in the first switching network, and the second identifier is used to indicate the generation time of the message label.
11. The method according to claim 10, characterized in that The first identifier is the MAC address or device number of the first network device that generates the message label.
12. The method according to claim 10, characterized in that The second identifier is a loop variable preset in the first network device that generates the message label, or a timestamp.
13. A first network device, characterized in that: The first network device is used to discard the repeatedly received broadcast message according to the unique identifier in the broadcast message when repeatedly receiving the broadcast message; the broadcast message includes a first broadcast message, the first network device includes a first port and a second port, and the first port and the second port are different ports; The first network device also includes: a receiver, configured to receive the first broadcast message through the first port; A processor, configured to write a correspondence between a source media access control MAC address of the first broadcast message and the first port into a main MAC address table; The receiver is further configured to repeatedly receive the first broadcast message through the second port; The processor is further configured to write a correspondence between the source MAC address of the first broadcast message and the second port into a standby MAC address table; The processor is further configured to forward a first unicast message according to the primary MAC address table or the backup MAC address table, wherein the destination MAC address of the first unicast message is the source MAC address of the first broadcast message.
14. The device according to claim 13, characterized in that The processor is specifically configured to forward the first unicast message through the first port when the first port corresponding to the source MAC address of the first broadcast message in the main MAC address table is available.
15. The device according to claim 13, characterized in that The processor is specifically configured to forward the first unicast message through the second port corresponding to the source MAC address of the first broadcast message in the backup MAC address table when the first port corresponding to the source MAC address of the first broadcast message in the primary MAC address table is unavailable.
16. The device according to any one of claims 13 to 15, characterized in that The unique identifier includes a message tag, and the message tag includes an operation code; The receiver is further configured to receive a second unicast message through the first port; When the port corresponding to the destination MAC address of the second unicast message in the primary MAC address table is unavailable or does not exist, and the port corresponding to the destination MAC address of the second unicast message in the standby MAC address table is unavailable or does not exist, the processor is further configured to add the message tag whose operation code is the first operation code to the second unicast message, and then forward the second unicast message through all ports of the first network device; The message tag is used to determine whether a message is received repeatedly, and the first operation code is used to instruct the first network device that receives the second unicast message to maintain its own primary MAC address table and the backup MAC address table, and flood the second unicast message.
17. The device according to any one of claims 13 to 16, characterized in that The receiver is further configured to receive a third unicast message through the first port, the third unicast message comprising a message label, and an operation code of the message label of the third unicast message is a first operation code; The processor is further configured to maintain the primary MAC address table and the backup MAC address table according to the first operation code, and flood the third unicast message.
18. The device according to claim 17, characterized in that The first network device further includes a third port, the third port is used to connect to a second network device or a terminal, the second network device is a network device outside the first switching network, and the first switching network is composed of a plurality of the first network devices; the broadcast message includes a second broadcast message, and the source MAC address of the second broadcast message is the destination MAC address of the third unicast message; If, in the primary MAC address table or the standby MAC address table, the port corresponding to the destination MAC address of the third unicast message is the third port, the processor is further configured to broadcast the second broadcast message; Among them, the second broadcast message includes a message tag, the operation code of the message tag of the second broadcast message is a second operation code, and the second operation code is used to instruct the first network device receiving the second broadcast message to update the main MAC address table or the backup MAC address table according to the source MAC address of the second broadcast message.
19. The device according to any one of claims 13 to 18, characterized in that The first network device also includes a third port; If the message label does not exist in the Ethernet frame header of the first broadcast message, the processor is further configured to add the message label to the Ethernet frame header; If the Ethernet frame header has the message tag, when forwarding the first broadcast message through the third port, the processor is further configured to delete the message tag in the Ethernet frame header and then forward the first broadcast message through the third port.
20. The device according to any one of claims 13 to 18, characterized in that After the receiver repeatedly receives the first broadcast message through the second port, if the receiver repeatedly receives the first broadcast message, the processor is further configured to maintain the standby MAC address table.
21. The device according to any one of claims 13 to 18, characterized in that The first broadcast message is an Address Resolution Protocol ARP request message; The receiver is also used to receive an ARP reply message corresponding to the ARP request message; The processor is further configured to modify the destination MAC address of the ARP reply message to the destination MAC address of the broadcast message; The processor is further configured to broadcast the ARP reply message after modifying the destination MAC address.
22. The device according to claims 16 to 19, characterized in that The message label includes a first identifier and a second identifier, the first identifier is used to indicate the first network device that generates the message label in the first switching network, and the second identifier is used to indicate the generation time of the message label.
23. The device according to claim 22, characterized in that The first identifier is the MAC address or device number of the first network device that generates the message label.
24. The device according to claim 22, characterized in that The second identifier is a loop variable preset in the first network device that generates the message label, or a timestamp.
25. A computer-readable storage medium, characterized in that: The computer-readable storage medium comprises instructions, and when the instructions are executed on a computer, the computer is caused to perform the method according to any one of claims 1 to 12.
26. A computer program product, characterized in that The method comprises computer-readable instructions, which, when executed on a computer device, cause the computer device to execute the method according to any one of claims 1 to 12.