CN106817264B - Method, device and system for detecting link fault - Google Patents

Method, device and system for detecting link fault Download PDF

Info

Publication number
CN106817264B
CN106817264B CN201510844330.3A CN201510844330A CN106817264B CN 106817264 B CN106817264 B CN 106817264B CN 201510844330 A CN201510844330 A CN 201510844330A CN 106817264 B CN106817264 B CN 106817264B
Authority
CN
China
Prior art keywords
link detection
local area
sending
detection
identifier
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
CN201510844330.3A
Other languages
Chinese (zh)
Other versions
CN106817264A (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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201510844330.3A priority Critical patent/CN106817264B/en
Publication of CN106817264A publication Critical patent/CN106817264A/en
Application granted granted Critical
Publication of CN106817264B publication Critical patent/CN106817264B/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
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0811Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity

Abstract

The invention discloses a method, a device and a system for detecting link faults, and belongs to the technical field of the Internet. The method comprises the following steps: under the state of serving as a link detection receiving end, the first equipment detects a link detection message sent by second equipment serving as a link detection sending end in a multicast mode according to a preset detection period; and when detecting that the packet loss quantity of the link detection message reaches a first preset threshold value, determining that a link fault occurs between the first device and the second device. By adopting the invention, the efficiency of detecting the link fault can be improved.

Description

Method, device and system for detecting link fault
Technical Field
The present invention relates to the field of internet technologies, and in particular, to a method, an apparatus, and a system for detecting a link failure.
Background
In the existing network networking model, a data packet can only reach a receiving end through a plurality of devices in a network link, and if any one device or line in the network link fails, the data packet cannot reach the receiving end, so that the detection of the link failure becomes particularly important.
At present, a method for detecting a link failure often uses a ping command, which needs to input the ping command and an IP (Internet Protocol) address of an opposite-end device, so as to detect a state of a link between a local-end device and the opposite-end device.
In the process of implementing the invention, the inventor finds that the prior art has at least the following problems:
when the state of the network link is detected through the ping command, only the link state between the local terminal device and the opposite terminal device can be obtained, and if the state of a plurality of network links is to be detected, the ping command needs to be used for many times, so that the efficiency of detecting the link failure is low.
Disclosure of Invention
In order to solve the problems in the prior art, embodiments of the present invention provide a method, an apparatus, and a system for detecting a link failure. The technical scheme is as follows:
in a first aspect, a method for detecting a link failure is provided, where the method includes:
under the state of serving as a link detection receiving end, the first equipment detects a link detection message sent by second equipment serving as a link detection sending end in a multicast mode according to a preset detection period;
when detecting that the packet loss number of the link detection message reaches a first preset threshold, the first device determines that a link fault occurs between the first device and the second device.
With reference to the first aspect, in a first possible implementation manner of the first aspect, before the detecting, by the first device, a link detection message sent by a second device serving as a link detection sending end in a multicast manner according to a preset detection period in a state where the first device serves as a link detection receiving end, the method further includes:
the first device sends an initialization message in the local area network in a multicast mode, and receives initialization messages sent by other devices in the local area network in the multicast mode, wherein the initialization messages carry device identifications of corresponding devices;
the first device compares its device identification with the device identifications of the other devices;
when any one of the other devices meets a preset sending end selection condition based on the comparison result, the first device sends a detection notification message to the any one device, and the first device sets the first device as a link detection receiving end; or, when the first device receives a detection notification message sent by another device in the local area network, the first device sets itself as a link detection sending end.
After a plurality of devices in the local area network start a link detection function, an initialization message can be sent in the local area network in a multicast mode, and the devices can receive the initialization message sent by other devices in the local area network in the multicast mode, wherein the initialization message carries device identifications of the corresponding devices. After receiving the link detection message sent by other devices in the local area network, the device may analyze the link detection message, obtain the device identifier carried therein, and compare the device identifier of the device with the device identifiers of other devices. For example, when the device identification is a MAC address, the connector colon in the MAC address may be removed and converted to a decimal number for comparison. The device may pre-store a sending end selection condition for selecting a link detection sending end, and may select a link detection sending end for sending a link detection message according to the preset sending end selection condition when initializing. After the device compares the device identifier of the device with the device identifiers of other devices, whether other devices in the local area network meet the preset sending terminal selection condition or not can be judged according to the comparison result, when the device determines that any one of the other devices meets the preset sending terminal selection condition, the device can send a detection notification message to the device meeting the condition, the device can be set as a link detection receiving end, the device receiving the detection notification message can be set as a link detection sending end, and when the device receives the detection notification message sent by the other devices in the local area network, the device can be set as the link detection sending end.
Thus, when two devices in the local area network are started, the link detection can be carried out.
With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner of the first aspect, the initialization message further carries an available logical port identifier selected by the corresponding device according to a preset logical port selection rule of the link detection function;
after the first device sets itself as a link detection receiving end, the method further includes:
under the initiation of a second device serving as a link detection sending end, the first device and the second device negotiate to select a commonly available logical port identifier according to a logical port selection rule of the link detection function, and set the commonly available logical port identifier as a logical port identifier of the link detection function.
Therefore, when the link detection message is a TCP packet, the commonly available port identifiers are selected so as to carry out link detection.
With reference to the first possible implementation manner of the first aspect, in a third possible implementation manner of the first aspect, the sending, by the first device, the initialization message in the local area network by using a multicast method includes:
the first equipment sends an initialization message in the local area network in a multicast mode according to a preset initialization period;
the method further comprises the following steps:
and when any one of the other devices meets the preset sending end selection condition based on the comparison result, the first device terminates sending the initialization message.
When it is determined based on the comparison result that any one of the other devices satisfies the preset sending end selection condition, that is, when the device detects the receiving end for the link, sending the initialization message may be terminated. When the device receives a detection notification message sent by another device, that is, when the device is a link detection sending end, after the port negotiation, the device may continue to send an initialization message in a multicast manner according to a preset initialization period, where the initialization message may carry a commonly available logical port identifier, so that a subsequently added device selects an available logical port identifier.
Therefore, the device added subsequently can conveniently acquire the port identifier corresponding to the link detection function at present, and further can determine the port identifier carried in the initialization message.
With reference to the first possible implementation manner of the first aspect, in a fourth possible implementation manner of the first aspect, the method further includes:
when a first device is in a state of being used as a link detection receiving end and receives an initialization message sent by a third device newly added to the local area network in a multicast mode, the initialization message carries a device identifier of the third device, and the device identifier of a second device used as the link detection sending end is compared with the device identifier of the third device;
and when the third equipment meets the preset sending end selection condition based on the comparison result, the first equipment sends a detection notification message to the third equipment.
When the first network receives an initialization message sent by a third device in a newly added local area network in a multicast mode in a state of being used as a link detection receiving end, the first network can analyze the initialization message to obtain a device identifier carrying the third device, and compare the device identifier of the third device with a device identifier of a second device used as a link detection sending end. The first device may send a detection notification message to the third device when it is determined that the third device satisfies the preset sending-end selection condition based on the comparison result, and the first device may not change when it is determined that the second device satisfies the preset sending-end selection condition based on the comparison result.
With reference to the first possible implementation manner of the first aspect, in a fifth possible implementation manner of the first aspect, the sending, by the first device, an initialization message in the local area network in a multicast manner, and receiving an initialization message sent by other devices in the local area network in the multicast manner, where the initialization message carries a device identifier of a corresponding device, includes:
the first device sends an initialization message in the local area network in a multicast mode through the network card corresponding to each network plane respectively, and receives the initialization message sent by other devices in the local area network in the multicast mode through the network card corresponding to each network plane respectively, wherein the initialization message carries the device identification of the corresponding device and the network plane identification of the corresponding network plane;
when it is determined, based on the comparison result, that any one of the other devices meets a preset sending-end selection condition, the sending, by the first device, a detection notification message to the any one device includes:
when determining that any one of the other devices meets a preset sending end selection condition corresponding to any network plane based on the comparison result, the first device sends a detection notification message to any one of the devices, wherein the detection notification message carries a network plane identifier of any one of the network planes;
when the first device receives a detection notification message sent by other devices in the local area network, the first device sets itself as a link detection sending end, including:
when the first device receives a detection notification message carrying a network plane identifier of a target network plane, which is sent by other devices in the local area network, the first device sets itself as a link detection sending end of the target network plane.
Therefore, the link detection transmitting ends of different network planes can be ensured to correspond to different devices, and each device can receive the link detection message transmitted by the link detection transmitting end, and can judge whether the link fails.
With reference to the first aspect, in a sixth possible implementation manner of the first aspect, the determining that a link failure occurs between the first device and the second device when it is detected that the packet loss number of the link detection message reaches a first preset threshold includes:
and when detecting that the packet loss quantity of the link detection message reaches a first preset threshold, the packet error quantity reaches a second preset threshold or the network delay quantity reaches a third preset threshold, determining that a link fault occurs between the first equipment and the second equipment.
In a second aspect, a method for detecting link failure is provided, where the method includes:
and the second equipment sends the link detection message in the local area network in a multicast mode according to a preset detection period in the state of serving as the link detection sending end.
A detection period for transmitting or receiving a link detection message (i.e., for link detection) may be set in the device in advance. After the application is started (it can be considered that the application can be started after the device is started), the second device can send the link detection message with the destination address being the multicast address according to a preset detection period in a state of being used as a link detection sending end.
With reference to the second aspect, in a first possible implementation manner of the second aspect, before the second device sends the link detection message in the local area network in a multicast manner according to a preset detection period in a state of serving as a link detection sending end, the method further includes:
the second device sends an initialization message in the local area network in a multicast mode, and receives the initialization message sent by other devices in the local area network in the multicast mode, wherein the initialization message carries the device identification of the corresponding device;
the second device compares its device identification with the device identifications of the other devices;
when any one of the other devices meets a preset sending end selection condition based on the comparison result, the second device sends a detection notification message to the any one device, and the second device sets the second device as a link detection receiving end; or, when the second device receives a detection notification message sent by another device in the local area network, the second device sets itself as a link detection sending end.
Thus, when two devices in the local area network are started, the link detection can be carried out.
With reference to the second aspect, in a second possible implementation manner of the second aspect, the initialization message further carries an available logical port identifier selected by the corresponding device according to a logical port selection rule of a preset link detection function;
after the second device sets itself as a link detection transmitting end, the method further includes:
the second device judges whether the logical port identifiers carried in the initialization messages sent by the other devices and the second device are consistent, if so, the consistent logical port identifiers are set as the logical port identifiers of the link detection function, if not, the second device and the other devices negotiate to select a commonly available logical port identifier according to a logical port selection rule of the link detection function, and the commonly available logical port identifier is set as the logical port identifier of the link detection function.
After the second device sets itself as a link detection sending end, it may also set a commonly available logical port identifier corresponding to a link detection negotiation function with all networks in the local area network, specifically, the second device may determine whether the logical port identifiers carried in the initialization messages sent by itself and other devices are consistent (based on a preset logical port selection rule of the link detection function, the consistency of the logical port identifiers may indicate that the logical port identifiers are available for each device), if so, the consistent logical port identifier may be set as the logical port identifier of the link detection function, if not, the second device may select a logical port identifier from all the logical port identifiers according to the logical port selection rule of the link detection function, and determine whether itself is available, if so, the port negotiation message may be sent in a multicast manner, the port negotiation message carries a logical port identifier, and if the port negotiation message is not available, the logical port identifier available for the port negotiation message can be selected according to a logical port selection rule of the link detection function, and the port negotiation message can be sent in a multicast mode, for example, when the logical port selection rule of the link detection function is the above-mentioned sequential increase of the preset threshold, the port negotiation message can carry the largest logical port identifier. The device on the link detection receiving end can receive the port negotiation message sent by the second device, it can be analyzed to obtain the carried logical port identification, and judge if the logical port identification is available, if so, if the port is unavailable, the self-available logical port identification can be selected according to the logical port selection rule of the link detection function again, and a port unavailable notification message is sent to the second equipment serving as the link detection sending end, wherein, the port unavailable notification message carries the logical port identification available for itself, when the second device receives the port unavailable message sent by other device, the port negotiation message can be analyzed to obtain the logical port identifier carried in the port negotiation message, and whether the port negotiation message is available or not is judged, and the port negotiation message can be processed according to the process of sending the port negotiation message. If the port unavailable message is not received within the preset time duration of the second device, the logical port identifier carried in the port negotiation message may be considered to be available for other devices. The processing may be performed according to the above procedure until a commonly available logical port identity is selected. That is, the second device and the other devices may negotiate to select the commonly available logical port identifier according to the logical port selection rule of the link detection function, and set the commonly available logical port identifier as the logical port identifier of the link detection function.
Therefore, when the link detection message is a TCP packet, the commonly available port identifiers are selected so as to carry out link detection.
With reference to the first possible implementation manner of the second aspect, in a third possible implementation manner of the second aspect, the sending, by the second device, the initialization message in the local area network by using a multicast method includes:
the second equipment sends an initialization message in the local area network in a multicast mode according to a preset initialization period;
the method further comprises the following steps:
and when any one of the other devices meets the preset sending end selection condition based on the comparison result, the second device terminates sending the initialization message.
With reference to the third possible implementation manner of the second aspect, in a fourth possible implementation manner of the second aspect, the method further includes:
when a second device is in a state of being used as a link detection sending end and receives an initialization message sent by a third device newly added to the local area network in a multicast mode, the initialization message carries a device identifier of the third device, and the device identifier of the second device is compared with the device identifier of the third device;
and when the third equipment meets the preset sending end selection condition based on the comparison result, the second equipment sends a detection notification message to the third equipment and sets the third equipment as a link detection receiving end.
When the second device receives an initialization message sent by a third device newly added to the local area network in a multicast mode, the second device can analyze the initialization message to obtain a device identifier of the third device carried in the initialization message, and the device identifier of the second device is compared with the device identifier of the third device. When it is determined based on the comparison result that the third device satisfies the preset sending-end selection condition, the second device may send a detection notification message to the third device, and set itself as a link detection receiving end.
Therefore, when a new device is added, the selected device meeting the selection condition of the sending terminal is used as the link detection sending terminal.
With reference to the first possible implementation manner of the second aspect, in a fifth possible implementation manner of the second aspect, the sending, by the second device, an initialization message in the local area network in a multicast manner, and receiving an initialization message sent by other devices in the local area network in the multicast manner, where the initialization message carries a device identifier of a corresponding device, includes:
the second device sends an initialization message in the local area network in a multicast mode through the network card corresponding to each network plane respectively, and receives the initialization message sent by other devices in the local area network in the multicast mode through the network card corresponding to each network plane respectively, wherein the initialization message carries the device identification of the corresponding device and the network plane identification of the corresponding network plane;
when it is determined, based on the comparison result, that any one of the other devices meets a preset sending-end selection condition, the sending, by the second device, a detection notification message to the any one device includes:
when determining that any one of the other devices meets a preset sending end selection condition corresponding to any one network plane based on the comparison result, the second device sends a detection notification message to the any one device, wherein the detection notification message carries a network plane identifier of the any one network plane;
when the second device receives a detection notification message sent by other devices in the local area network, the second device sets itself as a link detection sending end, including:
when the second device receives a detection notification message carrying a network plane identifier of a target network plane, which is sent by other devices in the local area network, the second device sets itself as a link detection sending end of the target network plane.
In a third aspect, an apparatus for detecting link failure is provided, where the apparatus includes a receiver and a processor, where:
the processor is used for detecting a link detection message which is received by the receiver and sent by a second device serving as a link detection sending end in a multicast mode according to a preset detection period in a state of serving as a link detection receiving end; and when detecting that the packet loss quantity of the link detection message reaches a first preset threshold value, determining that a link fault occurs between the first device and the second device.
With reference to the third aspect, in a first possible implementation manner of the third aspect, the apparatus further includes:
a transmitter, configured to send an initialization message in the local area network in a multicast manner;
the receiver is further configured to:
receiving an initialization message sent by other equipment in the local area network in a multicast mode, wherein the initialization message carries an equipment identifier of the corresponding equipment;
the processor is further configured to:
comparing its device identification with the device identifications of the other devices;
the transmitter is further configured to:
when any one of the other devices is determined to meet a preset sending end selection condition based on the comparison result, sending a detection notification message to the any one device,
the processor is further configured to:
setting the self as a link detection receiving end; or when receiving a detection notification message sent by other devices in the local area network, setting the local device as a link detection sending end.
With reference to the first possible implementation manner of the third aspect, in a second possible implementation manner of the third aspect, the initialization message further carries an available logical port identifier selected by the corresponding device according to a logical port selection rule of a preset link detection function;
the processor is further configured to:
under the initiation of a second device serving as a link detection transmitting end, negotiating with the second device to select a commonly available logical port identifier according to a logical port selection rule of the link detection function, and setting the commonly available logical port identifier as a logical port identifier of the link detection function.
With reference to the first possible implementation manner of the third aspect, in a third possible implementation manner of the third aspect, the transmitter is configured to:
according to a preset initialization period, sending an initialization message in the local area network in a multicast mode;
the processor is further configured to:
and when any one of the other devices meets the preset sending end selection condition based on the comparison result, the first device terminates sending the initialization message.
With reference to the first possible implementation manner of the third aspect, in a fourth possible implementation manner of the third aspect, the processor is further configured to:
when an initialization message sent by a third device newly added to the local area network in a multicast mode is received in a state of being used as a link detection receiving end, the initialization message carries a device identifier of the third device, and the device identifier of the second device used as the link detection sending end is compared with the device identifier of the third device;
the transmitter is further configured to:
and when the third equipment meets the preset sending end selection condition based on the comparison result, sending a detection notification message to the third equipment.
With reference to the first possible implementation manner of the third aspect, in a fifth possible implementation manner of the third aspect, the transmitter is configured to:
respectively sending initialization information in the local area network in a multicast mode through a network card corresponding to each network plane;
the receiver is configured to:
receiving an initialization message sent by other devices in the local area network in a multicast mode through a network card corresponding to each network plane, wherein the initialization message carries a device identifier of the corresponding device and a network plane identifier of the corresponding network plane;
the transmitter is configured to:
when determining that any one of the other devices meets a preset sending end selection condition corresponding to any network plane based on the comparison result, sending a detection notification message to the any one device, wherein the detection notification message carries a network plane identifier of the any network plane;
the processor is configured to:
when the first device receives a detection notification message carrying a network plane identifier of a target network plane, which is sent by other devices in the local area network, the first device sets itself as a link detection sending end of the target network plane.
With reference to the third aspect, in a sixth possible implementation manner of the third aspect, the processor is configured to:
and when detecting that the packet loss quantity of the link detection message reaches a first preset threshold value, the packet error quantity reaches a second preset threshold value, or the network delay quantity reaches a third preset threshold value, determining that a link fault occurs between the first device and the second device.
In a fourth aspect, an apparatus for link failure detection is provided, wherein the apparatus comprises a transmitter, and wherein:
and the transmitter is used for transmitting the link detection message in the local area network in a multicast mode according to a preset detection period in the state of serving as the link detection transmitting end.
With reference to the fourth aspect, in a first possible implementation manner of the fourth aspect, the transmitter is further configured to:
sending an initialization message in the local area network by a multicast mode,
the device further comprises: a receiver, configured to receive an initialization message sent by another device in the local area network in a multicast manner, where the initialization message carries a device identifier of a corresponding device;
the device further comprises: a processor for comparing its device identification with the device identifications of the other devices;
the transmitter is further configured to:
when any one of the other devices is determined to meet a preset sending end selection condition based on the comparison result, sending a detection notification message to the any one device,
the processor is further configured to:
setting the self as a link detection receiving end; or when receiving a detection notification message sent by other devices in the local area network, setting the local device as a link detection sending end.
With reference to the first possible implementation manner of the fourth aspect, in a second possible implementation manner of the fourth aspect, the initialization message further carries an available logical port identifier selected by the corresponding device according to a preset logical port selection rule of the link detection function;
the processor is further configured to:
judging whether the logic port identifiers carried in the initialization messages sent by the other equipment and the second equipment are consistent, if so, setting the consistent logic port identifiers as the logic port identifiers of the link detection function, and if not, the second equipment and the other equipment negotiate to select the commonly available logic port identifiers according to the logic port selection rule of the link detection function and set the commonly available logic port identifiers as the logic port identifiers of the link detection function.
With reference to the first possible implementation manner of the fourth aspect, in a third possible implementation manner of the fourth aspect, the transmitter is configured to:
according to a preset initialization period, sending an initialization message in the local area network in a multicast mode;
the processor is further configured to:
and when any one of the other devices meets the preset sending end selection condition based on the comparison result, stopping sending the initialization message.
With reference to the third possible implementation manner of the fourth aspect, in a fourth possible implementation manner of the fourth aspect, the processor is further configured to:
when receiving an initialization message sent by a third device newly added to the local area network in a multicast mode in a state of serving as a link detection sending end, the initialization message carries a device identifier of the third device, and the device identifier of the second device is compared with the device identifier of the third device;
the transmitter is further configured to:
when the third equipment is determined to meet the preset sending end selection condition based on the comparison result, sending a detection notification message to the third equipment;
the processor is further configured to:
and sets itself as the link detection receiving end.
With reference to the first possible implementation manner of the fourth aspect, in a fifth possible implementation manner of the fourth aspect, the transmitter is configured to:
respectively sending initialization information in the local area network in a multicast mode through a network card corresponding to each network plane;
the receiver is configured to:
receiving an initialization message sent by other devices in the local area network in a multicast mode through a network card corresponding to each network plane, wherein the initialization message carries a device identifier of the corresponding device and a network plane identifier of the corresponding network plane;
the transmitter is configured to:
when determining that any one of the other devices meets a preset sending end selection condition corresponding to any network plane based on the comparison result, sending a detection notification message to the any one device, wherein the detection notification message carries a network plane identifier of the any network plane;
the processor is configured to:
and when receiving a detection notification message carrying a network plane identifier of a target network plane, which is sent by other equipment in the local area network, setting the local equipment as a link detection sending end of the target network plane.
In a fifth aspect, an apparatus for detecting link failure is provided, where the apparatus includes a receiving module and a processing module, where:
the processing module is used for detecting a link detection message which is received by the receiving module and sent by a second device serving as a link detection sending end in a multicast mode according to a preset detection period in a state of serving as a link detection receiving end; and when detecting that the packet loss quantity of the link detection message reaches a first preset threshold value, determining that a link fault occurs between the first device and the second device.
With reference to the fifth aspect, in a first possible implementation manner of the fifth aspect, the apparatus further includes:
a sending module, configured to send an initialization message in the local area network in a multicast manner;
the receiving module is further configured to:
receiving an initialization message sent by other equipment in the local area network in a multicast mode, wherein the initialization message carries an equipment identifier of the corresponding equipment;
the processing module is further configured to:
comparing its device identification with the device identifications of the other devices;
the sending module is further configured to:
when any one of the other devices is determined to meet a preset sending end selection condition based on the comparison result, sending a detection notification message to the any one device,
the processing module is further configured to:
setting the self as a link detection receiving end; or when receiving a detection notification message sent by other devices in the local area network, setting the local device as a link detection sending end.
With reference to the first possible implementation manner of the fifth aspect, in a second possible implementation manner of the fifth aspect, the initialization message further carries an available logical port identifier selected by the corresponding device according to a logical port selection rule of a preset link detection function;
the processing module is further configured to:
under the initiation of a second device serving as a link detection transmitting end, negotiating with the second device to select a commonly available logical port identifier according to a logical port selection rule of the link detection function, and setting the commonly available logical port identifier as a logical port identifier of the link detection function.
With reference to the first possible implementation manner of the fifth aspect, in a third possible implementation manner of the fifth aspect, the sending module is configured to:
according to a preset initialization period, sending an initialization message in the local area network in a multicast mode;
the processing module is further configured to:
and when any one of the other devices meets the preset sending end selection condition based on the comparison result, stopping sending the initialization message.
With reference to the first possible implementation manner of the fifth aspect, in a fourth possible implementation manner of the fifth aspect, the processing module is further configured to:
when an initialization message sent by a third device newly added to the local area network in a multicast mode is received in a state of being used as a link detection receiving end, the initialization message carries a device identifier of the third device, and the device identifier of the second device used as the link detection sending end is compared with the device identifier of the third device;
the sending module is further configured to:
and when the third equipment meets the preset sending end selection condition based on the comparison result, sending a detection notification message to the third equipment.
With reference to the first possible implementation manner of the fifth aspect, in a fifth possible implementation manner of the fifth aspect, the sending module is configured to:
respectively sending initialization information in the local area network in a multicast mode through a network card corresponding to each network plane;
the receiving module is configured to:
receiving an initialization message sent by other devices in the local area network in a multicast mode through a network card corresponding to each network plane, wherein the initialization message carries a device identifier of the corresponding device and a network plane identifier of the corresponding network plane;
the sending module is configured to:
when determining that any one of the other devices meets a preset sending end selection condition corresponding to any network plane based on the comparison result, sending a detection notification message to the any one device, wherein the detection notification message carries a network plane identifier of the any network plane;
the processing module is configured to:
and when receiving a detection notification message carrying a network plane identifier of a target network plane, which is sent by other equipment in the local area network, setting the local equipment as a link detection sending end of the target network plane.
With reference to the fifth aspect, in a sixth possible implementation manner of the fifth aspect, the processing module is configured to:
and when detecting that the packet loss quantity of the link detection message reaches a first preset threshold, the packet error quantity reaches a second preset threshold or the network delay quantity reaches a third preset threshold, determining that a link fault occurs between the first equipment and the second equipment.
In a sixth aspect, an apparatus for detecting link failure is provided, where the apparatus includes a sending module and a storage module, where:
and the sending module is used for sending the link detection message in the local area network in a multicast mode according to a preset detection period in the state of serving as the link detection sending end.
With reference to the sixth aspect, in a first possible implementation manner of the sixth aspect, the sending module is further configured to:
sending an initialization message in the local area network by a multicast mode,
the device further comprises: a receiving module, configured to receive an initialization message sent by another device in the local area network in a multicast manner, where the initialization message carries a device identifier of a corresponding device;
the device further comprises: the processing module is used for comparing the equipment identification with the equipment identifications of the other equipment;
the sending module is further configured to:
when any one of the other devices is determined to meet a preset sending end selection condition based on the comparison result, sending a detection notification message to the any one device,
the processing module is further configured to:
setting the self as a link detection receiving end; or when receiving a detection notification message sent by other devices in the local area network, setting the local device as a link detection sending end.
With reference to the first possible implementation manner of the sixth aspect, in a second possible implementation manner of the sixth aspect, the initialization message further carries an available logical port identifier selected by the corresponding device according to a logical port selection rule of a preset link detection function;
the processing module is further configured to:
judging whether the logic port identifiers carried in the initialization messages sent by the other equipment and the second equipment are consistent, if so, setting the consistent logic port identifiers as the logic port identifiers of the link detection function, and if not, the second equipment and the other equipment negotiate to select the commonly available logic port identifiers according to the logic port selection rule of the link detection function and set the commonly available logic port identifiers as the logic port identifiers of the link detection function.
With reference to the first possible manner of the sixth aspect, in a third possible implementation manner of the sixth aspect, the sending module is configured to:
according to a preset initialization period, sending an initialization message in the local area network in a multicast mode;
the processing module is further configured to:
and when any one of the other devices meets the preset sending end selection condition based on the comparison result, stopping sending the initialization message.
With reference to the third possible implementation manner of the sixth aspect, in a fourth possible implementation manner of the sixth aspect, the processing module is further configured to:
when receiving an initialization message sent by a third device newly added to the local area network in a multicast mode in a state of serving as a link detection sending end, the initialization message carries a device identifier of the third device, and the device identifier of the second device is compared with the device identifier of the third device;
the sending module is further configured to:
when the third equipment is determined to meet the preset sending end selection condition based on the comparison result, sending a detection notification message to the third equipment;
the processing module is further configured to:
and sets itself as the link detection receiving end.
With reference to the first possible manner of the sixth aspect, in a fifth possible implementation manner of the sixth aspect, the sending module is configured to:
respectively sending initialization information in the local area network in a multicast mode through a network card corresponding to each network plane;
the receiving module is configured to:
receiving an initialization message sent by other devices in the local area network in a multicast mode through a network card corresponding to each network plane, wherein the initialization message carries a device identifier of the corresponding device and a network plane identifier of the corresponding network plane;
the sending module is configured to:
when determining that any one of the other devices meets a preset sending end selection condition corresponding to any network plane based on the comparison result, sending a detection notification message to the any one device, wherein the detection notification message carries a network plane identifier of the any network plane;
the processing module is configured to:
and when receiving a detection notification message carrying a network plane identifier of a target network plane, which is sent by other equipment in the local area network, setting the local equipment as a link detection sending end of the target network plane.
In a seventh aspect, a system for link detection is provided, where the system includes a first device and a second device, where:
the second device is used for sending a link detection message in the local area network in a multicast mode according to a preset detection period in a state of serving as a link detection sending end;
the first device is configured to detect, according to a preset detection period, a link detection message sent by the second device as a link detection sending end in a multicast mode in a state of serving as a link detection receiving end; and when detecting that the packet loss quantity of the link detection message reaches a first preset threshold value, determining that a link fault occurs between the first device and the second device.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
in the embodiment of the present invention, a second device, in a state of serving as a link detection transmitting end, transmits a link detection message in a multicast manner in a local area network according to a preset detection period, and a link detection receiving end detects, according to the preset detection period, the link detection message transmitted by the second device serving as the link detection transmitting end and received by the receiver in the multicast manner, and when it is detected that the packet loss amount of the link detection message reaches a first preset threshold, it is determined that a link failure occurs between the first device and the second device. Therefore, when the link fault detection is carried out on a plurality of links, the link detection sending end sends the link detection message in a multicast mode, other devices in the same local area network can receive the link detection message, and a ping command does not need to be sent for multiple times, so that the link fault detection efficiency can be improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic diagram of a system for detecting a link according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of an apparatus provided by an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of an apparatus provided by an embodiment of the present invention;
fig. 4 is a flowchart of a method for detecting a link failure according to an embodiment of the present invention;
fig. 5 is a flowchart of a method for selecting a link detection transmitting end according to an embodiment of the present invention;
fig. 6 is a flowchart of a processing method for detecting a receiving end by a link when a device newly joins according to an embodiment of the present invention;
fig. 7 is a flowchart of a processing method of a link detection transmitting end when a device is newly added according to an embodiment of the present invention;
fig. 8 is a flowchart of a method for selecting a link by multiple network planes to detect a transmitting end according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of an apparatus for detecting a link failure according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of an apparatus for detecting a link failure according to an embodiment of the present invention;
fig. 11 is a schematic structural diagram of an apparatus for detecting a link failure according to an embodiment of the present invention;
fig. 12 is a schematic structural diagram of an apparatus for detecting a link failure according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
The embodiment of the present invention provides a method for detecting a link failure, which may be implemented by a first device and a second device together, where the first device and the second device may be any devices in a local area network, such as a PC (personal computer), and the first device and the second device belong to the same local area network (also including a virtual local area network through which devices may communicate), and may communicate with each other.
The link detection transmitting end and the link detection receiving end may be set in advance in devices that can communicate with each other, where the second device may be set as the link detection transmitting end, and then other devices in the local area network are the link detection receiving ends, that is, one of the devices may be referred to as a first device. After the device is started or after the link detection function is triggered, the link detection transmitting end can transmit the link detection signal according to a preset detection period, the link detection message is sent by multicast mode, other started devices can detect the link detection message sent by the link detection sending end according to the preset detection period, and counts the number of lost packets and the number of erroneous packets within a certain time, and if the number of lost packets or the number of erroneous packets reaches a preset threshold, it can be determined that the network link has failed, as shown in fig. 1, wherein, the first device may also execute the processing executed by the second device when acting as the link detection sending end, and the second device may also execute the processing executed by the first device when acting as the link detection receiving end, that is, any device in the local area network includes corresponding processing when serving as a link detection transmitting end and a link detection receiving end. In addition, according to a preset sending end selection condition, a device meeting the preset sending end selection condition is selected from all devices which are in a working state and can communicate with each other to serve as a link detection sending end, and the rest devices serve as link detection receiving ends.
The first device may include a receiver 210, a processor 220, and a transmitter 230, and the receiver 210 and the transmitter 230 may be respectively connected with the processor 220, as shown in fig. 2. The receiver 210 may be configured to receive a message or data, that is, may receive a link detection message sent by a link detection transmitting end, the receiver 210 may include, but is not limited to, at least one Amplifier, a tuner, one or more oscillators, a coupler, an LNA (Low Noise Amplifier), a duplexer, and the like, and the transmitter 230 may be configured to transmit a message or data, that is, may send an initialization message. The processor 220 may be a control center of the terminal device, and various interfaces and lines are used to connect various parts of the whole terminal device, such as the receiver 210 and the transmitter 230. In the present invention, the processor 220 may be configured to determine whether a network link fails, and optionally, the processor 220 may include one or more processing units; preferably, the processor 220 may integrate an application processor and a modem processor, wherein the application processor primarily handles operating systems and the modem processor primarily handles wireless communications. The processor 220 may also be a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, or the like.
The second device may include a transmitter 310, a processor 320, and a receiver 330, and the transmitter 310 and the receiver 330 may be respectively connected with the processor 320, as shown in fig. 3. The transmitter 310 may be used to transmit messages or data, in the present invention, the transmitter 310 may be used to transmit link detection messages, the transmitter 310 may include, but is not limited to, at least one Amplifier, a tuner, one or more oscillators, a coupler, an LNA (Low Noise Amplifier), a duplexer, etc., and the receiver 330 may be used to receive data or messages. Processor 320 may include one or more processing units; processor 320 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, etc. In particular, the program may include program code including computer operating instructions.
The process flow shown in fig. 4 will be described in detail below with reference to the specific embodiments, and the contents may be as follows:
step 401, the second device sends a link detection message in the local area network in a multicast manner according to a preset detection period in a state of being used as a link detection sending end.
The second device is any device configured with the same multicast address in the local area network, such as a PC (personal computer), a server, etc., where the communication link detection message that can be performed by any network device in the local area network may be an IP packet or an ethernet frame.
In implementation, in order to ensure that service data packets can be transmitted normally between devices that can communicate with each other in a local area network, a state of a network link in the local area network can be detected, an application program for implementing a link detection function can be installed on any device in the local area network, any device in the local area network can be preset as a link detection transmitting end (a device corresponding to the link detection transmitting end can be called as a second device), and other devices are link detection receiving ends. A detection period for transmitting or receiving a link detection message (i.e., for link detection) may be set in the device in advance. After the application is started (it may be considered that after the device is started, the application may be started), the second device may send, in a state of serving as a link detection sending end, a link detection message whose destination address is a multicast address according to a preset detection period, where the multicast address may be 224.0.0.1 (the IP address is an address used for sending multicast data in an IP protocol, a network card of each device is configured with the IP address by default, all link detection messages sent to the address may be received by all devices configured with the default multicast address in the same lan), or the multicast address may be configured by the devices in the lan by themselves, and the multicast address may be a mac address corresponding to the multicast address, that is, the second device sends the link detection message in the lan by multicast. In addition, every time a preset detection period is reached, the link detection message sent by the second device may carry a sequence number, where the carried sequence number may be counted from 1 when the link detection message is sent for the first time.
Step 402, the first device detects a link detection message sent by the second device as the link detection sending end in a multicast mode according to a preset detection period in a state of being used as the link detection receiving end.
In implementation, one of the devices that serves as a link detection receiving end may be referred to as a first device. Taking the first device as an example, the process of the link detection receiving end will be described in detail.
After the second device sends the link detection message in the local area network in a multicast mode according to a preset detection period in a state of serving as a link detection sending end, all devices in the same local area network receive the link detection message, that is, the first device receives the link detection message sent by the second device. All devices in the local area network are provided with a detection period, so that the first device can detect the link detection message according to the preset detection period in the state of serving as the link detection receiving end.
In step 403, when detecting that the packet loss number of the link detection message reaches a first preset threshold, the first device determines that a link failure occurs between the first device and the second device.
In implementation, a threshold (i.e., a first preset threshold) of the number of packet losses for determining whether the network link fails may be preset. When a preset detection period is reached, and a link detection message corresponding to the sequence number of the detection period is not detected by the first device within the preset time (the time is set due to propagation delay), it may be determined that a packet loss event occurs, for example, the second device sends a link detection message with a sequence number N for T seconds, and the preset time is m seconds, and when a link detection message with a sequence number N is not detected within a time period from T to T + m seconds, the first device may determine that a packet loss occurs. When the number of lost packets reaches a preset threshold, the first device may determine that a link failure occurs between the first device and the second device.
Optionally, the first device may further determine whether the network link fails according to the number of the error packets, and accordingly, the processing procedure of step 403 may be as follows: and when detecting that the packet loss quantity of the link detection message reaches a first preset threshold, the packet error quantity reaches a second preset threshold or the network delay reaches a third preset threshold, determining that a link fault occurs between the first equipment and the second equipment.
In implementation, the link detection message sent by the link detection sending end may include Check information and detection information, where the Check information may be CRC (Cyclic Redundancy Check) Check information, and when receiving the link detection message sent by the second device, the first device may Check the detection information therein to obtain the Check information, and compare whether the obtained Check information is consistent with the Check information included in the link detection message, and if not, it may be considered that a packet error event occurs, and when the number of packet errors reaches a second preset threshold, it may be determined that a link failure occurs between the first device and the second device. In addition, the link detection message may also carry a sending time, and when the link detection receiving end (i.e., the first device) receives the link detection message, it may determine whether a network delay and a delay time occur according to the sending time carried in the link detection message, the receiving time of the link detection message received by the first device, and the time length of the link detection message received for the first time, for example, if the sending time of the link detection message sent for the first time by the second device is 1 second, the receiving time of the first device is 2 seconds, the time length of the receiving time and the sending time is 1 second, the sending time of the link detection message sent for the next time by the second device is 5 seconds, and the receiving time of the first device is 7 seconds, it may determine that a network delay event occurs, and the network delay is 1 second. When the number of network delays reaches a third preset threshold, it may be determined that a link failure occurs between the first device and the second device.
Optionally, the devices in the same local area network may also preset a sending end selection condition for selecting a link detection sending end, that is, preset an initialization mechanism, where all the devices in the same local area network may send an initialization message whose destination address is a multicast address after starting a link detection function. Before the link detection sending end sends the link detection message, the device meeting the sending end selection condition among all devices in the local area network may be selected according to the sending end selection condition to serve as the link detection sending end, and then all devices in the local area network may perform link detection according to the method described in step 401 and 403.
The device indicated in fig. 5 may be the first device described in steps 401 and 403, or may be the second device.
The process flow shown in fig. 5 will be described in detail below with reference to the specific embodiments, and the contents may be as follows:
step 501, a device sends an initialization message in a local area network in a multicast mode, and receives an initialization message sent by other devices in the local area network in the multicast mode, where the initialization message carries a device identifier of a corresponding device.
The device may be a first device or a second device, and the device identifier may be an identifier of the device, has uniqueness, and may be a MAC address.
In implementation, after a plurality of devices in the local area network start a link detection function, an initialization message may be sent in the local area network in a multicast manner, and the device may receive an initialization message sent by other devices in the local area network in the multicast manner, where the initialization message carries a device identifier of the corresponding device.
Step 502, the device compares its device identification with the device identifications of other devices.
In implementation, after receiving the link detection message sent by other devices in the local area network, the device may analyze the link detection message, obtain the device identifier carried therein, and compare the device identifier of the device with the device identifiers of other devices. For example, when the device identification is a MAC address, the connector colon in the MAC address may be removed and converted to a decimal number for comparison.
Step 503, when it is determined that any one of the other devices meets the preset sending end selection condition based on the comparison result, the device sends a detection notification message to any one of the devices, and the device sets itself as a link detection receiving end; or, when the device receives a detection notification message sent by other devices in the local area network, the device sets itself as the link detection sending end.
In implementation, the device may pre-store a sending end selection condition for selecting a link detection sending end, and during initialization, the link detection sending end for sending the link detection message may be selected according to the preset sending end selection condition. After the device compares the device identifier of the device with the device identifiers of other devices, whether other devices in the local area network meet the preset sending terminal selection condition or not can be judged according to the comparison result, when the device determines that any one of the other devices meets the preset sending terminal selection condition, the detection notification message can be sent to the devices meeting the condition, and the devices are set as the link detection receiving end, wherein, the detection notification message may be used to notify the device satisfying the condition that the device itself is the link detection receiving end, at this time, the processing executed by the first device may be executed, the device receiving the detection notification message may set itself as the link detection transmitting end, when the device receives the detection notification message sent by another device in the local area network, the device may set itself as the link detection sending end, and at this time, the processing executed by the second device may be executed. For example, the condition selected by the sending end may be that the device with the largest device identifier is the link detection sending end, that is, the device with the largest MAC address is the link detection sending end.
Optionally, when the link detection message is a TCP (Transmission Control Protocol) packet or a UDP (User data Protocol) packet, after the link detection transmitting end and the link detection receiving end are selected, the logical port identifier bound by the link detection function needs to be determined, and correspondingly, the initialization message may also carry an available logical port identifier selected by the corresponding device according to a preset logical port selection rule of the link detection function.
In the implementation, a logical port selection rule of the link detection function may be preset, after the link detection function of the device is started, an available logical port identifier of the device may be selected according to the preset logical port selection rule of the link detection function, and the sent initialization message may carry the available logical port identifier, specifically, a default logical port identifier of the link detection function is preset, after the link detection function of the device is started, it may be first determined whether the default logical port identifier is bound by other functions of the device, that is, it may be determined whether the default logical port identifier is available, if it is available, the initialization message may carry the logical port identifier, and if it is not available, it may be determined whether the logical port identifier corresponding to the logical port identifier plus a preset threshold is available, until an available logical port identifier is selected, for example, the default logical port id is 16666, the preset threshold is 10, the device may first determine 16666 whether it is available, if so, 16666 may be carried in the initialization message, and if not, it may determine 16676 whether it is available until the available logical port id is selected.
Correspondingly, when the device sets itself as the link detection transmitting end or the device is the second device, the second device may further perform the following processing after setting itself as the link detection transmitting end: the second device judges whether the logical port identifiers carried in the initialization messages sent by the other devices and the second device are consistent, if so, the consistent logical port identifiers are set as the logical port identifiers of the link detection function, if not, the second device and the other devices negotiate to select the commonly available logical port identifiers according to the logical port selection rule of the link detection function, and the commonly available logical port identifiers are set as the logical port identifiers of the link detection function.
In implementation, after the second device sets itself as a link detection transmitting end, it may also negotiate a commonly available logical port identifier corresponding to a link detection function with all network settings in the local area network, specifically, the second device may determine whether logical port identifiers carried in initialization messages sent by itself and other devices are consistent (based on a preset logical port selection rule of the link detection function, a logical port identifier is consistent, which may indicate that the logical port identifier is available for each device), if so, the consistent logical port identifier may be set as a logical port identifier of the link detection function, and if not, the second device may select a logical port identifier from all logical port identifiers according to the logical port selection rule of the link detection function, and determine whether itself is available, if the logical port selection rule is the preset threshold value, the port negotiation message can carry the largest logical port identification. The device on the link detection receiving end can receive the port negotiation message sent by the second device, it can be analyzed to obtain the carried logical port identification, and judge if the logical port identification is available, if so, if the port is unavailable, the self-available logical port identification can be selected according to the logical port selection rule of the link detection function again, and a port unavailable notification message is sent to the second equipment serving as the link detection sending end, wherein, the port unavailable notification message carries the logical port identification available for itself, when the second device receives the port unavailable message sent by other device, the port negotiation message can be analyzed to obtain the logical port identifier carried in the port negotiation message, and whether the port negotiation message is available or not is judged, and the port negotiation message can be processed according to the process of sending the port negotiation message. If the port unavailable message is not received within the preset time duration of the second device, the logical port identifier carried in the port negotiation message may be considered to be available for other devices. The processing may be performed according to the above procedure until a commonly available logical port identity is selected. That is, the second device and the other devices may negotiate to select the commonly available logical port identifier according to the logical port selection rule of the link detection function, and set the commonly available logical port identifier as the logical port identifier of the link detection function.
If the device sets itself as the link detection sending receiving end or the device is the first device, the first device may further perform the following processing after setting itself as the link detection receiving end: under the initiation of a second device serving as a link detection transmitting end, the first device and the second device negotiate to select a commonly available logical port identifier according to a logical port selection rule of a link detection function, and set the commonly available logical port identifier as a logical port identifier of the link detection function.
In an implementation, the first device may set the commonly available logical port identifier as a logical port identifier of the link detection function at the initiation of the second device serving as the link detection sender. Specifically, the first device may perform processing according to the processing procedure when the link detection receiving end receives the port negotiation message until the commonly available logical port identifier is selected, that is, the first device and the second device may select the commonly available logical port identifier according to the logical port selection rule of the link detection function, and set the commonly available logical port identifier as the logical port identifier of the link detection function.
Optionally, to ensure that the device in the lan can receive the initialization message, the device may send the initialization message according to a preset initialization period, and the corresponding processing procedure may be as follows: the device sends initialization information in the local area network in a multicast mode according to a preset initialization period.
In implementation, any device in the local area network may preset a period for sending the initialization message, wherein the initialization period may be the same as the detection period. After the link detection function is started, the device may send an initialization message in the lan by a multicast mode according to a preset initialization period.
Correspondingly, if the device is a link detection receiving end, the device may further perform the following processing: and when any one of the other devices meets the preset sending end selection condition based on the comparison result, the device terminates sending the initialization message.
In implementation, when it is determined that any one of the other devices satisfies the preset sending end selection condition based on the comparison result, that is, when the device detects the receiving end for the link, sending the initialization message may be terminated. When the device receives a detection notification message sent by another device, that is, when the device is a link detection sending end, after the port negotiation, the device may continue to send an initialization message in a multicast manner according to a preset initialization period, where the initialization message may carry a commonly available logical port identifier, so that a subsequently added device selects an available logical port identifier.
The embodiment of the invention also provides a processing process of the link detection transmitting end and the link detection receiving end when a certain device in the local area network starts the link detection function under the condition that the link detection transmitting end is selected.
Fig. 6 shows a processing procedure when the first device receives an initialization message sent by a third device in the local area network in a multicast mode in a state of being used as a link detection receiving end.
The process flow shown in fig. 6 will be described in detail below with reference to specific embodiments, and the contents may be as follows:
step 601, when receiving an initialization message sent by a third device newly added to the local area network in a multicast mode, the initialization message carries a device identifier of the third device, and the device identifier of the second device serving as a link detection sending end is compared with the device identifier of the third device.
The third device may be any device newly added to the local area network, and the second device may be a link detection transmitting end.
In implementation, when the first network receives an initialization message sent by a third device in a newly added local area network in a multicast mode in a state of serving as a link detection receiving end, the first network may parse the initialization message to obtain a device identifier carrying the third device, and compare the device identifier of the third device with a device identifier of a second device serving as the link detection receiving end. The specific processing procedure can be seen in the processing procedure of step 502.
Step 602, when it is determined that the third device meets the preset sending end selection condition based on the comparison result, the first device sends a detection notification message to the third device.
In implementation, the first device may send a detection notification message to the third device when it is determined that the third device satisfies the preset sending-end selection condition based on the comparison result, and the first device may not change when it is determined that the second device satisfies the preset sending-end selection condition based on the comparison result. The specific processing procedure can be referred to the processing procedure described in step 503.
For the case that the initialization message carries the logical port identifier, if the first device does not receive the port negotiation message, the first device may not change the port negotiation message, and if the first device receives the port negotiation message, the first device may perform related processing according to the processing mode when the link detection receiving end receives the port negotiation message.
For the case that the device sends the initialization message according to the preset initialization period, the processing procedure when the second device receives the initialization message sent by the third device in the newly added lan in the multicast mode in the state of being used as the link detection sending end is as shown in fig. 7.
The process flow shown in fig. 7 will be described in detail below with reference to specific embodiments, and the contents may be as follows:
step 701, when receiving an initialization message sent by a third device newly added to the local area network in a multicast manner, the initialization message carries a device identifier of the third device, and the device identifier of the second device is compared with the device identifier of the third device.
In implementation, when the second device is in a state of serving as a link detection sending end and in a state of sending the initialization message according to a preset initialization period, the second device may analyze the initialization message when receiving the initialization message sent by a third device newly added to the local area network in a multicast manner, obtain a device identifier of the third device carried in the initialization message, and compare the device identifier of the second device with the device identifier of the third device. The specific processing procedure may refer to the processing procedure described in step 502.
Step 702, when it is determined based on the comparison result that the third device meets the preset sending end selection condition, the second device sends a detection notification message to the third device, and sets itself as a link detection receiving end.
In implementation, when it is determined that the third device satisfies the preset sending-end selection condition based on the comparison result, the second device may send a detection notification message to the third device, and set itself as a link detection receiving end. The specific processing procedure can be referred to the processing procedure described in step 503.
For the case where the initialization message carries the logical port identifier, when the second device can send a detection notification message to the third device and sets itself as a link detection receiving end, the sending of the initialization message may be terminated. When the second device receives the detection notification message sent by the third device, corresponding processing may be performed according to the processing procedure of the port negotiation message sent by the link detection sending end.
Optionally, the device may have multiple network cards, that is, a main network card and at least one standby network card may exist, each network card corresponds to one network plane, and when the local area network corresponds to multiple network planes, a processing procedure when the link detection transmitting end and the link detection receiving end are initially selected may be as shown in fig. 8, where a specific processing procedure of each network plane may refer to the processing procedure described in step 501 and step 503.
The device described below may be the first device or the second device.
The process flow shown in fig. 8 will be described in detail below with reference to specific embodiments, and the contents may be as follows:
step 801, the device sends an initialization message in the local area network in a multicast manner through the network card corresponding to each network plane, and receives an initialization message sent by other devices in the domain network in a multicast manner through the network card corresponding to each network plane, where the initialization message carries the device identifier of the corresponding device and the network plane identifier of the corresponding network plane.
The device identifier may be the MAC address of the main network card and the MAC address of the standby network card.
In implementation, the initialization message sent by the device may be sent through a main network card and a standby network card in the device, where different network cards correspond to different network planes, and the different network planes may be intercommunicated through forwarding devices such as a switch, and receive the initialization message sent by other devices in the local area network in a multicast manner through the network cards corresponding to each network plane, that is, the device may receive the initialization message sent by other devices in a multicast manner through the network cards corresponding to each network plane through the main network card, where the initialization message may carry a device identifier of the device and a network plane identifier of the corresponding network plane, specifically, an MAC address of the main network card may be used as a device identifier of the corresponding device, and an MAC address of the standby network card may also be used as a device identifier of the corresponding device.
In step 802, the device compares its device identification with the device identifications of other devices.
In implementation, after receiving the initialization message sent by the other device, the device may analyze the initialization message, obtain the device identifier carried therein, and compare the device identifier of the device with the device identifiers of the other devices.
Step 803, when it is determined based on the comparison result that any one of the other devices meets the preset sending end selection condition corresponding to any one of the network planes, the device sends a detection notification message to any one of the devices, where the detection notification message carries the network plane identifier of any one of the network planes.
In implementation, a sending end selection condition corresponding to each network plane may be preset, and each network plane may select a link detection sending end and a link detection receiving end of the network plane according to the corresponding sending end selection condition, where the sending end selection condition corresponding to each network plane may be set on the premise that it is ensured that the link detection sending end of the network plane corresponding to the master network card and the link detection sending end of the network plane corresponding to the slave network card are not the same device, for example, the device corresponding to the MAC address where the sending end selection condition of the network plane corresponding to the master network card is the largest is the link detection sending end, and the device corresponding to the MAC address where the sending end selection condition of the network plane corresponding to the slave network card is the smallest is the link detection sending end. When it is determined, based on the comparison result, that any one of the other devices meets the preset sending-end selection condition corresponding to any one of the network planes, the device may send a detection notification message to any one of the devices, where the detection notification message carries the network plane identifier of any one of the network planes. The specific implementation process may refer to the method described in step 503.
Step 804, when the device receives the detection notification message carrying the network plane identifier of the target network plane sent by other devices in the local area network, the device sets itself as the link detection sending end of the target network plane.
In implementation, when the device receives a detection notification message sent by another device in the local area network, the device may perform parsing to obtain a network plane identifier of a target network plane carried therein, where the target network plane may be any network plane, and the device may set itself as a link detection sending end of the target network plane according to the obtained network plane identifier.
In the embodiment of the present invention, a second device, in a state of serving as a link detection transmitting end, transmits a link detection message in a multicast manner in a local area network according to a preset detection period, and a link detection receiving end detects, according to the preset detection period, the link detection message transmitted by the second device serving as the link detection transmitting end and received by the receiver in the multicast manner, and when it is detected that the packet loss amount of the link detection message reaches a first preset threshold, it is determined that a link failure occurs between the first device and the second device. Therefore, when the link fault detection is carried out on a plurality of links, the link detection sending end sends the link detection message in a multicast mode, other devices in the same local area network can receive the link detection message, and a ping command does not need to be sent for multiple times, so that the link fault detection efficiency can be improved.
Based on the same concept, the present embodiment further provides a device for detecting a link failure, as shown in fig. 2, the device may implement the processes shown in the above steps 401 through 403, 501 through 503, 601 through 602, 701 through 702, the device includes a receiver 210 and a processor 220, wherein:
a processor 220, configured to detect, according to a preset detection period, a link detection message sent by a second device serving as a link detection sending end and received by the receiver 210 in a multicast mode in a state where the first device serves as a link detection receiving end; and when detecting that the packet loss quantity of the link detection message reaches a first preset threshold value, determining that a link fault occurs between the first device and the second device.
Optionally, the apparatus further comprises:
a transmitter 230, configured to send an initialization message in the local area network in a multicast manner;
the receiver 210 is further configured to:
receiving an initialization message sent by other equipment in the local area network in a multicast mode, wherein the initialization message carries an equipment identifier of the corresponding equipment;
the processor 220 is further configured to:
comparing its device identification with the device identifications of the other devices;
the transmitter 230 is further configured to:
when any one of the other devices is determined to meet a preset sending end selection condition based on the comparison result, sending a detection notification message to the any one device,
the processor 220 is further configured to:
setting the self as a link detection receiving end; or, when the first device receives a detection notification message sent by another device in the local area network, the first device sets itself as a link detection sending end.
In implementation, after a plurality of devices in the local area network start a link detection function, the transmitter 230 may send an initialization message in the local area network in a multicast manner, and the receiver 210 may receive an initialization message sent by other devices in the local area network in a multicast manner, where the initialization message carries a device identifier of a corresponding device. After the receiver 210 receives the link detection message sent by other devices in the local area network, the processor 220 may analyze the link detection message, obtain the device identifier carried in the link detection message, and compare the device identifier of the processor with the device identifiers of other devices. The device may pre-store a sending end selection condition for selecting a link detection sending end, and during initialization, the processor 220 may select a link detection sending end for sending a link detection message according to the preset sending end selection condition. After comparing the device identifier of the device with the device identifiers of other devices, the processor 220 may determine whether the other devices in the local area network satisfy the predetermined sending terminal selection condition according to the comparison result, and when determining that any one of the other devices satisfies the predetermined sending terminal selection condition, the device may send a detection notification message to the device satisfying the condition, and set itself as a link detection receiving terminal, the device receiving the detection notification message may set itself as the link detection sending terminal, and when receiving the detection notification message sent by the other devices in the local area network, the device may set itself as the link detection sending terminal.
Optionally, the initialization message further carries an available logical port identifier selected by the corresponding device according to a logical port selection rule of a preset link detection function;
the processor 220 is further configured to:
under the initiation of a second device serving as a link detection transmitting end, negotiating with the second device to select a commonly available logical port identifier according to a logical port selection rule of the link detection function, and setting the commonly available logical port identifier as a logical port identifier of the link detection function.
Optionally, the transmitter 230 is configured to:
according to a preset initialization period, sending an initialization message in the local area network in a multicast mode;
the processor 220 is further configured to:
and when any one of the other devices meets the preset sending end selection condition based on the comparison result, the first device terminates sending the initialization message.
In implementation, when it is determined that any one of the other devices satisfies the preset sending end selection condition based on the comparison result, that is, when the device detects the receiving end for the link, sending the initialization message may be terminated. When the receiver 210 receives a detection notification message sent by another device, that is, when the device is a link detection sending end, after the port negotiation of the processor 220, the device may continue to send an initialization message in a multicast manner according to a preset initialization period, where the initialization message may carry a commonly available logical port identifier, so that a subsequently added device selects an available logical port identifier.
Optionally, the processor 220 is further configured to:
when an initialization message sent by a third device newly added to the local area network in a multicast mode is received in a state of being used as a link detection receiving end, the initialization message carries a device identifier of the third device, and the device identifier of the second device used as the link detection sending end is compared with the device identifier of the third device;
the transmitter 230 is further configured to:
and when the third equipment meets the preset sending end selection condition based on the comparison result, sending a detection notification message to the third equipment.
In implementation, when the receiver 210 receives an initialization message sent by a third device in a newly added local area network in a multicast mode in a state where the first network serves as a link detection receiving end, the processor 220 may analyze the initialization message, obtain a device identifier carrying the third device, and compare the device identifier of the third device with the device identifier of the second device serving as a link detection sending end. The transmitter 230 may transmit a detection notification message to the third device when it is determined that the third device satisfies the preset sender selection condition based on the comparison result, and the first device may not be changed when it is determined that the second device satisfies the preset sender selection condition based on the comparison result.
Optionally, the transmitter 230 is configured to:
respectively sending initialization information in the local area network in a multicast mode through a network card corresponding to each network plane;
the receiver 210 is configured to:
receiving an initialization message sent by other devices in the local area network in a multicast mode through a network card corresponding to each network plane, wherein the initialization message carries a device identifier of the corresponding device and a network plane identifier of the corresponding network plane;
the transmitter 230 is configured to:
when determining that any one of the other devices meets a preset sending end selection condition corresponding to any network plane based on the comparison result, sending a detection notification message to the any one device, wherein the detection notification message carries a network plane identifier of the any network plane;
the processor 220 is configured to:
when the first device receives a detection notification message carrying a network plane identifier of a target network plane, which is sent by other devices in the local area network, the first device sets itself as a link detection sending end of the target network plane.
Optionally, the processor 220 is configured to:
and when detecting that the packet loss quantity of the link detection message reaches a first preset threshold, the packet error quantity reaches a second preset threshold or the network delay quantity reaches a third preset threshold, determining that a link fault occurs between the first equipment and the second equipment.
Based on the same concept, the present embodiment further provides a device for detecting a link failure, as shown in fig. 3, the device can implement the processes shown in the steps 401-:
the transmitter 310 is configured to, in a state where the second device is used as a link detection transmitting end, transmit a link detection message in the local area network in a multicast mode according to a preset detection period.
Optionally, the transmitter 310 is further configured to:
sending an initialization message in the local area network by a multicast mode,
the device further comprises: a receiver 330, configured to receive an initialization message sent by another device in the local area network in a multicast manner, where the initialization message carries a device identifier of a corresponding device;
the device further comprises: a processor 320 for comparing its device identification with the device identifications of the other devices;
the transmitter 310 is further configured to:
when any one of the other devices is determined to meet a preset sending end selection condition based on the comparison result, the second device sends a detection notification message to the any one device,
the processor 320 is further configured to:
the second equipment sets itself as a link detection receiving end; or, when the second device receives a detection notification message sent by another device in the local area network, the second device sets itself as a link detection sending end.
Optionally, the initialization message further carries an available logical port identifier selected by the corresponding device according to a logical port selection rule of a preset link detection function;
the processor 320 is further configured to:
judging whether the logic port identifiers carried in the initialization messages sent by the other equipment and the second equipment are consistent, if so, setting the consistent logic port identifiers as the logic port identifiers of the link detection function, and if not, the second equipment and the other equipment negotiate to select the commonly available logic port identifiers according to the logic port selection rule of the link detection function and set the commonly available logic port identifiers as the logic port identifiers of the link detection function.
In implementation, after the processor 320 sets itself as a link detection transmitting end, it may also negotiate a commonly available logical port identifier corresponding to a link detection function with all network settings in the local area network, specifically, the processor 320 may determine whether logical port identifiers carried in initialization messages sent by itself and other devices are consistent (based on a preset logical port selection rule of the link detection function, a logical port identifier is consistent, which may indicate that the logical port identifier is available for each device), if so, the consistent logical port identifier may be set as a logical port identifier of the link detection function, if not, the second device may select a logical port identifier from all logical port identifiers according to the logical port selection rule of the link detection function, and determine whether itself is available, if the logical port selection rule is the preset threshold value, the port negotiation message can carry the largest logical port identification. The device on the link detection receiving end can receive the port negotiation message sent by the second device, it can be analyzed to obtain the carried logical port identification, and judge if the logical port identification is available, if so, if the port is unavailable, the self-available logical port identification can be selected according to the logical port selection rule of the link detection function again, and a port unavailable notification message is sent to the second equipment serving as the link detection sending end, wherein, the port unavailability notification message carries the logical port identifier available to itself, and when the receiver 330 receives the port unavailability message sent by other device, the processor 320 may parse the data, obtain the logical port id carried therein, and judging whether the terminal is available or not, and processing according to the process of sending the port negotiation message. If the port unavailable message is not received within the preset time duration of the second device, the logical port identifier carried in the port negotiation message may be considered to be available for other devices. The processing may be performed according to the above procedure until a commonly available logical port identity is selected.
Optionally, the transmitter 310 is configured to:
the second equipment sends an initialization message in the local area network in a multicast mode according to a preset initialization period;
the processor 320 is further configured to:
and when any one of the other devices meets the preset sending end selection condition based on the comparison result, stopping sending the initialization message.
Optionally, the processor 320 is further configured to:
when a second device is in a state of being used as a link detection sending end and receives an initialization message sent by a third device newly added to the local area network in a multicast mode, the initialization message carries a device identifier of the third device, and the device identifier of the second device is compared with the device identifier of the third device;
the transmitter 310 is further configured to:
when the third equipment is determined to meet the preset sending end selection condition based on the comparison result, sending a detection notification message to the third equipment;
the processor 320 is further configured to:
and sets itself as the link detection receiving end.
When the receiver 330 receives an initialization message sent by a third device newly joining the local area network in a multicast manner in a state where the second device is used as a link detection sending end and the transmitter 310 sends the initialization message according to a preset initialization period, the processor 320 may analyze the initialization message, obtain a device identifier of the third device carried in the initialization message, and compare the device identifier of the second device with the device identifier of the third device. When it is determined that the third device satisfies the preset sender-side selection condition based on the comparison result, the transmitter 310 may send a detection notification message to the third device, and the processor 320 sets itself as a link detection receiver.
Optionally, the transmitter 320 is configured to:
respectively sending initialization information in the local area network in a multicast mode through a network card corresponding to each network plane;
the receiver 330 is configured to:
receiving an initialization message sent by other devices in the local area network in a multicast mode through a network card corresponding to each network plane, wherein the initialization message carries a device identifier of the corresponding device and a network plane identifier of the corresponding network plane;
the transmitter 310 is configured to:
when determining that any one of the other devices meets a preset sending end selection condition corresponding to any network plane based on the comparison result, sending a detection notification message to the any one device, wherein the detection notification message carries a network plane identifier of the any network plane;
the processor 320 is configured to:
and when the second device receives a detection notification message which is sent by other devices in the local area network and carries the network plane identifier of the target network plane, setting the second device as a link detection sending end of the target network plane.
In the embodiment of the present invention, a second device, in a state of serving as a link detection transmitting end, transmits a link detection message in a multicast manner in a local area network according to a preset detection period, and a link detection receiving end detects, according to the preset detection period, the link detection message transmitted by the second device serving as the link detection transmitting end and received by the receiver in the multicast manner, and when it is detected that the packet loss amount of the link detection message reaches a first preset threshold, it is determined that a link failure occurs between the first device and the second device. Therefore, when the link fault detection is carried out on a plurality of links, the link detection sending end sends the link detection message in a multicast mode, other devices in the same local area network can receive the link detection message, and a ping command does not need to be sent for multiple times, so that the link fault detection efficiency can be improved.
Based on the same concept, the present embodiment further provides a device for detecting a link failure, as shown in fig. 9, the device may implement the flows shown in the steps 401-:
a processing module 920, configured to detect, according to a preset detection period, a link detection message sent by a second device serving as a link detection sending end and received by the receiving module 910 in a multicast mode when the first device serves as a link detection receiving end; and when detecting that the packet loss quantity of the link detection message reaches a first preset threshold value, determining that a link fault occurs between the first device and the second device.
Optionally, as shown in fig. 10, the apparatus further includes:
a sending module 930, configured to send an initialization message in the local area network in a multicast manner;
the receiving module 910 is further configured to:
receiving an initialization message sent by other equipment in the local area network in a multicast mode, wherein the initialization message carries an equipment identifier of the corresponding equipment;
the processing module 920 is further configured to:
comparing its device identification with the device identifications of the other devices;
the sending module 930 is further configured to:
when any one of the other devices is determined to meet a preset sending end selection condition based on the comparison result, sending a detection notification message to the any one device,
the processing module 920 is further configured to:
setting the self as a link detection receiving end; or, when the first device receives a detection notification message sent by another device in the local area network, the first device sets itself as a link detection sending end.
In implementation, after a plurality of devices in the local area network start a link detection function, the sending module 930 may send an initialization message in the local area network in a multicast manner, and the receiving module 910 may receive an initialization message sent by other devices in the local area network in a multicast manner, where the initialization message carries a device identifier of a corresponding device. After the receiving module 910 receives the link detection message sent by other devices in the local area network, the processing module 920 may analyze the link detection message, obtain the device identifier carried therein, and compare the device identifier of itself with the device identifiers of other devices. The device may pre-store a sending end selection condition for selecting a link detection sending end, and during initialization, the processing module 920 may select a link detection sending end for sending a link detection message according to the preset sending end selection condition. After comparing the device identifier of the device with the device identifiers of other devices, the processing module 920 may determine whether the other devices in the local area network satisfy the predetermined sending terminal selection condition according to the comparison result, and when determining that any one of the other devices satisfies the predetermined sending terminal selection condition, the device may send a detection notification message to the device satisfying the condition, and set itself as a link detection receiving terminal, the device receiving the detection notification message may set itself as the link detection sending terminal, and when receiving the detection notification message sent by the other devices in the local area network, the device may set itself as the link detection sending terminal.
Optionally, the initialization message further carries an available logical port identifier selected by the corresponding device according to a logical port selection rule of a preset link detection function;
the processing module 920 is further configured to:
under the initiation of a second device serving as a link detection transmitting end, negotiating with the second device to select a commonly available logical port identifier according to a logical port selection rule of the link detection function, and setting the commonly available logical port identifier as a logical port identifier of the link detection function.
Optionally, the sending module 930 is configured to:
according to a preset initialization period, sending an initialization message in the local area network in a multicast mode;
the processing module 920 is further configured to:
and when any one of the other devices meets the preset sending end selection condition based on the comparison result, the first device terminates sending the initialization message.
In implementation, when it is determined that any one of the other devices satisfies the preset sending end selection condition based on the comparison result, that is, when the device detects the receiving end for the link, sending the initialization message may be terminated. When the receiving module 910 receives a detection notification message sent by another device, that is, when the device is a link detection sending end, after the port negotiation of the processing module 920, the device may continue to send an initialization message in a multicast manner according to a preset initialization period, where the initialization message may carry a commonly available logical port identifier, so that a subsequently added device selects an available logical port identifier.
Optionally, the processing module 920 is further configured to:
when an initialization message sent by a third device newly added to the local area network in a multicast mode is received in a state of being used as a link detection receiving end, the initialization message carries a device identifier of the third device, and the device identifier of the second device used as the link detection sending end is compared with the device identifier of the third device;
the sending module 930 is further configured to:
and when the third equipment meets the preset sending end selection condition based on the comparison result, sending a detection notification message to the third equipment.
In implementation, when the receiving module 910 receives an initialization message sent by a third device in a newly added local area network in a multicast mode in a state where the first network serves as a link detection receiving end, the processing module 920 may analyze the initialization message, obtain a device identifier carrying the third device, and compare the device identifier of the third device with a device identifier of a second device serving as a link detection sending end. The sending module 930 may send the detection notification message to the third device when it is determined that the third device satisfies the preset sender selection condition based on the comparison result, and the first device may not change when it is determined that the second device satisfies the preset sender selection condition based on the comparison result.
Optionally, the sending module 930 is configured to:
respectively sending initialization information in the local area network in a multicast mode through a network card corresponding to each network plane;
the receiving module 910 is configured to:
receiving an initialization message sent by other devices in the local area network in a multicast mode through a network card corresponding to each network plane, wherein the initialization message carries a device identifier of the corresponding device and a network plane identifier of the corresponding network plane;
the sending module 930 is configured to:
when determining that any one of the other devices meets a preset sending end selection condition corresponding to any network plane based on the comparison result, sending a detection notification message to the any one device, wherein the detection notification message carries a network plane identifier of the any network plane;
the processing module 920 is configured to:
when the first device receives a detection notification message carrying a network plane identifier of a target network plane, which is sent by other devices in the local area network, the first device sets itself as a link detection sending end of the target network plane.
Optionally, the processing module 920 is configured to:
and when detecting that the packet loss quantity of the link detection message reaches a first preset threshold, the packet error quantity reaches a second preset threshold or the network delay quantity reaches a third preset threshold, determining that a link fault occurs between the first equipment and the second equipment.
Based on the same concept, the present embodiment further provides a device for detecting a link failure, as shown in fig. 11, the device can implement the processes shown in the steps 401-:
the sending module 1110 is configured to send, by the second device, the link detection message in the local area network in a multicast mode according to a preset detection period in a state where the second device serves as a link detection sending end.
Optionally, the sending module 1110 is further configured to:
sending an initialization message in the local area network by a multicast mode,
as shown in fig. 12, the apparatus further includes: a receiving module 1130, configured to receive an initialization message sent by another device in the local area network in a multicast manner, where the initialization message carries a device identifier of the corresponding device;
the device further comprises: a processing module 1120 for comparing its device identity with the device identities of the other devices;
the sending module 1110 is further configured to:
when any one of the other devices is determined to meet a preset sending end selection condition based on the comparison result, the second device sends a detection notification message to the any one device,
the processing module 1120 is further configured to:
the second equipment sets itself as a link detection receiving end; or, when the second device receives a detection notification message sent by another device in the local area network, the second device sets itself as a link detection sending end.
Optionally, the initialization message further carries an available logical port identifier selected by the corresponding device according to a logical port selection rule of a preset link detection function;
the processing module 1120 is further configured to:
judging whether the logic port identifiers carried in the initialization messages sent by the other equipment and the second equipment are consistent, if so, setting the consistent logic port identifiers as the logic port identifiers of the link detection function, and if not, the second equipment and the other equipment negotiate to select the commonly available logic port identifiers according to the logic port selection rule of the link detection function and set the commonly available logic port identifiers as the logic port identifiers of the link detection function.
In implementation, after the processing module 1120 sets itself as a link detection transmitting end, it may further negotiate a commonly available logical port identifier corresponding to a link detection function with all network settings in the local area network, specifically, the processing module 1120 may determine whether logical port identifiers carried in initialization messages sent by itself and other devices are consistent (based on a preset logical port selection rule of the link detection function, a logical port identifier is consistent, which may indicate that the logical port identifier is available for each device), if so, the consistent logical port identifier may be set as a logical port identifier of the link detection function, and if not, the second device may select a logical port identifier from all logical port identifiers according to the logical port selection rule of the link detection function, and determine whether itself is available, if the logical port selection rule is the preset threshold value, the port negotiation message can carry the largest logical port identification. The device on the link detection receiving end can receive the port negotiation message sent by the second device, it can be analyzed to obtain the carried logical port identification, and judge if the logical port identification is available, if so, if the port is unavailable, the self-available logical port identification can be selected according to the logical port selection rule of the link detection function again, and a port unavailable notification message is sent to the second equipment serving as the link detection sending end, wherein, the port unavailability notification message carries a logical port identifier available for itself, and when the receiving module 1130 receives a port unavailability message sent by another device, the processing module 1120 can parse the received data, obtain the logical port id carried therein, and judging whether the terminal is available or not, and processing according to the process of sending the port negotiation message. If the port unavailable message is not received within the preset time duration of the second device, the logical port identifier carried in the port negotiation message may be considered to be available for other devices. The processing may be performed according to the above procedure until a commonly available logical port identity is selected.
Optionally, the sending module 1110 is configured to:
the second equipment sends an initialization message in the local area network in a multicast mode according to a preset initialization period;
the processing module 1120 is further configured to:
and when any one of the other devices meets the preset sending end selection condition based on the comparison result, stopping sending the initialization message.
Optionally, the processing module 1120 is further configured to:
when a second device is in a state of being used as a link detection sending end and receives an initialization message sent by a third device newly added to the local area network in a multicast mode, the initialization message carries a device identifier of the third device, and the device identifier of the second device is compared with the device identifier of the third device;
the sending module 1110 is further configured to:
when the third equipment is determined to meet the preset sending end selection condition based on the comparison result, sending a detection notification message to the third equipment;
the processing module 1120 is further configured to:
and sets itself as the link detection receiving end.
When the second device is in a state of serving as a link detection sending end and the sending module 1110 sends the initialization message according to a preset initialization period and the receiving module 1130 receives the initialization message sent by a third device newly added to the local area network in a multicast manner, the processing module 1120 may analyze the initialization message, obtain a device identifier of the third device carried in the initialization message, and compare the device identifier of the second device with the device identifier of the third device. When it is determined that the third device meets the preset sending-end selection condition based on the comparison result, the sending module 1110 may send a detection notification message to the third device, and the processing module 1120 sets itself as a link detection receiving end.
Optionally, the sending module 1120 is configured to:
respectively sending initialization information in the local area network in a multicast mode through a network card corresponding to each network plane;
the receiving module 1130 is configured to:
receiving an initialization message sent by other devices in the local area network in a multicast mode through a network card corresponding to each network plane, wherein the initialization message carries a device identifier of the corresponding device and a network plane identifier of the corresponding network plane;
the sending module 1110 is configured to:
when determining that any one of the other devices meets a preset sending end selection condition corresponding to any network plane based on the comparison result, sending a detection notification message to the any one device, wherein the detection notification message carries a network plane identifier of the any network plane;
the processing module 1120 is configured to:
and when the second device receives a detection notification message which is sent by other devices in the local area network and carries the network plane identifier of the target network plane, setting the second device as a link detection sending end of the target network plane.
In the embodiment of the present invention, a second device, in a state of serving as a link detection transmitting end, transmits a link detection message in a multicast manner in a local area network according to a preset detection period, and a link detection receiving end detects, according to the preset detection period, the link detection message transmitted by the second device serving as the link detection transmitting end and received by the receiver in the multicast manner, and when it is detected that the packet loss amount of the link detection message reaches a first preset threshold, it is determined that a link failure occurs between the first device and the second device. Therefore, when the link fault detection is carried out on a plurality of links, the link detection sending end sends the link detection message in a multicast mode, other devices in the same local area network can receive the link detection message, and a ping command does not need to be sent for multiple times, so that the link fault detection efficiency can be improved.
Based on the same concept, the present embodiment further provides a system for detecting a link, where the system includes a first device and a second device, where:
the second device is used for sending a link detection message in the local area network in a multicast mode according to a preset detection period in a state of serving as a link detection sending end;
the first device is configured to detect, according to a preset detection period, a link detection message sent by the second device as a link detection sending end in a multicast mode in a state of serving as a link detection receiving end; and when detecting that the packet loss quantity of the link detection message reaches a first preset threshold value, determining that a link fault occurs between the first device and the second device.
In the embodiment of the present invention, a second device, in a state of serving as a link detection transmitting end, transmits a link detection message in a multicast manner in a local area network according to a preset detection period, and a link detection receiving end detects, according to the preset detection period, the link detection message transmitted by the second device serving as the link detection transmitting end and received by the receiver in the multicast manner, and when it is detected that the packet loss amount of the link detection message reaches a first preset threshold, it is determined that a link failure occurs between the first device and the second device. Therefore, when the link fault detection is carried out on a plurality of links, the link detection sending end sends the link detection message in a multicast mode, other devices in the same local area network can receive the link detection message, and a ping command does not need to be sent for multiple times, so that the link fault detection efficiency can be improved.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (28)

1. A method of link failure detection, the method comprising:
a first device sends an initialization message in a local area network in a multicast mode, and receives initialization messages sent by other devices in the local area network in the multicast mode, wherein the initialization messages carry device identifications of corresponding devices and available logical port identifications selected by the corresponding devices according to a preset logical port selection rule of a link detection function;
the first device comparing its device identification with the device identifications of the other devices;
when any one of the other devices meets a preset sending end selection condition based on the comparison result, the first device sends a detection notification message to the any one device, and the first device sets the first device as a link detection receiving end; or, when the first device receives a detection notification message sent by other devices in the local area network, the first device sets itself as a link detection sending end;
under the state that the first device is used as a link detection receiving end and the initiation of a second device used as a link detection transmitting end, the first device and the second device negotiate to select a commonly available logical port identifier according to a logical port selection rule of the link detection function, and the commonly available logical port identifier is set as the logical port identifier of the link detection function;
the first equipment detects a link detection message sent by second equipment serving as a link detection sending end in a multicast mode according to a preset detection period;
when detecting that the packet loss number of the link detection message reaches a first preset threshold, the first device determines that a link fault occurs between the first device and the second device.
2. The method of claim 1, wherein the first device sends the initialization message in a local area network by multicast, comprising:
the first equipment sends an initialization message in the local area network in a multicast mode according to a preset initialization period;
the method further comprises the following steps:
and when any one of the other devices meets the preset sending end selection condition based on the comparison result, the first device terminates sending the initialization message.
3. The method of claim 1, further comprising:
when a first device is in a state of being used as a link detection receiving end and receives an initialization message sent by a third device newly added to the local area network in a multicast mode, the initialization message carries a device identifier of the third device, and the device identifier of a second device used as the link detection sending end is compared with the device identifier of the third device;
and when the third equipment meets the preset sending end selection condition based on the comparison result, the first equipment sends a detection notification message to the third equipment.
4. The method according to claim 1, wherein the first device sends an initialization message in a local area network by a multicast method, and receives an initialization message sent by other devices in the local area network by the multicast method, where the initialization message carries a device identifier of a corresponding device, and the method includes:
the first device sends an initialization message in the local area network in a multicast mode through the network card corresponding to each network plane respectively, and receives the initialization message sent by other devices in the local area network in the multicast mode through the network card corresponding to each network plane respectively, wherein the initialization message carries the device identification of the corresponding device and the network plane identification of the corresponding network plane;
when it is determined, based on the comparison result, that any one of the other devices meets a preset sending-end selection condition, the sending, by the first device, a detection notification message to the any one device includes:
when determining that any one of the other devices meets a preset sending end selection condition corresponding to any network plane based on the comparison result, the first device sends a detection notification message to any one of the devices, wherein the detection notification message carries a network plane identifier of any one of the network planes;
when the first device receives a detection notification message sent by other devices in the local area network, the first device sets itself as a link detection sending end, including:
when the first device receives a detection notification message carrying a network plane identifier of a target network plane, which is sent by other devices in the local area network, the first device sets itself as a link detection sending end of the target network plane.
5. The method according to claim 1, wherein the determining that a link failure occurs between the first device and the second device when detecting that the packet loss number of the link detection message reaches a first preset threshold value comprises:
and when detecting that the packet loss quantity of the link detection message reaches a first preset threshold, the packet error quantity reaches a second preset threshold or the network delay quantity reaches a third preset threshold, determining that a link fault occurs between the first device and the second device.
6. A method of link failure detection, the method comprising:
the second device sends an initialization message in a local area network in a multicast mode, and receives the initialization message sent by other devices in the local area network in the multicast mode, wherein the initialization message carries a device identifier of the corresponding device and an available logical port identifier selected by the corresponding device according to a preset logical port selection rule of a link detection function;
the second device comparing its device identification with the device identifications of the other devices;
when any one of the other devices meets a preset sending end selection condition based on the comparison result, the second device sends a detection notification message to the any one device, and the second device sets the second device as a link detection receiving end; or, when the second device receives a detection notification message sent by other devices in the local area network, the second device sets itself as a link detection sending end;
when the second device is in a state of being used as a link detection sending end, the second device judges whether the logic port identifiers carried in the initialization messages sent by the other devices and the second device are consistent, if so, the consistent logic port identifiers are set as the logic port identifiers of the link detection function, if not, the second device and the other devices negotiate to select a commonly available logic port identifier according to a logic port selection rule of the link detection function, and the commonly available logic port identifier is set as the logic port identifier of the link detection function;
and the second equipment sends the link detection message in the local area network in a multicast mode according to a preset detection period.
7. The method of claim 6, wherein the second device sends the initialization message in the local area network by multicast, comprising:
the second equipment sends an initialization message in the local area network in a multicast mode according to a preset initialization period;
the method further comprises the following steps:
and when any one of the other devices meets the preset sending end selection condition based on the comparison result, the second device terminates sending the initialization message.
8. The method of claim 7, further comprising:
when the second device is in a state of being used as a link detection sending end and receives an initialization message sent by a third device newly added to the local area network in a multicast mode, the initialization message carries a device identifier of the third device, and the device identifier of the second device is compared with the device identifier of the third device;
and when the third equipment meets the preset sending end selection condition based on the comparison result, the second equipment sends a detection notification message to the third equipment and sets the third equipment as a link detection receiving end.
9. The method according to claim 6, wherein the second device sends an initialization message in a local area network by a multicast method, and receives an initialization message sent by other devices in the local area network by a multicast method, where the initialization message carries a device identifier of a corresponding device, and the method includes:
the second device sends an initialization message in the local area network in a multicast mode through the network card corresponding to each network plane respectively, and receives the initialization message sent by other devices in the local area network in the multicast mode through the network card corresponding to each network plane respectively, wherein the initialization message carries the device identification of the corresponding device and the network plane identification of the corresponding network plane;
when it is determined, based on the comparison result, that any one of the other devices meets a preset sending-end selection condition, the sending, by the second device, a detection notification message to the any one device includes:
when determining that any one of the other devices meets a preset sending end selection condition corresponding to any one network plane based on the comparison result, the second device sends a detection notification message to the any one device, wherein the detection notification message carries a network plane identifier of the any one network plane;
when the second device receives a detection notification message sent by other devices in the local area network, the second device sets itself as a link detection sending end, including:
when the second device receives a detection notification message carrying a network plane identifier of a target network plane, which is sent by other devices in the local area network, the second device sets itself as a link detection sending end of the target network plane.
10. An apparatus for link failure detection, the apparatus comprising a receiver and a processor, wherein:
the transmitter is used for transmitting the initialization message in the local area network in a multicast mode;
a receiver for:
receiving an initialization message sent by other equipment in the local area network in a multicast mode, wherein the initialization message carries an equipment identifier of the corresponding equipment and an available logical port identifier selected by the corresponding equipment according to a preset logical port selection rule of a link detection function;
a processor to:
comparing its device identification with the device identifications of the other devices;
the transmitter is further configured to:
when any one of the other devices is determined to meet a preset sending end selection condition based on the comparison result, sending a detection notification message to the any one device,
the processor is further configured to:
setting the self as a link detection receiving end; or when receiving a detection notification message sent by other equipment in the local area network, setting the local area network as a link detection sending end;
the processor is further configured to negotiate with a second device as a link detection transmitting end according to a logical port selection rule of the link detection function to select a commonly available logical port identifier in a state of serving as a link detection receiving end under initiation of the second device as the link detection transmitting end, and set the commonly available logical port identifier as a logical port identifier of the link detection function; detecting a link detection message which is received by the receiver and sent by a second device serving as a link detection sending end in a multicast mode according to a preset detection period; and when detecting that the packet loss quantity of the link detection message reaches a first preset threshold value, determining that a link fault occurs between the first device and the second device.
11. The apparatus of claim 10, wherein the transmitter is configured to:
according to a preset initialization period, sending an initialization message in the local area network in a multicast mode;
the processor is further configured to:
and when any one of the other devices meets the preset sending end selection condition based on the comparison result, stopping sending the initialization message.
12. The apparatus of claim 10, wherein the processor is further configured to:
when an initialization message sent by a third device newly added to the local area network in a multicast mode is received in a state of being used as a link detection receiving end, the initialization message carries a device identifier of the third device, and the device identifier of the second device used as the link detection sending end is compared with the device identifier of the third device;
the transmitter is further configured to:
and when the third equipment meets the preset sending end selection condition based on the comparison result, sending a detection notification message to the third equipment.
13. The apparatus of claim 10, wherein the transmitter is configured to:
respectively sending initialization information in the local area network in a multicast mode through a network card corresponding to each network plane;
the receiver is configured to:
receiving an initialization message sent by other devices in the local area network in a multicast mode through a network card corresponding to each network plane, wherein the initialization message carries a device identifier of the corresponding device and a network plane identifier of the corresponding network plane;
the transmitter is configured to:
when determining that any one of the other devices meets a preset sending end selection condition corresponding to any network plane based on the comparison result, sending a detection notification message to the any one device, wherein the detection notification message carries a network plane identifier of the any network plane;
the processor is configured to:
and when receiving a detection notification message carrying a network plane identifier of a target network plane, which is sent by other equipment in the local area network, setting the local equipment as a link detection sending end of the target network plane.
14. The apparatus of claim 10, wherein the processor is configured to:
and when detecting that the packet loss quantity of the link detection message reaches a first preset threshold, the packet error quantity reaches a second preset threshold or the network delay quantity reaches a third preset threshold, determining that a link fault occurs between the first equipment and the second equipment.
15. An apparatus for link failure detection, the apparatus comprising a transmitter, wherein:
the transmitter is configured to:
sending an initialization message in a local area network in a multicast mode;
the device further comprises: a receiver, configured to receive an initialization message sent by another device in the local area network in a multicast manner, where the initialization message carries a device identifier of a corresponding device and an available logical port identifier selected by the corresponding device according to a preset logical port selection rule of a link detection function;
the device further comprises: a processor for comparing its device identification with the device identifications of the other devices;
the transmitter is further configured to:
when any one of the other devices is determined to meet a preset sending end selection condition based on the comparison result, sending a detection notification message to the any one device,
the processor is further configured to:
setting the self as a link detection receiving end; or when receiving a detection notification message sent by other equipment in the local area network, setting the local area network as a link detection sending end;
the transmitter is further configured to, in a state of being a link detection transmitting end, determine whether logical port identifiers carried in initialization messages sent by the other devices and the transmitter are consistent, if so, set the consistent logical port identifier as a logical port identifier of a link detection function, and if not, negotiate with the other devices to select a commonly available logical port identifier according to a logical port selection rule of the link detection function, and set the commonly available logical port identifier as a logical port identifier of the link detection function; and sending the link detection message in the local area network in a multicast mode according to a preset detection period.
16. The apparatus of claim 15, wherein the transmitter is configured to:
according to a preset initialization period, sending an initialization message in the local area network in a multicast mode;
the processor is further configured to:
and when any one of the other devices meets the preset sending end selection condition based on the comparison result, stopping sending the initialization message.
17. The apparatus of claim 16, wherein the processor is further configured to:
when receiving an initialization message sent by a third device newly added to the local area network in a multicast mode in a state of serving as a link detection sending end, the initialization message carries a device identifier of the third device, and the device identifier of the apparatus is compared with the device identifier of the third device;
the transmitter is further configured to:
when the third equipment is determined to meet the preset sending end selection condition based on the comparison result, sending a detection notification message to the third equipment;
the processor is further configured to:
and sets itself as the link detection receiving end.
18. The apparatus of claim 15, wherein the transmitter is configured to:
respectively sending initialization information in the local area network in a multicast mode through a network card corresponding to each network plane;
the receiver is configured to:
receiving an initialization message sent by other devices in the local area network in a multicast mode through a network card corresponding to each network plane, wherein the initialization message carries a device identifier of the corresponding device and a network plane identifier of the corresponding network plane;
the transmitter is configured to:
when determining that any one of the other devices meets a preset sending end selection condition corresponding to any network plane based on the comparison result, sending a detection notification message to the any one device, wherein the detection notification message carries a network plane identifier of the any network plane;
the processor is configured to:
and when receiving a detection notification message carrying a network plane identifier of a target network plane, which is sent by other equipment in the local area network, setting the local equipment as a link detection sending end of the target network plane.
19. An apparatus for detecting link failure, the apparatus comprising a sending module, a receiving module, and a processing module, wherein:
the sending module is used for sending an initialization message in a local area network in a multicast mode;
the receiving module is configured to:
receiving an initialization message sent by other equipment in the local area network in a multicast mode, wherein the initialization message carries an equipment identifier of the corresponding equipment and an available logical port identifier selected by the corresponding equipment according to a preset logical port selection rule of a link detection function;
the processing module is configured to:
comparing its device identification with the device identifications of the other devices;
the sending module is further configured to:
when any one of the other devices is determined to meet a preset sending end selection condition based on the comparison result, sending a detection notification message to the any one device,
the processing module is further configured to:
setting the self as a link detection receiving end; or when receiving a detection notification message sent by other equipment in the local area network, setting the local area network as a link detection sending end;
the processing module is further configured to negotiate with a second device as a link detection transmitting end according to a logical port selection rule of the link detection function to select a commonly available logical port identifier in a state of serving as a link detection receiving end under initiation of the second device as the link detection transmitting end, and set the commonly available logical port identifier as a logical port identifier of the link detection function; according to a preset detection period, detecting a link detection message which is received by the receiving module and sent by a second device serving as a link detection sending end in a multicast mode; and when detecting that the packet loss quantity of the link detection message reaches a first preset threshold value, determining that a link fault occurs between the first device and the second device.
20. The apparatus of claim 19, wherein the sending module is configured to:
according to a preset initialization period, sending an initialization message in the local area network in a multicast mode;
the processing module is further configured to:
and when any one of the other devices meets the preset sending end selection condition based on the comparison result, the first device terminates sending the initialization message.
21. The apparatus of claim 19, wherein the processing module is further configured to:
when an initialization message sent by a third device newly added to the local area network in a multicast mode is received in a state of being used as a link detection receiving end, the initialization message carries a device identifier of the third device, and the device identifier of the second device used as the link detection sending end is compared with the device identifier of the third device;
the sending module is further configured to:
and when the third equipment meets the preset sending end selection condition based on the comparison result, sending a detection notification message to the third equipment.
22. The apparatus of claim 19, wherein the sending module is configured to:
respectively sending initialization information in the local area network in a multicast mode through a network card corresponding to each network plane;
the receiving module is configured to:
receiving an initialization message sent by other devices in the local area network in a multicast mode through a network card corresponding to each network plane, wherein the initialization message carries a device identifier of the corresponding device and a network plane identifier of the corresponding network plane;
the sending module is configured to:
when determining that any one of the other devices meets a preset sending end selection condition corresponding to any network plane based on the comparison result, sending a detection notification message to the any one device, wherein the detection notification message carries a network plane identifier of the any network plane;
the processing module is configured to:
and when the first device receives a detection notification message which is sent by other devices in the local area network and carries the network plane identifier of the target network plane, setting the first device as a link detection sending end of the target network plane.
23. The apparatus of claim 19, wherein the processing module is configured to:
and when detecting that the packet loss quantity of the link detection message reaches a first preset threshold, the packet error quantity reaches a second preset threshold or the network delay quantity reaches a third preset threshold, determining that a link fault occurs between the first equipment and the second equipment.
24. An apparatus for link failure detection, the apparatus comprising a sending module and a storage module, wherein:
the sending module is configured to:
the initialization message is sent in the local area network by means of multicast,
the device further comprises: a receiving module, configured to receive an initialization message sent by another device in the local area network in a multicast manner, where the initialization message carries a device identifier of a corresponding device and an available logical port identifier selected by the corresponding device according to a preset logical port selection rule of a link detection function;
the device further comprises: a processing module for comparing its device identification with the device identifications of the other devices;
the sending module is further configured to:
when any one of the other devices is determined to meet a preset sending end selection condition based on the comparison result, sending a detection notification message to the any one device,
the processing module is further configured to:
setting the self as a link detection receiving end; or when receiving a detection notification message sent by other equipment in the local area network, setting the local area network as a link detection sending end;
the sending module is further configured to, in a state of being a link detection sending end, determine whether the other devices and the logical port identifier carried in the initialization message sent by the sending module are consistent, if so, set the consistent logical port identifier as a logical port identifier of a link detection function, if not, negotiate with the other devices to select a commonly available logical port identifier according to a logical port selection rule of the link detection function, and set the commonly available logical port identifier as a logical port identifier of the link detection function; and sending the link detection message in the local area network in a multicast mode according to a preset detection period.
25. The apparatus of claim 24, wherein the sending module is configured to:
according to a preset initialization period, sending an initialization message in the local area network in a multicast mode;
the processing module is further configured to:
and when any one of the other devices meets the preset sending end selection condition based on the comparison result, stopping sending the initialization message.
26. The apparatus of claim 25, wherein the processing module is further configured to:
when receiving an initialization message sent by a third device newly added to the local area network in a multicast mode in a state of serving as a link detection sending end, the initialization message carries a device identifier of the third device, and the device identifier of the apparatus is compared with the device identifier of the third device;
the sending module is further configured to:
when the third equipment is determined to meet the preset sending end selection condition based on the comparison result, sending a detection notification message to the third equipment;
the processing module is further configured to:
and sets itself as the link detection receiving end.
27. The apparatus of claim 24, wherein the sending module is configured to:
respectively sending initialization information in the local area network in a multicast mode through a network card corresponding to each network plane;
the receiving module is configured to:
receiving an initialization message sent by other devices in the local area network in a multicast mode through a network card corresponding to each network plane, wherein the initialization message carries a device identifier of the corresponding device and a network plane identifier of the corresponding network plane;
the sending module is configured to:
when determining that any one of the other devices meets a preset sending end selection condition corresponding to any network plane based on the comparison result, sending a detection notification message to the any one device, wherein the detection notification message carries a network plane identifier of the any network plane;
the processing module is configured to:
and when receiving a detection notification message carrying a network plane identifier of a target network plane, which is sent by other equipment in the local area network, setting the local equipment as a link detection sending end of the target network plane.
28. A system for link detection, the system comprising a first device and a second device, wherein:
the second device is configured to send an initialization message in a local area network in a multicast manner, and receive an initialization message sent by other devices in the local area network in the multicast manner, where the initialization message carries a device identifier of a corresponding device and an available logical port identifier selected by the corresponding device according to a preset logical port selection rule of a link detection function; comparing its device identification with the device identifications of the other devices; when any one of the other devices meets a preset sending end selection condition based on the comparison result, sending a detection notification message to the any one device, and setting the device as a link detection receiving end; or when receiving a detection notification message sent by other equipment in the local area network, setting the local area network as a link detection sending end; under the state of serving as a link detection sending end, judging whether the logic port identifiers carried in initialization messages sent by the other equipment and the second equipment are consistent, if so, setting the consistent logic port identifiers as the logic port identifiers of the link detection function, and if not, the second equipment and the other equipment negotiate to select a commonly available logic port identifier according to a logic port selection rule of the link detection function and set the commonly available logic port identifier as the logic port identifier of the link detection function; according to a preset detection period, sending a link detection message in a local area network in a multicast mode;
the first device is configured to send an initialization message in a local area network in a multicast manner, and receive an initialization message sent by other devices in the local area network in the multicast manner, where the initialization message carries a device identifier of a corresponding device and an available logical port identifier selected by the corresponding device according to a preset logical port selection rule of a link detection function; comparing its device identification with the device identifications of the other devices; when any one of the other devices meets a preset sending end selection condition based on the comparison result, sending a detection notification message to the any one device, and setting the device as a link detection receiving end; or when receiving a detection notification message sent by other equipment in the local area network, setting the local area network as a link detection sending end; under the state of serving as a link detection receiving end and under the initiation of second equipment serving as a link detection transmitting end, the first equipment and the second equipment negotiate to select a commonly available logical port identifier according to a logical port selection rule of the link detection function, and set the commonly available logical port identifier as a logical port identifier of the link detection function; detecting a link detection message sent by the second device serving as a link detection sending end in a multicast mode according to a preset detection period; and when detecting that the packet loss quantity of the link detection message reaches a first preset threshold value, determining that a link fault occurs between the first device and the second device.
CN201510844330.3A 2015-11-27 2015-11-27 Method, device and system for detecting link fault Active CN106817264B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510844330.3A CN106817264B (en) 2015-11-27 2015-11-27 Method, device and system for detecting link fault

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510844330.3A CN106817264B (en) 2015-11-27 2015-11-27 Method, device and system for detecting link fault

Publications (2)

Publication Number Publication Date
CN106817264A CN106817264A (en) 2017-06-09
CN106817264B true CN106817264B (en) 2020-09-08

Family

ID=59101867

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510844330.3A Active CN106817264B (en) 2015-11-27 2015-11-27 Method, device and system for detecting link fault

Country Status (1)

Country Link
CN (1) CN106817264B (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107426030B (en) * 2017-08-09 2020-11-06 杭州迪普科技股份有限公司 Link fault reminding method and device
CN109982065B (en) * 2017-12-27 2020-10-20 浙江宇视科技有限公司 Method, device and storage medium for equipment fault recovery in video monitoring network
CN108683542A (en) * 2018-05-22 2018-10-19 郑州云海信息技术有限公司 A kind of fault self-diagnosis method of distributed memory system, system and device
CN110830283B (en) * 2018-08-10 2021-10-15 华为技术有限公司 Fault detection method, device, equipment and system
CN109104338B (en) * 2018-11-12 2020-10-16 北京天融信网络安全技术有限公司 Link intelligent detection method, storage medium and computer equipment
CN109586959B (en) * 2018-11-26 2021-11-26 新华三技术有限公司 Fault detection method and device
CN111756588B (en) * 2019-03-26 2023-01-06 华为技术有限公司 Communication link detection method and related device
CN110855530B (en) * 2019-11-28 2021-08-20 北京恒泰实达科技股份有限公司 Method for assisting detection of RS232 serial interface communication link
CN115396344A (en) * 2021-05-08 2022-11-25 华为技术有限公司 Method, device and equipment for detecting link
CN117240748A (en) * 2022-06-08 2023-12-15 华为技术有限公司 Communication link detection method and device
CN114760222A (en) * 2022-06-13 2022-07-15 北京国科天迅科技有限公司 Link disconnection detection method and device for 100base-T1 PHY chip

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101778113A (en) * 2010-01-25 2010-07-14 福建星网锐捷网络有限公司 Method for detection of RP state in multicast network, device, RP device and multicast system
US8705580B2 (en) * 2010-01-22 2014-04-22 Aruba Networks, Inc. Aggregating multiple wireless channels
CN104717140A (en) * 2013-12-11 2015-06-17 华为技术有限公司 Method and device for fault treatment for edge route bridge equipment in TRILL network

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102130778A (en) * 2010-10-22 2011-07-20 华为技术有限公司 Method and system for protecting IPTV (Internet Protocol Television) multicast service
CN102724086B (en) * 2012-06-21 2018-05-04 中兴通讯股份有限公司 Detect the method and device of link quality
CN103036904B (en) * 2012-12-27 2015-10-21 东方通信股份有限公司 A kind of udp protocol that uses in a communication network carries out the method for reliable data transmission

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8705580B2 (en) * 2010-01-22 2014-04-22 Aruba Networks, Inc. Aggregating multiple wireless channels
CN101778113A (en) * 2010-01-25 2010-07-14 福建星网锐捷网络有限公司 Method for detection of RP state in multicast network, device, RP device and multicast system
CN104717140A (en) * 2013-12-11 2015-06-17 华为技术有限公司 Method and device for fault treatment for edge route bridge equipment in TRILL network

Also Published As

Publication number Publication date
CN106817264A (en) 2017-06-09

Similar Documents

Publication Publication Date Title
CN106817264B (en) Method, device and system for detecting link fault
CN107864228B (en) Connection establishment method and system in content distribution network
CN107925629B (en) Method and device for sending data message in IPv6 network
US20090232152A1 (en) Method and apparatus for aggregating ports
US20080232261A1 (en) Transmission apparatus, test method, and transmission apparatus control program
CN107196820B (en) Switch performance test method, device and system
CN101595686A (en) Trigger the flow analysis at intermediate equipment place
CN107370636B (en) Link state determination method and device
CN107547430B (en) Message sending method and device
JP7124206B2 (en) Packet processing methods and gateway devices
CN107204924B (en) Link discovery method and device
US8472336B2 (en) Network management apparatus for setting communication method of network apparatus
KR102435334B1 (en) Adaptive Bidirectional Forwarding Detection protocol and equipment for maximizing service availability in network system
EP2858302A1 (en) Connectivity check method of service stream link, related apparatus and system
CN105703967B (en) Method and device for detecting connectivity of label switched path
CN107786441B (en) Communication method, OpenFlow switch and communication system
CN108259254B (en) Path quality detection method and network equipment
CN110099001B (en) Bidirectional forwarding detection time parameter negotiation method and device and electronic equipment
CN106992878B (en) Multicast detection method and device
CN114070495A (en) Data transmission method, device, electronic device and storage medium
CN114500632A (en) Communication method and communication device
JP2021064843A (en) Network management device, failure section determination method, and program
CN111405025A (en) Data transmission method and device, transmission equipment and readable storage medium
Zhang et al. A service protection mechanism impelemented on P4 by packet replication
CN111835551A (en) Method and apparatus for operating a network element and a monitoring entity in a communication infrastructure

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
TA01 Transfer of patent application right

Effective date of registration: 20200201

Address after: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Applicant after: HUAWEI TECHNOLOGIES Co.,Ltd.

Address before: 210012 Ande Gate No. 94, Yuhuatai District, Jiangsu, Nanjing

Applicant before: Huawei Technologies Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant