CN109391526B - Network loop detection method and device - Google Patents

Network loop detection method and device Download PDF

Info

Publication number
CN109391526B
CN109391526B CN201811426995.2A CN201811426995A CN109391526B CN 109391526 B CN109391526 B CN 109391526B CN 201811426995 A CN201811426995 A CN 201811426995A CN 109391526 B CN109391526 B CN 109391526B
Authority
CN
China
Prior art keywords
network
network device
network equipment
upstream
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811426995.2A
Other languages
Chinese (zh)
Other versions
CN109391526A (en
Inventor
刘熙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ruijie Networks Co Ltd
Original Assignee
Ruijie Networks Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ruijie Networks Co Ltd filed Critical Ruijie Networks Co Ltd
Priority to CN201811426995.2A priority Critical patent/CN109391526B/en
Publication of CN109391526A publication Critical patent/CN109391526A/en
Application granted granted Critical
Publication of CN109391526B publication Critical patent/CN109391526B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0677Localisation of faults
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/18Loop-free operations

Abstract

The invention discloses a method and a device for detecting a network loop, wherein a local terminal network device receives identification information of an opposite terminal network device and identification information of an upstream network device of the local terminal network device, which are sent by the opposite terminal network device, and respectively compares the identification information of the local terminal network device with the identification information of the upstream network device of the opposite terminal network device and the identification information of the upstream network device of the local terminal network device with the identification information of the opposite terminal network device to determine whether the local terminal network device and the opposite terminal network device have an upstream-downstream relationship or not, and when the local terminal network device and the opposite terminal network device do not have the upstream-downstream relationship, the network loop is determined to appear, and the related network devices forming the network loop can be determined by using the detection method, so that maintenance personnel can quickly locate the loop fault, and the processing efficiency of.

Description

Network loop detection method and device
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and an apparatus for detecting a network loop.
Background
In a large-scale network environment, a network loop becomes one of the failures that easily occur due to improper configuration of network devices, hardware damage of the network devices, a connection error of a network physical topology, or a virus attack on the network, and the like, and the network loop, that is, the network device receives a message sent by itself, as shown in fig. 1A and 1B, a schematic diagram of the network loop is shown.
Fig. 1A and 1B both include a network device 1, a network device 2, and a network device 3, in fig. 1A, the network device 1 is connected to the network device 2 through a port 1, and the network device 1 is connected to the network device 3 through the port 2.
Because the network loop can cause the network device to continuously copy and forward the broadcast, multicast and unknown messages, network paralysis is easily caused, and normal services are affected, so that timely and effective discovery and processing of the network loop become especially important.
At present, a method for detecting a network loop generally detects the network loop in a source-out and source-in manner, and it can be understood that a network device receives a message sent by itself, and then determines that the network loop exists.
For example, for the network device 1 in fig. 1A, when it is detected that the network device 1 receives the packet sent from the port 1 at the port 2, it is determined that a network loop occurs, and this detection method is simple, and only the network loop that occurs can be detected, and it cannot be determined which network device causes the network loop specifically.
Disclosure of Invention
The invention aims to provide a method and a device for detecting a network loop, which solve the problem that only the network loop can be detected and related equipment causing the network loop cannot be determined in the prior art.
The purpose of the invention is realized by the following technical scheme:
in a first aspect, the present invention provides a method for detecting a network loop, including:
receiving identification information of second network equipment and identification information of upstream network equipment of the second network equipment, wherein the identification information of the second network equipment is sent by the second network equipment connected with first network equipment;
if the stored identification information of the first network device is different from the identification information of the upstream network device of the second network device and the stored identification information of the upstream network device of the first network device is different from the identification information of the second network device, determining that the first network device and the second network device do not have an upstream-downstream relationship;
and if the first network equipment and the second network equipment are determined not to have the upstream and downstream relation, determining that a network loop occurs.
Optionally, before receiving the identification information of the second network device and the identification information of the upstream network device of the second network device, which are sent by the second network device connected to the first network device, the method further includes:
receiving a first learning message sent by any one third network device connected with a first network device, wherein the first learning message carries hop count information of the third network device, identification information of the third network device and identification information of an upstream network device of the third network device;
according to the hop count information of the third network equipment and the identification information of the third network equipment, determining that the hop count information of the first network equipment is added and stored as the hop count information of the third network equipment, and storing the identification information of the third network equipment as the identification information of the upstream network equipment of the first network equipment;
and sending a second learning message to any fourth network device connected with the first network device, where the second learning message carries the hop count information stored by the first network device, the identification information of the first network device, and the identification information of the upstream network device of the first network device.
Optionally, the method further includes: receiving role information of second network equipment, which is sent by the second network equipment connected with the first network equipment, wherein the role information is used for indicating network layer information of the second network equipment;
accordingly, after determining that a network loop is present, the method further comprises:
determining network layer information of the second network equipment according to the role information;
if the first network equipment determines that the network layer information of the upstream network equipment stored by the first network equipment is different from the network layer information of the second network equipment, the first network equipment determines that the network equipment at the higher network layer is the optimal upstream network equipment of the first network equipment; or
If the first network device determines that the network layer information of the upstream network device stored by the first network device is the same as the network layer information of the second network device, comparing the sizes of the bandwidths used by the upstream network device of the first network device and the second network device, and if the sizes of the bandwidths used by the upstream network device of the first network device and the second network device are different, determining the network device with the large bandwidth to be the optimal upstream network device of the first network device; or
If the bandwidth used by the upstream network device of the first network device is the same as the bandwidth used by the second network device, comparing the sizes of a first port number and a second port number of the first network device, wherein the first network device is connected with the upstream network device and the second network device through a first port and a second port respectively, and the first port number and the second port number are port numbers with the largest port numbers in the first port and the second port respectively;
if the first port number is larger than the second port number, determining that the network equipment connected through the first port is the optimal upstream network equipment of the first network equipment;
and if the second port number is larger than the first port number, determining that the network equipment connected through the second port is the optimal upstream network equipment of the first network equipment.
Optionally, after determining the optimal upstream network device, the method further includes:
recording the network equipment except the optimal upstream network equipment in the upstream network equipment and the second network equipment stored by the first network equipment as loop network equipment, and disconnecting the path between the loop network equipment and the first network equipment.
In a second aspect, the present invention provides a device for detecting a network loop, including:
a receiving unit, configured to receive identifier information of a second network device and identifier information of an upstream network device of the second network device, where the identifier information is sent by the second network device connected to a first network device;
a determining unit, configured to determine that the first network device and the second network device do not have an upstream-downstream relationship when it is determined that the stored identification information of the first network device is different from the identification information of the upstream network device of the second network device and the stored identification information of the upstream network device of the first network device is different from the identification information of the second network device, and determine that a network loop occurs when it is determined that the first network device and the second network device do not have an upstream-downstream relationship.
Optionally, the receiving unit is further configured to: receiving a first learning message sent by any one third network device connected with a first network device, wherein the first learning message carries role information, hop count information, identification information of the third network device and identification information of an upstream network device of the third network device, and the role information is used for indicating network layer information where the third network device is located;
the determination unit is further configured to: determining whether a network layer where the first network device is located is the same as a network layer where the third network device is located according to the role information of the first network device and the role information of the third network device;
the device further comprises: the processing unit is used for determining that the hop count information of the first network equipment is the hop count information of the third network equipment and is added and stored according to the hop count information of the third network equipment and the identification information of the third network equipment, and storing the identification information of the third network equipment as the identification information of the upstream network equipment of the first network equipment;
the device further comprises: a sending unit, configured to send a second learning packet to any one fourth network device connected to the first network device, where the second learning packet carries hop count information stored in the first network device, identification information of the first network device, and identification information of an upstream network device of the first network device.
Optionally, the receiving unit is further configured to: receiving role information of second network equipment, which is sent by the second network equipment connected with the first network equipment, wherein the role information is used for indicating network layer information of the second network equipment;
the processing unit is further to: determining network layer information of the second network equipment according to the role information;
if the network layer information of the upstream network equipment stored by the network equipment is different from the network layer information of the second network equipment, determining the network equipment at the higher network layer as the optimal upstream network equipment of the first network equipment; or
If the network layer information of the upstream network device stored by the network device is the same as the network layer information of the second network device, comparing the bandwidth used by the upstream network device of the first network device and the bandwidth used by the second network device, and if the bandwidth used by the upstream network device of the first network device and the bandwidth used by the second network device are different, determining the network device with the large bandwidth to be the optimal upstream network device of the first network device; or
If the bandwidth used by the upstream network device of the first network device is the same as the bandwidth used by the second network device, comparing the sizes of a first port number and a second port number of the first network device, wherein the first network device is connected with the upstream network device and the second network device through a first port and a second port respectively, and the first port number and the second port number are port numbers with the largest port numbers in the first port and the second port respectively;
if the first port number is larger than the second port number, determining that the network equipment connected through the first port is the optimal upstream network equipment of the first network equipment;
and if the second port number is larger than the first port number, determining that the network equipment connected through the second port is the optimal upstream network equipment of the first network equipment.
Optionally, the processing unit is further configured to: recording the network equipment except the optimal upstream network equipment in the upstream network equipment and the second network equipment stored by the first network equipment as loop network equipment, and disconnecting the path between the loop network equipment and the first network equipment.
In a third aspect, the present invention further provides a device for detecting a network loop, including:
a memory for storing program instructions;
a processor for calling the program instructions stored in the memory and executing the method of the first aspect according to the obtained program.
In a fourth aspect, the present invention provides a computer readable storage medium having stored thereon computer instructions which, when run on a computer, cause the computer to perform the method of the first aspect.
The invention provides a method and a device for detecting a network loop, wherein a network device at a receiving end receives identification information of a network device at the sending end and identification information of an upstream network device per se, which are sent by a network device at the sending end, and the network device at the receiving end compares the identification information of the network device at the sending end with the identification information of the network device at the receiving end and the identification information of the upstream network device of the network device per se, so that the network loop is determined to appear when the fact that the network device at the sending end and the network device at the receiving end do not have an upstream-downstream relation is determined.
Drawings
FIG. 1A is a schematic diagram of a network loop in the prior art;
FIG. 1B is a schematic diagram of another network loop in the prior art;
fig. 2 is a schematic diagram of a network layer structure according to an embodiment of the present application;
fig. 3 is a schematic diagram of roles of an interconnection port according to an embodiment of the present application;
fig. 4 is a flowchart of a method for detecting a network loop according to an embodiment of the present disclosure;
fig. 5 is a schematic diagram of a network loop according to an embodiment of the present application;
fig. 6 is a schematic diagram illustrating message learning performed between network devices according to an embodiment of the present application;
fig. 7 is a schematic diagram of network topology identification according to an embodiment of the present application;
fig. 8 is a schematic diagram illustrating a processing method of a network loop according to an embodiment of the present application;
fig. 9 is a block diagram of a structure of a detection apparatus for a network loop according to an embodiment of the present disclosure;
fig. 10 is a schematic diagram of another detection apparatus for network loops according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The network can be generally divided into a core layer, a convergence layer and an access layer, and devices deployed at each layer are generally called: core equipment, convergence equipment and access equipment. With the core device as the root node, the aggregation device and the access device can refer to fig. 2, where the core device is represented by DSW, the aggregation device is represented by PSW, the access device is represented by ASW, and the Terminal (Terminal) is represented by TER.
As can be seen from fig. 2, the DSW is an upstream device of the PSW, and the PSW is an upstream device of the ASW, and each network device has an interconnection port for communicating with other connected network devices. In a network topology, an interconnection port can be divided into an uplink port and a downlink port according to the role relationship of two connected network devices.
Specifically, assuming that the core device is a root node of the network topology, the ports of the network devices of other layers pointing to the core device are used as uplink ports, and the ports of the network devices of other layers pointing to the core device are used as downlink ports. For example, the port of the convergence device connected to the core device is an uplink port of the convergence device, and the port of the access device connected to the convergence device is an uplink port of the access device.
Different roles of the interconnection ports can be seen from table 1, where it should be noted that the access devices can also be divided into edge access devices and cascade access devices, and ports interconnected between the access devices are also referred to as cascade ports.
TABLE 1 role of interconnect between different devices
Local device Neighbor device Role of interconnection port
Core device Convergence device Core equipment lower connection port
Core device Access device Core equipment lower connection port
Convergence device Core device Upper connection port of convergence equipment
Convergence device Access device Lower connection port of convergence equipment
Access device Core device Upper connection port of access equipment
Access device Convergence device Upper connection port of access equipment
Access device Terminal device Lower connection port of access equipment
Access equipment (edge) Access equipment (cascade) Downstream cascade interface of access equipment
Access equipment (cascade) Access equipment (edge) Uplink cascade interface of access equipment
In particular, refer to the schematic diagram of the role of the interconnect port shown in fig. 3.
In the current automatic deployment of network equipment, an interconnection port role can be identified by utilizing an interconnection port identification technology, after the interconnection port role is determined, configuration information corresponding to the determined interconnection port role is generated according to a preset configuration template, and then the configuration information is applied to a port to realize the automatic configuration of the network equipment port.
In a network, a network loop occurs between access layer devices due to the fact that the access layer devices are in cascade connection by mistake or the fact that the downlink ports of two access layer devices are connected to the same switch device or the fact that different downlink ports of the access devices are connected to the same switch device, and the like, and therefore the detection of the occurrence of the network loop plays an important role in correct identification of the ports.
Compared with the detection method in the prior art, the network loop detection method can determine the network equipment related to the network loop, so that the position of the network loop is accurately positioned when the network loop is processed subsequently.
It is to be understood that the terms "first," "second," and the like in the following description are used for descriptive purposes only and are not to be construed as indicating or implying relative importance, nor order.
As shown in fig. 4, which is a flowchart of a method for detecting a network loop according to an embodiment of the present application, an execution subject of the method shown in fig. 4 may be a device for detecting a network loop, and is installed in a network device.
Referring to fig. 4, the network loop detection apparatus is installed in a first network device, and the method includes:
s101: the detection device of the network loop receives the identification information of the second network device connected with the first network device and the identification information of the upstream network device of the second network device.
Specifically, the second network device may be one of the network devices connected to the first network device.
It should be noted that the identification information of the network device is information that can uniquely identify the network device, and for example, the identification information may be Media Access Control (MAC) address information, and the like, which is not limited in this embodiment of the application.
And the first network device is used as the network device of the receiving end, and the second network device is used as the network device of the transmitting end.
S102: the detection apparatus of the network loop compares the identification information of the first network device with the identification information of the upstream network device of the second network device, and the identification information of the upstream network device stored by the first network device with the identification information of the second network device, and determines whether there is an upstream-downstream relationship between the first network device and the second network device, if there is no upstream-downstream relationship, S103 is executed, and if there is an upstream-downstream relationship, S104 is executed.
S103: if the upstream and downstream relationship does not exist between the first network device and the second network device, the network loop detection device determines that the network loop exists.
Specifically, if the first network device determines that the stored identification information of the first network device is different from the identification information of the upstream network device of the second network device, and the stored identification information of the upstream network device of the first network device is different from the identification information of the second network device, it determines that the first network device and the second network device do not have the upstream-downstream relationship.
S104: if the upstream and downstream relationship exists between the first network device and the second network device, the detection device of the network loop determines that the network loop does not exist.
The new network loop detection method proposed in the present application is different from the principle of the detection method adopted in the prior art, whether a loop occurs is simply determined according to the definition of the network loop, and which network device causes the loop cannot be determined, but the detection method in the embodiment of the present application determines whether the upstream and downstream relationship exists between the network device at the sending end and the network device at the receiving end by comparing the identification information of the network device at the receiving end with the identification information of the upstream network device at the sending end and the identification information of the upstream network device at the receiving end with the identification information of the network device at the sending end, determines that the network loop occurs when the upstream and downstream relationship does not exist, detects the network loop by using the identification information of the network device, and can determine which network device causes the network loop when the network loop is detected, on the basis of the detection method, the network loop is repaired by utilizing the subsequent loop processing process.
The steps involved in the above method will be described in detail below:
as shown in fig. 5, in the network, a network device may send messages to other network devices connected to it, including network devices connected through a HUB. For example, the PSW may send messages to ASW1, ASW2, ASW3, ASW1 may send messages to ASW4, ASW2, ASW2 may send messages to PSW, ASW1, ASW3, and ASW3 may send messages to ASW2, PSW.
It should be noted that, in the embodiment of the present application, two connected network devices may be understood as devices that are neighbors of each other.
Optionally, before the detecting apparatus of the network loop receives the identification information of the second network device and the identification information of the upstream network device of the second network device, where the identification information of the second network device is sent by the second network device connected to the first network device, the method further includes:
the detection device of the network loop receives a first learning message sent by any one third network device connected with the first network device.
Specifically, the first learning packet may carry hop count information of the third network device, identification information of the third network device, and identification information of an upstream network device of the third network device.
The detection apparatus of the network loop may determine hop count information of the first network device itself and identification information of an upstream network device of the first network device according to hop count information of a third network device connected to the first network device and identification information of the third network device.
In this embodiment, according to the hop count information of the third network device and the identification information of the third network device, it may be determined that the hop count information of the first network device is the hop count information of the third network device plus one, and the identification information of the upstream network device of the first network device is the identification information of the third network device.
In a possible implementation manner, the first learning packet may further carry role information of the third network device, where the role information is used to indicate network layer information where the third network device is located.
Specifically, the first network device may determine whether the network layer where the first network device is located is the same as the network layer where the third network device is located according to the role information of the first network device and the role information of the third network device.
If the network layer of the third network device is different from the network layer of the first network device, determining that the hop count information of the first network device is the hop count information of the third network device and is added and stored, and storing the identification information of the third network device as the identification information of the upstream network device of the first network device.
In this embodiment of the present application, it is assumed that the hop count information of the third network device is 0, and after receiving the message sent by the third network device, the hop count information of the first network device may be set to be 1, which is obtained by adding 1 to the hop count information of the third network device.
If the network layer of the first network device is the same as the network layer of the first network device, the upstream network device of the first network device cannot be determined according to the network layer of the network device.
Specifically, the detection apparatus of the network loop may determine that the hop count information of the first network device is stored as the hop count information of the third network device added together, and determine that the identification information of the upstream network device of the first network device is the identification information of the third network device and store the identification information. I.e. the upstream network device of the first network device is the third network device.
The detection apparatus of the network loop may send the second learning packet to any one of fourth network devices connected to the first network device.
The second learning message may carry hop count information stored by the first network device, identification information of the first network device, and identification information of an upstream network device of the first network device.
Specifically, when the network layer where the first network device and the third network device are located is different, the hop count information of the first network device is the hop count information of the third network device plus 1, and when the first network device sends a message to the fourth network device, the hop count information of the first network device carried in the message is 1.
When the network layer where the first network device and the third network device are located is the same, the hop count information of the first network device is the hop count information of the third network device plus 1, for example, if the hop count information of the third network device is 1, the hop count information of the first network device is 1+1 ═ 2, and when the first network device sends a message to the fourth network device, the hop count information of the first network device carried in the message is 2.
It should be noted that the third network device is any network device connected to the first network device.
It can be understood that the second network device, the third network device, and the fourth network device are all network devices connected to the first network device, in an embodiment, the second network device and the third network device may be the same network device or different network devices, and the third network device and the fourth network device may be different network devices.
In a possible implementation manner, the detecting apparatus of the network loop may further receive role information of the second network device sent by the second network device connected to the first network device.
It should be noted that, in the embodiment of the present application, the role information is used to indicate network layer information where the network device is located.
Taking fig. 5 as an example, the above process is explained in detail:
when the role information of the first network device is different from the role information of the third network device, assuming that the first network device is ASW2, the third network device is PSW, that is, the role information of the first network device is access layer device, and the role information of the third network device is convergence layer device, at this time, since the network layer where the third network device is located is higher than the network layer where the first network device is located, the PSW is an upstream network device of ASW2, and the identification information of the PSW is identification information of an upstream network device of ASW2, that is, the identification information of the third network device is identification information of an upstream device of the first network device.
When the role information of the first network device is the same as the role information of the third network device, assuming that the first network device is ASW4 and the third network device is ASW1, the relationship between the two network devices cannot be determined according to the role information.
For example, if the hop count information of the third network device ASW1 is 1 and is greater than 0, the hop count information of the first network device ASW4 may be updated to 2, the third network device ASW1 may be the upstream network device of the first network device ASW4, and the identification information ASW1 of the third network device may be the identification information of the upstream network device of the first network device ASW 4.
It should be understood that, since the hop count information of the message when the ASW4 does not receive the learning message may be set to-1, the hop count information of the receiving end may be updated according to the hop count information of the network device at the transmitting end.
When the role information of the first network device is different from the role information of the third network device, the hop count information of the network device may also be adjusted, and the identification information of the upstream network device of the first network device is determined.
For example, assuming that the first network device is ASW2 and the third network device is PSW, the initial hop count information of the PSW may be set to 0, and when it is determined that the third network device is located at a network layer higher than the network layer where the first network device is located, the hop count information of the first network device ASW2 may be set to 1, and the PSW is an upstream network device of ASW2, and the identification information of the PSW is the identification information of the upstream network device of ASW2, that is, the identification information of the third network device is the identification information of the upstream device of the first network device.
In the embodiment of the application, the cascade depth of the access layer network equipment can be judged through the hop count information, the larger the hop count value is, the larger the depth is, the worse the effect of network planning is, and the network planning is helped to the operation and maintenance of the network to a certain extent.
For each network device, in the case that there are multiple network devices connected to the network device, the sequence of receiving messages sent by other network devices cannot be determined, and therefore, in this embodiment of the present application, the network device may learn about relevant information of other network devices by receiving messages sent by other network devices.
For example, it cannot be determined whether the ASW2 receives the learning message sent by the PSW, the learning message sent by the ASW1, or the learning message sent by the ASW 3.
Assuming that the ASW2 receives the learning message sent by the ASW1 first and does not receive the learning message sent by the PSW yet, that is, the ASW2 learns the relevant information of the ASW1 first and does not learn the relevant information of the PSW yet, for the ASW2, the ASW1 is determined to be the upstream network device of itself.
It is understood that the related information referred to herein can be understood as the information carried in the learning message.
In the embodiment of the present application, when detecting that the upstream network device of the ASW2 is NULL, the learning may be continued until the ASW2 learns that the upstream network device of itself is not NULL, and the comparison process may be started. If the ASW2 does not receive the message sent by other network devices, the upstream network device itself is NULL, and when receiving the message sent by other network devices, the upstream network device itself can be learned. As shown in fig. 6, for example, when the ASW2 learns the relevant information of the ASW1 first and does not learn the relevant information of the PSW yet, the ASW2 may determine that the ASW1 is an access stratum device, the upstream network device of the ASW1 is a PSW, and the ASW2 may determine that the ASW1 is an upstream network device of itself. At this point, the upstream network device of ASW2 is not NULL, and therefore, the process of comparing may be initiated.
Specifically, after receiving the learning packet sent by the ASW1, the ASW2 may compare the identification information of the upstream network device of the ASW1 with the identification information of the ASW2, and if the identification information of the upstream network device of the ASW1 is different from the identification information of the ASW2, determine that the ASW1 is not the downstream network device of the ASW 2.
The identification information of the upstream network device of ASW2 is then compared with the identification information of ASW1, and if the identification information of the upstream network device of ASW2 is different from the identification information of ASW1, it is determined that ASW1 is not the upstream network device of ASW 2.
After the comparison in the above manner, it can be determined that there is no upstream-downstream relationship between ASW2 and ASW 1.
In the embodiment of the present application, the method for detecting a network loop may be understood as a process in which the network device learns and compares while receiving the learning packet, so as to determine whether the network loop occurs.
For two connected network devices in a network, there are three relationships: (1) ASW2 is an upstream network device of ASW 1; (2) ASW2 is a downstream network device of ASW 1; (3) a loop exists between ASW2 and ASW 1.
In the embodiment of the application, whether a network loop occurs can be judged by judging whether the upstream and downstream relations exist between adjacent network devices in the network, and when the upstream and downstream relations do not exist between the adjacent network devices, the network loop is determined to occur.
Network loops typically occur at the access layer because the probability of network loops occurring at the core layer and the convergence layer is relatively small.
If one of the adjacent network devices receives the learning message sent by the other network device, for example, the ASW2 in fig. 6 receives the learning message sent by the ASW1, the learning message sent by the ASW1 may be stored in the ASW2, and the information in the ASW2 may be updated.
Specifically, for the network device as the receiving end, the following rule may be adopted when updating:
(1) and in a default condition (when the learning message is not received), the upstream network equipment of the ASW is NULL, the Hop count value Hop is-1, the DSW and the PSW are understood as the boundary of the network, and the Hop count value of the upstream network equipment is set to be 0.
For convenience of calculation in the embodiment of the present application, the Hop value of ASW may be set to-1, the Hop values of DSW and PSW may be set to 0, and the set values are not limited in the present application.
(2) ASW devices connected to the DSW or PSW may have the DSW or PSW as an upstream network device of the ASW and record the Hop value of the ASW as 1.
(3) And if the Hop value of the ASW device as the receiving end is-1 and the Hop value of the ASW device as the transmitting end is greater than 0, assuming that N is the Hop value, the ASW device as the transmitting end may be used as the upstream network device of the ASW device as the receiving end, and the Hop value of the ASW device as the receiving end may be recorded as N + 1.
The following will specifically take fig. 5 as an example, and use of the above rule will be described in detail with reference to the example:
1) when the opposite end is a DSW or a PSW, the home end is an ASW, and the Hop is-1, the opposite end may be used as the upstream network device of the home end according to the rule (2), and the Hop value of the home end is recorded as 1.
Assuming that the ASW1 learns the PSW, the information may be updated as:
TABLE 2 ASW1 learned information update to PSW
Device Upstream of Hop Node relationships
ASW1 PSW 1 This node
PSW - 0 Upstream node
In this example, ASW1 may be understood as a home device and PSW may be understood as an opposite device.
2) When the opposite end is ASW and the Hop value is greater than 0, for example, N, and the home end is ASW and the Hop value is equal to-1, the opposite end may be taken as the upstream network device of the home end according to rule (3), and the Hop value of the home end is recorded as N + 1.
Assuming that ASW4 learns ASW1, the information may be updated as:
TABLE 3 ASW4 learning of information updates to ASW1
Device Upstream of Hop Node relationships
ASW4 ASW1 2 This node
ASW1 PSW 1 Upstream node
Since the ASW1 has already updated its own information after learning the PSW, when the ASW1 sends the learning packet to the ASW4, the information carried in the learning packet is the information updated after learning the PSW, and after the ASW4 learns the ASW1, the information of the ASW4 itself is updated on the basis of the information updated after learning the PSW by the ASW 1.
In this example, ASW4 may be understood as a home terminal device, and ASW1 may be understood as an opposite terminal device.
3) When the opposite end is ASW and the Hop value is-1, the home end is ASW and the Hop value is greater than 0, for example, N, the opposite end device may be referred to as the downstream network device of the home end device according to rule (3).
After assuming ASW1 learns ASW4, the information may be updated as:
TABLE 4 ASW1 information updates learned to ASW4
Device Upstream of Hop Node relationships
ASW1 PSW 1 This node
PSW - 0 Upstream node
ASW4 ASW1 2 Downstream node
In this example, ASW1 may be understood as a home terminal device, and ASW4 may be understood as an opposite terminal device.
4) And when the opposite end is ASW and the Hop value is greater than 0, the home end is ASW and the Hop value is greater than 0, whether the opposite end and the home end have an upstream-downstream relationship needs to be judged, and whether a loop exists between the home end and the opposite end is determined.
After assuming ASW1 learns ASW2, the information may be updated as:
TABLE 5 ASW1 information updates learned to ASW2
Device Upstream of Hop Node relationships
ASW1 PSW 1 This node
PSW - 0 Upstream node
ASW4 ASW1 1 Downstream node
ASW2 PSW 1 Neighbor node, loop
In this example, ASW1 may be understood as a home terminal device, and ASW2 may be understood as an opposite terminal device.
It should be noted that "opposite end" and "sending end", "home end" and "receiving end", "node" and "device" in the embodiments of the present application are often mixed, and those skilled in the art should understand that they are the same in the present application and only different in meaning.
When loops occur in the network, the identification of the network topology may be disturbed. As shown in FIG. 7, the HUB HUB causes a loop to occur between ASW1 and ASW2, and the network devices are powered up in the order: PSW, ASW1, ASW2, when there is a loop in the network, may cause ASW2 to mistakenly treat ASW1 as its upstream network device, while PSW is actually the upstream network device of ASW 2.
Therefore, when the network loop is detected to appear, the network loop needs to be processed to ensure that the network loop can be processed in time, and the problems of network equipment paralysis, user network disconnection and the like caused by the network loop are avoided.
In one possible embodiment, the network loops may be processed as follows:
firstly, the best upstream device of the network device at the receiving end is determined, and secondly, the loop in the network loop is repaired.
Specifically, the method for determining the optimal upstream network device is as follows:
1) and the detection device of the network loop determines the network layer information of the second network equipment according to the role information. If the network layer information of the upstream network equipment stored by the first network equipment is different from the network layer information of the second network equipment, the network equipment with the higher network layer is determined to be the optimal upstream network equipment of the first network equipment.
2) If the network loop detection device determines that the network layer information of the upstream network device stored by the first network device is the same as the network layer information of the second network device, the network loop detection device compares the bandwidth used by the upstream network device of the first network device and the bandwidth used by the second network device, and if the bandwidth used by the upstream network device of the first network device and the bandwidth used by the second network device are different, the network device with the large bandwidth is determined to be the optimal upstream network device of the first network device.
3) If the detection device of the network loop determines that the sizes of the bandwidths used by the upstream network device and the second network device of the first network device are the same, the detection device of the network loop compares the sizes of the port numbers of the first network device and determines that the network device connected through the port with the large port number is the optimal upstream network device of the first network device.
Specifically, the ports of the first network device may be set as a "first port" and a "second port", the size relationship between the two port numbers may be determined by comparing the port numbers, and if the first port number is greater than the second port number, the network device connected through the first port is used as the optimal upstream network device of the first network device.
And if the second port number is larger than the first port number, the network equipment connected through the second port is taken as the optimal upstream network equipment of the first network equipment.
The first network equipment is connected with the two network equipment through a first port and a second port respectively, and the first port number and the second port number are port numbers with the largest port numbers in the first port and the second port respectively. The two network devices refer to: an upstream network device of the first network device and a second network device.
In this embodiment, it is not limited that the first port is a port through which the first network device is connected to an upstream network device of the first network device or a port through which the first network device is connected to the second network device, and the second port is also not limited that the first network device is connected to an upstream network device of the first network device or a port through which the first network device is connected to the second network device.
For example, when the first port is a port to which the first network device is connected to an upstream network device of the first network device, and the second port is a port to which the first network device is connected to the second network device, if the first port number is greater than the second port number, the upstream network device of the first network device may be the optimal upstream network device.
When the first port is a port through which the first network device is connected to the second network device, and the second port is a port through which the first network device is connected to the upstream network device of the first network device, if the number of the first port is greater than the number of the second port, the second network device can be used as the optimal upstream network device.
Specifically, there may be a plurality of interconnected ports between the first network device and the second network device, and therefore, in the embodiment of the present application, a port with the largest port number is selected as the first port and the second port from among the interconnected ports between the first network device and the second network device. For example, the first network device is device 1, the second network devices are device 2 and device 3, respectively, and assuming that there are 47, 48 and 50 ports interconnected between device 1 and device 2 and 30, 45 and 46 ports interconnected between device 1 and device 3, the first port is a port with port number 50, and the second port is a port with port number 46.
It should be noted that, because the port numbers of the network devices are not repeated, the port numbers of the network devices must have a size relationship.
For example, the first network device is device 1, the second network devices are device 2 and device 3, respectively, and assuming that the port numbers of device 1 and device 2 are connected to each other are 48 and the port numbers of device 1 and device 3 are connected to each other are 20, device 2 can be regarded as the best upstream network device of device 1.
After determining the optimal upstream network device, in one possible implementation, the detecting device of the network loop may disconnect a path between the first network device and a network device that is not the optimal upstream network device, among the upstream network device and the second network device that are stored by the first network device itself.
In this embodiment, a network device that is not the best upstream network device among the upstream network device and the second network device that are stored in the first network device itself may be marked as a loop network device, and a path between the loop network device and the first network device may be disconnected.
Specifically, the network loop detection apparatus first compares the network layer information of the upstream network device currently stored by the home terminal device with the network layer information of the network device in which the loop occurs with the home terminal device, uses the network device at the higher level of the network layer as the best upstream network device of the home terminal device, and disconnects the path between the network device at the lower level of the network layer and the home terminal device.
That is, the detection means of the network loop disconnects the path between the network device at the lower network layer and the first network device.
It should be noted that, the network layer order is: DSW > PSW > ASW.
For example, in fig. 5, ASW2 learns ASW1 first and then PSW, and corresponding information can be referred to table 6 as follows:
table 6 related information of network devices constituting a network loop
Device Upstream of Hop Node relationships
ASW2 ASW1 2 This node
ASW1 PSW 1 Upstream node
PSW - 0 Neighbor node, loop
By comparing the above-mentioned methods, it can be seen that: the PSW has a higher priority than the ASW, so the PSW is the best upstream network device of ASW2, and the table can be updated as:
table 7 updates information on network devices constituting a network loop
Device Upstream of Hop Node relationships
ASW2 PSW 1 This node
ASW1 PSW 1 Neighbor node, loop
PSW - 0 Upstream node
If the network layers of the network devices are the same, the neighbor device with the larger bandwidth can be used as the optimal upstream network device by comparing the bandwidth of the network device connected with the local terminal device.
As shown in fig. 8, it is assumed that the home device is ASW3 and the neighbor devices are ASW2 and ASW1, so the bandwidth sizes used by ASW2 and ASW1 can be compared, as shown in the figure: the bandwidth used between ASW3 and ASW1 is twice the bandwidth used between ASW2 and ASW1, so the bandwidth used by ASW2 is small, and the bandwidth used by ASW1 is large, so ASW1 is the best upstream network device for ASW3, and the path between ASW3 and ASW2 can be disconnected.
I.e. the detection means of the network loop disconnects the path between the network device with the small bandwidth of use and the first network device.
If the bandwidths used by the neighbor devices are the same, the detection device of the network loop may use the neighbor device connected through the port with the larger port number as the optimal upstream network device by comparing the port number of the home device connected to the neighbor device, and disconnect the path between the neighbor device connected through the port with the smaller port number and the home device.
That is, the detection means of the network loop disconnects the path between the network device connected through the port having the small port number and the first network device.
For example, the first network device is device 1, the second network devices are device 2 and device 3, respectively, and assuming that the port numbers of the devices 1 and 2 are 30 and the port numbers of the devices 1 and 3 are 12, the path between the devices 1 and 3 can be disconnected.
It should be noted that, in network design, a port with a larger port number is generally an uplink port, and a port with a smaller port number is generally a downlink port.
In the embodiment of the present application, the processing of the network loop is performed based on the foregoing detection method, that is, for the network device at the receiving end, when the network loop occurs, the optimal upstream network device of the network device at the receiving end may be determined, so as to avoid a situation of misjudgment occurring when the network loop is processed.
It is understood that the misjudgment condition occurring when the network loop is processed may include: for example, if the network device at the receiving end is the device 1, and the network devices at the transmitting end are the device 2 and the device 3, respectively, if a loop is caused by a path between the device 1 and the device 2, and one path is arbitrarily closed in the prior art during loop processing, it is assumed that the path between the device 1 and the device 3 is closed, and at this time, a misjudgment situation occurs.
Based on the same concept as the above-mentioned embodiment of the method for detecting a network loop, the embodiment of the present invention further provides a detection apparatus for a network loop, where the detection apparatus may be a detection apparatus installed in a network device. Fig. 9 is a block diagram illustrating a structure of a detection apparatus for a network loop according to an embodiment of the present application, where the detection apparatus includes: receiving unit 101, determining unit 102.
The receiving unit 101 is configured to receive identification information of a second network device and identification information of an upstream network device of the second network device, where the identification information of the second network device is sent by the second network device connected to the first network device.
A determining unit 102, configured to determine that the first network device and the second network device do not have an upstream-downstream relationship when it is determined that the stored identification information of the first network device is different from the identification information of the upstream network device of the second network device and the stored identification information of the upstream network device of the first network device is different from the identification information of the second network device, and determine that a network loop occurs when it is determined that the first network device and the second network device do not have an upstream-downstream relationship.
Optionally, the receiving unit 101 is further configured to: and receiving a first learning message sent by any one third network device connected with the first network device.
The first learning message carries hop count information of the third network device, identification information of the third network device, and identification information of an upstream network device of the third network device.
Correspondingly, the device also comprises: and the processing unit 103 is configured to determine, according to the hop count information of the third network device and the identification information of the third network device, that the hop count information of the first network device is stored as the added hop count information of the third network device, and store the identification information of the third network device as the identification information of the upstream network device of the first network device.
The device further comprises: a sending unit 104, configured to send the second learning packet to any one of the fourth network devices connected to the first network device.
The second learning message carries hop count information stored by the first network device, identification information of the first network device, and identification information of an upstream network device of the first network device.
Optionally, the receiving unit 101 is further configured to: receiving role information of the second network equipment, which is sent by the second network equipment connected with the first network equipment, wherein the role information is used for indicating network layer information in which the second network equipment is positioned.
Further, the processing unit 103 is further configured to: determining network layer information of the second network equipment according to the role information; if the network layer information of the upstream network equipment stored by the network equipment is different from the network layer information of the second network equipment, determining the network equipment at the higher network layer as the optimal upstream network equipment of the first network equipment; or if the network layer information of the upstream network device stored by the network device is the same as the network layer information of the second network device, comparing the bandwidth used by the upstream network device of the first network device and the bandwidth used by the second network device, and if the bandwidth used by the upstream network device of the first network device and the bandwidth used by the network device are different, determining the network device with the large bandwidth to be the optimal upstream network device of the first network device; or if the bandwidth used by the upstream network device of the first network device is the same as the bandwidth used by the second network device, comparing the sizes of the first port number and the second port number of the first network device, wherein the first network device is connected with the upstream network device of the first network device and the second network device through the first port and the second port respectively, and the first port number and the second port number are the port numbers with the largest port numbers in the first port and the second port respectively; if the first port number is larger than the second port number, determining that the network equipment connected through the first port is the optimal upstream network equipment of the first network equipment, and if the second port number is larger than the first port number, determining that the network equipment connected through the second port is the optimal upstream network equipment of the first network equipment.
Further, the processing unit 103 is further configured to: and recording the network equipment except the optimal upstream network equipment in the upstream network equipment and the second network equipment stored by the first network equipment as loop network equipment, and disconnecting the path between the loop network equipment and the first network equipment.
It should be noted that, for the implementation of the functions of each unit in the above-mentioned detection apparatus for a network loop in the embodiment of the present invention, reference may be further made to the description of the related method embodiment, which is not described herein again.
An embodiment of the present application further provides another apparatus for detecting a network loop, as shown in fig. 10, the apparatus includes:
a memory 202 for storing program instructions.
The transceiver 201 is used for receiving and transmitting a detection instruction of a network loop.
And the processor 200 is configured to call the program instructions stored in the memory, and execute any method flow described in the embodiments of the present application according to the obtained program according to the instructions received by the transceiver 201. The processor 200 is used to implement the methods performed by the determining unit (102) and the processing unit (103) shown in fig. 9.
Where in fig. 10 the bus architecture may include any number of interconnected buses and bridges, in particular one or more processors represented by processor 200 and various circuits of memory represented by memory 202, linked together. The bus architecture may also link together various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. The bus interface provides an interface.
The transceiver 201 may be a number of elements, including a transmitter and a transceiver, providing a means for communicating with various other apparatus over a transmission medium.
The processor 200 is responsible for managing the bus architecture and general processing, and the memory 202 may store data used by the processor 200 in performing operations.
The processor 200 may be a Central Processing Unit (CPU), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), or a Complex Programmable Logic Device (CPLD).
Embodiments of the present application also provide a computer storage medium for storing computer program instructions for any apparatus described in the embodiments of the present application, which includes a program for executing any method provided in the embodiments of the present application.
The computer storage media may be any available media or data storage device that can be accessed by a computer, including, but not limited to, magnetic memory (e.g., floppy disks, hard disks, magnetic tape, magneto-optical disks (MOs), etc.), optical memory (e.g., CDs, DVDs, BDs, HVDs, etc.), and semiconductor memory (e.g., ROMs, EPROMs, EEPROMs, non-volatile memory (NAND FLASH), Solid State Disks (SSDs)), etc.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (10)

