A loop detection method and apparatus
By receiving and recording the area identifier and hop count of loop detection messages, the system automatically detects and blocks ports that do not meet the requirements, thus solving the loop problem caused by incorrect wiring in the campus network and avoiding network forwarding storms and business shutdowns.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NEW H3C TECH CO LTD
- Filing Date
- 2023-03-22
- Publication Date
- 2026-06-05
AI Technical Summary
In the campus network, loop problems caused by incorrect cabling are difficult to detect and eliminate automatically, leading to network forwarding storms and prolonged business shutdowns.
By receiving and recording the area identifier and hop count of loop detection messages, and comparing and blocking ports that do not meet the conditions, automated loop detection and blocking are achieved, avoiding manual troubleshooting of loop faults.
It effectively blocks loops caused by faulty connections within the campus network, avoiding prolonged business outages due to loop storms and improving the efficiency of automated network management.
Smart Images

Figure CN116319478B_ABST
Abstract
Description
Technical Field
[0001] This application relates to communication technology, specifically a loop detection method and device. Background Technology
[0002] With the development and changes in IT infrastructure, mobile internet, and other technologies, campus network security measures and approaches face numerous challenges. The types and numbers of mobile terminals in campus networks are increasing, and any single terminal device could potentially become a springboard for intrusion into the entire campus network.
[0003] The campus network should construct a layered, in-depth security defense system centered on "traffic paths." This involves rationally dividing security zones to define security defense boundaries, including internet access zones, WAN access zones, user access zones, and server access zones. Therefore, within the campus network, specific backbone devices between zones are connected, while leaf switches or downstream devices of leaf switches between different zones are not connected. However, during the implementation of the campus network plan, if network devices that are not allowed to be interconnected create loops due to incorrect wiring, manually correcting the wiring errors is not only labor-intensive but also requires shutting down the entire area to investigate the wiring errors in order to prevent forwarding storms caused by the loops. Summary of the Invention
[0004] The purpose of this application is to provide a loop detection method and device to find loops caused by the interconnection of devices in different areas of a park.
[0005] To achieve the above objectives, this application provides a loop detection method, which includes: receiving a first loop detection message through a first port; recording loop detection information; wherein the loop detection information records the first area identifier and first hop number carried in the first loop detection message corresponding to the receiving port of the first loop detection message; decrementing the first hop number of the first loop detection message by one and sending it through ports other than the first port; receiving a second loop detection message through a second port; determining that the second area identifier carried in the second loop message is different from the first area identifier; determining that the second hop number carried in the second loop message is less than the first hop number, and blocking the second port.
[0006] To achieve the above objectives, this application also provides a loop detection device, which includes a processor and a memory; the memory is used to store processor-executable instructions; wherein, the processor executes the processor-executable instructions in the memory to perform the following operations: receiving a first loop detection message through a first port; recording loop detection information; wherein the loop detection information records the first region identifier and first hop number carried in the first loop detection message corresponding to the receiving port of the first loop detection message; decrementing the first hop number of the first loop detection message by one and sending it through ports other than the first port; receiving a second loop detection message through a second port; determining that the second region identifier carried in the second loop message is different from the first region identifier; determining that the second hop number carried in the second loop message is less than the first hop number, and blocking the second port.
[0007] The beneficial effect of this application is that it blocks loops caused by incorrect connections between different areas within the campus network, thus avoiding prolonged business downtime caused by loop storms when manually troubleshooting loop faults. Attached Figure Description
[0008] Figure 1 A flowchart illustrating an embodiment of the loop detection method provided in this application;
[0009] Figure 2A-2B The diagram shown is a loop detection network provided in an embodiment of this application;
[0010] Figure 3 This is a schematic diagram of an embodiment of the loop detection device provided in this application. Detailed Implementation
[0011] The following detailed description will be provided with reference to several examples illustrated in the accompanying figures. In this detailed description, numerous specific details are used to provide a comprehensive understanding of the present application. Known methods, steps, components, and circuits are not described in detail in the examples to avoid obscuring their meaning.
[0012] In the terminology used, the term "including" means including but not limited to; the term "containing" means including but not limited to; the terms "above," "within," and "below" include the number itself; the terms "greater than" and "less than" mean not including the number itself. The term "based on" means based on at least a portion of them.
[0013] Figure 1 A flowchart of an embodiment of the loop detection method provided in this application; the embodiment includes:
[0014] Step 101: Receive the first loop detection message through the first port;
[0015] Step 102: Record loop detection information; wherein, the loop detection information records the first area identifier and the first hop number carried in the first loop detection message corresponding to the receiving port of the first loop detection message;
[0016] Step 103: Decrement the first hop count of the first loop detection message by one and send it through all ports except the first port;
[0017] Step 104: Receive the second loop detection message through the second port;
[0018] Step 10: Determine that the second area identifier carried in the second loop message is different from the first area identifier;
[0019] Step 106: Determine that the second hop count carried by the second loop message is less than the first hop count, and block the second port.
[0020] Figure 1 The beneficial effect of this embodiment is that it blocks loops caused by incorrect connections between different areas within the campus network, avoiding prolonged business downtime caused by loop storms when manually troubleshooting loop faults.
[0021] Figure 2A-2B The diagram shown is a loop detection schematic provided in an embodiment of this application. Figure 2A-2B In this network, Layer 2 switches are categorized by role into backbone switches, leaf switches, and access switches. Backbone switches Spine1 and Spine2 are connected to Layer 3 switches via Equal Cost Multiple Path (ECMP). Switches Access13, 14, and 15, belonging to Area 1, are configured with the area identifier Site1 and the maximum access tier (hop count). Switches Leaf21 and Leaf22, belonging to Area 2, are configured with the area identifier Site2 and the optimal access tier. The maximum access tiers configured for the leaf switches in Area 1 and Area 2 are the same.
[0022] The downlink ports of switches Leaf11, Leaf12, Leaf21, and Leaf22 are enabled with the link layer loop discovery function, and periodically send LLDP (Link Layer Discovery Protocol) protocol messages with area identifier and maximum access layer. The custom TLV (Time-Length-Value) field of the LLDP protocol message can carry the area identifier, and the TTL (Time to Live) field carries the access layer number (hop count).
[0023] Figure 2AIn the middle, switches Leaf21 and Leaf22 send loop detection messages 201 and 202; the area identifier is site2 and TTL=3.
[0024] Switch Access24 records loop detection information based on the loop detection message 201 received from switch Leaf21; this includes the receiving port corresponding to the area identifier site2 and the access layer TTL=3. Switch Access24 then decrements the TTL carried in the received loop detection message 201 by 1 and sends a loop detection message 201 with TTL=2 to switches Access25 and Leaf22 (not shown in the figure) through other link layer ports.
[0025] When switch Access24 receives loop detection message 202, it first compares the recorded loop detection information with the area identifier of loop detection message 202. If they are the same, it then compares the port priority (such as port bandwidth and port identifier) of the receiving port of the loop detection information with that of the receiving port of loop detection message 202. If the receiving port of the loop detection information has a higher priority, it does not update the receiving port of the loop detection information, decrements the access layer carried in loop detection message 202 by 1, and then sends loop detection message 202 with TTL=2 to switch Access25 and switch Leaf21 (not shown in the figure).
[0026] The Leaf22 switch received a loop detection message 201 with TTL=2 through the port connected to the Access24 switch. It determined that the area identifier carried was the same and discarded it.
[0027] The Leaf21 switch received a loop detection message 202 with TTL=2 through the port connected to the Access24 switch. It determined that the area identifier carried was the same and discarded it.
[0028] When switch Access25 receives loop detection message 201 with TTL=2, it records the loop detection information, including the area identifier site2 corresponding to the receiving port and the access layer TTL=2; it decrements the TTL by 1, and then sends loop detection message 201 with TTL=1 to terminals T19 and T26.
[0029] When switch Access25 receives loop detection message 202 with TTL=2, it compares the recorded loop detection information with the area identifier and access layer of loop detection message 202 and determines that they are the same. It then compares the receiving port of the loop detection information with the receiving port of loop detection message 202 and determines that the port priority is higher. It decrements the TTL carried in loop detection message 202 by 1 and then sends it to terminals T19 and T26 respectively. Terminal T26 receives loop detection messages 201 and 202, determines that there are no other link layer ports locally, and discards them without forwarding them.
[0030] Figure 2B In the middle, switches Leaf11 and Leaf12 send loop detection messages 203 and 204, respectively; which carry the area identifier site1 and TTL=3.
[0031] Based on the loop detection message 203 received from switch Leaf11, switch Access15 records loop detection information, including the area identifier site1 corresponding to the receiving port and the access layer TTL=3.
[0032] Switch Access15 will receive the loop detection message 203 and send the TTL decremented by 1 through other link layer ports. One copy will be sent to terminal T19, and the other copy will be sent to switch Leaf12 (not shown in the figure).
[0033] When terminal T19 receives loop detection message 203 with TTL=2, it decrements the access layer TTL=2 by 1 and then sends loop detection message 203 to switch Access25 through other link layer ports.
[0034] When switch Access15 receives loop detection message 204, it compares the loop detection information with the area identifier and TTL carried in loop detection message 203. If it determines that the loop detection information and the received loop detection message 203 have the same area identifier (site1) and access layer TTL=3, it compares the port priorities of the receiving ports of loop detection messages 203 and 203. It then compares the priority of the receiving port in the loop detection information with the priority of the receiving port in loop detection message 204. If it determines that the port priority of the loop detection information is higher than that of the receiving port in loop detection message 204, it does not update the recorded loop detection information based on loop detection message 204.
[0035] The Access15 switch will receive the loop detection message 204, which carries the access layer minus 1, and send it to the terminal T19 and the switch Leaf11 (not shown in the figure) through other link layer ports.
[0036] When switches Leaf11 and Leaf12 receive loop detection messages 204 and 203 respectively through the ports connected to switch Access15, they determine that the area identifiers they carry are the same and discard them.
[0037] Figure 2A and Figure 2B In this process, the loop detection messages 201 and 202 are sent to switch Access25 with fewer hops than the loop detection messages 203 and 204 are sent to switch Access25.
[0038] Similarly, the loop detection messages 203 and 204 have fewer hops when sent to switch Access15 than the loop detection messages 201 and 202.
[0039] Terminal T19 receives loop detection message 203 with TTL=2, decrements TTL by 1, and then sends loop detection message 203 with TTL=1 to switch Access25.
[0040] Terminal T19 receives loop detection message 201 with TTL=1, decrements TTL by 1, and then sends loop detection message 201 with TTL=0 to switch Access15.
[0041] When switch Access25 receives loop detection message 203 through port T19, it compares the area identifier site2 recorded in the loop detection information log with the area identifier site1 of the loop detection message 203. Since the area identifier site2 is different, and the access layer TTL of the loop detection information log is 2, which is greater than the access layer TTL of 1 carried in the received loop detection message 203, the port receiving the loop detection message 203 is blocked; that is, the port connected to terminal T19 is blocked. Thus, terminal T19 fails to continue sending loop detection message 204 to switch Access25.
[0042] When a port on the Access25 switch becomes blocked in a connection loop, it outputs a loop alarm message. This message includes the blocked port and the loop detection message 203 received by the blocked port, which carries the area identifier site1 and the access layer TTL=1. This allows network administrators to locate the loop fault based on the area identifier and access layer.
[0043] Similarly, Figure 2A and Figure 2B middle,
[0044] When switch Access15 receives a loop detection message 201 with a TTL of 0 via port T19, it determines not to forward the loop detection message 201 through other ports. It compares the loop detection information recorded at site1 with the area identifier site2 of the loop detection message 201, and finds that the access layer TTL of the loop detection information recorded at site1 is different from that of the received loop detection message 201, which has a TTL of 2 greater than that of the received loop detection message 201. Therefore, it blocks the port that received the loop detection message 201; that is, it blocks the port connected to terminal T19. Terminal T19 can no longer send loop detection messages 202 to switch Access15.
[0045] When a port on the Access15 switch becomes blocked in a connection loop, it outputs a loop alarm message. This message includes the blocked port and the loop detection message 201 received by the blocked port, which carries the area identifier site2 and the access layer TTL=0. This allows network administrators to locate the loop fault based on the area identifier and access layer without having to manually locate the fault by cutting off the entire campus service forwarding, thus avoiding large-scale service outages within the campus network.
[0046] Figure 2A and 2B In this application, the processing mechanism for loop detection messages received by switches Access13, 14, and 23 is the same as that of switches Access15, 24, and 25. This application uses the LLDP protocol for loop detection and employs various campus network topologies, including but not limited to VLAN networks, VXLAN networks, and MPLS networks.
[0047] Figure 3 The diagram shown is a schematic representation of an embodiment of the loop detection device provided in this application. The device 30 includes a processor and a memory. The memory stores processor-executable instructions. The processor executes the processor-executable instructions in the memory to perform the following operations: receiving a first loop detection message through a first port; recording loop detection information; wherein the loop detection information records the first region identifier and first hop count carried in the first loop detection message corresponding to the receiving port of the first loop detection message; decrementing the first hop count of the first loop detection message by one and sending it through ports other than the first port; receiving a second loop detection message through a second port; determining that the second region identifier carried in the second loop message is different from the first region identifier; determining that the second hop count carried in the second loop message is less than the first hop count, and blocking the second port.
[0048] The processor executes processor-executable instructions in memory to perform the following operations: receive a third loop detection message through the third port; determine the first region identifier and first hop number carried in the second loop message; determine the first region identifier and first hop number that are the same as those recorded in the loop detection information of the second loop message; compare the priorities of the first port and the third port; when the port priority of the first port is higher, decrement the first hop number of the third loop detection message by one and send it through ports other than the third port; when the port priority of the third port is higher, update the first port recorded in the loop detection information to the third port, decrement the first hop number of the third loop detection message by one and send it through ports other than the third port.
[0049] The processor executes processor-executable instructions in memory to perform the following operations: receive fourth loop detection information through the fourth port; determine that the first region identifier and hop count carried in the fourth loop detection information are zero; and discard the fourth loop detection information.
[0050] The processor executes processor-executable instructions in memory to perform the following operations: receive fourth loop detection information through the fourth port; determine that the second region identifier and hop count carried in the fourth loop detection information are zero; block the fourth port and discard the fourth loop detection information.
[0051] The processor executes processor-executable instructions in memory to perform the following operations: outputting loop fault alarm information including the blocked second port, the second region identifier, and the second hop count; outputting loop fault alarm information including the blocked fourth port, the second region identifier, and a hop count of zero.
[0052] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A loop detection method, characterized in that, The method includes: Receive the first loop detection message through the first port; Record loop detection information; wherein, the loop detection information records the first area identifier and the first hop number carried in the first loop detection message corresponding to the receiving port of the first loop detection message; The first hop count of the first loop detection message is reduced by one and sent through ports other than the first port; Receive the second loop detection message through the second port; It was determined that the second region identifier carried in the second loop detection message was different from the first region identifier; If the second loop detection message is found to have a second hop count that is less than the first hop count, the second port is blocked.
2. The method according to claim 1, characterized in that, The method further includes: Receive third loop detection messages through the third port; Determine the first region identifier and the first hop count carried in the third loop detection message; The third loop detection message records the same first area identifier and first hop number as the loop detection information; Compare the priorities of the first port and the third port; When the port priority of the first port is high, the first hop count of the third loop detection message is reduced by one and sent through ports other than the third port; When the port priority of the third port is high, the first port recorded in the loop detection information is updated to the third port, the first hop count of the third loop detection message is reduced by one, and it is sent through ports other than the third port.
3. The method according to claim 1, characterized in that, The method further includes: Receive fourth loop detection information through the fourth port; The fourth loop detection information is determined to carry the region identifier of the first region identifier and the hop count is zero; The detection information of the fourth loop is discarded.
4. The method according to claim 1, characterized in that, The method further includes: Receive fourth loop detection information through the fourth port; The fourth loop detection information is determined to carry the area identifier of the second area identifier and the hop count is zero; The fourth port is blocked, and the fourth loop detection information is discarded.
5. The method according to claim 2, characterized in that, The method also includes, The output includes loop fault alarm information for the blocked second port, the second area identifier, and the second hop count.
6. The method according to claim 4, characterized in that, The method also includes, The output includes the blocked fourth port, the second area identifier, and a loop fault alarm message with a hop count of zero.
7. A loop detection device, characterized in that, The device includes a processor and a memory; the memory stores processor-executable instructions; wherein the processor executes the processor-executable instructions in the memory to perform the following operations: Receive the first loop detection message through the first port; Record loop detection information; wherein, the loop detection information records the first area identifier and the first hop number carried in the first loop detection message corresponding to the receiving port of the first loop detection message; The first hop count of the first loop detection message is reduced by one and sent through ports other than the first port; Receive the second loop detection message through the second port; It was determined that the second region identifier carried in the second loop detection message was different from the first region identifier; If the second loop detection message is found to have a second hop count that is less than the first hop count, the second port is blocked.
8. The device according to claim 7, characterized in that, The processor performs the following operations by executing processor-executable instructions in the memory: Receive third loop detection messages through the third port; Determine the first region identifier and the first hop count carried in the third loop detection message; The third loop detection message records the same first area identifier and first hop number as the loop detection information; Compare the priorities of the first port and the third port; When the port priority of the first port is high, the first hop count of the third loop detection message is reduced by one and sent through ports other than the third port; When the port priority of the third port is high, the first port recorded in the loop detection information is updated to the third port, the first hop count of the third loop detection message is reduced by one, and it is sent through ports other than the third port.
9. The device according to claim 7, characterized in that, The processor performs the following operations by executing processor-executable instructions in the memory: Receive fourth loop detection information through the fourth port; The fourth loop detection information is determined to carry the region identifier of the first region identifier and the hop count is zero; The detection information of the fourth loop is discarded.
10. The device according to claim 7, characterized in that, The processor performs the following operations by executing processor-executable instructions in the memory: Receive fourth loop detection information through the fourth port; The fourth loop detection information is determined to carry the area identifier of the second area identifier and the hop count is zero; The fourth port is blocked, and the fourth loop detection information is discarded.
11. The device according to claim 8, characterized in that, The processor performs the following operations by executing processor-executable instructions in the memory: The output includes loop fault alarm information for the blocked second port, the second area identifier, and the second hop count.
12. The device according to claim 10, characterized in that, The processor performs the following operations by executing processor-executable instructions in the memory: The output includes the blocked fourth port, the second area identifier, and a loop fault alarm message with a hop count of zero.