A method and apparatus for detecting a link
By identifying and blocking ports that do not support the STP protocol, the problem of loop storms in the campus network was solved, effectively blocking loops and improving network security.
Patent Information
- Application Number
- CN202310377335.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-31
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2043-03-31
AI Technical Summary
In the campus network, unauthorized devices that do not support the STP protocol cause loop storms to go undetected, and existing technologies are unable to effectively block the loops.
By identifying ports that support and do not support the STP protocol, edge ports that do not support the STP protocol are recorded and blocked, thus blocking the transmission of data packets through these ports.
It effectively blocks ports that do not support the STP protocol, avoiding loop storms in the Layer 2 network and improving network security.
Smart Images

Figure CN116405344B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the communication technology, and particularly relates to a method and a device for detecting a link. BACKGROUND
[0002] With the development and change of IT infrastructure, mobile internet and other technologies, the security protection means and ideas of the park network are facing many challenges. The types and quantities of mobile terminals in the park network are increasing, and any terminal device may become a stepping stone for invading the entire park network.
[0003] The park network takes the traffic path as the core to build a progressive depth security defense system, determines the security defense boundary by reasonably dividing the security areas, including the Internet access area, the wide area network access area, the user access area, the server access area and the like. Therefore, in the park network, the specific spine devices between areas are connected, and the leaf exchange devices or downstream devices of the leaf exchange devices between different areas are not connected. However, in the implementation process of the park network planning, once the network devices that are not allowed to be interconnected cause a loop in the network due to incorrect wiring, it is not only a large workload to manually exclude the incorrect wiring, but also in order to prevent the loop from causing a forwarding storm, the access switches connected to the leaf exchange devices send STP protocol packets to block the layer 2 network loop. However, when the illegal devices that do not support the STP protocol are connected to the network, the loop cannot be blocked by relying on the STP protocol, resulting in a loop storm. SUMMARY
[0004] The purpose of the present application is to provide a method and a device for detecting a link to block the data forwarding of the devices that do not support the STP protocol.
[0005] To achieve the above purpose, the present application provides a method for detecting a link, which comprises: identifying one or more STP non-edge ports supporting the STP protocol and one or more STP edge ports not supporting the STP protocol; recording each identified STP edge port; and blocking the receiving or sending of data packets through each STP edge port.
[0006] To achieve the above purpose, the present application further provides a device for detecting a link, which comprises a processor and a memory. The memory is used to store processor executable instructions. The processor executes the processor executable instructions in the memory to perform the following operations: one or more STP non-edge ports supporting the STP protocol and one or more STP edge ports not supporting the STP protocol are identified; each identified STP edge port is recorded; and the receiving or sending of data packets through each STP edge port is blocked.
[0007] The application has the beneficial effect of blocking the ports that do not support the STP protocol message, avoiding the devices in the two-layer network from being unable to identify the loop through the STP protocol, and avoiding the loop storm in the two-loop network. BRIEF DESCRIPTION OF DRAWINGS
[0008] Figure 1 A flow chart of a method for detecting a link provided by the application is shown;
[0009] Figures 2A-2B A schematic diagram of detecting a link in a two-layer network provided by the embodiment of the application is shown;
[0010] Figure 3 A schematic diagram of a loop detection device provided by the application is shown. DETAILED DESCRIPTION
[0011] The examples shown in the multiple drawings will be described in detail. In the following detailed description, multiple specific details are used to provide a comprehensive understanding of the application. The known methods, steps, components and circuits are not described in detail in the examples so as not to make the examples difficult to understand.
[0012] In the terms used, the term "includes" means includes but is not limited to; the term "contains" means includes but is not limited to; the terms "above", "within" and "below" include the number; the terms "greater than", "less than" mean not including the number. The term "based on" means at least based on a part of it.
[0013] Figure 1 A flow chart of a method for detecting a link provided by the application is shown, which includes:
[0014] Step 101, identifying one or more STP non-edge ports supporting the STP protocol and one or more STP edge ports not supporting the STP protocol;
[0015] Step 102, recording each STP edge port identified;
[0016] Step 103, blocking the receiving or sending data message through each STP edge port.
[0017] Figure 1 The beneficial effect of the embodiment is to block the ports that do not support the STP protocol message, avoid the devices in the two-layer network from being unable to identify the loop through the STP protocol, and avoid the loop storm in the two-loop network.
[0018] Figure 2AFig. 1 shows a schematic diagram of detecting a link in a two-layer network according to an embodiment of the present application. In the two-layer network, two-layer switches are divided into spine layer switches, leaf layer switches and access switches according to roles. The spine layer switches spine1 and spine2 are connected to three-layer switches through equal cost multiple path (ECMP).
[0019] The two-layer network can be a common two-layer network, or a two-layer network interconnected through two-layer VPN tunnels, or the leaf layer switches are interconnected through two-layer VPN tunnels such as VXLAN tunnels. The access layer switches are used to access terminals (not shown in Fig. 2).
[0020] For convenience of description, the present application takes some switches, access14, 15, 16 and leaf21, 22 as examples for illustration. The switches access14, 15, 16 and leaf21, 22 determine to start the loop detection function, and send STP loop detection messages with the device identifier of the present device through each port.
[0021] The switches access14, 15, 16 and leaf21, 22 send STP loop detection messages through each port and detect whether the messages return to the device (the receiving port and the sending port are not required to be the same port) to confirm whether there is a loop. If a port receives a loop detection message sent by the present device, it is determined that there is a loop in the link where the port is located.
[0022] Figure 2A In the figure, the port of the switch access16 connected to the switch access15 fails, and cannot send STP loop detection messages with the device identifier of the switch access16.
[0023] The switches access14, 15, 16 and leaf21, 22 detect whether each port receives STP loop detection messages with the device identifier of the STP neighbor when the initial loop detection period arrives.
[0024] The switch access15 identifies the ports (i.e. connected to the switches leaf21 and leaf22) receiving STP loop detection messages with the device identifier of other devices in the initial loop detection period as STP non-edge ports, and identifies the port (i.e. connected to the switch access16) not receiving STP loop detection messages with the device identifier of other devices in the initial loop detection period as an STP edge port.
[0025] Switch access 14 identifies each port (i.e. the port connecting switch access 16, leaf 21, 22) from which it receives a STP loop detection message with the identity of another device during the initial loop detection period as a STP non-edge port; and identifies the port (i.e. the port connecting illegal device 17) from which it does not receive a STP loop detection message with the identity of another device during the initial loop detection period as a STP edge port.
[0026] Switch access 15 records the port connecting switch access 16 as a STP edge port and blocks the port from receiving or sending data messages.
[0027] Switch access 14 records the port connecting illegal device 17 as a STP edge port and blocks the port from receiving or sending data messages.
[0028] Figure 2B In the meantime, switch access 15 sends a STP black hole detection message with its own identity through the port connecting switch access 16;
[0029] Switch access 14 sends a STP black hole detection message with its own identity through the port connecting illegal device 17.
[0030] Switch access 16 resumes sending STP loop detection messages through the port connecting switch access 15.
[0031] Switch access 15 receives a STP loop detection message through the port connecting switch access 16 within the specified black hole detection time, records the port as a STP non-edge port and allows the port to receive or send data messages.
[0032] Switch access 15, upon arrival of a new loop detection period, sends a STP loop detection message with its own identity through the recorded STP non-edge ports (i.e. the ports connecting leaf 21, 22 and access 16); and identifies each port from which it receives a STP loop detection message with the identity of another device during the loop detection period as a STP non-edge port.
[0033] Switch access 14, upon arrival of a new loop detection period, sends a STP loop detection message with its own identity through the recorded STP non-edge ports (i.e. the ports connecting leaf 21, 22); and identifies each port from which it receives a STP loop detection message with the identity of another device during the loop detection period as a STP non-edge port.
[0034] The switch access 14 does not receive the STP loop detection message through the port connecting the illegal device 17 within the specified black hole detection time, closes the port, deletes the record of the STP edge port, i.e. the port connecting the illegal device 17, and no longer wastes resources to send the black hole detection message from the port.
[0035] Figure 2A And 2B Other leaf layer switches and access switches in the above-mentioned network can detect the link in the same way, and details are not repeated here.
[0036] Figure 3 A schematic diagram of an embodiment of a loop detection device provided in the present application is shown. The device 30 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: identifying one or more STP non-edge ports and one or more STP edge ports; recording each identified STP edge port; blocking the reception or transmission of data messages through each STP edge port.
[0037] The processor executes the processor executable instructions in the memory to perform the following operations: sending an STP black hole detection message with the identification of the device through each STP edge port; when any STP edge port receives an STP loop detection message with the identification of another device within the specified black hole detection time, recording it as an STP non-edge port and allowing the reception or transmission of data messages.
[0038] The processor executes the processor executable instructions in the memory to perform the following operations: closing the STP edge port that does not receive an STP loop detection message with the identification of another device within the specified black hole detection time; deleting the closed STP edge port from all recorded STP edge ports.
[0039] The processor executes the processor executable instructions in the memory to perform the following operations: determining to start the loop detection function; sending an STP loop detection message with the identification of the device through each port; identifying each port that receives an STP loop detection message with the identification of another device within the initial loop detection period as an STP non-edge port; identifying each port that does not receive an STP loop detection message with the identification of another device within the initial loop detection period as an STP edge port.
[0040] The processor executes the processor-executable instructions in the memory to perform the identifying the one or more STP non-edge ports and the one or more STP edge ports includes determining that a new loop detection period has arrived, sending a STP loop detection packet with an identification of the device through the recorded STP non-edge port, identifying each port that receives a STP loop detection packet with an identification of another device in the new loop detection period as an STP non-edge port, and identifying each port that does not receive a STP loop detection packet with an identification of another device in the new loop detection period as an STP edge port.
[0041] The above description is merely illustrative of the application, and not restrictive.
Claims
1. A method of detecting a link, characterized by, The method comprises: identifying one or more STP non-edge ports and one or more STP edge ports; recording each of the identified STP edge ports; blocking receiving or sending data packets through each of the STP edge ports; sending STP black hole detection packets with the local device identification through each of the STP edge ports; recording each of the STP edge ports as the STP non-edge port and allowing receiving or sending data packets when any of the STP edge ports receives STP loop detection packets with other device identification within a specified black hole detection time; closing the STP edge port that does not receive STP loop detection packets with other device identification within the specified black hole detection time; deleting the closed STP edge port from all the recorded STP edge ports.
2. The method of claim 1, wherein, The identifying one or more STP non-edge ports and one or more STP edge ports comprises determining to start a loop detection function; sending STP loop detection packets with the local device identification through each port; identifying each port that receives STP loop detection packets with other device identification within an initial loop detection period as the STP non-edge port; identifying each port that does not receive STP loop detection packets with other device identification within the initial loop detection period as the STP edge port.
3. The method of claim 1, wherein, The identifying one or more STP non-edge ports and one or more STP edge ports comprises determining that a new loop detection period arrives; sending STP loop detection packets with the local device identification through the recorded STP non-edge ports; identifying each port that receives STP loop detection packets with other device identification within the new loop detection period as the STP non-edge port; identifying each port that does not receive STP loop detection packets with other device identification within the new loop detection period as the STP edge port.
4. An apparatus for detecting a link, the apparatus comprising: The device comprises 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: identifying one or more STP non-edge ports and one or more STP edge ports; recording each of the identified STP edge ports; blocking receiving or sending data packets through each of the STP edge ports; sending STP black hole detection packets with the local device identification through each of the STP edge ports; recording each of the STP edge ports as the STP non-edge port and allowing receiving or sending data packets when any of the STP edge ports receives STP loop detection packets with other device identification within a specified black hole detection time; closing the STP edge port that does not receive STP loop detection packets with other device identification within the specified black hole detection time; deleting the closed STP edge port from all the recorded STP edge ports.
5. The apparatus of claim 4, wherein, The processor executes the processor-executable instructions in the memory to perform the identifying one or more STP non-edge ports and one or more STP edge ports comprises the following operations: determining to start a loop detection function; sending STP loop detection packets with the local device identification through each port; identifying each port that receives STP loop detection packets with other device identification within an initial loop detection period as the STP non-edge port; identifying each port that does not receive STP loop detection packets with other device identification within the initial loop detection period as the STP edge port. sending a STP loop detection message with the identity of the device through each port; identifying each port that receives a STP loop detection message with the identity of another device in the initial loop detection period as the STP non-edge port; identifying each port that does not receive a STP loop detection message with the identity of another device in the initial loop detection period as the STP edge port.
6. The apparatus of claim 4, wherein, The processor executes the processor-executable instructions in the memory to perform the identifying of the one or more STP non-edge ports and the one or more STP edge ports includes: determining that a new loop detection period has arrived; sending a STP loop detection message with the identity of the device through each recorded STP non-edge port; identifying each port that receives a STP loop detection message with the identity of another device in the new loop detection period as the STP non-edge port; identifying each port that does not receive a STP loop detection message with the identity of another device in the new loop detection period as the STP edge port.
Citation Information
Patent Citations
Method and network equipment for preventing network loop and spanning tree protocol network system
CN101699799A
Method and device for determining edge interface
CN105162733A