CN106789625B - Loop detection method and device - Google Patents

Loop detection method and device Download PDF

Info

Publication number
CN106789625B
CN106789625B CN201611220023.9A CN201611220023A CN106789625B CN 106789625 B CN106789625 B CN 106789625B CN 201611220023 A CN201611220023 A CN 201611220023A CN 106789625 B CN106789625 B CN 106789625B
Authority
CN
China
Prior art keywords
loop detection
message
equipment
detection message
loop
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
CN201611220023.9A
Other languages
Chinese (zh)
Other versions
CN106789625A (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.)
Beijing Huawei Digital Technologies Co Ltd
Original Assignee
Beijing Huawei Digital Technologies 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 Beijing Huawei Digital Technologies Co Ltd filed Critical Beijing Huawei Digital Technologies Co Ltd
Priority to CN201611220023.9A priority Critical patent/CN106789625B/en
Publication of CN106789625A publication Critical patent/CN106789625A/en
Application granted granted Critical
Publication of CN106789625B publication Critical patent/CN106789625B/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
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/18Loop-free operations
    • 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/0631Management of faults, events, alarms or notifications using root cause analysis; using analysis of correlation between notifications, alarms or events based on decision criteria, e.g. hierarchy, tree or time analysis
    • 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/10Active monitoring, e.g. heartbeat, ping or trace-route

Abstract

The invention relates to the technical field of networks, in particular to a loop detection method and a loop detection device, which are used for solving the problems of manual loop fault detection, long time consumption and low efficiency. The method comprises the following steps: when receiving a message with the Time To Live (TTL) of 0, a first device acquires a destination IP address of the message with the TTL of 0, generates a loop detection message, wherein the destination address of the loop detection message is the destination IP address, a source address of the loop detection message is the IP address of the first device, the loop detection message comprises a device information field, the device information field is used for recording identification information of each device through which the loop detection message passes, and the device information field comprises the identification information of the first device; and the first equipment determines a forwarding path according to the target address of the loop detection message and forwards the loop detection message according to the forwarding path.

Description

