A method, apparatus and device for detecting a two-layer network loop
By constructing redundant links in a Layer 2 network and filtering out ports with no traffic, and combining different types of loop localization algorithms, the complex loop localization problem in existing technologies is solved, achieving fast and intuitive loop detection.
Patent Information
- Application Number
- CN202211539447.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-02
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2042-12-02
AI Technical Summary
Existing technologies require the use of multiple methods to identify Layer 2 network loops. This process is complex, demands high technical skills from maintenance personnel, is time-consuming, and makes it difficult to quickly and intuitively locate the relevant device ports for loops.
In a Layer 2 network, redundant links are constructed by deploying the STP protocol, ports with no traffic are filtered out, different types of loop location algorithms are used to classify loop types, and relevant device ports are marked on the topology map.
It enables quick and intuitive location of ports related to Layer 2 loop devices, reducing the professional knowledge requirements for maintenance personnel and improving operability.
Smart Images

Figure CN115941530B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application generally relate to the field of network communication technology, and in particular, to a method, device and equipment for loop detection in a Layer 2 network. BACKGROUND
[0002] Ethernet is a broadcast-enabled network. When a switch receives a broadcast packet, it will forward the broadcast packet to all interfaces except the receiving port. Once there is a loop in the network, the broadcast packet will be repeatedly forwarded, resulting in a broadcast storm and quickly reaching or approaching the port line speed, and rapidly consuming the link bandwidth. The broadcast packet is not only forwarded on the loop, but the loop device also forwards a copy to other ports, so that the entire network is filled with a large number of duplicate broadcast packets. This seriously affects the normal data service of the network, resulting in poor user communication quality, and even communication interruption.
[0003] Currently, to determine whether there is a Layer 2 loop in the network, four methods can be used to confirm, including checking whether the interface bandwidth traffic is too large, checking MAC drift alarms, deploying loop detection, and checking CPU occupancy. To more accurately determine the loop fault, multiple methods are usually used to comprehensively locate the problem.
[0004] For example, the patent "Network loop problem fast positioning method and system (application number: CN202011111090.3)": a network user discovers that there is an abnormal problem in the network, determines the location and cause of the network loop problem; by checking the traffic variation under the network device port, it is determined whether there is an abnormal problem in the Layer 2 loop, and the existing network abnormal problem is located using the loopback monitoring function of the port. The problem of the Layer 2 loop; detect network connectivity, query the routing table of the network device in the three-layer loop, and track the routing of the loopback node in the three-layer loop by checking the TTL value, and locate the problem of the three-layer loop at the loopback node. This scheme provides a method for quickly locating loop faults according to different causes of problems in Layer 2 loops and three-layer loops, but it is complex to analyze comprehensively based on network, device, and other professional knowledge. Not only is the technical ability of the operation and maintenance personnel required to be high, but the time required for the entire process is also relatively long. SUMMARY
[0005] To solve the above problems, the present application executes the loop positioning algorithm proposed in the present application on the basis of the Layer 2 topology, which can quickly and conveniently locate the device ports related to the Layer 2 loop and identify them on the topology, which is very intuitive. Moreover, it does not require network operation and maintenance personnel to have professional knowledge of networks, devices, and the like, greatly improving the operability.
[0006] According to embodiments of the present application, a method, device and equipment for loop detection in a Layer 2 network are provided.
[0007] In a first aspect of the application, a method for detecting a loop in a two-layer network is provided. The method comprises:
[0008] S01: In a two-layer network, an access layer device forms a loop through redundant links of dual uplinks, and a STP protocol is deployed on a switch to prevent the redundant links in the network from forming a loop;
[0009] S02: The two-layer topology is screened through port traffic, and a device port without traffic is filtered out;
[0010] S03: The loop is divided into a single-port loop, a single-device loop, a double-device loop, or a multi-device loop, and a corresponding loop positioning algorithm is executed;
[0011] S04: Device ports related to the two-layer loop are located and marked on a topology graph.
[0012] Further, the single-port loop in S03 refers to a loop formed by user-side devices.
[0013] Further, the single-port loop positioning algorithm is that if the user-side devices form a loop, the user-side devices will generate a closed storm, and the broadcast storm is propagated to the network side through the downlink port of the access switch. The flow-in rate of unicast packets, broadcast packets, and multicast packets in the downlink port of the access switch is collected, and the proportion of unicast packets is lower than the normal value.
[0014] Further, the number of unicast packets, the number of broadcast packets, and the number of multicast packets are collected through SNMP at a public OID; the increment of the results of two adjacent collections is calculated, and the time interval of the collection is divided to obtain the unicast packet flow-in rate, the broadcast packet flow-in rate, and the multicast packet flow-in rate of the port.
[0015] Further, the single-device loop in S03 refers to two ports of a single switch device being connected to each other.
[0016] Further, the single-device loop positioning algorithm is to traverse each node and check whether the node exists in its adjacency list. If the node does not exist, there is no single-device loop, and if the node exists, there is a single-device loop.
[0017] Further, the double-device loop in S03 refers to four ports of two switch devices being connected to each other.
[0018] Further, the double-device loop positioning algorithm described in S03 is: traversing all circuits, grouping counting: constructing a key-value pair, taking the double-end device of the circuit as the primary key, and agreeing to arrange the device names in ascending order first, and then splice the device names together; traverse all key-value pairs, check if there is a number greater than 1, if there is a circuit number greater than 1, there is a loop between the two, otherwise there is no loop.
[0019] Further, the multi-device loop described in S03 refers to: at least three switch devices are connected end to end, that is, each switch device is directly connected to at least two other switch devices.
[0020] Further, the multi-device loop positioning algorithm described in S03 is: defining the number of devices directly connected to a switch device as the connection number; if the connection number is less than or equal to 1, the device is not a loop device; if the connection number is greater than 1, use a recursive method to remove leaf nodes from the topology, if there are no remaining devices in the final topology, it means that there is no loop in the topology; otherwise, there is a loop in the topology, and the loop is composed of the remaining devices and the corresponding layer 2 circuits.
[0021] In the second aspect of the application, a device for detecting a layer 2 network loop is provided. The device comprises:
[0022] A deployment module is configured to: in a layer 2 network, access layer devices form a loop through redundant links of double uplinks, and deploy an STP protocol on a switch to prevent the redundant links in the network from forming a loop.
[0023] A filtering module is configured to: filter device ports with no traffic by filtering the layer 2 topology through port traffic.
[0024] An execution module is configured to: divide the loop into a single-port loop, a single-device loop, a double-device loop, or a multi-device loop, and execute a corresponding loop positioning algorithm.
[0025] An identification module is configured to: locate device ports related to a layer 2 loop and identify them on a topology graph.
[0026] In the third aspect of the application, an electronic device is provided. The electronic device comprises a memory and a processor, wherein the memory stores a computer program, and the processor executes the program to implement the method according to the first aspect of the application.
[0027] In the fourth aspect of the application, a computer-readable storage medium is provided, which stores a computer program, and the program is executed by a processor to implement the method according to the first aspect of the application.
[0028] The above-mentioned English abbreviations are explained as follows:
[0029] STP: Spanning Tree Protocol, spanning tree protocol
[0030] SNMP: Simple Network Management Protocol, simple network management protocol
[0031] OID: Object Identifier, management information base object identifier
[0032] MAC: Media Access Control, medium access control
[0033] CPU: Central processing unit, central processing unit
[0034] TTL: Time To Live, time to live value
[0035] The application is based on a two-layer topology, and the loop positioning algorithm proposed in the present application can quickly and conveniently locate the device ports related to the two-layer loop and identify them on the topology, which is very intuitive. Moreover, it does not require network operation personnel to have professional knowledge of network and equipment, and the operability is greatly improved.
[0036] It should be understood that the content described in the summary section is not intended to limit or important features of the embodiments of the application, nor is it intended to limit the scope of the application. Other features of the application will become apparent through the following description. BRIEF DESCRIPTION OF DRAWINGS
[0037] The above and other features, advantages, and aspects of the embodiments of the present application will become more apparent with reference to the following detailed description when taken in conjunction with the accompanying drawings, in which:
[0038] Figure 1 A method flowchart for detecting a two-layer network loop according to an embodiment of the present application is shown;
[0039] Figure 2 A schematic diagram showing that an access layer device forms a loop through redundant links of double uplinks according to an embodiment of the present application is shown;
[0040] Figure 3 A schematic diagram showing that a user-side device forms a loop according to an embodiment of the present application is shown;
[0041] Figure 4 A topology schematic diagram of a single-port loop according to an embodiment of the present application is shown;
[0042] Figure 5 A single-device loop schematic diagram according to an embodiment of the present application is shown;
[0043] Figure 6 A topology diagram of a single-device loop according to an embodiment of the present application is shown;
[0044] Figure 7 A double-device loop diagram according to an embodiment of the present application is shown;
[0045] Figure 8 A topology diagram of a double-device loop according to an embodiment of the present application is shown;
[0046] Figure 9 A diagram of a multi-device loop according to an embodiment of the present application is shown;
[0047] Figure 10 A topology diagram of a multi-device loop according to an embodiment of the present application is shown;
[0048] Figure 11 A topology diagram of a multi-device loop according to an embodiment of the present application is shown;
[0049] Figure 12 A device block diagram of a two-layer network loop detection according to an embodiment of the present application is shown;
[0050] Figure 13 A device diagram of a two-layer network loop detection according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0051] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0052] According to the embodiments of the present application, a two-layer network loop detection method, device and equipment are provided. On the basis of a two-layer topology, a loop positioning algorithm provided by the present application is executed to quickly and conveniently locate a two-layer loop related device port and mark it on the topology, which is very intuitive. Moreover, the network operation personnel do not need to have professional network and equipment knowledge, and the operability is greatly improved.
[0053] The principles and spirits of the present application will be explained in detail below with reference to several representative embodiments of the present application.
[0054] Figure 1 is a method flow diagram of a two-layer network loop detection according to an embodiment of the present application. The method comprises:
[0055] S01: In the two-layer network, the access layer device forms a loop through the redundant links of double uplink, and STP protocol is deployed on the switch to prevent the redundant links in the network from forming a loop;
[0056] S02: The two-layer topology is screened through port flow, and the device port without flow is filtered;
[0057] S03: The loop is divided into single-port loop, single-device loop, double-device loop or multi-device loop, and the corresponding loop positioning algorithm is executed;
[0058] S04: The device port related to the two-layer loop is located and marked on the topology graph.
[0059] It should be noted that although the operations of the method of the present application are described in a specific order in the above embodiments and drawings, this does not require or imply that the operations must be performed in this specific order or that all the shown operations must be performed to achieve the desired result. Additionally or alternatively, certain steps can be omitted, multiple steps can be combined into one step, and / or one step can be divided into multiple steps.
[0060] In order to more clearly explain the method of detecting the two-layer network loop, a specific embodiment will be described below, however, it should be noted that this embodiment is only for better illustrating the present application and does not constitute an improper limitation on the present application.
[0061] The method of detecting the two-layer network loop will be further described in more detail below with a specific example:
[0062] In the two-layer network, in order to improve network reliability, redundant devices and redundant links are usually used. Then various loop protection protocols are deployed to eliminate loops. As shown in the figure, the access layer device forms a loop through the redundant links of double uplink. The STP protocol is deployed on the switch to prevent the redundant links in the network from forming a loop, in short, the redundant links are not allowed to forward data packets. Figure 2
[0063] Therefore, when diagnosing the loop, the two-layer topology needs to be screened through port flow, and the device port without flow is filtered. Because of the broadcast mechanism based on the two-layer network, if a device port has no flow, the device port must not participate in the loop. The two-layer topology mentioned below refers to the device port with network flow.
[0064] The loop is further divided here and the positioning algorithm is described respectively.
[0065] I. Single-port loop
[0066] As Figure 3 shown, below the dividing line is the user side equipment, which is invisible to us. Above the dividing line is the network side equipment, which is the equipment we can manage.
[0067] According to the broadcast principle, if the user side equipment forms a loop (as shown by the Lan in Figure 3 ), a broadcast storm will be generated in the Lan. The broadcast storm of the Lan will spread to the network side through the downlink port (such as GE0 / 0 / 1 in Figure 3 ) of the access switch, as shown by the arrow in Figure 3 , thereby affecting the overall performance of the network side equipment. Therefore, by collecting the flow direction packet rate of the unicast packet, broadcast packet and multicast packet of the downlink port of the access switch, if the proportion of the unicast packet is lower than the threshold value, it means that a single port loop occurs.
[0068] The number of unicast packet, broadcast packet and multicast packet of the switch port can be collected by the public OID of SNMP at regular intervals. The increment of the results of the adjacent two times of collection is calculated, and then divided by the time interval of the collection, so as to obtain the flow rate of the unicast packet, broadcast packet and multicast packet of the port, as shown in Table 1:
[0069] Table 1
[0070] Gathered metrics OID Inbound unicast packet 1.3.6.1.2.1.2.2.1.1.1 Inbound broadcast packet 1.3.6.1.2.1.31.1.1.1.3 Inbound multicast packet 1.3.6.1.2.1.31.1.1.1.2
[0071] The topology diagram of the single port loop is shown in Figure 4 .
[0072] II. Single equipment loop
[0073] Two ports of a single switch equipment are connected together, thereby forming a loop. The diagram is shown in Figure 5 : port a and port h form a loop.
[0074] The topology diagram of the single equipment loop is shown in Figure 6 .
[0075] We use the adjacency list to represent the two-layer topology. The diagram is as follows:
[0076] graph={}
[0077] graph['a']={'b','c','d'}
[0078] graph['b']={'a','e','i'}
[0079] graph['c']={'a','f'}
[0080] graph['d'] = {'a', 'g', 'h'}
[0081] graph['i'] = {'b'}
[0082] graph['e'] = {'b', 'j'}
[0083] graph['f'] = {'c'}
[0084] graph['g'] = {'d'}
[0085] graph['h'] = {'d'}
[0086] graph['j'] = {'e', 'j'}
[0087] Computing method:
[0088] Traverse each node, check if there is a self node in its adjacency list, as shown in Table 2:
[0089] Table 2
[0090] Step Check contents Conclusion 1 Check node a, adjacency table contents 'b', 'c', 'd' No single device loop 2 Check node b, adjacency table contents 'a', 'e', 'i' No single device loop 3 Check node c, adjacency table contents 'a', 'f' No single device loop 4 Check node d, adjacency table contents 'a', 'g', 'h' No single device loop 5 Check node i, adjacency table contents 'b' No single device loop 6 Check node e, adjacency table contents 'b', 'j' No single device loop 7 Check node f, adjacency table contents 'c' No single device loop 8 Check node g, adjacency table contents 'd' No single device loop 9 Check node h, adjacency table contents 'd' No single device loop 10 Check node j, adjacency table contents 'e', 'j', found self in adjacency table Single device loop
[0091] Three, double equipment loop
[0092] 2 switch equipment 4 ports are connected together, thus forming a loop, as shown in Figure 7 as shown in the topological diagram Figure 8
[0093] For ease of description, we number the circuits between devices in the topology, the numbering order is: from left to right, from top to bottom. The circuit numbering order does not affect the final result, even if we use from bottom to top, from right to left, there is no any influence.
[0094] Computing method:
[0095] Group count for circuits. Group by double-ended devices, accumulate the number of circuits between double-ended devices. If the number of circuits is greater than 1, there is a loop between the corresponding 2 devices.
[0096] Specific calculation steps:
[0097] 1, traverse all circuits, group count, as shown in Table 3. The specific method is to construct a key-value pair (key=>value), the advantage of this data structure is that the query efficiency is extremely high. Take the double-ended device of the circuit as the primary key, because it involves 2 devices, it is uniformly agreed that the device name will be arranged in ascending order first, and then the device name will be spliced together. For example, devices a and b, the primary key is (a, b).
[0098] Table 3
[0099]
[0100]
[0101]
[0102] 2. Traverse all key-value pairs, check if there is a case where the number is greater than 1.
[0103] After the first step of processing, the key-value pairs are obtained as follows:
[0104] (a, b) => 1
[0105] (a, c) => 1
[0106] (a, d) => 1
[0107] (b, i) => 1
[0108] (b, e) => 1
[0109] (c, f) => 1
[0110] (d, g) => 1
[0111] (d, h) => 1
[0112] (e, j) => 2
[0113] Traverse the above data for checking, it is found that the number of circuits between devices e and j is greater than 1, and there is a loop between them.
[0114] Four, multi-device loop
[0115] Take the case of 3 devices as an example, as shown in 9.
[0116] According to Figure 9 , it can be found that for the case of multi-device loop, the devices are connected end to end, and each device must have at least 2 circuits directly connected to other devices. In order to facilitate the description, we define a concept of link degree, the link degree of a certain device is equal to the number of devices directly connected to it, and the link degree is a non-negative integer. In other words, for loop devices, linkdegree > 1. For example, in Figure 9 , the link degree of the three switches is 2.
[0117] On the contrary, if the number of connections of a device is less than or equal to 1, then the device must not be a loop device (hereinafter, the device with the number of connections less than or equal to 1 is referred to as a leaf node). Therefore, we remove the leaf nodes from the topology in a recursive manner. If there is no remaining device in the final topology, then there is no loop in the topology; otherwise, there is a loop in the topology, and the loop is composed of the remaining devices and corresponding layer-2 circuits. Therefore, the algorithm finally outputs two key information: 1) whether there is a loop in the layer-2 topology; and 2) if there is a loop, the devices and circuits related to the loop.
[0118] For a layer-2 topology with a loop, an example is shown in Figure 10 .
[0119] In the figure, the English letters represent switch devices, and the line segments with arrows represent layer-2 circuits between switches.
[0120] We use an adjacency list to represent the layer-2 topology. An example is shown as follows:
[0121] graph={}
[0122] graph['a']={'b','c','d'}
[0123] graph['b']={'a','e','i'}
[0124] graph['c']={'a','f'}
[0125] graph['d']={'a','g','h'}
[0126] graph['i']={'b'}
[0127] graph['e']={'b','j'}
[0128] graph['f']={'c','g'}
[0129] graph['g']={'d','f'}
[0130] graph['h']={'d'}
[0131] graph['j']={'e'}
[0132] Explanation: graph['a']={'b','c','d'} means that switch a is directly connected to switches b, c, and d. Obviously, the degree of a is 3. Similarly, the degrees of other switches are calculated.
[0133] Define a FIFO (First In First Out) queue to store the leaf nodes in the two-layer topology.
[0134] import queue
[0135] #FIFO queue
[0136] leaf = queue.Queue()
[0137] Initialize the FIFO queue.
[0138] Iterate through all the devices in the topology and add the leaf nodes to the queue
[0139] for i in graph:
[0140] linkdegree = len(graph[i])
[0141] if linkdegree <= 1:
[0142] leaf.put(i)
[0143] Define a function to perform the operation of deleting leaf nodes from the topology, as shown below:
[0144]
[0145] Iterate through the leaf nodes in the queue and execute the above deletion function until the queue is empty:
[0146] while not leaf.empty(): # Take leaf nodes from the queue in order and execute the function deleaf.
[0147] Until the queue is empty;
[0148] curleaf = leaf.get()
[0149] delleaf(curleaf)
[0150] After the above operation, if there are remaining nodes in the topology, it means that there is a loop in the topology and the loop is composed of these remaining nodes. If there are no remaining nodes, it means that there is no loop in the topology. Taking the above figure as an example, the final remaining nodes are a, c, d, f, g, and the loop is shown as Figure 11 .
[0151] For ease of understanding, taking the above two-layer topology as an example, we describe the calculation process of our algorithm step by step, as shown in Table 4:
[0152] Table 4
[0153]
[0154]
[0155] Further, the case of loop-free topology is illustrated, as shown in Table 5:
[0156] Table 5
[0157]
[0158]
[0159]
[0160] Finally, the topology has no remaining nodes, so it is illustrated that there is no loop in the two-layer topology.
[0161] Based on the same inventive concept, the application further provides a device for detecting loops in a two-layer network. The implementation of the device can refer to the implementation of the above-mentioned method, and the repeated parts will not be described here. As shown in Figure 12 the device 100 comprises:
[0162] a deployment module 101: configured to deploy an STP protocol on a switch in a two-layer network to prevent the formation of a loop in the network by a redundant link of a dual uplink of an access layer device;
[0163] a filtering module 102: configured to filter a device port without traffic by port traffic to screen the two-layer topology;
[0164] an execution module 103: configured to divide the loop into a single-port loop, a single-device loop, a double-device loop, or a multi-device loop, and execute a corresponding loop positioning algorithm;
[0165] an identification module 104: configured to locate a device port related to the two-layer loop and identify it on a topology graph.
[0166] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the described modules can refer to the corresponding process in the foregoing method embodiments, which will not be described here.
[0167] As Figure 13As shown, the device includes a central processing unit (CPU) which can perform various appropriate actions and processes according to computer program instructions stored in a read only memory (ROM) or computer program instructions loaded from a storage unit into a random access memory (RAM). In the RAM, various programs and data required for operation of the device can also be stored. The CPU, the ROM, and the RAM are connected to each other through a bus. An input / output (I / O) interface is also connected to the bus.
[0168] A plurality of components in the device are connected to the I / O interface, including: an input unit such as a keyboard, a mouse, etc.; an output unit such as various types of displays, speakers, etc.; a storage unit such as a magnetic disk, a magneto optical disk, etc.; and a communication unit such as a network card, a modem, a wireless communication transceiver, etc. The communication unit allows the device to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0169] The processing unit performs the various methods and processes described above, such as the methods S01-S04. For example, in some embodiments, the methods S01-S04 can be implemented as a computer software program tangibly embodied in a machine readable medium, such as the storage unit. In some embodiments, part or all of the computer program can be loaded onto and / or installed on the device via the ROM and / or the communication unit. When the computer program is loaded onto the RAM and executed by the CPU, one or more steps of the methods S01-S04 described above can be performed. Alternatively, in other embodiments, the CPU can be configured to perform the methods S01-S04 by any other appropriate means, such as by means of firmware.
[0170] The functionality described above in this document can be performed, at least in part, by one or more hardware logic components. For example, and without limitation, example types of hardware logic components that can be used include Field-programmable Gate Arrays (FPGAs), Application-specific Integrated Circuits (ASICs), Application-specific Standard Products (ASSPs), System-on-a-chip systems (SOCs), Complex Programmable Logic Devices (CPLDs), etc.
[0171] Program code for carrying out the methods of the present application can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, causes the machine to perform the functions / acts specified in the flow diagrams and / or block diagrams. The program code can execute entirely on a machine, partly on a machine, as a stand-alone software package, partly on a machine and partly on a remote machine or entirely on a remote machine or server.
[0172] In the context of the present application, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.
[0173] Moreover, while operations have been depicted in a particular order, this should not be understood as requiring such order nor that all illustrated operations be performed, to achieve desirable results. In certain circumstances, multitasking and parallel processing can be advantageous. Likewise, while several specific implementation details have been discussed, these should not be construed as limitations on the scope of the present application. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable sub-combination.
[0174] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.
Claims
1. A method for detecting loops in a two-layer network, characterized in that, The method includes: S01: In a Layer 2 network, access layer devices form loops through redundant links with dual uplinks. The STP protocol is deployed on the switch to prevent redundant links in the network from forming loops. S02: Filter the Layer 2 topology by port traffic, filtering out device ports with no traffic; S03: Determine the loop: single-port loop, single-device loop, dual-device loop, or multi-device loop, and execute the corresponding loop location algorithm. The single-port loop refers to a loop formed by user-side devices. The single-port loop location algorithm is as follows: if user-side devices form a loop, the user-side devices will generate a shutdown storm. The broadcast storm propagates to the network side through the downstream port of the access switch. Collect the packet rate of unicast packets, broadcast packets, and multicast packets in the inflow direction of the downstream port of the access switch. The proportion of unicast packets is lower than the normal value. S04: Locate the device ports related to the Layer 2 loop and mark them on the topology diagram.
2. The method for detecting loops in a two-layer network according to claim 1, characterized in that, The number of unicast packets, broadcast packets, and multicast packets are collected periodically using SNMP on the common OID. For the results of two consecutive collections, the increment is calculated and divided by the collection time interval to obtain the unicast packet inflow rate, broadcast packet inflow rate, and multicast packet inflow rate of the port.
3. The method for detecting loops in a two-layer network according to claim 1, characterized in that, The single-device loop mentioned in S03 refers to the interconnection of two ports of a single switch device.
4. The method for detecting loops in a two-layer network according to claim 1, characterized in that, The algorithm for locating a single-device loop is as follows: traverse each node and check if its own node exists in its adjacency list. If its own node does not exist, there is no single-device loop; if its own node exists, there is a single-device loop.
5. The method for detecting loops in a two-layer network according to claim 1, characterized in that, The dual-device loop mentioned in S03 refers to the interconnection of the four ports of two switch devices.
6. The method for detecting loops in a two-layer network according to claim 1, characterized in that, The dual-device loop location algorithm described in S03 is as follows: Traverse all circuits and count in groups: Construct a key-value pair with the dual-end devices of the circuit as the primary key. It is agreed that the device names will be sorted in ascending order first, and then the device names will be concatenated together; Traverse all key-value pairs and check if there is a case where the number is greater than 1. If there is a case where the number of circuits is greater than 1, then there is a loop between the two; otherwise, there is no loop.
7. The method for detecting loops in a two-layer network according to claim 1, characterized in that, The multi-device loop described in S03 refers to at least three switch devices connected end-to-end, meaning that each switch device has at least two circuits directly connected to other switch devices.
8. The method for detecting loops in a two-layer network according to claim 1, characterized in that, The multi-device loop location algorithm described in S03 is as follows: the number of devices directly connected to a switch is defined as the connection number; if the connection number is less than or equal to 1, then the device is not a loop device; if the connection number is greater than 1, then a recursive method is used to remove leaf nodes from the topology; if there are no remaining devices in the final topology, then there is no loop in the topology; otherwise, there is a loop in the topology, and the loop is composed of the remaining devices and the corresponding Layer 2 circuits.
9. A device for detecting loops in a two-layer network, characterized in that, The device includes: Deployment module: Used in a Layer 2 network, where access layer devices form loops through redundant links with dual uplinks, deploying the STP protocol on the switch to prevent redundant links in the network from forming loops; Filtering module: Used to filter Layer 2 topology based on port traffic, filtering out device ports with no traffic; Execution module: Used to classify loops as single-port loops, single-device loops, dual-device loops, or multi-device loops, and execute the corresponding loop location algorithm. A single-port loop refers to a loop formed by user-side devices. The single-port loop location algorithm is as follows: If user-side devices form a loop, the user-side devices will generate a shutdown storm. The broadcast storm propagates to the network side through the downstream port of the access switch. The packet rate of unicast packets, broadcast packets, and multicast packets in the inflow direction of the downstream port of the access switch is collected. The proportion of unicast packets is lower than the normal value. Identification module: Used to locate the device ports related to the Layer 2 loop and mark them on the topology diagram.
10. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 9.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Methods and Systems for Rapid Loop Location in Networks
CN112260922B
Ethernet loop detecting and processing method based on IPRAN equipment
CN105897515A
EPON accurate loop detection method based on geographic information positioning
CN108123752A