1. A method for detecting a network loop, comprising:
receiving identification information of second network equipment and identification information of upstream network equipment of the second network equipment, wherein the identification information of the second network equipment is sent by the second network equipment connected with first network equipment;
if the stored identification information of the first network device is different from the identification information of the upstream network device of the second network device and the stored identification information of the upstream network device of the first network device is different from the identification information of the second network device, determining that the first network device and the second network device do not have an upstream-downstream relationship;
and if the first network equipment and the second network equipment are determined not to have the upstream and downstream relation, determining that a network loop occurs.
2. The method of claim 1, wherein prior to receiving the identification information of the second network device and the identification information of the upstream network device of the second network device sent by the second network device connected to the first network device, the method further comprises:
receiving a first learning message sent by any one third network device connected with a first network device, wherein the first learning message carries hop count information of the third network device, identification information of the third network device and identification information of an upstream network device of the third network device;
according to the hop count information of the third network equipment and the identification information of the third network equipment, determining that the hop count information of the first network equipment is added and stored as the hop count information of the third network equipment, and storing the identification information of the third network equipment as the identification information of the upstream network equipment of the first network equipment;
sending a second learning message to any one fourth network device connected with the first network device, where the second learning message carries hop count information stored by the first network device, identification information of the first network device, and identification information of an upstream network device of the first network device;
the hop count information is used for judging the cascading depth of the access layer network equipment, and the larger the hop count information is, the larger the depth is.
3. The method of claim 1, wherein the method further comprises: receiving role information of second network equipment, which is sent by the second network equipment connected with the first network equipment, wherein the role information is used for indicating network layer information of the second network equipment;
accordingly, after determining that a network loop is present, the method further comprises:
determining network layer information of the second network equipment according to the role information;
if the network layer information of the upstream network equipment stored by the first network equipment is different from the network layer information of the second network equipment, determining the network equipment at the network layer higher than the first network equipment as the optimal upstream network equipment of the first network equipment; or
If the network layer information of the upstream network equipment stored by the first network equipment is the same as the network layer information of the second network equipment, comparing the bandwidth used by the upstream network equipment of the first network equipment and the bandwidth used by the second network equipment, and if the bandwidth used by the upstream network equipment of the first network equipment and the bandwidth used by the second network equipment are different, determining the network equipment with the large bandwidth to be the optimal upstream network equipment of the first network equipment; or
If the bandwidth used by the upstream network device of the first network device is the same as the bandwidth used by the second network device, comparing the sizes of a first port number and a second port number of the first network device, wherein the first network device is connected with the upstream network device of the first network device and the second network device through a first port and a second port respectively, and the first port number and the second port number are port numbers with the largest port numbers in the first port and the second port respectively;
if the first port number is larger than the second port number, determining that the network equipment connected through the first port is the optimal upstream network equipment of the first network equipment;
if the second port number is larger than the first port number, determining that the network equipment connected through the second port is the optimal upstream network equipment of the first network equipment;
wherein the network layer information includes: the core layer, the convergence layer and the access layer, and the network layer has the following sequence: core layer > convergence layer > access layer.
4. The method of claim 3, wherein after determining the optimal upstream network device, the method further comprises:
recording network equipment except the optimal upstream network equipment in the upstream network equipment and the second network equipment stored by the first network equipment as loop network equipment;
disconnecting the path between the loop network device and the first network device.
5. An apparatus for detecting a network loop, comprising:
a receiving unit, configured to receive identifier information of a second network device and identifier information of an upstream network device of the second network device, where the identifier information is sent by the second network device connected to a first network device;
a determining unit, configured to determine that the first network device and the second network device do not have an upstream-downstream relationship if it is determined that the stored identification information of the first network device is different from the identification information of the upstream network device of the second network device and the stored identification information of the upstream network device of the first network device is different from the identification information of the second network device, and determine that a network loop occurs when it is determined that the first network device and the second network device do not have an upstream-downstream relationship.
6. The apparatus of claim 5, wherein the receiving unit is further to: receiving a first learning message sent by any one third network device connected with the first network device, where the first learning message carries hop count information of the third network device, identification information of the third network device, and identification information of an upstream network device of the third network device;
correspondingly, the device further comprises: the processing unit is used for determining that the hop count information of the first network equipment is the hop count information of the third network equipment and is added and stored according to the hop count information of the third network equipment and the identification information of the third network equipment, and storing the identification information of the third network equipment as the identification information of the upstream network equipment of the first network equipment;
the device further comprises: a sending unit, configured to send a second learning packet to any one fourth network device connected to the first network device, where the second learning packet carries hop count information stored in the first network device, identification information of the first network device, and identification information of an upstream network device of the first network device;
the hop count information is used for judging the cascading depth of the access layer network equipment, and the larger the hop count information is, the larger the depth is.
7. The apparatus of claim 5, wherein the receiving unit is further to: receiving role information of second network equipment, which is sent by the second network equipment connected with the first network equipment, wherein the role information is used for indicating network layer information of the second network equipment;
the processing unit is further to: determining network layer information of the second network equipment according to the role information; if the network layer information of the upstream network equipment stored by the network equipment is different from the network layer information of the second network equipment, determining the network equipment at the higher network layer as the optimal upstream network equipment of the first network equipment; or
If the network layer information of the upstream network device stored by the network device is the same as the network layer information of the second network device, comparing the bandwidth used by the upstream network device of the first network device and the bandwidth used by the second network device, and if the bandwidth used by the upstream network device of the first network device and the bandwidth used by the second network device are different, determining the network device with the large bandwidth to be the optimal upstream network device of the first network device; or
If the bandwidth used by the upstream network device of the first network device is the same as the bandwidth used by the second network device, comparing the sizes of a first port number and a second port number of the first network device, wherein the first network device is connected with the upstream network device and the second network device through a first port and a second port respectively, and the first port number and the second port number are port numbers with the largest port numbers in the first port and the second port respectively;
if the first port number is larger than the second port number, determining that the network equipment connected through the first port is the optimal upstream network equipment of the first network equipment;
if the second port number is larger than the first port number, determining that the network equipment connected through the second port is the optimal upstream network equipment of the first network equipment;
wherein the network layer information includes: the core layer, the convergence layer and the access layer, and the network layer has the following sequence: core layer > convergence layer > access layer.
8. The apparatus as recited in claim 7, said processing unit to further: recording network equipment except the optimal upstream network equipment in the upstream network equipment and the second network equipment stored by the first network equipment as loop network equipment;
disconnecting the path between the loop network device and the first network device.
9. An apparatus for detecting a network loop, comprising:
a memory for storing program instructions;
a transceiver for receiving and transmitting a detection instruction of a network loop;
a processor for calling the program instructions stored in the memory and executing the method of any one of claims 1 to 4 according to the obtained program according to the instructions received by the transceiver.
10. A computer readable storage medium having stored thereon computer instructions which, when run on a computer, cause the computer to perform the method of any of claims 1-4.
CN201811426995.2A 2018-11-27 2018-11-27 Network loop detection method and device Active CN109391526B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811426995.2A CN109391526B (en) 2018-11-27 2018-11-27 Network loop detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811426995.2A CN109391526B (en) 2018-11-27 2018-11-27 Network loop detection method and device