Loop detection method and device
Technical Field
The present invention relates to the field of network technologies, and in particular, to a loop detection method and apparatus.
Background
In a three-layer network, such as a Long Term Evolution (LTE) network, as shown in fig. 1, a loop may fail due to a problem of routing configuration or a device failure, so that a message cannot be successfully sent to a destination address, and a service is damaged.
For example, in fig. 1, in a subnet, a loop fault is formed by network side Edge devices (PE) 1, PE2, PE3, and PE4, so that a message is circularly forwarded among PE1, PE2, PE3, and PE4, and a destination address cannot be reached. Furthermore, PE3 and PE4 may also form a loop fault with devices within other subnets (not shown in fig. 1).
In the prior art, when a message is found to be unable to reach a destination address, each device can only be manually checked one by one to determine each device forming a loop fault and a cause of the loop fault, so that time is consumed, the checking efficiency is low, and quick recovery of the fault is influenced.
Disclosure of Invention
The embodiment of the invention provides a loop detection method and device, which are used for solving the problems of manual detection of loop faults, long time consumption and low efficiency.
The purpose of the embodiment of the invention is realized by the following technical scheme:
in a first aspect, a loop detection method includes:
when receiving a message with the Time To Live (TTL) of 0, the first device acquires the destination IP address of the message with the TTL of 0, then generates a loop detection message, determines a forwarding path according to the destination address of the loop detection message, and forwards the loop detection message according to the forwarding path.
The destination address of the loop detection message is a destination IP address, the source address of the loop detection message is an IP address of the first device, the loop detection message comprises a device information field, the device information field is used for recording identification information of each device through which the loop detection message passes, and the device information field comprises the identification information of the first device. The loop detection message is used for detecting whether the first device and other devices form a loop fault.
Therefore, the TTL is 0 by the method provided by the embodiment of the present invention, which indicates that the packet has reached the maximum allowed network segment number, and the first device generates the loop detection packet for detecting whether the first device and other devices form a loop fault.
In a possible implementation manner, the IP header of the loop detection packet includes a preset packet protocol number, where the preset packet protocol number is used to represent that a packet corresponding to the protocol number is a loop detection packet.
The preset protocol number may be selected as 134, it should be understood that the protocol number here is only an example, and any unoccupied protocol number may be applied as a protocol number corresponding to the loop detection packet.
In a possible implementation manner, the loop detection packet further includes a hop count field, where the hop count field is used to count the number of devices through which the loop detection packet passes, and a current value of the hop count field is 0.
In addition, the IP header of the loop detection packet further includes a total length field of 1500 bytes, and a TTL field, which may be set to 255, and other fields commonly found in IP headers.
In a second aspect, a loop detection method includes: and the first equipment receives the message sent by the second equipment, and judges whether the source address of the loop detection message is the same as the IP address of the first equipment or not when the message is determined to be the loop detection message. Specifically, when the first device determines that the source address of the loop detection message is the same as the IP address of the first device, a loop fault alarm is generated and sent to the network management device, where the loop fault alarm carries a device information field included in the loop detection message, so that the network management device determines a device member constituting the loop fault according to the identification information of each device through which the loop detection message passes, recorded in the device information field; when the first equipment determines that the source address of the loop detection message is different from the IP address of the first equipment, sequentially writing identification information of the first equipment into an equipment information field carried by the loop detection message; and determining a forwarding path according to the target address of the loop detection message, and forwarding the updated loop detection message according to the forwarding path. Wherein. The loop detection message is used for detecting whether the first device and other devices form a loop fault.
Therefore, the device receiving the loop detection message by the method provided by the embodiment of the invention can quickly and simply judge whether the received loop detection message is the loop detection message generated by the device, and when the device and other devices form a loop fault, the device related to the loop fault can be actively reported to the network management device. When determining that the loop fault does not form with other equipment, the loop detection message is continuously forwarded, and the checking efficiency of the loop fault is greatly improved.
In a possible implementation manner, the determining, by the first device, that the packet sent by the second device is the loop detection packet includes: the first device extracts a message protocol number included in an IP (Internet protocol) header of a message sent by the second device, and determines that the message is a loop detection message when the message protocol number is determined to be a preset message protocol number.
Therefore, the type of the received message can be simply, conveniently and accurately judged through the preset message protocol number.
In a possible implementation manner, after determining that a source address of a loop detection message is different from an IP address of a first device, the first device adds 1 to a value of a hop count field carried by the loop detection message, where the hop count field is used to count the number of devices through which the loop detection message passes; therefore, when the first device writes the identification information of the first device in the device information field carried by the loop detection message in sequence, the first device writes the identification information of the first device in the corresponding position of the device information field according to the updated value of the hop count field.
In a possible implementation manner, when the first device writes the identification information of the first device in the device information field carried in the loop detection packet in sequence, the first device writes the identification information of the first device in the corresponding position of the device information field according to the value of the hop count field carried in the loop detection packet, where the hop count field is used to count the number of devices through which the loop detection packet passes. Therefore, after the first device sequentially writes the identification information of the first device in the device information field carried in the loop detection packet, the first device adds 1 to the value of the hop count field.
Therefore, when the identification information of the first device is written into the device information field, the embodiment of the invention provides a plurality of possible implementation modes so as to conveniently record the identification information of each device and improve the user experience.
In a third aspect, a loop detection apparatus includes:
the analyzing unit is used for acquiring a destination IP address of the message with the TTL of 0 when the message with the survival time TTL of 0 is received;
the generating unit is used for generating a loop detection message, wherein the destination address of the loop detection message is a destination IP address, the source address of the loop detection message is an IP address of equipment where the device is located, the loop detection message comprises an equipment information field, the equipment information field is used for recording identification information of each piece of equipment through which the loop detection message passes, and the equipment information field comprises identification information of the equipment where the device is located;
the forwarding unit is used for determining a forwarding path according to the target address of the loop detection message and forwarding the loop detection message according to the forwarding path;
the loop detection message is used for detecting whether the equipment where the device is located and other equipment form a loop fault.
In a possible implementation manner, the IP header of the loop detection packet includes a preset packet protocol number, where the preset packet protocol number is used to represent that a packet corresponding to the protocol number is a loop detection packet.
In a possible implementation manner, the loop detection packet further includes a hop count field, where the hop count field is used to count the number of devices through which the loop detection packet passes, and a current value of the hop count field is 0.
In a fourth aspect, a loop detection apparatus includes:
the receiving and sending unit is used for receiving the message sent by the second equipment;
the processing unit is used for judging whether a source address of the loop detection message is the same as an IP address of equipment where the device is located when the message is determined to be the loop detection message, and the loop detection message is used for detecting whether the equipment where the device is located and other equipment form a loop fault;
when the source address of the loop detection message is determined to be the same as the IP address of the equipment where the device is located, generating a loop fault alarm, and sending the loop fault alarm to the network management equipment, wherein the loop fault alarm carries an equipment information field included in the loop detection message, so that the network management equipment determines the equipment members forming the loop fault according to the identification information of each piece of equipment through which the loop detection message passes, recorded in the equipment information field;
when the source address of the loop detection message is determined to be different from the IP address of the equipment where the device is located, sequentially writing identification information of the equipment where the device is located in an equipment information field carried by the loop detection message; and determining a forwarding path according to the target address of the loop detection message, and forwarding the updated loop detection message through the receiving and sending unit according to the forwarding path.
In one possible implementation, a processing unit is configured to:
and when the message sent by the second equipment is determined to be the loop detection message, extracting a message protocol number included in an IP (Internet protocol) header of the message sent by the second equipment, and when the message protocol number is determined to be a preset message protocol number, determining that the message is the loop detection message.
In one possible implementation, the processing unit is further configured to:
after determining that the source address of the loop detection message is different from the IP address of the device, adding 1 to the value of a hop field carried by the loop detection message, wherein the hop field is used for counting the number of devices through which the loop detection message passes;
a processing unit to:
and when the identification information of the equipment where the device is located is written in the equipment information field carried by the loop detection message in sequence, writing the identification information of the equipment where the device is located in the corresponding position of the equipment information field according to the updated hop count field value.
In one possible implementation, a processing unit is configured to:
when the identification information of the equipment where the device is located is written in the equipment information field carried by the loop detection message in sequence, the identification information of the equipment where the device is located is written in the corresponding position of the equipment information field according to the value of the hop field carried by the loop detection message, wherein the hop field is used for counting the number of the equipment through which the loop detection message passes;
a processing unit to: and after the identification information of the equipment where the device is located is written in the equipment information field carried by the loop detection message in sequence, adding 1 to the value of the hop count field.
In a fifth aspect, a loop detection apparatus includes: the system comprises a communication interface, a memory and a processor, wherein the memory is used for storing programs; the processor calls the program stored in the memory for executing the method provided by the first aspect.
In a sixth aspect, a loop detection apparatus includes: the system comprises a communication interface, a memory and a processor, wherein the memory is used for storing programs; the processor calls the program stored in the memory for executing the method provided by the second aspect.
Drawings
Fig. 1 is a schematic diagram of a loop fault in an LTE network according to the background of the present invention;
FIG. 2 is a flowchart illustrating an exemplary embodiment of a loop detection method;
fig. 3 is a schematic structural diagram of a loop detection packet in the embodiment of the present invention;
FIG. 4 is a second flowchart of an exemplary loop detection method according to the present invention;
fig. 5 is a schematic diagram of different processing procedures for a loop detection packet in the embodiment of the present invention;
FIG. 6 is a schematic structural diagram of a loop detection apparatus according to an embodiment of the present invention;
FIG. 7 is a second schematic structural diagram of a loop detection apparatus according to an embodiment of the present invention;
FIG. 8 is a diagram illustrating an exemplary structure of a loop detection apparatus according to an embodiment of the present invention;
fig. 9 is a second schematic structural diagram of a loop detection apparatus according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention will be described below with reference to the accompanying drawings.
The device in the embodiment of the present invention may be a Network side edge device, a router, a Packet Transport Network (PTN) device, or the like.
The Time To Live (TTL) field in the embodiments of the present invention is used To indicate the maximum number of network segments allowed To pass through before the IP packet is discarded by the router, that is, the maximum number of hops that the IP packet can forward in the computer network. The TTL is set by the sending host to prevent packets from ever looping around the IP internetwork. The maximum value of TTL is 255.
Specifically, the TTL field is set by the sender of the IP packet, and the router modifies the value of the TTL field every time the IP packet passes through a router on the entire forwarding path from the source address to the destination address, specifically, the TTL field is decremented by 1, and then the IP packet is forwarded. If the TTL is reduced to 0 before the IP packet reaches the destination address, the router discards the received IP packet with TTL being 0 and sends an Internet control message protocol timeout (ICMP timed) message to the sender of the IP packet. Network management personnel determine that the routing loop fault occurs according to the message, and manually troubleshoot each device one by one, which is time-consuming, low in troubleshooting efficiency and capable of influencing rapid recovery of the fault.
In view of this, an embodiment of the present invention provides a loop detection method, as shown in fig. 2, the method includes:
step 200: and when receiving the message with the TTL of 0, the first equipment acquires the destination IP address of the message with the TTL of 0.
Specifically, the TTL is 0, which indicates that the packet has reached the maximum allowed number of network segments, and the first device discards the packet when receiving the packet. Therefore, the message cannot reach the destination IP address, and a loop fault may exist in the network system.
Step 210: the first device generates a loop detection message.
Therefore, TTL is 0 as a trigger condition for generating a loop detection packet.
And the first equipment generates the loop detection message, and the message is used for detecting whether the first equipment and other equipment form loop faults or not. The destination address of the loop detection message is a destination IP address, the source address of the loop detection message is an IP address of the first device, the loop detection message comprises a device information field, the device information field is used for recording identification information of each device through which the loop detection message passes, and the device information field comprises the identification information of the first device.
Step 220: and the first equipment determines a forwarding path according to the target address of the loop detection message and forwards the loop detection message according to the forwarding path.
Specifically, each device searches a routing table according to the target address, and determines a forwarding path and a next hop forwarding node.
In a possible implementation manner, the IP header of the loop detection packet includes a preset packet protocol number, where the preset packet protocol number is used to represent that a packet corresponding to the protocol number is a loop detection packet.
In a possible implementation manner, the loop detection packet further includes a hop count field, where the hop count field is used to count the number of devices through which the loop detection packet passes, and a current value of the hop count field is 0.
As an alternative embodiment, referring to fig. 3, in the loop detection packet provided in the embodiment of the present invention, it is assumed that PE1 in fig. 1 receives a packet with TTL of 0, and generates a loop detection packet. In the IP header of the loop detection message, the IP address of PE1 is used as a source address, the destination IP address of the message with TTL of 0 is used as a destination address, and a protocol number is preset to be 134, it should be understood that the protocol number here is merely an example, and any unoccupied protocol number may be applied as a protocol number corresponding to the loop detection message. In addition, the IP header of the loop detection packet further includes a total length field of 1500 bytes, and a TTL field, which can be set to 255, and other fields commonly found in IP headers, which are similar to the existing packet and are not listed here.
The data field of the loop detection message comprises a hop field and a device information field, wherein the data field is divided according to every 4 bytes, one byte of the first 4 bytes is used as the hop field, the other 3 bytes are reserved, and the other 4 bytes are used as the device information field. The initial value of the hop count field is 0, the device information field includes identification information of PE1, where the identification information may be a device identifier of PE1 or an IP address of PE1, and the remaining portion of the device information field is 0.
Further, referring to fig. 4, an embodiment of the present invention provides a loop detection method, where a first device is any device, and a process described below is a processing flow of any device after receiving a loop detection packet. The method comprises the following steps:
step 400: the first equipment receives the message sent by the second equipment.
Step 410: when the first device determines that the message is a loop detection message, whether the source address of the loop detection message is the same as the IP address of the first device or not is judged, and the loop detection message is used for detecting whether the first device and other devices form a loop fault or not.
In a possible implementation manner, the method for determining, by the first device, that the packet sent by the second device is the loop detection packet may adopt, but is not limited to, the following methods: the first device extracts a message protocol number included in an IP (Internet protocol) header of a message sent by the second device, and determines that the message is a loop detection message when the message protocol number is determined to be a preset message protocol number.
For example, the preset message protocol number is 134, and when the message protocol number of the message received by the first device through parsing is determined to be 134, the message is determined to be a loop detection message.
Step 420 a: and when the first equipment determines that the source address of the loop detection message is the same as the IP address of the first equipment, generating a loop fault alarm and sending the loop fault alarm to the network management equipment, wherein the loop fault alarm carries an equipment information field included in the loop detection message, so that the network management equipment determines the equipment members forming the loop fault according to the identification information of each piece of equipment through which the loop detection message passes, recorded in the equipment information field.
Step 420 b: when the first equipment determines that the source address of the loop detection message is different from the IP address of the first equipment, sequentially writing identification information of the first equipment into an equipment information field carried by the loop detection message; and determining a forwarding path according to the target address of the loop detection message, and forwarding the updated loop detection message according to the forwarding path.
As can be seen from the above, the determining, by the first device, whether the source address of the loop detection packet is the same as the IP address of the first device may include two cases, step 420a and step 420 b.
In step 420a, when the source address of the loop detection message is the same as the IP address of the first device, it indicates that the loop detection message returns to the sending host, and the forwarding path of the loop detection message forms a loop, and does not reach the destination address, at this time, the first device generates a loop fault alarm and sends the loop fault alarm to the network management device.
Specifically, the first device determines the loop topology according to the device information field, and starts from the identification information of the first device, the identification information of all devices in the device information field, that is, the identification information (value of the hop count field +1) is used as a loop fault alarm.
In step 420b, when the source address of the loop detection packet is different from the IP address of the first device, it indicates that loop detection is not completed and needs to be forwarded continuously, and at this time, the first device writes the identification information of the first device in the device information field carried in the loop detection packet in sequence.
Specifically, when the first device sequentially writes the identification information of the first device in the device information field carried in the loop detection packet, the following method may be adopted, but is not limited to:
the first method comprises the following steps: and when the loop detection message does not comprise the hop field, the first equipment writes the identification information of the first equipment in the equipment information field carried by the loop detection message in sequence.
For example, the first device writes the IP address of the first device in the next 4 bytes of the currently stored information according to the information currently stored in the device information field.
The second method comprises the following steps: and when the loop detection message comprises the hop count field, the first device adds 1 to the value of the hop count field carried by the loop detection message, and the first device writes the identification information of the first device in the corresponding position of the device information field according to the updated hop count field value.
For example, PE4 determines that the value of the current hop count field is 3, the loop detection packet has already passed through PE1, PE2, and PE3, at this time, PE4 updates the value of the hop count field in the loop detection packet to be 4, and writes the identification information of PE4 in the (4+1) th 4-byte position. Specifically, one byte in the first 4 bytes of the data field in the loop detection message is occupied by the hop count field, and the second to fourth 4 bytes respectively store the identification information of the PE1, the identification information of the PE2, and the identification information of the PE3, which are written in sequence. Thus, PE4 writes its own identification information in the 5 th 4-byte.
The third method comprises the following steps: when the loop detection message includes the hop count field, the first device writes the identification information of the first device in the corresponding position of the device information field according to the value of the hop count field carried by the loop detection message, and the first device adds 1 to the value of the hop count field.
For example, PE4 determines that the value of the current hop count field is 3, the loop detection packet has already passed through PE1, PE2, and PE3, and at this time, PE4 writes the identification information of PE4 at the (3+2) th 4-byte position. Specifically, one byte in the first 4 bytes of the data field in the loop detection message is occupied by the hop count field, and the second to fourth 4 bytes respectively store the identification information of the PE1, the identification information of the PE2, and the identification information of the PE3, which are written in sequence. Therefore, PE4 writes its own identification information in the 5 th 4-byte, and then updates the hop count field in the loop detection message to have a value of 4.
Therefore, as seen from step 420a and step 420b, the number of devices that receive the loop detection packet in the embodiment of the present invention is two, where the first device is a device that initiates the loop detection packet, and the second device is a device that receives the loop detection packet in the middle.
Referring to fig. 5, different processes of two devices for loop detection messages are shown.
And after receiving the message with TTL of 0, the equipment initiating the loop detection message extracts the message, constructs the loop detection message and sends the loop detection message.
The total length of the loop detection message is 1500, the life cycle is 255, the IP protocol number is 134, the source address is the device IP, the destination address is the destination address in the extraction message, the hop count is 0, and the device information field is the device IP.
When the device receiving the loop detection message in the middle identifies the loop detection message according to the IP protocol number 134, the source address in the message is compared with the IP of the device, when the source address and the IP of the device are determined to be unequal, the IP of the device is filled to the corresponding position of the information field of the device, and the value of the hop field is added with 1 for forwarding.
The device initiating the loop detection message receives the message again, and generates a loop alarm by comparing the source address in the message with the IP of the device when recognizing the loop detection message according to the IP protocol number 134.
Based on the same inventive concept, an embodiment of the present invention further provides a loop detection apparatus, which may be configured to execute the method embodiment corresponding to fig. 2, so that the implementation of the loop detection apparatus provided in the embodiment of the present invention may refer to the implementation of the method, and repeated details are not described again.
Referring to fig. 6, an embodiment of the invention provides a loop detection apparatus 600, including:
an analyzing unit 610, configured to obtain a destination IP address of a packet with a TTL of 0 when the packet with the TTL of 0 is received;
a generating unit 620, configured to generate a loop detection message, where a destination address of the loop detection message is a destination IP address, a source address of the loop detection message is an IP address of a device in which the apparatus is located, the loop detection message includes an apparatus information field, the apparatus information field is used to record identification information of each apparatus through which the loop detection message passes, and the apparatus information field includes identification information of the device in which the apparatus is located;
a forwarding unit 630, configured to determine a forwarding path according to a destination address of the loop detection packet, and forward the loop detection packet according to the forwarding path;
the loop detection message is used for detecting whether the equipment where the device is located and other equipment form a loop fault.
In a possible implementation manner, the IP header of the loop detection packet includes a preset packet protocol number, where the preset packet protocol number is used to represent that a packet corresponding to the protocol number is a loop detection packet.
In a possible implementation manner, the loop detection packet further includes a hop count field, where the hop count field is used to count the number of devices through which the loop detection packet passes, and a current value of the hop count field is 0.
Based on the same inventive concept, an embodiment of the present invention further provides a loop detection apparatus, which may be used to execute the method embodiment corresponding to fig. 4, so that the implementation of the loop detection apparatus provided in the embodiment of the present invention may refer to the implementation of the method, and repeated details are not described again.
Referring to fig. 7, an embodiment of the invention provides a loop detection apparatus 700, including:
a transceiving unit 710, configured to receive a message sent by a second device;
a processing unit 720, configured to determine whether a source address of the loop detection packet is the same as an IP address of the device in which the apparatus is located when the packet is determined to be the loop detection packet, where the loop detection packet is used to detect whether the device in which the apparatus is located and other devices form a loop fault;
when the source address of the loop detection message is determined to be the same as the IP address of the equipment where the device is located, generating a loop fault alarm, and sending the loop fault alarm to the network management equipment, wherein the loop fault alarm carries an equipment information field included in the loop detection message, so that the network management equipment determines the equipment members forming the loop fault according to the identification information of each piece of equipment through which the loop detection message passes, recorded in the equipment information field;
when the source address of the loop detection message is determined to be different from the IP address of the equipment where the device is located, sequentially writing identification information of the equipment where the device is located in an equipment information field carried by the loop detection message; and determining a forwarding path according to the target address of the loop detection message, and forwarding the updated loop detection message through the receiving and sending unit according to the forwarding path.
In one possible implementation, the processing unit 720 is configured to:
and when the message sent by the second equipment is determined to be the loop detection message, extracting a message protocol number included in an IP (Internet protocol) header of the message sent by the second equipment, and when the message protocol number is determined to be a preset message protocol number, determining that the message is the loop detection message.
In a possible implementation manner, the processing unit 720 is further configured to:
after determining that the source address of the loop detection message is different from the IP address of the device, adding 1 to the value of a hop field carried by the loop detection message, wherein the hop field is used for counting the number of devices through which the loop detection message passes;
a processing unit 720 for:
and when the identification information of the equipment where the device is located is written in the equipment information field carried by the loop detection message in sequence, writing the identification information of the equipment where the device is located in the corresponding position of the equipment information field according to the updated hop count field value.
In one possible implementation, the processing unit 720 is configured to:
when the identification information of the equipment where the device is located is written in the equipment information field carried by the loop detection message in sequence, the identification information of the equipment where the device is located is written in the corresponding position of the equipment information field according to the value of the hop field carried by the loop detection message, wherein the hop field is used for counting the number of the equipment through which the loop detection message passes;
a processing unit 720 for: and after the identification information of the equipment where the device is located is written in the equipment information field carried by the loop detection message in sequence, adding 1 to the value of the hop count field.
Based on the same inventive concept, an embodiment of the present invention further provides a loop detection device, which may be configured to execute the method embodiment corresponding to fig. 2, so that reference may be made to the method embodiment for implementing the loop detection device provided in the embodiment of the present invention, and repeated details are not repeated.
Referring to fig. 8, an embodiment of the invention provides a loop detection apparatus 800, including: the communication interface 810, the memory 820, the processor 830, and the processor 830, which are respectively connected to the memory 820 and the communication interface 810, wherein the memory 820 is used for storing programs; the processor 830 invokes a program stored in the memory 820 to: when a message with the survival time of 0 is received through a communication interface 810, acquiring a destination IP address of the message with the TTL of 0; generating a loop detection message, wherein a destination address of the loop detection message is the destination IP address, a source address of the loop detection message is the IP address of the equipment, the loop detection message comprises an equipment information field, the equipment information field is used for recording identification information of each piece of equipment through which the loop detection message passes, and the equipment information field comprises the identification information of the equipment; determining a forwarding path according to the destination address of the loop detection packet, and forwarding the loop detection packet through the communication interface 810 according to the forwarding path.
And the loop detection message is used for detecting whether the first equipment and other equipment form a loop fault.
Based on the same inventive concept, an embodiment of the present invention further provides a loop detection device, which may be configured to execute the method embodiment corresponding to fig. 4, so that the implementation of the loop detection device provided in the embodiment of the present invention may refer to the implementation of the method, and repeated details are not described again.
Referring to fig. 9, an embodiment of the present invention provides a loop detection apparatus 900, including: the communication interface 910, the memory 920, the processor 930, and the processor 930, which are respectively connected to the memory 920 and the communication interface 910, wherein the memory 920 is used for storing programs; the processor 930 invokes a program stored in the memory 920 to: receiving a message sent by the second device through the communication interface 910; when the message is determined to be a loop detection message, judging whether a source address of the loop detection message is the same as an IP address of the equipment, wherein the loop detection message is used for detecting whether the equipment and other equipment form a loop fault; when the source address of the loop detection message is determined to be the same as the IP address of the first device, generating a loop fault alarm, and sending the loop fault alarm to network management equipment, wherein the loop fault alarm carries an equipment information field included in the loop detection message, so that the network management equipment determines the equipment members forming the loop fault according to the identification information of each piece of equipment through which the loop detection message passes, recorded in the equipment information field; when the source address of the loop detection message is determined to be different from the IP address of the first device, sequentially writing identification information of the devices in a device information field carried by the loop detection message; and determines a forwarding path according to the destination address of the loop detection packet, and forwards the updated loop detection packet through the communication interface 910 according to the forwarding path.
It should be noted that the connection manner between the parts shown in fig. 8 and fig. 9 is only one possible example, and both the communication interface and the memory may be connected to the processor, and the communication interface and the memory are not connected, or other possible connection manners may be possible.
In summary, compared with the problem of low time consumption and long efficiency in manual loop fault detection in the prior art, the method provided by the embodiment of the invention generates the loop detection message when the TTL of the received message is 0. Therefore, the device receiving the message with TTL of 0 by adopting the method provided by the embodiment of the invention can automatically generate the loop detection message to detect the loop fault, thereby improving the loop detection efficiency. Furthermore, the device receiving the loop detection message can quickly, simply and conveniently judge whether the received loop detection message is a loop detection message generated by the device itself, and when determining that the device itself and other devices form a loop fault, the device related to the loop fault can be actively reported to the network management device. When determining that the loop fault does not form with other equipment, the loop detection message is continuously forwarded, and the checking efficiency of the loop fault is greatly improved.
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 modifications and variations can be made in the embodiments of the present invention without departing from the spirit or scope of the embodiments of the invention. Thus, if such modifications and variations of the embodiments 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 encompass such modifications and variations.

Claims (14)

1. A loop detection method, comprising:
when receiving a message with the survival time of 0, a first device acquires a destination IP address of the message with the TTL of 0;
the first device generates a loop detection message, wherein a destination address of the loop detection message is the destination IP address, a source address of the loop detection message is the IP address of the first device, the loop detection message comprises a device information field, the device information field is used for recording identification information of each device through which the loop detection message passes, and the device information field comprises the identification information of the first device;
the first equipment determines a forwarding path according to the target address of the loop detection message and forwards the loop detection message according to the forwarding path;
and the loop detection message is used for detecting whether the first equipment and other equipment form a loop fault.
2. The method according to claim 1, wherein the IP header of the loop detection packet includes a predetermined packet protocol number, and the predetermined packet protocol number is used to characterize the packet corresponding to the protocol number as the loop detection packet.
3. The method according to claim 1 or 2, wherein the loop detection packet further comprises a hop count field, wherein the hop count field is used for counting the number of devices passed by the loop detection packet, and the current value of the hop count field is 0.
4. A loop detection method, comprising:
the first equipment receives a message sent by the second equipment;
when the first device determines that the message is a loop detection message, judging whether a source address of the loop detection message is the same as an IP address of the first device, wherein the loop detection message is used for detecting whether the first device and other devices form a loop fault;
when the first device determines that the source address of the loop detection message is the same as the IP address of the first device, a loop fault alarm is generated and sent to network management equipment, wherein the loop fault alarm carries an equipment information field included in the loop detection message, so that the network management equipment determines equipment members forming a loop fault according to the identification information of each piece of equipment through which the loop detection message passes, recorded in the equipment information field;
when the first device determines that the source address of the loop detection message is different from the IP address of the first device, sequentially writing the identification information of the first device in a device information field carried by the loop detection message; and are
Determining a forwarding path according to the target address of the loop detection message, and forwarding the updated loop detection message according to the forwarding path, wherein the loop detection message is generated by a device receiving the message with TTL of 0, and the destination address of the loop detection message is the destination IP address of the message with TTL of 0.
5. The method of claim 4, wherein the determining, by the first device, that the packet sent by the second device is a loop detection packet, comprises:
and the first equipment extracts a message protocol number included in an IP (Internet protocol) header of a message sent by the second equipment, and determines that the message is a loop detection message when the message protocol number is determined to be a preset message protocol number.
6. The method according to claim 4 or 5, wherein after the first device determines that the source address of the loop detection packet is not the same as the IP address of the first device, the method further comprises:
the first device adds 1 to the value of a hop field carried by the loop detection message, wherein the hop field is used for counting the number of devices through which the loop detection message passes;
the first device writes the identification information of the first device in the device information field carried in the loop detection packet in sequence, including:
and the first equipment writes the identification information of the first equipment in the corresponding position of the equipment information field according to the updated value of the hop count field.
7. The method according to claim 4 or 5, wherein the first device writes the identification information of the first device in sequence in a device information field carried in the loop detection packet, including:
the first device writes the identification information of the first device in the corresponding position of the device information field according to the value of the hop field carried by the loop detection message, wherein the hop field is used for counting the number of devices through which the loop detection message passes;
after the first device sequentially writes the identification information of the first device in the device information field carried in the loop detection packet, the method includes:
the first device adds 1 to the value of the hop count field.
8. A loop detection device, comprising:
the analyzing unit is used for acquiring a destination IP address of the message with the TTL of 0 when the message with the survival time TTL of 0 is received;
a generating unit, configured to generate a loop detection packet, where a destination address of the loop detection packet is the destination IP address, a source address of the loop detection packet is an IP address of a device in which the apparatus is located, the loop detection packet includes a device information field, the device information field is used to record identification information of each device through which the loop detection packet passes, and the device information field includes identification information of the device in which the apparatus is located;
a forwarding unit, configured to determine a forwarding path according to a target address of the loop detection packet, and forward the loop detection packet according to the forwarding path;
and the loop detection message is used for detecting whether the equipment where the device is located forms a loop fault with other equipment.
9. The apparatus according to claim 8, wherein the IP header of the loop detection packet includes a predetermined packet protocol number, and the predetermined packet protocol number is used to characterize the packet corresponding to the protocol number as the loop detection packet.
10. The apparatus according to claim 8 or 9, wherein the loop detection packet further includes a hop count field, wherein the hop count field is used for counting the number of devices passed by the loop detection packet, and a current value of the hop count field is 0.
11. A loop detection device, comprising:
the receiving and sending unit is used for receiving the message sent by the second equipment;
the processing unit is used for judging whether a source address of the loop detection message is the same as an IP address of equipment where the device is located when the message is determined to be the loop detection message, and the loop detection message is used for detecting whether the equipment where the device is located and other equipment form a loop fault;
when the source address of the loop detection message is determined to be the same as the IP address of the device, generating a loop fault alarm, and sending the loop fault alarm to network management equipment, wherein the loop fault alarm carries an equipment information field included in the loop detection message, so that the network management equipment determines the equipment members forming the loop fault according to the identification information of each piece of equipment through which the loop detection message passes, recorded in the equipment information field;
when the source address of the loop detection message is determined to be different from the IP address of the equipment where the device is located, sequentially writing identification information of the equipment where the device is located in an equipment information field carried by the loop detection message; and determining a forwarding path according to the destination address of the loop detection message, and forwarding the updated loop detection message through the transceiver unit according to the forwarding path, wherein the loop detection message is generated by a device receiving the message with TTL of 0, and the destination address of the loop detection message is the destination IP address of the message with TTL of 0.
12. The apparatus as recited in claim 11, said processing unit to:
and when the message sent by the second equipment is determined to be a loop detection message, extracting a message protocol number included in an IP (Internet protocol) header of the message sent by the second equipment, and when the message protocol number is determined to be a preset message protocol number, determining that the message is the loop detection message.
13. The apparatus as claimed in claim 11 or 12, wherein said processing unit is further configured to:
after determining that the source address of the loop detection message is different from the IP address of the device, adding 1 to the value of a hop field carried by the loop detection message, wherein the hop field is used for counting the number of devices through which the loop detection message passes;
the processing unit is configured to:
and when the identification information of the equipment where the device is located is written in the equipment information field carried by the loop detection message in sequence, writing the identification information of the equipment where the device is located in the corresponding position of the equipment information field according to the updated value of the hop count field.
14. The apparatus as claimed in claim 11 or 12, wherein said processing unit is configured to:
when the identification information of the equipment where the device is located is written in the equipment information field carried by the loop detection message in sequence, the identification information of the equipment where the device is located is written in the corresponding position of the equipment information field according to the value of the hop field carried by the loop detection message, wherein the hop field is used for counting the number of the equipment through which the loop detection message passes;
the processing unit is configured to: and after the identification information of the equipment where the device is located is written in the equipment information field carried by the loop detection message in sequence, adding 1 to the value of the hop count field.
CN201611220023.9A 2016-12-26 2016-12-26 Loop detection method and device Active CN106789625B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611220023.9A CN106789625B (en) 2016-12-26 2016-12-26 Loop detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611220023.9A CN106789625B (en) 2016-12-26 2016-12-26 Loop detection method and device

Publications (2)

Publication Number Publication Date
CN106789625A CN106789625A (en) 2017-05-31
CN106789625B true CN106789625B (en) 2021-02-23

Family

ID=58926277

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611220023.9A Active CN106789625B (en) 2016-12-26 2016-12-26 Loop detection method and device

Country Status (1)

Country Link
CN (1) CN106789625B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107171898A (en) * 2017-07-14 2017-09-15 上海市信息网络有限公司 Operator's Ethernet Circle detection and loop method of disposal
CN107809351B (en) * 2017-10-24 2022-05-10 南京贝伦思网络科技股份有限公司 Method for detecting loop in bypass mode
CN110650086B (en) * 2018-06-27 2020-12-15 华为技术有限公司 Routing loop detection method and device
CN109547339B (en) * 2019-01-18 2021-07-09 深圳市吉祥腾达科技有限公司 Method and system for preventing network from forming loop in wireless router networking
CN113014442B (en) * 2019-12-19 2023-04-18 西安诺瓦星云科技股份有限公司 Network port loop detection method and network port loop detection system
CN111314216A (en) * 2020-02-13 2020-06-19 深圳市吉祥腾达科技有限公司 Mixed networking ring prevention method for MESH router
WO2022088843A1 (en) * 2020-10-28 2022-05-05 华为技术有限公司 Routing advertisement method, routing loop detection method, and device
CN112769667B (en) * 2021-01-14 2022-07-19 北京星网锐捷网络技术有限公司 Loop protection control method and device for multi-device cascade communication network

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103457756A (en) * 2012-06-05 2013-12-18 华为技术有限公司 Method, device and system for loop path detection

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI424713B (en) * 2009-12-02 2014-01-21 Realtek Semiconductor Corp Loop detection method and network device applying the same
WO2012167474A1 (en) * 2011-07-12 2012-12-13 华为技术有限公司 Method, device and system for detecting network loop
CN103607317A (en) * 2013-10-21 2014-02-26 华为技术有限公司 Two-layer loop detection method, two-layer loop detection device and communication system
CN104852826B (en) * 2015-04-13 2018-09-11 北京华为数字技术有限公司 A kind of loop detecting method and device

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103457756A (en) * 2012-06-05 2013-12-18 华为技术有限公司 Method, device and system for loop path detection

