Fault monitoring method, device, equipment and storage medium

CN123020314APending Publication Date: 2026-10-30CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611164350.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-03
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0004]然而,目前的传统技术中,由于网络设备的故障监测是基于人为手动操作实现的,导致网络设备故障监测的效率较差

Benefits of technology

[0064]上述故障监测方法、装置、设备和存储介质中,在第一网络设备基于目标协议与第二网络设备进行通信的过程中,在网络通路正常时,第一网络设备发出高优先级的第一报文后,第二网络设备会反馈与第一报文相同优先级的第二报文,所以,在第一网络设备接收到第二网络设备反馈的第二报文后,通过获取预设时间窗口内第二网络设备响应于第一报文反馈的第二报文,并对比预设时间窗口内的第二报文与第一二报文的优先级结果,能够在优先级结果为预设时间窗口内优先级低于所述第一报文的所述第二报文的数据特征满足预设特征条件时,捕捉到第一网络设备持续接收低优先级第二报文的通信状态。此时,该通信状态说明当前第二网络设备由于无法接收到第一网络设备的第一报文,反馈的第二报文的优先级低于第一报文的优先级,进而能够确定第一网络设备与第二网络设备存在单向通信的故障,并通过预设故障设置机制将第一网络设备与第二网络设备之间的通信状态确定为故障状态,避免了故障监测中繁琐的人为操作,从而提升故障监测的效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123020314A_ABST
    Figure CN123020314A_ABST
Patent Text Reader

Abstract

The application relates to a fault monitoring method, device, equipment and storage medium. The method comprises the following steps: in the communication process between a first network device and any second network device, sending a first message to the second network device, and receiving a second message fed back by the second network device for the first message; the communication priority of the first network device is higher than that of the second network device; determining a priority result between the first message and the second message according to a preset priority strategy; based on a target protocol and a fault judgment rule, if the priority result in multiple message interactions is that the priority of the first message is higher than that of the second message, and the data characteristics of the second message meet a preset characteristic condition, it is determined that there is a fault between the first network device and the second network device. The method can improve the efficiency of fault monitoring.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer network technology, and in particular to a fault monitoring method, apparatus, device, and storage medium. Background Technology

[0002] With the development of computer network technology, network devices such as switches, routers, and network elements in data center networks construct attribute topologies using STP (Spanning Tree Protocol) to achieve functions such as data forwarding, service access, and core service aggregation. However, due to user Layer 2 VLAN configuration errors, failure to enable STP on interconnecting devices, or physical link failures, network devices are prone to one-way communication failures, thus requiring fault monitoring of network devices.

[0003] In traditional technologies, network operators manually test the connectivity of every two network devices within a data center to monitor network device faults. For example, for switches A, B, and C, operators control switch A to ping switch B and switch B to ping switch A, thus achieving bidirectional connectivity testing between switches A and B. Similarly, operators also need to test bidirectional connectivity between switches A and C, and between switches B and C, to ultimately determine whether the communication status between each group of switches is faulty, thereby achieving network device fault monitoring.

[0004] However, in current traditional technologies, the efficiency of network device fault monitoring is relatively poor because it is based on manual operation. Summary of the Invention

[0005] Therefore, it is necessary to provide a fault monitoring method, apparatus, device, and storage medium to address the aforementioned technical problems.

[0006] In a first aspect, this application provides a fault monitoring method, the method being applied to a first network device in a network environment, comprising:

[0007] During communication between the first network device and any second network device, the first network device sends a first message to the second network device and receives a second message from the second network device in response to the first message; the communication priority of the first network device is higher than that of the second network device.

[0008] The priority result between the first message and the second message is determined according to a preset priority strategy;

[0009] Based on the target protocol and fault determination rules, if the priority result in multiple message exchanges is that the priority of the first message is higher than that of the second message, and the data characteristics of the second message meet the preset characteristic conditions, it is determined that there is a fault between the first network device and the second network device.

[0010] In one embodiment, the step of sending a first message to the second network device and receiving a second message from the second network device in response to the first message during communication between the first network device and any second network device includes:

[0011] A first message is generated based on a target protocol. During communication between the first network device and the second network device, the first message is sent to any second network device in the network environment. The target protocol is the Spanning Tree Protocol.

[0012] Receive the second message fed back by the second network device within the preset time window.

[0013] In one embodiment, the preset priority policy includes multiple target parameters and parameter levels corresponding to each target parameter; determining the priority result between the first packet and the second packet according to the preset priority policy includes:

[0014] According to the parameter level corresponding to each target parameter, the target parameters in the first message and the target parameters in the second message are compared level by level, and the priority result between the first message and the second message is obtained based on the comparison result of each target parameter.

[0015] In one embodiment, the parameter hierarchy corresponding to the target parameter is, in order, the root bridge identity number, the root path cost, the designated bridge identity number, the designated interface identity number, and the receiving interface identity number.

[0016] In one embodiment, the step of determining a fault between the first network device and the second network device based on the target protocol and fault determination rules, if the priority result in multiple message exchanges indicates that the first message has a higher priority than the second message, and the data characteristics of the second message meet preset characteristic conditions, includes:

[0017] In multiple message exchanges within a preset time window, if the priority result in the multiple message exchanges is that the priority of the first message is higher than that of the second message, the target number of consecutively received second messages is determined.

[0018] Based on the target protocol and fault determination rules, if the number of target packets is greater than a preset threshold, it is determined that the data characteristics of the second packet meet the preset characteristic conditions, and it is determined that there is a fault between the first network device and the second network device.

[0019] In one embodiment, after determining that a fault exists between the first network device and the second network device based on the target protocol and fault determination rules, if the priority result in multiple message exchanges indicates that the first message has a higher priority than the second message, and the data characteristics of the second message meet preset characteristic conditions, the method further includes:

[0020] Based on a preset fault setting mechanism, the data forwarding function of the target interface in the first network device is blocked; the target interface is the interface in the first network device that communicates with the second network device.

[0021] Set the protocol status of the target interface to a fault state and record the fault cause as a one-way communication fault.

[0022] Secondly, this application provides a fault monitoring method, which is applied to a second network device in a network environment, comprising:

[0023] An initial message is generated based on the target protocol, and the receiving interface corresponding to the first network device is monitored.

[0024] If the first message is not received based on the receiving interface, a second message is constructed according to the second message construction mechanism and the initial message.

[0025] If a first message is received based on the receiving interface, a second message is constructed according to a preset priority policy and a second message construction mechanism, as well as the first message or the initial message.

[0026] The second message is fed back to the first network device; the second message is used in the first network device to determine that there is a fault between the first network device and the second network device, based on the target protocol and fault determination rules, if the priority result of multiple message exchanges is that the priority of the first message is higher than that of the second message, and the data characteristics of the second message meet the preset characteristic conditions.