Publications (2)

Publication Number Publication Date
CN109391526A CN109391526A (en) 2019-02-26
CN109391526B true CN109391526B (en) 2020-12-18

Family

ID=65429647

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811426995.2A Active CN109391526B (en) 2018-11-27 2018-11-27 Network loop detection method and device

Country Status (1)

Country Link
CN (1) CN109391526B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110233713B (en) * 2019-06-26 2022-08-09 广东九博科技股份有限公司 Multi-link communication method and system based on LLDP message
CN113824579B (en) * 2020-06-19 2022-12-06 华为技术有限公司 Interface configuration method of equipment in campus network and network equipment
CN112968846B (en) * 2021-02-02 2022-08-16 武汉迈威通信股份有限公司 Detection system for illegal short circuit of switch port
CN112994990B (en) * 2021-05-20 2021-07-30 蚂蚁金服(杭州)网络技术有限公司 Loop detection method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0896494A2 (en) * 1997-08-08 1999-02-10 Kabushiki Kaisha Toshiba Scheme for label switched path loop detection at node device
CN1361612A (en) * 2000-12-29 2002-07-31 北京邮电大学 Simple adaptive fast convergence mark exchange path loop preventing technique
CN101309161A (en) * 2007-05-01 2008-11-19 兄弟工业株式会社 Information distribution system, terminal apparatus used in such system, recording medium on which program is recorded, and loop connection avoidance method
CN107171898A (en) * 2017-07-14 2017-09-15 上海市信息网络有限公司 Operator's Ethernet Circle detection and loop method of disposal

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7843854B2 (en) * 2006-02-01 2010-11-30 Hewlett-Packard Development Company, L.P. Network loop detection using known static addresses
FR2903830B1 (en) * 2006-07-11 2008-08-22 Alcatel Sa METHOD AND DEVICE FOR MONITORING OPTICAL CONNECTION PATHS FOR A TRANSPARENT OPTICAL NETWORK
WO2015120581A1 (en) * 2014-02-11 2015-08-20 Telefonaktiebolaget L M Ericsson (Publ) Traffic loop detection in a communication network

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0896494A2 (en) * 1997-08-08 1999-02-10 Kabushiki Kaisha Toshiba Scheme for label switched path loop detection at node device
CN1361612A (en) * 2000-12-29 2002-07-31 北京邮电大学 Simple adaptive fast convergence mark exchange path loop preventing technique
CN101309161A (en) * 2007-05-01 2008-11-19 兄弟工业株式会社 Information distribution system, terminal apparatus used in such system, recording medium on which program is recorded, and loop connection avoidance method
CN107171898A (en) * 2017-07-14 2017-09-15 上海市信息网络有限公司 Operator's Ethernet Circle detection and loop method of disposal