Also Published As

Publication number Publication date
CN106789625A (en) 2017-05-31

Similar Documents

Publication Publication Date Title
CN106789625B (en) Loop detection method and device
US11032174B2 (en) Service chain fault detection method and apparatus
US11894998B2 (en) Bit-forwarding ingress router, bit-forwarding router, and operation, administration and maintenance test method
EP3346661B1 (en) Path detection method and device
US10305783B2 (en) Packet control method, switch, and controller
US10454822B2 (en) Full-path validation in segment routing
CN103748835B (en) The dynamic renewal of label switched path
EP3958521A1 (en) Method and apparatus for providing service for service flow
EP3399699B1 (en) Link detection method and device, and network equipment and controller
CN108259299B (en) Forwarding table item generating method and device and machine-readable storage medium
CN107171883B (en) Method, device and equipment for detecting forwarding table
CN111431800B (en) Method, device and equipment for establishing path and machine-readable storage medium
CN113411260B (en) Method and device for sending data message in IPv6 network
WO2016045098A1 (en) Switch, controller, system and link quality detection method
WO2015184771A1 (en) Method and node device for operation, administration, and maintenance of service function chaining
CN112491718A (en) Message header processing method and device, storage medium and electronic device
CN113179189A (en) Method and device for detecting fault of segmented route, first segmented route and destination route
CN107800581B (en) Two-layer network and loopback detection method thereof
CN104506369A (en) Packet loss position detecting method and device
CN105634948B (en) LSP reconvergence identification method and device in P2MP
CN110300033B (en) Packet loss information recording method, network equipment and network system
WO2015120581A1 (en) Traffic loop detection in a communication network
CN115442288B (en) SRv6 network data packet inspection method and device
US20170264656A1 (en) Handling source routed content

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