[0027] In one embodiment, if a first message is received based on the receiving interface, constructing a second message according to a preset priority policy and a second message construction mechanism, and the first message or the initial message, includes:

[0028] The priority result between the first message and the initial message is determined according to a preset priority strategy;

[0029] If the priority result indicates that the priority of the first message is higher than the priority of the initial message, the message content of the initial message is replaced with the message content of the first message to obtain the second message, and the second message is fed back to the first network device.

[0030] If the priority result indicates that the priority of the initial message is higher than that of the first message, the initial message is sent back to the first network device as the second message.

[0031] Thirdly, this application also provides a fault monitoring device, which is applied to a first network device in a network environment, comprising:

[0032] The transceiver module is used to send a first message to the second network device and receive a second message from the second network device in response to the first message during communication between the first network device and any second network device; the communication priority of the first network device is higher than that of the second network device.

[0033] The determining module is used to determine the priority result between the first message and the second message according to a preset priority strategy;

[0034] The fault identification module is used to determine, based on the target protocol and fault determination rules, that if the priority result in multiple message exchanges shows that the priority of the first message is higher than that of the second message, and the data characteristics of the second message meet preset characteristic conditions, a fault exists between the first network device and the second network device.

[0035] In one embodiment, the transceiver module is specifically used to generate a first message based on a target protocol, and send the first message to any second network device in the network environment during the communication process between the first network device and the second network device; the target protocol is the Spanning Tree Protocol.

[0036] Receive the second message fed back by the second network device within the preset time window.

[0037] In one embodiment, the preset priority strategy includes multiple target parameters and parameter levels corresponding to each target parameter; the determining module is specifically used to compare the target parameters in the first message and the target parameters in the second message level by level according to the parameter levels corresponding to each target parameter, and obtain the priority result between the first message and the second message based on the comparison results of each target parameter.

[0038] In one embodiment, the parameter hierarchy corresponding to the target parameter is, in order, the root bridge identity number, the root path cost, the designated bridge identity number, the designated interface identity number, and the receiving interface identity number.

[0039] In one embodiment, the fault identification module is specifically used to determine the target number of consecutively received second messages if the priority result in multiple message interactions within a preset time window is that the priority of the first message is higher than that of the second message.

[0040] Based on the target protocol and fault determination rules, if the number of target packets is greater than a preset threshold, it is determined that the data characteristics of the second packet meet the preset characteristic conditions, and it is determined that there is a fault between the first network device and the second network device.

[0041] In one embodiment, the device further includes:

[0042] The blocking module is specifically used to block the data forwarding function of the target interface in the first network device based on a preset fault setting mechanism; the target interface is the interface in the first network device that communicates with the second network device.

[0043] The status setting module is used to set the protocol status of the target interface to a fault status and record the fault cause as a one-way communication fault.

[0044] Fourthly, this application also provides a fault monitoring device, which is applied to a second network device in a network environment, comprising:

[0045] The listening module is used to generate an initial message based on the target protocol and listen to the receiving interface corresponding to the first network device.

[0046] The first construction module is used to construct a second message according to the second message construction mechanism and the initial message if the first message is not received based on the receiving interface.

[0047] The second construction module is used to construct a second message based on a preset priority strategy and a second message construction mechanism, and the first message or the initial message, if a first message is received based on the receiving interface.

[0048] The feedback module is used to feed back the second message to the first network device; the second message is used in the first network device to determine that there is a fault between the first network device and the second network device based on the target protocol and fault determination rules, if the priority result of multiple message exchanges is that the priority of the first message is higher than that of the second message, and the data characteristics of the second message meet the preset characteristic conditions.

[0049] In one embodiment, the second construction module is specifically used to determine the priority result between the first message and the initial message according to a preset priority strategy;

[0050] If the priority result indicates that the priority of the first message is higher than the priority of the initial message, the message content of the initial message is replaced with the message content of the first message to obtain the second message, and the second message is fed back to the first network device.

[0051] If the priority result indicates that the priority of the initial message is higher than that of the first message, the initial message is sent back to the first network device as the second message.

[0052] Fifthly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0053] During communication between the first network device and any second network device, the first network device sends a first message to the second network device and receives a second message from the second network device in response to the first message; the communication priority of the first network device is higher than that of the second network device.

[0054] The priority result between the first message and the second message is determined according to a preset priority strategy;

[0055] Based on the target protocol and fault determination rules, if the priority result in multiple message exchanges is that the priority of the first message is higher than that of the second message, and the data characteristics of the second message meet the preset characteristic conditions, it is determined that there is a fault between the first network device and the second network device.

[0056] Sixthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0057] During communication between the first network device and any second network device, the first network device sends a first message to the second network device and receives a second message from the second network device in response to the first message; the communication priority of the first network device is higher than that of the second network device.

[0058] The priority result between the first message and the second message is determined according to a preset priority strategy;

[0059] Based on the target protocol and fault determination rules, if the priority result in multiple message exchanges is that the priority of the first message is higher than that of the second message, and the data characteristics of the second message meet the preset characteristic conditions, it is determined that there is a fault between the first network device and the second network device.

[0060] In a seventh aspect, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:

[0061] During communication between the first network device and any second network device, the first network device sends a first message to the second network device and receives a second message from the second network device in response to the first message; the communication priority of the first network device is higher than that of the second network device.

[0062] The priority result between the first message and the second message is determined according to a preset priority strategy;

[0063] Based on the target protocol and fault determination rules, if the priority result in multiple message exchanges is that the priority of the first message is higher than that of the second message, and the data characteristics of the second message meet the preset characteristic conditions, it is determined that there is a fault between the first network device and the second network device.

[0064] In the aforementioned fault monitoring method, apparatus, device, and storage medium, during the communication between the first network device and the second network device based on the target protocol, when the network path is normal, after the first network device sends a high-priority first message, the second network device will respond with a second message of the same priority as the first message. Therefore, after the first network device receives the second message from the second network device, by acquiring the second message from the second network device in response to the first message within a preset time window and comparing the priority results of the second message within the preset time window with those of the first and second messages, it can capture the communication state where the first network device continuously receives low-priority second messages when the data characteristics of the second message with a priority lower than that of the first message within the preset time window meet the preset characteristic conditions. At this time, this communication state indicates that the second network device is unable to receive the first message from the first network device, and the priority of the second message it responds to is lower than that of the first message. Thus, it can be determined that there is a one-way communication fault between the first and second network devices, and the communication state between the first and second network devices is determined as a fault state through a preset fault setting mechanism, avoiding cumbersome manual operations in fault monitoring and improving the efficiency of fault monitoring. Attached Figure Description

[0065] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0066] Figure 1 This is a diagram illustrating the application environment of a fault monitoring method in one embodiment;

[0067] Figure 2 This is a flowchart illustrating a fault monitoring method applied to a first network device in one embodiment;

[0068] Figure 3 This is a schematic diagram illustrating the process of message exchange between a first network device and a second network device in one embodiment.

[0069] Figure 4 This is a schematic diagram of the BPDU message structure in one embodiment;

[0070] Figure 5 This is a schematic diagram of a fault identification process based on a target protocol and fault determination rules in one embodiment;

[0071] Figure 6 This is a schematic diagram of the fault handling process after a fault is determined to exist in one embodiment.

[0072] Figure 7 This is a flowchart illustrating a fault monitoring method applied to a second network device in one embodiment;

[0073] Figure 8 This is a schematic diagram illustrating the process of constructing a second message after the second network device receives the first message in one embodiment.

[0074] Figure 9 This is a schematic diagram simulating a one-way communication failure between a first network device and a second network device in one embodiment;

[0075] Figure 10 This is a structural block diagram of a fault monitoring device applied to a first network device in one embodiment;

[0076] Figure 11 This is a structural block diagram of a fault monitoring device applied to a second network device in one embodiment;

[0077] Figure 12 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0078] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0079] Before introducing specific embodiments of the present invention, the technical terms involved in the present invention will be explained:

[0080] STP (Spanning Tree Protocol): The Spanning Tree Protocol can be used to establish tree topologies in computer networks. Its main function is to prevent redundant links in bridged networks from forming loops.

[0081] BPDU (Bridge Protocol Data Unit): The protocol message used by STP is BPDU. STP determines the network topology by transmitting BPDU between network devices. The BPDU contains enough information to ensure that the device completes the spanning tree calculation process.

[0082] Layer 2 Network: A Layer 2 network refers to a network that operates at the second layer (data link layer) of the OSI (Open System Interconnection) model. It is mainly responsible for transmitting data frames within the same local area network (LAN).

[0083] The fault monitoring method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, the first network device 102 communicates with the second network device 104 via a network. During communication between the first network device 102 and either of the second network devices 104, the first network device 102 sends a first message to the second network device 104 and receives a second message from the second network device 104 in response to the first message. The communication priority of the first network device is higher than that of the second network device. The first network device 102 determines the priority result between the second message and the first message according to a preset priority policy. Based on the target protocol and fault judgment rules, if the priority result of multiple message exchanges shows that the first message has a higher priority than the second message, and the data characteristics of the second message meet preset characteristic conditions, the first network device 102 determines that there is a fault between the first network device 102 and the second network device 104. The first network device 102 and the second network device 104 can be devices forming an Internet within the same network environment; for example, the first network device 102 and the second network device 104 can be switches, routers, network elements, etc. The first network device can be any network device in the current network environment, and the second network device is any network device that communicates with the first network device. Both the first and second network devices are devices that have enabled the Spanning Tree Protocol in a Layer 2 switch network environment.

[0084] In one exemplary embodiment, such as Figure 2 As shown, a fault monitoring method is provided, which can be applied to... Figure 1Taking the first network device 102 as an example, the explanation includes the following steps 202 to 206. Wherein:

[0085] Step 202: During the communication between the first network device and any second network device, a first message is sent to the second network device, and a second message is received from the second network device in response to the first message.

[0086] Among them, the communication priority of the first network device is higher than that of the second network device.

[0087] In this embodiment of the application, during the communication between the first network device and any second network device based on the Spanning Tree Protocol (STP), the first network device generates and sends out a first message carrying its own priority information, namely a BPDU message, according to the Spanning Tree Protocol and a preset period.

[0088] Meanwhile, the first network device continuously listens for and receives second messages from other network devices (i.e., the second network device) in the current network environment. The second message is a feedback message generated by the second network device based on the STP protocol and the first message. The specific method by which the second network device generates the second message is described in detail in the following embodiments.

[0089] Specifically, the first network device can collect the received second packets within a preset time window (e.g., 3 consecutive seconds or 5 packet cycles). In addition to the time window-based collection method, the first network device can also use a continuous counting method to perform real-time fault monitoring and processing each time a second packet is received.

[0090] Step 204: Determine the priority result between the second message and the first message according to the preset priority strategy.

[0091] In this embodiment, after receiving the second message from the second network device, the first network device compares the first message and the second message according to a preset priority strategy to determine the priority between them. The preset priority strategy can be a hierarchical comparison of target fields in the first and second messages, or it can be a strategy that generates a comprehensive priority value based on a preset calculation mechanism and target fields. For example, in the hierarchical comparison of target fields in the first and second messages, the first network device first compares the root bridge identification number carried in the messages; messages with smaller root bridge identification numbers have higher priority. If the root bridge identification numbers are the same, the sum of the root path cost and the path cost of the current interface is compared; messages with smaller sums of path costs have higher priority. If the path costs are still the same, the designated bridge identification number, designated interface identification number, and receiving interface identification number are compared sequentially. For each type of identification number, messages with smaller numerical values ​​have higher priority.

[0092] Optionally, regarding the method for generating the overall priority value in the preset priority strategy, the first network device can also generate a single overall priority value corresponding to each comparison parameter through hashing or weighted calculation, and directly compare the overall priority value corresponding to the first packet and the overall priority value corresponding to the second packet to determine the priority result between the first packet and the second packet. Furthermore, the first network device can pre-calculate the overall priority value of its own first packet during the device initialization phase. Subsequently, upon receiving the second packet, it only needs to parse and compare the corresponding fields in the second packet, without needing to recalculate all parameters.

[0093] Step 206: Based on the target protocol and fault determination rules, if the priority result in multiple message exchanges shows that the priority of the first message is higher than that of the second message, and the data characteristics of the second message meet the preset characteristic conditions, it is determined that there is a fault between the first network device and the second network device.

[0094] The target protocol is the Spanning Tree Protocol (STP).

[0095] In this embodiment, during communication between the first network device and the second network device based on the Spanning Tree Protocol (STP), the first network device periodically sends a first message to the second network device, declaring its own communication priority. Since the root bridge election rule of the STP is that when a network device has a message with a higher communication priority than itself, it stops sending messages containing its own communication priority and instead forwards the message with the highest communication priority. Therefore, when the first network device has a higher communication priority than the second network device, after receiving the first message, the second network device uses the content of the first message as a second message and sends it back to the first network device. Thus, when there is no one-way communication failure between the first and second network devices, the priority of the second message received by the first network device is the same as the priority of the first message.

[0096] Based on the principle of the root bridge election rule of the aforementioned spanning tree protocol, the fault determination rule in this embodiment is as follows: In multiple message exchanges between the first network device and the second network device, if the priority result shows that the first message has a higher priority than the second message, and the data characteristics of the second message meet the preset characteristic conditions, then it is determined that the first network device can only receive the second message from the second network device, while the second network device cannot receive the first message from the first network device. Therefore, it is determined that there is a one-way communication fault between the first network device and the second network device. The preset characteristic conditions are used to determine whether there is a one-way communication fault between the first network device and the second network device based on the data characteristics of the second message received by the first network device during multiple message exchanges, in order to avoid interference from network fluctuations on fault monitoring.

[0097] In one specific embodiment, the preset feature condition may be that when the priority result is that the priority of the first message is higher than that of the second message, and the number of second messages continuously received by the first network device is greater than a preset threshold, then the data feature of the second message is the number of second messages with a priority lower than that of the first message that are continuously received; or, the preset feature condition may be that when the priority result is that the priority of the first message is higher than that of the second message, and the number of second messages received within a preset time window is greater than a preset threshold, then the data feature of the second message is the number of second messages with a priority lower than that of the first message that are received within the preset time window.

[0098] In the aforementioned fault monitoring method, during the communication between the first network device and the second network device based on the target protocol, when the network path is normal, after the first network device sends a high-priority first message, the second network device will send back a second message with the same priority as the first message. Therefore, after the first network device receives the second message from the second network device, by acquiring the second message from the second network device in response to the first message within a preset time window and comparing the priority results of the second message within the preset time window with those of the first and second messages, it can capture the communication state where the first network device continuously receives low-priority second messages when the data characteristics of the second message with a priority lower than that of the first message within the preset time window meet the preset characteristic conditions. At this time, this communication state indicates that the second network device is unable to receive the first message from the first network device, and the priority of the second message it sends back is lower than that of the first message. Thus, it can be determined that there is a one-way communication fault between the first and second network devices, and the communication state between the first and second network devices is determined as a fault state through a preset fault setting mechanism, avoiding cumbersome manual operations in fault monitoring and thus improving the efficiency of fault monitoring.

[0099] In one exemplary embodiment, such as Figure 3As shown, step 202 includes steps 302 to 304. Wherein:

[0100] Step 302: Generate a first message based on the target protocol, and send the first message to any second network device in the network environment during the communication process between the first network device and the second network device.

[0101] The target protocol is the Spanning Tree Protocol.

[0102] In this embodiment, the first network device, based on the Spanning Tree Protocol (STP), first determines the priority parameters required by the first network device in the spanning tree calculation. Specifically, the priority parameters include the root bridge identity number of the first network device, the path cost from the first network device to the root bridge, the bridge identity number of the first network device, and the interface identity number used to send the first message. Then, the first network device generates a first message according to the priority parameters; this first message is a BPDU message. Subsequently, the first network device sends the first message to the second network device connected to the first network device in the current network environment according to a preset period in the STP.

[0103] Step 304: Receive the second message fed back by the second network device within the preset time window.

[0104] In this embodiment, after sending a first message, the first network device listens to the target interface connected to the second network device within a preset time window and receives a second message from the second network device. Within this preset time window, the first network device receives second messages from the second network device in the network environment. These second messages are also BPDU messages based on the Spanning Tree Protocol, carrying parameters such as the root bridge identifier, root path cost, bridge identifier, and interface identifier of the second network device. Upon receiving each second message, the first network device records the reception timestamp and parses out the aforementioned priority parameters. When the preset time window ends, the first network device statistically analyzes the data characteristics of all second messages received within the preset time window as a basis for fault determination.

[0105] In an optional embodiment, the preset time window can also be a sliding window. The preset time window is dynamically updated every time the first network device receives a second message or every time a time unit has elapsed, to ensure the real-time nature of the data characteristics of the received second message.

[0106] In this embodiment, the first network device actively sends a first message carrying its own priority parameters and receives a second message within a preset time window, thereby providing a real-time data basis for subsequent one-way communication fault determination, avoiding manual fault monitoring and improving fault monitoring efficiency.

[0107] In an exemplary embodiment, the preset priority strategy includes multiple target parameters and parameter levels corresponding to each target parameter; step 204 includes step 2041. Wherein:

[0108] Step 2041: According to the parameter level corresponding to each target parameter, compare the target parameters in the first message and the target parameters in the second message level by level, and obtain the priority result between the first message and the second message based on the comparison results of each target parameter.

[0109] In this embodiment of the application, the first network device extracts multiple target parameters for characterizing the priority of the packets from the first packet and the second packet respectively. The target parameters are arranged in a preset hierarchical order, and each parameter level corresponds to a comparison dimension.

[0110] The first network device compares the current-level feature parameters of the first packet with the same-level feature parameters of the second packet sequentially, from higher to lower levels. At the current level, if the feature parameters of the first packet and the second packet satisfy a preset size relationship (e.g., the first parameter value of the first packet is less than the first parameter value of the second packet), then the first packet is determined to have a higher priority than the second packet, and the comparison of parameters at subsequent levels is terminated. If the target parameters of the first packet and the second packet are equal at the current level, the comparison continues to the next level. If the feature parameters of both packets are equal at all levels, then the first packet and the second packet are determined to have the same priority. Through this progressive comparison method, the first network device ultimately determines the priority result between the first packet and the second packet.

[0111] In an optional embodiment, the first network device additionally sets a Priority field in the flag field of the STP protocol BPDU message, such as... Figure 4 As shown, Figure 4This is a schematic diagram of the BPDU message structure. The BPDU message content includes DMA, SMA, L / T, LLC Header, and Payload. DMA (Destination MAC Address) is the destination MAC (Media Access Control Address), SMA (Source MAC Address) is the source MAC address, L / T (Length / Type) is the frame length, LLC Header (Logical Link Control Header) is a fixed link header for configuration messages, and Payload is the BPDU data. The Payload includes Protocol ID, Protocol Version ID, BPDU Type, Flags, Root ID, Root Path Cost, Bridge ID, Port ID, MessageAge, Max Age, Hello Time, and Forward Delay. Figure 4 As shown, bits 1 to 6 of the flag are empty reserved bits. In this embodiment, bit 1 is used as the storage location for the Priority field. The Priority field can be a comprehensive priority value. When the first network device continuously receives the second message, it compares the Priority field in the second message to determine the priority and thus determine whether there is a link failure.

[0112] Optionally, the Priority field can also be set as a flag indicating priority. For example, after comparing the target parameters hierarchically based on their corresponding parameter levels, if the priority of the first packet is higher than that of the second packet, the Priority field is set to 1; otherwise, it is set to 0. In subsequent fault monitoring based on the target protocol and fault determination rules, upon receiving the second packet, the Priority field of the second packet is set according to the priority result. During fault monitoring, the first network device can use the Priority field in the second packet to statistically analyze its data characteristics and compare these characteristics with preset feature conditions to determine whether a fault exists between the first and second network devices.

[0113] In this embodiment, by comparing target parameters at multiple levels, the accuracy of priority judgment between the first and second messages can be improved, thereby improving the accuracy of fault monitoring.

[0114] In an exemplary embodiment, the parameter hierarchy corresponding to the target parameter is as follows: root bridge identity number, root path cost, designated bridge identity number, designated interface identity number, and receiving interface identity number.

[0115] In this embodiment of the application, the first network device extracts multiple root bridge identity number, root path cost, designated bridge identity number, designated interface identity number, and receiving interface identity number from the first message and the second message respectively, and compares them sequentially according to the parameter hierarchy order of the root bridge identity number, root path cost, designated bridge identity number, designated interface identity number, and receiving interface identity number, based on the same principle as step 2041, to obtain the priority result between the first message and the second message.

[0116] In one exemplary embodiment, such as Figure 5 As shown, step 206 includes steps 502 to 504. Wherein:

[0117] Step 502: In multiple message exchanges within a preset time window, if the priority result of the multiple message exchanges is that the priority of the first message is higher than that of the second message, determine the target number of consecutive messages that the second message is received.

[0118] In this embodiment, the first network device monitors and counts second packets from the second network device sequentially within a preset time window (e.g., a 5-second preset time window). If the priority result of multiple packet interactions indicates that the priority of the first packet is higher than that of the second packet, the first network device determines the target number of consecutively received second packets. Specifically, the first network device can maintain a continuous counter with an initial value of 0. Whenever a second packet is received, the first network device determines the priority result between the second packet and its own first packet. If the priority result indicates that the priority of the currently received second packet is lower than that of the first packet, the continuous counter is incremented by 1; if the priority of the currently received second packet is equal to or higher than that of the first packet, the continuous counter is reset to zero (i.e., counting restarts). At the end of the preset time window, the first network device determines the current value of the continuous counter as the target number of consecutively received second packets with a priority lower than that of the first packet. Alternatively, the first network device can also use a sliding window method for continuous monitoring, that is, after receiving a second packet, it determines whether the current continuous count value of the continuous counter has reached a preset threshold, thereby enabling real-time detection of the occurrence of consecutive low-priority second packets.

[0119] Step 504: Based on the target protocol and fault determination rules, if the number of target packets is greater than a preset threshold, determine that the data characteristics of the second packet meet the preset characteristic conditions, and determine that there is a fault between the first network device and the second network device.

[0120] In this embodiment, the first network device compares the number of target packets with a preset threshold based on the Spanning Tree Protocol and preset fault determination rules. If the number of target packets exceeds the preset threshold, the first network device determines that the data characteristics of the second packet meet preset characteristic conditions and identifies a one-way communication fault in the communication link between the first and second network devices. The preset threshold can be a factory default value, or optionally, it can be dynamically adjusted based on the network environment.

[0121] In this embodiment, by counting the number of consecutively received low-priority second messages and comparing them with a preset threshold, the monitoring interference caused by network fluctuations can be reduced and the accuracy of fault monitoring can be improved.

[0122] In one exemplary embodiment, such as Figure 6 As shown, after step 206, the method further includes steps 602 to 604. Wherein:

[0123] Step 602: Based on the preset fault setting mechanism, block the data forwarding function of the target interface in the first network device.

[0124] The target interface is the interface in the first network device that communicates with the second network device.

[0125] In this embodiment, when the first network device determines that a one-way communication failure exists between it and the second network device, the first network device performs a fault handling operation based on a preset fault setting mechanism (e.g., the LowbpduBlock mechanism). Specifically, the first network device first determines the target interface for receiving the second message, which is the interface on the first network device that communicates with the second network device. Then, the first network device blocks the data forwarding function of the target interface through hardware or software. For example, the first network device can set the outbound or inbound packet filtering rule corresponding to the target interface in the forwarding table entry of the switching chip to discard all data frames, or directly set the forwarding status register of the target interface to a prohibited forwarding state, ensuring that messages cannot enter or exit through the target interface, thereby blocking the data forwarding function of the target interface.

[0126] Specifically, blocking operations can be implemented by setting the port status to blocking, disabling the forwarding engine, or adding the port to the hardware blacklist.

[0127] Step 604: Set the protocol status of the target interface to a fault state and record the fault cause as a one-way communication fault.

[0128] In this embodiment, after blocking the data forwarding function of the target interface, the first network device further sets the protocol state of the target interface to a fault state. For example, in the port state machine of the Spanning Tree Protocol, the port state is switched from the original forwarding state to the down state. Simultaneously, the first network device records the cause of the fault, explicitly indicating that the fault is caused by one-way communication. Specifically, the system log can record that the target interface triggered LowbpduBlock (representing a one-way communication fault) due to continuously receiving low-priority BPDU packets, or a reason field "reason: LowbpduBlock" can be added to the interface status display of the target interface. This fault cause record can be obtained by network administrators through query commands or collection from the control terminal, thereby quickly locating the device and interface where the one-way communication fault occurred.

[0129] In this embodiment, by blocking the data forwarding of the faulty interface and clearly recording the cause of the fault, the target interface of the fault can be automatically isolated when the one-way communication of the network is abnormal, and accurate fault location information can be provided, thereby improving the efficiency of fault location.

[0130] In one exemplary embodiment, such as Figure 7 As shown, a fault monitoring method is provided, which can be applied to... Figure 1 Taking the second network device 104 as an example, the explanation includes the following steps 702 to 708. Wherein:

[0131] Step 702: Generate an initial message based on the target protocol and listen to the receiving interface corresponding to the first network device.

[0132] The target protocol is the Spanning Tree Protocol (STP).

[0133] In this embodiment of the application, the second network device generates an initial message based on the Spanning Tree Protocol. The initial message contains target parameters for the second network device to declare its own priority. The target parameters include the root bridge identity number, root path cost, bridge identity number, port identity number, and other parameters of the second network device.

[0134] Meanwhile, the second network device continuously listens to the corresponding receive port of the first network device to receive the first message sent by the first network device. Under normal bidirectional link conditions, the second network device will receive the first message, but in a one-way communication failure scenario, the second network device will not receive the first message.

[0135] Step 704: If the first message is not received based on the receiving interface, construct the second message according to the second message construction mechanism and the initial message.

[0136] In this embodiment, after generating an initial message and continuously listening to the receiving interface, the second network device first determines whether it has received a first message from the first network device. If no first message appears on the receiving interface corresponding to the first network device within a preset timeout period, the second network device determines that there is no higher-priority network device or that the first message failed to arrive due to a link failure. At this time, the second network device constructs the second message by directly using its own generated initial message as the content of the second message according to the second message construction mechanism. Specifically, the second network device retains the root bridge identity number, root path cost, bridge identity number, port identity number, and other parameters in the initial message unchanged, and only updates the relevant timing fields (e.g., Message Age) in the message to the current value, thereby forming the second message.

[0137] Step 706: If the first message is received based on the receiving interface, construct the second message according to the preset priority policy and the second message construction mechanism, as well as the first message or the initial message.

[0138] In this embodiment, if the second network device successfully receives the first message from the first network device on the receiving interface corresponding to the first network device, the second network device first extracts the target parameters of the first network device from the first message, and compares the target parameters with the target parameters corresponding to the initial message it generates according to a preset priority strategy. If the priority of the first message is higher than that of the initial message, the second network device constructs the second message using the content of the first message according to the second message construction mechanism. If the priority of the first message is lower than that of the initial message, the second network device constructs the second message based on the initial message according to the same principle as step 704.

[0139] Step 708: Send the second message back to the first network device.

[0140] The second message is used in the first network device to determine whether there is a fault between the first network device and the second network device, based on the target protocol and fault determination rules, if the priority result of multiple message exchanges is that the priority of the first message is higher than that of the second message, and the data characteristics of the second message meet the preset characteristic conditions.

[0141] In this embodiment, after constructing the second message, the second network device sends the second message back to the first network device through the receiving interface connected to the first network device, regardless of whether the second message is constructed based on the initial message or the first message. In the first network device, the second message is used for fault monitoring based on the same principles as steps 202 to 206. The specific process of fault monitoring will not be described in detail in this embodiment.

[0142] In one exemplary embodiment, such as Figure 8 As shown, step 706 further includes steps 802 to 806. Wherein:

[0143] Step 802: Determine the priority result between the first message and the initial message according to the preset priority policy.

[0144] In this embodiment, the second network device determines the priority result between the first packet and the initial packet according to a preset priority policy. The principle for determining the priority result between the first packet and the initial packet is the same as the principle for determining the priority result between the first packet and the second packet in step 2041. Therefore, the principle for determining the priority result between the first packet and the initial packet will not be elaborated further in this embodiment.

[0145] Step 804: If the priority result shows that the priority of the first message is higher than that of the initial message, replace the message content of the initial message with the message content of the first message to obtain the second message, and send the second message back to the first network device.

[0146] In this embodiment, if the priority result determined by the second network device is that the priority of the first message is higher than that of the initial message, then the second network device, according to the root bridge election rules of the Spanning Tree Protocol, stops using its own initial message and instead uses the content of the first message as the basis to construct the second message. Specifically, the second network device replaces the entire message content of the initial message with the message content of the first message, and the second network device obtains the second message. This second message is essentially a forwarding of the first message (i.e., propagating the BPDU of the higher-priority device), and the priority information carried is the same as that of the first network device. Under normal link conditions, the second message received by the first network device has the same priority as the first message it sent; therefore, the first network device determines that there is no fault between the first network device and the second network device.

[0147] Step 806: If the priority result shows that the priority of the initial message is higher than that of the first message, the initial message is sent back to the first network device as the second message.

[0148] In this embodiment, if the priority result determined by the second network device is that the priority of the initial message is higher than that of the first message, the second network device assumes that there is no device in the network with a higher communication priority than itself. Therefore, the second network device directly uses its own generated initial message as the second message, keeping its original message content unchanged, and sends the second message back to the first network device through the interface connected to the first network device. At this time, the priority of the second message received by the first network device is lower than the priority of its own first message. Therefore, the first network device can determine that there is a fault between the first network device and the second network device, based on the target protocol and fault determination rules, provided that the data characteristics of the received second message meet preset characteristic conditions.

[0149] In this embodiment, the second network device dynamically constructs and feeds back a second message based on the priority comparison result, enabling the first network device to identify whether there is a one-way communication failure based on the priority characteristics of the received second message, thus avoiding tedious manual operations in fault monitoring and improving the efficiency of fault monitoring.

[0150] In one exemplary embodiment, such as Figure 9 As shown, Figure 9 This diagram illustrates a one-way communication failure between the first and second network devices. Figure 9 The network devices in this diagram include switches SW1, SW2, and SW3 (hereinafter referred to as SW1, SW2, and SW3). Using SW1 as the first network device and SW3 as the second, and simulating a fault in SW2 for illustration, after interconnecting SW1, SW2, and SW3, SW1 and SW3 enable the Spanning Tree Protocol (STP), while SW2 disables STP. Furthermore, SW1's STP priority is higher than SW3's, meaning SW1's communication priority is higher than SW3's. Because SW2 does not enable STP, when SW2 receives BPDU messages from SW1 and SW3, it will not send these protocol messages to the local CPU (Central Processing Unit) for parsing and processing. Instead, the chip will forward them as ordinary Layer 2 Ethernet messages. Additionally, the Ethernet 1 interface in SW2 is configured as a trunk type, allowing all VLAN tags to pass through, and the Ethernet 2 interface is configured as a trunk type, allowing all VLAN tags to pass through, but rejecting the default VLAN tag 1.

[0151] According to the Spanning Tree Protocol (STP) definition, BPDU packets do not carry a VLAN-Tag field in their Layer 2 header when transmitted over a link. Therefore, after SW2 receives BPDU packets (without VLAN-Tag) from SW1 and SW3 respectively from interfaces G1 / 0 / 1 and G1 / 0 / 2, it adds them to VLAN 1 within SW2 based on their interface PVID=1 and forwards them within VLAN 1. However, VLAN 1 is not allowed in SW2's G1 / 0 / 2 configuration. Therefore, the BPDU packet (first packet) sent by SW1 cannot be forwarded from SW2's Ethernet 2 port, causing SW3 to be unable to receive SW1's BPDU packet, while SW1 can receive SW3's BPDU packet, thus simulating a one-way communication failure.

[0152] Based on this, while sending the first message, SW1 continuously listens on its receiving port G1 / 0 / 1 within a preset time window to receive the second message sent by SW3 in the network environment. Due to the aforementioned fault configuration, after SW2 forwards the second message to SW1, SW1 will successfully receive the second message from SW3. Each second message carries target parameters such as SW3's root bridge identity number, root path cost, bridge identity number, and port identity number. SW1 records the receiving timestamp of each second message and parses out the aforementioned priority parameters. After receiving each second message, SW1 compares the target parameters of the first and second messages hierarchically according to a preset parameter hierarchy, and SW1 obtains a clear priority result: the first message has a higher priority than the second message.

[0153] Furthermore, within a preset time window, SW1 performs priority monitoring on each received second message. Since the priority of the second messages sent by SW3 is lower than that of the first messages, in multiple message exchanges, when the priority of the first message is higher than that of the second message, the number of target messages that SW1 continuously receives in the second message exceeds a preset threshold. Therefore, based on the spanning tree protocol and a preset fault identification mechanism, SW1 determines that the data characteristics of the second message meet the preset characteristic conditions and identifies a one-way communication fault between SW1 and SW3.

[0154] Then, SW1 sets the port G1 / 0 / 1 that receives the second message from SW3 to a blocked state, prohibiting the port from forwarding any data packets, and sets the protocol status of the port to down (failed state), and marks the reason as "LowbpduBlock" (continuously receiving the second lowest priority BPDU) in the device log or interface status.

[0155] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0156] Based on the same inventive concept, this application also provides a fault monitoring device for implementing the fault monitoring method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more fault monitoring device embodiments provided below can be found in the limitations of the fault monitoring method described above, and will not be repeated here.

[0157] In one exemplary embodiment, such as Figure 10 As shown, a fault monitoring device 1000 is provided, which is applied to a first network device in a network environment, and includes: a transceiver module 1001, a determination module 1002, and a fault identification module 1003, wherein:

[0158] The transceiver module 1001 is used to send a first message to the second network device and receive a second message from the second network device in response to the first message during communication between the first network device and any second network device; the communication priority of the first network device is higher than that of the second network device.

[0159] The determination module 1002 is used to determine the priority result between the first message and the second message according to a preset priority strategy;

[0160] The fault identification module 1003 is used to determine that there is a fault between the first network device and the second network device based on the target protocol and fault judgment rules, if the priority result of multiple message exchanges is that the priority of the first message is higher than that of the second message, and the data characteristics of the second message meet the preset characteristic conditions.

[0161] In one embodiment, the transceiver module 1001 is specifically used to generate a first message based on a target protocol, and send the first message to any second network device in the network environment during the communication process between the first network device and the second network device; the target protocol is the Spanning Tree Protocol.

[0162] Receive the second message from the second network device within the preset time window.

[0163] In one embodiment, the preset priority strategy includes multiple target parameters and parameter levels corresponding to each target parameter; the determining module 1002 is specifically used to compare the target parameters in the first message and the target parameters in the second message level by level according to the parameter levels corresponding to each target parameter, and obtain the priority result between the first message and the second message based on the comparison results of each target parameter.

[0164] In one embodiment, the parameter hierarchy corresponding to the target parameter is, in order, the root bridge identity number, the root path cost, the designated bridge identity number, the designated interface identity number, and the receiving interface identity number.

[0165] In one embodiment, the fault identification module 1003 is specifically used to determine the target number of consecutively received second messages if the priority result of multiple message interactions within a preset time window is that the priority of the first message is higher than that of the second message.

[0166] Based on the target protocol and fault determination rules, if the number of target packets is greater than a preset threshold, it is determined that the data characteristics of the second packet meet the preset characteristic conditions, and it is determined that there is a fault between the first network device and the second network device.

[0167] In one embodiment, the device 1000 further includes:

[0168] The blocking module is specifically used to block the data forwarding function of the target interface in the first network device based on a preset fault setting mechanism; the target interface is the interface in the first network device that communicates with the second network device.

[0169] The status setting module is used to set the protocol status of the target interface to a fault state and record the fault cause as a one-way communication fault.

[0170] In one exemplary embodiment, such as Figure 11 As shown, a fault monitoring device 1100 is provided. This device 1100 is applied to a second network device in a network environment and includes: a monitoring module 1101, a first construction module 1102, a second construction module 1103, and a feedback module 1104, wherein:

[0171] The listening module 1101 is used to generate an initial message based on the target protocol and listen to the receiving interface corresponding to the first network device.

[0172] The first construction module 1102 is used to construct a second message based on the second message construction mechanism and the initial message if the first message is not received based on the receiving interface.

[0173] The second construction module 1103 is used to construct a second message based on a preset priority strategy and a second message construction mechanism, as well as the first message or the initial message, if a first message is received based on the receiving interface.

[0174] Feedback module 1104 is used to feed back the second message to the first network device. The second message is used in the first network device to determine that there is a fault between the first network device and the second network device, based on the target protocol and fault determination rules, if the priority result of multiple message exchanges is that the priority of the first message is higher than that of the second message, and the data characteristics of the second message meet the preset characteristic conditions.

[0175] In one embodiment, the second construction module 1103 is specifically used to determine the priority result between the first message and the initial message according to a preset priority strategy;

[0176] If the priority result shows that the priority of the first message is higher than the priority of the initial message, the message content of the initial message is replaced with the message content of the first message to obtain the second message, and the second message is sent back to the first network device.

[0177] If the priority result shows that the initial message has a higher priority than the first message, the initial message will be sent back to the first network device as the second message.

[0178] Each module in the aforementioned fault monitoring device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each module.

[0179] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 12As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a fault monitoring method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0180] Those skilled in the art will understand that Figure 12 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0181] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0182] During communication between the first network device and any second network device, the first network device sends a first message to the second network device and receives a second message from the second network device in response to the first message; the communication priority of the first network device is higher than that of the second network device.

[0183] The priority result between the first message and the second message is determined according to the preset priority strategy;

[0184] Based on the target protocol and fault determination rules, if the priority result of multiple message exchanges shows that the first message has a higher priority than the second message, and the data characteristics of the second message meet the preset characteristic conditions, it is determined that there is a fault between the first network device and the second network device.

[0185] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0186] A first message is generated based on the target protocol. During the communication between the first network device and the second network device, the first message is sent to any second network device in the network environment. The target protocol is the Spanning Tree Protocol.

[0187] Receive the second message from the second network device within the preset time window.

[0188] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0189] According to the parameter level corresponding to each target parameter, the target parameters in the first message and the target parameters in the second message are compared level by level, and the priority result between the first message and the second message is obtained based on the comparison results of each target parameter.

[0190] In one embodiment, the parameter hierarchy corresponding to the target parameter is, in order, the root bridge identity number, the root path cost, the specified bridge identity number, the specified interface identity number, and the receiving interface identity number.

[0191] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0192] If, during multiple message exchanges within a preset time window, the priority result of the multiple message exchanges indicates that the priority of the first message is higher than that of the second message, the target number of consecutive messages to receive the second message is determined.

[0193] Based on the target protocol and fault determination rules, if the number of target packets is greater than a preset threshold, it is determined that the data characteristics of the second packet meet the preset characteristic conditions, and it is determined that there is a fault between the first network device and the second network device.

[0194] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0195] Based on a preset fault setting mechanism, the data forwarding function of the target interface in the first network device is blocked; the target interface is the interface in the first network device that communicates with the second network device.

[0196] Set the protocol status of the target interface to a fault state and record the fault cause as a one-way communication failure.

[0197] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0198] An initial message is generated based on the target protocol, and the receiving interface corresponding to the first network device is monitored.

[0199] If the first message is not received based on the receiving interface, the second message is constructed according to the second message construction mechanism and the initial message.

[0200] If the first message is received based on the receiving interface, the second message is constructed according to the preset priority policy and the second message construction mechanism, as well as the first message or the initial message;

[0201] The second message is fed back to the first network device. The second message is used in the first network device to determine whether there is a fault between the first network device and the second network device, based on the target protocol and fault determination rules, if the priority result of multiple message exchanges is that the priority of the first message is higher than that of the second message, and the data characteristics of the second message meet the preset characteristic conditions.

[0202] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0203] The priority result between the first message and the initial message is determined according to the preset priority strategy;

[0204] If the priority result shows that the priority of the first message is higher than the priority of the initial message, the message content of the initial message is replaced with the message content of the first message to obtain the second message, and the second message is sent back to the first network device.

[0205] If the priority result shows that the initial message has a higher priority than the first message, the initial message will be sent back to the first network device as the second message.

[0206] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.

[0207] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0208] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0209] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0210] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0211] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A fault monitoring method, characterized in that, The method is applied to a first network device in a network environment, and the method includes: During communication between the first network device and any second network device, the first network device sends a first message to the second network device and receives a second message from the second network device in response to the first message; the communication priority of the first network device is higher than that of the second network device. The priority result between the first message and the second message is determined according to a preset priority strategy; Based on the target protocol and fault determination rules, if the priority result in multiple message exchanges is that the priority of the first message is higher than that of the second message, and the data characteristics of the second message meet the preset characteristic conditions, it is determined that there is a fault between the first network device and the second network device.

2. The method according to claim 1, characterized in that, During the communication process between the first network device and any second network device, sending a first message to the second network device and receiving a second message from the second network device in response to the first message includes: A first message is generated based on a target protocol. During communication between the first network device and the second network device, the first message is sent to any second network device in the network environment. The target protocol is the Spanning Tree Protocol. Receive the second message fed back by the second network device within the preset time window.

3. The method according to claim 1, characterized in that, The preset priority strategy includes multiple target parameters and parameter levels corresponding to each target parameter; The step of determining the priority result between the first message and the second message according to the preset priority strategy includes: According to the parameter level corresponding to each target parameter, the target parameters in the first message and the target parameters in the second message are compared level by level, and the priority result between the first message and the second message is obtained based on the comparison result of each target parameter.

4. The method according to claim 3, characterized in that, The parameter hierarchy corresponding to the target parameters is as follows: root bridge identity number, root path cost, designated bridge identity number, designated interface identity number, and receiving interface identity number.

5. The method according to claim 1, characterized in that, Based on the target protocol and fault determination rules, if the priority result in multiple message exchanges indicates that the first message has a higher priority than the second message, and the data characteristics of the second message meet preset characteristic conditions, it is determined that a fault exists between the first network device and the second network device, including: In multiple message exchanges within a preset time window, if the priority result in the multiple message exchanges is that the priority of the first message is higher than that of the second message, the target number of consecutively received second messages is determined. Based on the target protocol and fault determination rules, if the number of target packets is greater than a preset threshold, it is determined that the data characteristics of the second packet meet the preset characteristic conditions, and it is determined that there is a fault between the first network device and the second network device.

6. The method according to claim 1, characterized in that, Based on the target protocol and fault determination rules, if the priority result in multiple message exchanges indicates that the first message has a higher priority than the second message, and the data characteristics of the second message meet preset characteristic conditions, after determining that a fault exists between the first network device and the second network device, the method further includes: Based on a preset fault setting mechanism, the data forwarding function of the target interface in the first network device is blocked; the target interface is the interface in the first network device that communicates with the second network device. Set the protocol status of the target interface to a fault state and record the fault cause as a one-way communication fault.

7. A fault monitoring method, characterized in that, The method is applied to a second network device in a network environment, and the method includes: An initial message is generated based on the target protocol, and the receiving interface corresponding to the first network device is monitored. If the first message is not received based on the receiving interface, a second message is constructed according to the second message construction mechanism and the initial message. If a first message is received based on the receiving interface, a second message is constructed according to a preset priority policy and a second message construction mechanism, as well as the first message or the initial message. The second message is fed back to the first network device; the second message is used in the first network device to determine that there is a fault between the first network device and the second network device, based on the target protocol and fault determination rules, if the priority result of multiple message exchanges is that the priority of the first message is higher than that of the second message, and the data characteristics of the second message meet the preset characteristic conditions.

8. The method according to claim 7, characterized in that, If a first message is received based on the receiving interface, constructing a second message according to a preset priority policy and a second message construction mechanism, and the first message or the initial message, includes: The priority result between the first message and the initial message is determined according to a preset priority strategy; If the priority result indicates that the priority of the first message is higher than the priority of the initial message, the message content of the initial message is replaced with the message content of the first message to obtain the second message, and the second message is fed back to the first network device. If the priority result indicates that the priority of the initial message is higher than that of the first message, the initial message is sent back to the first network device as the second message.

9. A fault monitoring device, characterized in that, The apparatus is applied to a first network device in a network environment, and the apparatus includes: The transceiver module is used to send a first message to the second network device and receive a second message from the second network device in response to the first message during communication between the first network device and any second network device; the communication priority of the first network device is higher than that of the second network device. The determining module is used to determine the priority result between the first message and the second message according to a preset priority strategy; The fault identification module is used to determine, based on the target protocol and fault determination rules, that if the priority result in multiple message exchanges shows that the priority of the first message is higher than that of the second message, and the data characteristics of the second message meet preset characteristic conditions, a fault exists between the first network device and the second network device.

10. A fault monitoring device, characterized in that, The device is used in a second network device in a network environment, and the device includes: The listening module is used to generate an initial message based on the target protocol and listen to the receiving interface corresponding to the first network device. The first construction module is used to construct a second message according to the second message construction mechanism and the initial message if the first message is not received based on the receiving interface. The second construction module is used to construct a second message based on a preset priority strategy and a second message construction mechanism, and the first message or the initial message, if a first message is received based on the receiving interface. The feedback module is used to feed back the second message to the first network device; the second message is used in the first network device to determine that there is a fault between the first network device and the second network device based on the target protocol and fault determination rules, if the priority result of multiple message exchanges is that the priority of the first message is higher than that of the second message, and the data characteristics of the second message meet the preset characteristic conditions.

11. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6 and 7 to 8.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6 and 7 to 8.