Also Published As

Publication number Publication date
CN109391526A (en) 2019-02-26

Similar Documents

Publication Publication Date Title
CN109391526B (en) Network loop detection method and device
EP3627767B1 (en) Fault processing method and device for nodes in cluster
US10873622B2 (en) Call chain-based concurrency control method and apparatus, and control node
CN102882704B (en) Link protection method in the soft reboot escalation process of a kind of ISSU and equipment
US10049068B2 (en) SAS system, SAS system traversal method, and apparatus
CN109088818B (en) Equipment linkage switching method and device
CN113193996B (en) Power optical transmission network optimization method, device, equipment and storage medium
CN111355600B (en) Main node determining method and device
CN110912815B (en) Network element ring formation preventing method, device, equipment and readable storage medium
CN109462533B (en) Link switching method, link redundancy backup network and computer readable storage medium
WO2019178731A1 (en) Data transmission method and device
US10409620B2 (en) Spanning tree protocol warm reboot system
CN112995002B (en) Switch ring network design method, switch and storage medium
CN111698157B (en) Link management method, board card and switch
CN108667640B (en) Communication method and device, and network access system
CN109450765B (en) Method and device for collecting topology information
CN103414591A (en) Method and system for fast converging when port failure is recovered
US10516625B2 (en) Network entities on ring networks
US20220038798A1 (en) Service path switching method and related device
CN111464436B (en) Method for solving single-port loop of RSTP (remote station transfer protocol)
CN110661599A (en) HA implementation method, device and storage medium between main node and standby node
CN114760207A (en) Ring network damage method and system of Ethernet
US20180139113A1 (en) Efficiently Calculating Per Service Impact Of Ethernet Ring Status Changes
CN111404810B (en) Openflow flow table recovery method and device, electronic equipment and medium
CN115460635A (en) Fault detection method, device, equipment and computer storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant