A loop detection method, apparatus, electronic device and storage medium
By dividing the network into equivalence class packets and performing repeated probing, the problem of bandwidth consumption and network paralysis caused by loops in complex networks is solved, achieving fast and stable loop detection and suppression, and ensuring network stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-16
- Publication Date
- 2026-04-03
AI Technical Summary
Loops in complex networks can lead to problems such as bandwidth consumption, packet loss, increased latency, and network paralysis, which are particularly difficult to detect and suppress effectively in three-layer networks.
By determining the attribute information of the received packets, especially the source IP address and destination IP address, the packets are divided into equivalence class packets. Repeated probing is performed when the number of times equivalence class packets are received exceeds a predetermined threshold. Ping operations are performed using ARP entries to determine whether a loop exists or not, and virtual ports are closed if necessary to suppress the loop.
It enables fast, stable, and reliable detection of Layer 3 loops in networks with any routing protocol, preventing bandwidth consumption and network paralysis, reducing packet loss and latency, and ensuring stable network operation.
Smart Images

Figure CN116232853B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of network communication technology, and specifically relates to a loop detection method, device, electronic device and storage medium. Background Technology
[0002] With the rapid development of the Internet, network scale is becoming increasingly larger, and the number of device nodes is increasing. Different protocols operate in networks built at different times, leading to greater complexity in both physical and logical topologies. Complex network architectures can create network loops. The harm caused by loops is usually severe for services. A large number of loop packets consume precious bandwidth resources, resulting in packet loss, increased latency, increased CPU utilization, and even network paralysis. Summary of the Invention
[0003] In view of the above problems, embodiments of the present invention provide a loop detection method to overcome or at least partially solve the above problems.
[0004] In a first aspect, the present invention provides a loop detection method, the method comprising:
[0005] Determine the attribute information of each received message, wherein the attribute information includes at least: source IP address and destination IP address;
[0006] Among the received messages, at least two messages with the same attribute information are identified as equivalence class messages;
[0007] When the number of times the equivalence class message is received exceeds a predetermined number, repeat detection is initiated;
[0008] Based on the results of the repeated probes, it is determined whether a loop exists.
[0009] Optionally, when the number of times the equivalence class message is received exceeds a predetermined number, repeated probing is initiated, including:
[0010] Extract the IP address from the ARP table entry, and use the IP address from the ARP table entry as the source IP address for a ping operation;
[0011] When a repetitive phenomenon is detected through the ping operation, the detection result indicates that a loop has occurred;
[0012] When no duplicate phenomena are detected through the ping operation, the detection result is that no loop has occurred.
[0013] Optionally, the step of extracting the source IP address from the ARP table entry and using the source IP address as the destination IP address for the ping operation includes:
[0014] Construct an ICMP request packet with the local interface's IP address as the destination IP address and the IP address in the ARP table entry as the source address;
[0015] The ICMP request message is sent through the local interface.
[0016] Optionally, it also includes:
[0017] If a loop is determined to exist based on the results of the repeated probes, shut down any one of the multiple virtual ports corresponding to the local interface.
[0018] If, based on the results of the repeated probes, it is determined that no loop exists, the action of performing the ping operation is recorded in the alarm log and uploaded to the alarm collector.
[0019] Optionally, the attribute information includes, in addition to the source IP address and destination IP address, at least one of the following additional attribute information: Ethernet type, protocol type, source port number, and destination port number; the step of determining at least two packets with the same attribute information among the received packets as equivalent class packets includes:
[0020] Determine the attribute information of each received message, including the at least one additional attribute information;
[0021] Multiple messages with identical attribute information, including at least one additional attribute information, among the received messages are identified as equivalence class messages.
[0022] Optionally, it may also include at least one of the following:
[0023] Whenever an equivalence class message is identified, the information of the identified equivalence class message is recorded in the alarm log and uploaded to the alarm collector;
[0024] When the number of times the equivalence class message is received exceeds a predetermined number, information indicating a loop risk will be recorded in the alarm log and uploaded to the alarm collector.
[0025] Optionally, before determining at least two messages with the same attribute information among the received messages as equivalent class messages, the method further includes:
[0026] Detect whether the packet forwarding delay of the local interface is greater than a preset threshold, or detect whether the packets sent by the local interface are lost;
[0027] Among the received messages, at least two messages with the same attribute information are identified as equivalence class messages, including:
[0028] If the packet forwarding delay of the local interface is greater than the preset threshold, and / or if the packet sent by the local interface is lost, the following steps are performed: at least two packets with the same attribute information among the received packets are identified as equivalent class packets.
[0029] In a second aspect of this embodiment, a loop detection device is provided, the device comprising:
[0030] The first determining module is used to determine the attribute information of each received message, wherein the attribute information includes at least: source IP address and destination IP address;
[0031] The second determining module is used to determine at least two of the received messages that have the same attribute information as equivalent class messages;
[0032] The detection module is used to initiate repeated detection when the number of times the equivalence class message is received exceeds a predetermined number.
[0033] The third determining module is used to determine whether a loop exists based on the results of the repeated detection.
[0034] In a third aspect of this embodiment, an electronic device is provided, the electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps in the loop detection method described in the first aspect of this embodiment.
[0035] In a fourth aspect of this embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the loop detection method as described in the first aspect of this embodiment.
[0036] The loop detection method provided by this invention first determines the attribute information of each received packet, including at least the source IP address and destination IP address. Then, at least two packets with identical attribute information are identified as equivalence class packets. This method can span all routing protocols. When the number of times the equivalence class packets are repeatedly received exceeds a predetermined number, repeated probing is initiated. This method can easily and efficiently detect Layer 3 loops in networks running any routing protocol. Finally, based on the results of repeated probing, the existence of a loop is determined. The method provided by this invention not only enables fast, stable, and reliable detection of Layer 3 network loops in complex Layer 3 networks with any routing protocol, but also simultaneously suppresses loop ports, ensuring stable network operation, preventing continuous bandwidth occupation and network paralysis, reducing packet loss and increased latency, improving CPU utilization, and mitigating network paralysis. Attached Figure Description
[0037] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0038] Figure 1 This is a flowchart of the loop detection method provided in an embodiment of the present invention;
[0039] Figure 2 This is a schematic diagram of a management ring network provided in an embodiment of the present invention;
[0040] Figure 3 This is a schematic diagram of a loop detection device provided in an embodiment of the present invention;
[0041] Figure 4 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0042] Exemplary embodiments of the present invention will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this invention will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
[0043] A network loop is a network loop that forms due to confusion caused by an unclear destination path. Loops are divided into Layer 2 and Layer 3 loops. Layer 2 loops are usually caused by device short circuits or module malfunctions, because BUM (broadcast-unicast-multicast) packets are flooded within the same VLAN (Virtual Local Area Network), creating traffic loops and consuming valuable bandwidth resources. Layer 3 loops have more complex causes, such as unexpected malfunction of the original router causing incorrect route advertisements and creating a vicious cycle, or incorrect routing policies. Especially when VLAN interfaces (virtual ports) are enabled in the network, multiple physical ports share a single virtual machine's logical interface, making Layer 3 loops more likely to occur in certain scenarios.
[0044] The three-layer loop mainly relies on the protocol's own prevention and loop-prevention mechanisms, but it can only guarantee protection for devices running a single protocol. The dangers of the three-layer loop are an urgent problem to be solved.
[0045] Example 1
[0046] Reference Figure 1 , Figure 1 This is a flowchart of a loop detection method provided by an embodiment of the present invention, which may specifically include the following steps:
[0047] Step S101: Determine the attribute information of each received message, wherein the attribute information includes at least: source IP address and destination IP address.
[0048] In this embodiment, the attribute information of each packet received by multiple physical ports is first determined. Attribute information refers to the matching fields recorded when traffic flows through the device, where the matching fields include at least the source IP address and the destination IP address. This can be applied to Layer 3 network forwarding scenarios. Layer 3 networks are located at Layer 3 of the OSI (Open System Interconnection) model, between the transport layer and the data link layer, providing information transmission services between the sender and the destination. Data in Layer 3 networks is transmitted in the form of IP datagrams.
[0049] For example, refer to Figure 2 , Figure 2 This is a schematic diagram of a management ring network provided by an embodiment of the present invention. Devices DUT5 and DUT6 are inserted into the DUT3 management switch. DUT5 and DUT6 forward packets to the DUT3 management switch through virtual ports Eth1 and Eth2 in the campus switch. The DUT3 management switch then performs further forwarding processing on the received packets. The DUT3 management switch has multiple physical ports to receive packet information sent by DUT5 and DUT6. Normally, the DUT3 management switch will have corresponding physical ports to receive packets sent by DUT5 and DUT6. Therefore, normally, the packets received by different physical ports are different. It is necessary to determine the attribute information of each packet received by multiple physical ports to determine which device sent the packet. The attribute information includes at least the source IP address and the destination IP address. If device DUT5 forwards a packet to the DUT3 management switch, then the source IP address is 10.112.225.72 and the destination IP address is 10.115255.65.
[0050] Step S102: Determine at least two of the received messages that have the same attribute information as equivalent class messages.
[0051] In this embodiment, for each message received by multiple physical ports in step S101 (multiple physical ports refer to multiple different physical ports), at least two messages with the same attribute information among the received messages are determined as equivalent class messages.
[0052] For example, combined Figure 2 This paper describes a method for classifying packets into equivalent equivalence classes (EQCs) based on traffic attributes. The method involves enabling loop detection on the DUT3 management switch, performing EQC segmentation on packets received from multiple physical ports, and analyzing these traffic attributes. Generally, when traffic flows through the device, matching fields such as SMAC, DMAC, Ethernet type, SIP, DIP, protocol type, source port number, and destination port number are recorded. SIP refers to the source IP address, and DIP refers to the destination IP address. EQCs are segmented based on whether the matching fields change during Layer 3 network forwarding. Since SMAC and DMAC change during forwarding, matching fields that remain unchanged are used. Traffic with the same Ethernet type, SIP, DIP, protocol type, source port number, and destination port number can be considered as having the same EQC, or traffic with the same SIP and DIP matching fields can be considered as having the same EQC. This application does not impose any limitations on this method. Equivalence classes are defined based on the matching SIP and DIP fields. For example, if port 1 receives a message sent by DUT5 and port 2 receives a message sent by DUT6, and the SIP and DIP fields in the message received by port 2 are the same as those in the message received by port 1, then the messages received by port 1 and port 2 are considered to be in the same equivalence class.
[0053] Step S103: When the number of times the equivalence class message is received exceeds a predetermined number, repeat detection is initiated.
[0054] In this embodiment, the attributes of packets received by multiple ports are detected. When the number of packets that match the equivalence class message among the packets received by multiple ports exceeds a predetermined number, repeated detection will be started on the internal network of the virtual port that transmits the packet.
[0055] For example, combined Figure 2Equivalence class (EBC) packets are defined as packets with identical SIP and DIP matching fields. Therefore, packets received from multiple ports are analyzed, focusing on the matching SIP and DIP fields. The predetermined number of times an EBC packet is received is set to three. Assuming port 1 receives packets from DUT5 and port 2 receives packets from DUT6, if port 2 receives packets with identical SIP and DIP matching fields to those received by port 1 more than three times, it indicates that the number of times the EBC packet has been received by different ports exceeds the predetermined number. This suggests a potential network loop and necessitates triggering repeated network probing within the interface corresponding to the EBC packet, thus initiating repeated probing.
[0056] The following example illustrates this: When DUT5 pings the management IP of switch DUT3 (10.115.255.65), switch DUT3 records the traffic information: sip 10.115.255.72, dip 10.115.255.65, protocol ICMP, source port 0, destination port 0. Switch DUT3 also transparently forwards Layer 3 packets sent to its VLAN virtual interface by other devices within the VLAN. At this time, DUT6 receives the ping packet sent by DUT5. When DUT6's management port receives the packet from another device, regardless of whether the destination MAC address is its own, it will check the ARP and routing tables for Layer 3 forwarding, looking up 10.115.255.65 and finding that it is being forwarded from the mgmt management port. At this time, management switch DUT3 receives the traffic forwarded by DUT6 and records the traffic class information: sip10.115.255.72, dip10.115.255.65, protocol ICMP, source port number 0, and destination port 0. At this time, management switch DUT3 receives the same equivalent class packets from eth1 and eth2 respectively.
[0057] When traffic is forwarded to DUT5, the management port of this vendor's switch receives packets from other devices and, regardless of whether the destination MAC address is its own, will look up the ARP and routing tables for Layer 3 forwarding. DUT5 then looks up the ARP and routing tables and forwards the packets out from the mgmt management port. At this time, the management switch DUT3 again receives the same equivalent class traffic on different ports, indicating a possible network loop. Traffic repeats the previous forwarding path. When the number of times the same equivalent class packet is received on different ports exceeds the set equivalent class repetition threshold (default threshold is 3), a network loop is considered to be possible, and network repetition probing needs to be triggered on the interface corresponding to that equivalent class packet, and repetition probing should be enabled.
[0058] Step S104: Determine whether a loop exists based on the results of the repeated detection.
[0059] In this embodiment, repeated probing is performed on the internal network of the interface corresponding to the equivalence class message that triggers the message. Based on the results of repeated probing, it is determined whether there is a loop in the process of the three-layer network forwarding the message.
[0060] For example, combined Figure 2 Repeatedly probe the management switch DUT3. Based on the results of repeated probing of the management switch DUT3, determine whether there is a loop in the management ring network where the management switch DUT3, vendor switches DUT5 and DUT6 are located.
[0061] In one embodiment, when the number of times the equivalence class message is received exceeds a predetermined number, duplicate probing is initiated, including: extracting the IP address from the ARP entry and using the IP address in the ARP entry as the source IP address for a ping operation; when duplicate phenomena are detected through the ping operation, the detection result is that a loop has occurred; when duplicate phenomena are not detected through the ping operation, the detection result is that no loop has occurred.
[0062] In this embodiment, duplicate detection is enabled. The system searches and extracts the ARP (Address Resolution Protocol) entries learned on the interface corresponding to the traffic equivalence class that triggered the duplicate traffic. An ARP entry is a TCP / IP protocol entry that retrieves the physical address based on the IP address. This entry already existed before duplicate detection was enabled. The IP address in the ARP entry is used as the source IP address for a ping operation. The ping (Packet Internet Groper) operation is a program used to test network connectivity. Ping is a service command operating at the application layer of the TCP / IP network architecture. It primarily sends ICMP (Internet Control Message Protocol) request messages to a specific destination host to test the reachability of the destination and to understand its status. When the ping operation detects duplicate traffic, the detection result indicates a loop has occurred. Duplicate traffic means the sending device receives duplicate response packets. When the ping operation does not detect duplicate traffic, the detection result indicates no loop has occurred.
[0063] For example, combined Figure 2 The system searches for and extracts the ARP entries learned on the VLAN interface interce911 that triggered the traffic equivalence class. The ARP entries include 10.115.255.72, mac5, 10.115.255.74mac6, etc. The IP addresses 10.115.255.72 and 10.115.255.74 in the ARP entries are extracted as the destination addresses for ping operations.
[0064] In one embodiment, extracting the source IP address from the ARP entry and using the source IP address as the destination IP address for pinging includes: constructing an ICMP request packet with the IP address of the local interface as the destination IP address and the IP address in the ARP entry as the source address; and sending the ICMP request packet through the local interface.
[0065] In this embodiment, when performing a ping operation, it is also necessary to construct an ICMP request packet with the local interface's IP address as the destination IP address and the IP address in the ARP table entry as the source address. This ICMP request packet is then forwarded and sent from the local interface.
[0066] For example, combined Figure 2 The process involves constructing an ICMP packet with the destination IP being the local interface IP and the source IP being the IP address in the ARP cache. If a ping operation is performed on DUT5, an ICMP request packet with SIP 10.115.255.72 and DIP 10.115.255.65 is constructed. If a ping operation is performed on DUT6, an ICMP request packet with SIP 10.115.255.74 and DIP 10.115.255.65 is constructed. The constructed ICMP packet is then sent from VLAN-interface911, and the packet forwarding path in step S103 is repeated. If duplicate response packets are still received on different ports, then a loop exists.
[0067] In one embodiment, the method further includes: if a loop is determined to exist based on the results of the repeated probing, closing any one of the multiple virtual ports corresponding to the local interface; if a loop is determined not to exist based on the results of the repeated probing, recording the ping operation to an alarm log and uploading it to an alarm collector.
[0068] In this embodiment, if a loop is determined based on the results of repeated probing, to prevent looped packets from circulating indefinitely, any one of the multiple virtual ports corresponding to the local interface will be shut down to isolate the fault domain and suppress packet forwarding by that port, thus avoiding unlimited bandwidth occupation; combined with Figure 2 If multiple virtual ports are Eth1 and Eth2, then any one of the virtual ports, Eth1 and Eth2, will be randomly closed. At the same time as closing the virtual port, a suppression timer can be started and the port suppression time can be set to control the time of closing the port within the suppression time. When the time of closing the port reaches the suppression time, the port will be opened and the port will still be used to forward packets.
[0069] If the results of repeated detection determine that there is no loop, the ping operation will be recorded in the alarm log and uploaded to the alarm collector. This will record when repeated detection was triggered and a ping operation was performed, making it easier for administrators to query the records later.
[0070] In one embodiment, the attribute information includes, in addition to the source IP address and the destination IP address, at least one of the following additional attribute information: Ethernet type, protocol type, source port number, and destination port number; determining at least two packets with the same attribute information among the received packets as equivalent class packets includes: determining the attribute information of each received packet, including the at least one additional attribute information; and determining multiple packets with the same attribute information, including the at least one additional attribute information, among the received packets as equivalent class packets.
[0071] In this embodiment, in addition to the source IP address and destination IP address, the attribute information of the message may also include at least one of the following additional attribute information, specifically Ethernet type, protocol type, source port number, and destination port number. Among the received messages, at least two messages with the same attribute information are called equivalence class messages. The attribute information of each received message, including at least one additional attribute information, is determined. Multiple messages with the same attribute information, including at least one additional attribute information, among the received messages are determined to be equivalence class messages.
[0072] For example, combined Figure 2 If the attribute information for classifying equivalent class packets includes the source IP address and destination IP address, as well as the protocol type in the additional attribute information, then for packets received by different physical ports of the management switch DUT3, their attribute information will be analyzed. Packets with the same source IP address, destination IP address, and protocol type in their attribute information belong to the equivalent class. For example, the attribute information of packets received by port 1 is recorded, and the attribute information of packets received by port 2 is also recorded. The attribute information of packets received by port 2 is compared with that of packets received by port 1. If the source IP address, destination IP address, and protocol type of packets received by port 1 and port 2 are the same, then the packets received by port 2 and port 1 are determined to be equivalent class packets.
[0073] In one embodiment, it further includes at least one of the following: whenever an equivalence class message is determined, the information of the determined equivalence class message is recorded in the alarm log and uploaded to the alarm collector; when the number of times the equivalence class message is repeatedly received exceeds a predetermined number, the information of the loop risk is recorded in the alarm log and uploaded to the alarm collector.
[0074] In this embodiment, at least one of the following is also included: when an equivalence class message is determined, the number of times and the time of occurrence of the equivalence class message will be recorded in the alarm log and uploaded to the alarm collector; when the number of occurrences of the equivalence class message in the alarm log exceeds a predetermined number, a time reminder of the existence of loop risk will be recorded in the alarm log and uploaded to the alarm collector, so as to facilitate later review by management personnel or as a triggering condition for related devices or programs.
[0075] In one embodiment, before determining at least two packets with the same attribute information among the received packets as equivalence class packets, the method further includes: detecting whether the packet forwarding delay of the local interface is greater than a preset threshold, or detecting whether a packet sent by the local interface is lost; determining at least two packets with the same attribute information among the received packets as equivalence class packets includes: in the case that the packet forwarding delay of the local interface is greater than the preset threshold, and / or a packet sent by the local interface is lost, performing the step: determining at least two packets with the same attribute information among the received packets as equivalence class packets.
[0076] In this embodiment, before determining at least two packets with the same attribute information as equivalent class packets, it is also necessary to detect whether the packet forwarding delay of the local interface is greater than a preset threshold, or to detect whether the packets sent by the local interface are lost. Among the received packets, at least two packets with the same attribute information are determined as equivalent class packets. When the packet forwarding delay of the local interface is greater than the preset threshold, or when the packets sent by the local interface are lost, the following steps will be executed: at least two packets with the same attribute information among the received packets will be determined as equivalent class packets, and Layer 3 loop detection will be enabled to detect the packet forwarding network.
[0077] For example, refer to Figure 2 , Figure 2 This is a schematic diagram of a management ring network provided by an embodiment of the present invention. When a customer builds a network, DUT5 and DUT6 are inserted into the DUT3 management switch to form a management ring network. There will be problems such as intermittent connectivity of the management IP of some switches. Pinging 10.115.255.65 from the campus switch will result in large delays and packet loss. When DUT5 pings the management IP of the management switch DUT3 (10.115.255.65), there will be duplicate retransmissions. A three-layer loop is generated, which will trigger the loop detection.
[0078] The loop detection method provided by this invention can detect identical traffic equivalence class information in networks running any routing protocol by defining traffic equivalence classes. When the number of times the same equivalence class traffic is repeatedly received on different ports exceeds a set threshold, repeated network probing is triggered within the interface corresponding to that traffic equivalence class. The device searches for the ARP entries learned on that interface, extracts the IP address from the ARP entries as the destination address for ping operations, and simultaneously constructs an ICMP packet with the destination IP being the local interface IP and the source IP being the IP address in the ARP entry. This packet is then sent from the corresponding interface. If repeated ping operations are detected, it indicates the existence of a loop in the network, triggering loop suppression. This achieves fast, stable, and reliable detection of network loops and can also suppress loop ports simultaneously, ensuring stable network operation, preventing continuous bandwidth occupation and network paralysis, and reducing packet loss and increased latency. The method provided by this invention can also be used in campus networks, enterprise networks, and carrier WANs to achieve layer 3 network loop detection and suppression by shielding specific routing protocol networking.
[0079] Example 2
[0080] In a second aspect of this embodiment, a loop detection device is provided. The device includes: a first determining module, configured to determine the attribute information of each received packet, the attribute information including at least: source IP address and destination IP address; a second determining module, configured to determine at least two packets with the same attribute information as equivalence class packets; a detection module, configured to initiate repeated detection when the number of times the equivalence class packets are repeatedly received exceeds a predetermined number; and a third determining module, configured to determine whether a loop exists based on the result of the repeated detection.
[0081] In this embodiment, refer to Figure 3 , Figure 3 This invention provides a loop detection device, which includes a first determination module 301, a second determination module 302, a detection module 303, and a third determination module 304.
[0082] The first determining module 301 is used to determine the attribute information of each received message, wherein the attribute information includes at least: source IP address and destination IP address;
[0083] The second determining module 302 is used to determine at least two of the received messages that have the same attribute information as equivalent class messages;
[0084] The detection module 303 is used to initiate repeated detection when the number of times the equivalence class message is received exceeds a predetermined number;
[0085] The third determining module 304 is used to determine whether a loop exists based on the results of the repeated detection.
[0086] In some embodiments, a loop detection device further includes:
[0087] The loop detection module is used to extract IP addresses from ARP entries and perform ping operations using the IP addresses in the ARP entries as source IP addresses. When duplicate occurrences are detected through the ping operation, the detection result is that a loop has occurred; when duplicate occurrences are not detected through the ping operation, the detection result is that no loop has occurred.
[0088] The construction module is used to construct an ICMP request packet with the IP address of the local interface as the destination IP address and the IP address in the ARP table entry as the source address; and to send the ICMP request packet through the local interface.
[0089] Action module one is used to close any one of the multiple virtual ports corresponding to the local interface if a loop is determined to exist based on the results of the repeated probing; and to record the ping operation to the alarm log and upload it to the alarm collector if no loop is determined to exist based on the results of the repeated probing.
[0090] An equivalence determination module is used to determine the attribute information of each received message, including the at least one additional attribute information; and to determine multiple messages with the same attribute information, including the at least one additional attribute information, as equivalence class messages.
[0091] Action module two is used to record the information of the identified equivalence class message in the alarm log and upload it to the alarm collector whenever an equivalence class message is identified; when the number of times the equivalence class message is received exceeds a predetermined number, the information of the loop risk is recorded in the alarm log and uploaded to the alarm collector.
[0092] The triggering module is used to detect whether the packet forwarding delay of the local interface is greater than a preset threshold, or to detect whether a packet sent by the local interface is lost; in determining at least two packets with the same attribute information among the received packets as equivalence class packets, including: in the case that the packet forwarding delay of the local interface is greater than the preset threshold, and / or a packet sent by the local interface is lost, the step of determining at least two packets with the same attribute information among the received packets as equivalence class packets.
[0093] The device provided by this invention can not only realize a method for quickly, stably and reliably detecting Layer 3 network loops in complex Layer 3 networks with any routing protocol, but also suppress loop ports at the same time, ensure stable network operation, prevent continuous bandwidth occupation and network paralysis, and reduce packet loss and increased latency.
[0094] Example 3
[0095] In a third aspect of this embodiment, an electronic device is provided, the electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the loop detection method as described in the first aspect of this embodiment.
[0096] In this embodiment, refer to Figure 4 , Figure 4 This is a schematic diagram of an electronic device provided in an embodiment of the present invention; as shown. Figure 4 As shown, the electronic device 100 includes a memory 110 and a processor 120. The memory 110 and the processor 120 are connected via a bus for communication. The memory 110 stores a computer program that can run on the processor 120 to implement the steps in the loop detection method described in the first aspect of the present application.
[0097] Example 4
[0098] In a fourth aspect of this embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the loop detection method as described in the first aspect of this embodiment.
[0099] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0100] Embodiments of the present invention are described with reference to flowchart illustrations and / or block diagrams of methods and apparatus according to embodiments of the present invention. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0101] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0102] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0103] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.
[0104] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0105] The loop detection method, apparatus, electronic device, and storage medium provided by the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A loop detection method, characterized in that, In a Layer 3 network forwarding scenario, a first vendor switch forwards packets to a management switch via a first virtual port, and a second vendor switch forwards packets to a management switch via a second virtual port; the method includes: Determine the attribute information of each packet received by the management switch, wherein the attribute information includes at least: source IP address and destination IP address; Among the packets received by the management switch, at least two packets with the same attribute information are identified as equivalent class packets. During the Layer 3 network forwarding process, the source IP address and destination IP address are unchanging matching fields, while the SMAC and DMAC are changing matching fields. When the number of times the management switch receives the equivalence class packets from the first virtual port and the second virtual port exceeds a predetermined number, repeated probing is initiated on the management switch, including: extracting the IP address from the ARP table entry and using the IP address from the ARP table entry as the source IP address for ping operation; Based on the results of the repeated probes, it is determined whether there is a loop in the management ring network in which the management switch, the first vendor switch, and the second vendor switch are located. When duplicate packets are detected by the ping operation, the detection result indicates a loop has occurred; when no duplicate packets are detected by the ping operation, the detection result indicates no loop has occurred; the duplicate packet phenomenon refers to the management switch receiving duplicate response packets. Extracting IP addresses from ARP entries and using those IP addresses as the source IP address for ping operations includes: Extract the IP address from the ARP table entry; Construct an ICMP request packet with the IP address of the local interface of the management switch as the destination IP address and the IP address in the ARP table entry as the source address; The ICMP request message is sent through the local interface of the management switch.
2. The method according to claim 1, characterized in that, Also includes: If a loop is determined to exist based on the results of the repeated probes, shut down any one of the multiple virtual ports corresponding to the local interface. If, based on the results of the repeated probes, it is determined that no loop exists, the action of performing the ping operation is recorded in the alarm log and uploaded to the alarm collector.
3. The method according to claim 1, characterized in that, In addition to the source IP address and destination IP address, the attribute information also includes at least one of the following additional attribute information: Ethernet type, protocol type, source port number, and destination port number; The step of identifying at least two packets with the same attribute information among the packets received by the management switch as equivalence class packets includes: Determine the attribute information of each received message, including the at least one additional attribute information; Multiple messages with identical attribute information, including at least one additional attribute information, among the received messages are identified as equivalence class messages.
4. The method according to claim 1, characterized in that, It also includes at least one of the following: Whenever an equivalence class message is identified, the information of the identified equivalence class message is recorded in the alarm log and uploaded to the alarm collector; When the number of times the equivalence class message is received exceeds a predetermined number, information indicating a loop risk will be recorded in the alarm log and uploaded to the alarm collector.
5. The method according to claim 1, characterized in that, Before determining at least two packets with identical attribute information among the packets received by the management switch as equivalent class packets, the method further includes: Detect whether the packet forwarding delay of the local interface is greater than a preset threshold, or detect whether the packets sent by the local interface are lost; In the various packets received by the management switch, at least two packets with the same attribute information are identified as equivalence class packets, including: If the packet forwarding delay of the local interface is greater than the preset threshold, and / or if the packet sent by the local interface is lost, the following steps are performed: at least two packets with the same attribute information among the received packets are identified as equivalent class packets.
6. A loop detection device, characterized in that, In a Layer 3 network forwarding scenario, a first vendor switch forwards packets to a management switch via a first virtual port, and a second vendor switch forwards packets to a management switch via a second virtual port; the device includes: The first determining module is used to determine the attribute information of each packet received by the management switch, wherein the attribute information includes at least: source IP address and destination IP address; The second determining module is used to determine at least two packets with the same attribute information among the packets received by the management switch as equivalent class packets. In the process of forwarding in the Layer 3 network, the source IP address and destination IP address are the matching fields that do not change, while the SMAC and DMAC are the matching fields that will change. The detection module is configured to initiate repeated probing of the management switch when the number of times the management switch receives the equivalent class packets from the first virtual port and the second virtual port exceeds a predetermined number. This includes: extracting the IP address from the ARP table entry and using the IP address from the ARP table entry as the source IP address for a ping operation, including: Extract the IP address from the ARP table entry; Construct an ICMP request packet with the IP address of the local interface of the management switch as the destination IP address and the IP address in the ARP table entry as the source address; The ICMP request message is sent through the local interface of the management switch; The third determining module is used to determine whether a loop exists in the management ring network in which the management switch, the first vendor switch, and the second vendor switch are located, based on the result of the repeated detection. When a repeated phenomenon is detected through the ping operation, the detection result is that a loop has occurred. When no repeated phenomenon is detected through the ping operation, the detection result is that no loop has occurred. The repeated phenomenon refers to the management switch receiving repeated response packets.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the loop detection method as described in any one of claims 1 to 5.
8. 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 loop detection method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Loop detection method, loop detection device, loop detection equipment and computer readable storage medium
CN112702226A