Link switching method and device, network equipment and readable storage medium

By detecting the status of the communication link and judging the switching conditions, automatically switching to the backup link, the risk of service interruption in the prior art is solved and high-reliability link switching is achieved.

CN119484379AActive Publication Date: 2025-02-18CHINA TELECOM CLOUD TECH CO LTD

Patent Information

Application Number
CN202411693338.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-02-18
Estimated Expiration
2044-11-25

AI Technical Summary

Technical Problem

The prior art has the risk of service interruption in multiple communication links, and network administrators require manual switching to the backup link.

Method used

By sending a detection message and listening to a response message, it is determined whether the handover conditions are met based on the detection results of the communication link, and automatically switch to the backup link.

Benefits of technology

Reduces the risk of business interruption, realizes automated link switching, and reduces operation and maintenance costs and complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119484379A_ABST
    Figure CN119484379A_ABST
Patent Text Reader

Abstract

The invention relates to a link switching method and device, network equipment and a readable storage medium. The method comprises the following steps: sending a first detection message corresponding to each to-be-detected communication link, monitoring a response message corresponding to each first detection message to obtain a detection result of each to-be-detected communication link, and switching the to-be-detected communication link when the detection result of the first communication link meets a first switching condition. And determining a target communication link according to the detection result of the second communication link, and performing communication based on the target communication link. Wherein the first communication link is a communication link in a use state in the communication links to be tested, and the second communication link is a standby communication link of the first communication link in the communication links to be tested. By adopting the method, the risk of service interruption can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a link switching method, apparatus, network equipment and readable storage medium. Background Art

[0002] In the field of network technology, in order to improve the reliability and flexibility of the network, users often configure multiple communication links, for example, a primary link and a backup link.

[0003] Currently, static routing protocols are used to manage multiple communication links. Normally, communication is performed through the primary link. However, once the primary link fails, the network administrator needs to manually switch to the backup link for communication. Therefore, the current link determination method has the risk of service interruption. Summary of the invention

[0004] Based on this, it is necessary to provide a link switching method, apparatus, network device and readable storage medium that can reduce the risk of service interruption in response to the above technical problems.

[0005] In a first aspect, the present application provides a link switching method, comprising:

[0006] Sending a first detection message corresponding to each communication link to be tested;

[0007] Monitor the response messages corresponding to the first detection messages to obtain the detection results of the communication links to be tested;

[0008] When the detection result of the first communication link meets the first switching condition, the target communication link is determined according to the detection result of the second communication link, and communication is performed based on the target communication link; the first communication link is a communication link in use among the communication links to be tested, and the second communication link is a backup communication link for the first communication link among the communication links to be tested.

[0009] In one embodiment, the method further comprises:

[0010] If no response message corresponding to the first communication link is received within a preset time period, determining that the detection result of the first communication link meets the first switching condition; or,

[0011] When the quality parameter of the first communication link is less than a preset quality threshold, it is determined that the detection result of the first communication link meets the first switching condition; the quality parameter of the first communication link is determined according to the first detection message and the response message corresponding to the first communication link.

[0012] In one embodiment, the method further comprises:

[0013] When the detection result of the first communication link meets the first switching condition, communication using the first communication link is prohibited.

[0014] In one of the embodiments, after determining the target communication link according to the detection result of the second communication link and communicating based on the target communication link, the method further includes:

[0015] When the detection result of the first communication link satisfies the second switching condition, the first communication link is used as the target communication link, and communication is performed based on the target communication link.

[0016] In one embodiment, the method further comprises:

[0017] Obtaining configuration information; the configuration information includes a target address of the communication link to be tested;

[0018] Parse the configuration information and update the communication link to be tested.

[0019] In one embodiment, sending a first detection message corresponding to each communication link to be tested includes:

[0020] For each communication link to be tested, fill the identifier corresponding to the communication link to be tested into the load part of the initial detection message to generate a second detection message;

[0021] Generate a first detection message corresponding to the communication link to be tested according to the second detection message;

[0022] Send a first detection message.

[0023] In a second aspect, the present application also provides a link switching device, including:

[0024] A sending module, used for sending a first detection message corresponding to each communication link to be tested;

[0025] A monitoring module, used to monitor the response messages corresponding to the first detection messages, and obtain the detection results of the communication links to be tested;

[0026] The first determination module is used to determine the target communication link according to the detection result of the second communication link and communicate based on the target communication link when the detection result of the first communication link meets the first switching condition; the first communication link is a communication link in use among the communication links to be tested, and the second communication link is a backup communication link for the first communication link among the communication links to be tested.

[0027] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any of the above methods when executing the computer program.

[0028] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of any of the above methods when executed by a processor.

[0029] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the steps of any of the above methods when executed by a processor.

[0030] The above-mentioned link switching method, device, network equipment and readable storage medium can send the first detection message corresponding to each communication link to be tested, and monitor the response message corresponding to each first detection message to obtain the detection result of each communication link to be tested. Therefore, when the detection result of the first communication link meets the first switching condition, the target communication link can be determined according to the detection result of the second communication link, and communication can be carried out based on the target communication link. In addition, since the first communication link is the communication link in use among the communication links to be tested, and the second communication link is the backup communication link of the first communication link in the communication link to be tested, it is possible to timely and accurately monitor the communication anomaly of the first communication link, and then switch the used first communication link to the backup communication link of the first communication link, thereby avoiding business interruption caused by the network administrator manually switching to the backup communication link of the first communication link, and reducing the risk of business interruption. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0032] FIG1 is a diagram of an application environment of a link switching method according to an embodiment;

[0033] Figure 2 A schematic diagram of a link switching method in an embodiment;

[0034] Figure 3 is a schematic diagram of the switching principle in an embodiment;

[0035] Figure 4 A schematic diagram of updating a communication link to be tested in one embodiment;

[0036] Figure 5 A schematic diagram of maintaining a communication link to be tested in one embodiment;

[0037] Figure 6 A schematic diagram of a process of sending a first detection message in an embodiment;

[0038] Figure 7 An example diagram of link switching in one embodiment;

[0039] Figure 8 is an overall schematic diagram of a link switching method in an embodiment;

[0040] Fig. 9 A schematic diagram of a link switching method according to an embodiment;

[0041] Fig.10 is a structural block diagram of a link switching device in one embodiment;

[0042] FIG. 11 is a diagram showing the internal structure of a network device in one embodiment. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0044] FIG1 is an application environment diagram of a link switching method in an embodiment. The link switching method provided in the embodiment of the present application can be applied in the application environment shown in FIG1. ​​Among them, the user terminal 101 accesses the network 103 through the network device 102. There are multiple communication links between the network device 102 and the network 103, such as the communication link 1 to the communication link n shown in FIG1, where n is a positive integer greater than or equal to 2. Usually, there is one main link among the multiple communication links, and the rest are backup links. For example, communication link 1 is the main link, and the communication links other than communication link 1 are backup links.

[0045] The user terminal 101 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices may be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The network device 102 may include, but is not limited to, a router.

[0046] Figure 2 FIG. 1 is a flow chart of a link switching method in an embodiment. In an exemplary embodiment, as shown in FIG. Figure 2 As shown, a link switching method is provided, which is described by taking the method applied to the network device in FIG. 1 as an example, and includes the following S201 to S203.

[0047] S201, sending a first detection message corresponding to each communication link to be tested.

[0048] In this embodiment, each communication link to be tested refers to a communication link that needs to be monitored, for example, all communication links set on the network device. Optionally, the user can specify each communication link to be tested, and the network device can also automatically determine each communication link to be tested. Taking Figure 1 as an example, the communication links to be tested can include communication link 1 to communication link n.

[0049] Furthermore, the network device will send a corresponding first detection message to each communication link to be tested. In other words, the network device will send a first detection message corresponding to the communication link to be tested to each communication link to be tested. Among them, the network device can determine the target address to be detected in each communication link to be tested, and send a corresponding first detection message to the target address of each communication link to be tested. It should be noted that the target addresses of the communication links to be tested can be the same or different, and this embodiment does not limit it.

[0050] Optionally, the network device may periodically send a first detection message corresponding to each communication link to be tested.

[0051] Further optionally, the first detection message may be an Internet Control Message Protocol (ICMP) message, such as an ICMP Echo Request message. ICMP is a network layer protocol used to transmit control messages, such as error reports and network query information, between Internet Protocol (IP) hosts and routers. ICMP messages are usually encapsulated in IP data packets and are used to diagnose network problems, such as unreachable hosts, routing problems, or connection timeouts.

[0052] In one embodiment, the first detection message may be a message sent by the network device in a Vector Packet Processing (VPP) framework, wherein the VPP is a high-performance network stack that can provide fast, scalable, and programmable network data packet processing capabilities.

[0053] Continuing with the example of FIG. 1 , the network device may send a first detection message 1 to communication link 1 , send a first detection message 2 to communication link 2 , ... send a second detection message n to communication link n.

[0054] S202, monitoring response messages corresponding to the first detection messages, and obtaining detection results of the communication links to be tested.

[0055] In this embodiment, if the communication link to be tested and the network device communicate normally, then after receiving the first detection message sent by the network device, the communication link to be tested will return a response message corresponding to the first detection message to the network device. In other words, under normal circumstances, after receiving the corresponding first detection message, the target address of the communication link to be tested will return a response message corresponding to the first detection message to the network device. Therefore, the network device can monitor the response message corresponding to the first detection message to obtain the detection results of each communication link to be tested.

[0056] The detection result can represent the communication status of the communication link to be tested. For example, the detection result can be whether the communication of the communication link to be tested is normal or abnormal, or can be the communication quality of the communication link to be tested, which is not limited in this embodiment.

[0057] Optionally, both the first detection message and the response message may include identification information. In this way, after receiving the first detection message, the communication link to be tested can generate a response message corresponding to the first detection message according to the identification information of the first detection message, and send the response message to the network device. After receiving the response message, the network device can determine which first detection message corresponds to the response message through the identification information carried in the response message. The identification information includes but is not limited to at least one of an identifier (id) value and a sequence (seq) value.

[0058] In some embodiments, the response message may also be an ICMP message, such as an IMCP Echo Reply message.

[0059] S203, when the detection result of the first communication link meets the first switching condition, determine the target communication link according to the detection result of the second communication link, and communicate based on the target communication link; the first communication link is a communication link in use among the communication links to be tested, and the second communication link is a backup communication link for the first communication link among the communication links to be tested.

[0060] In this embodiment, the computer device determines whether the detection result of the first communication link meets the first switching condition. The first communication link is a communication link in use among the communication links to be tested. In one embodiment, the network device can set a static route with the highest priority as a default route. Taking Figure 1 as an example, if the current network device uses communication link 1 for communication, the first communication link is communication link 1.

[0061] The first switching condition is used to determine whether the first communication link switches to other communication links. The first switching condition can be set as required. Optionally, the network device can determine that the detection result of the first communication link meets the first switching condition when the response message corresponding to the first communication link is not received within a preset time length. Exemplarily, if the network device sends the first detection message 1 corresponding to communication link 1 to communication link 1, and does not receive the response message corresponding to the first detection message 1 within 1 minute, that is, does not receive the response message corresponding to communication link 1, it can be determined that communication link 1 has met the first switching condition. It should be noted that the above example is based on a preset time length of 1 minute, and the present embodiment is not limited to this.

[0062] In this way, by determining whether a response message corresponding to the first communication link is received within a preset time period, the communication status of the first communication link can be determined timely and accurately, so that when the communication of the first communication link is abnormal, the first communication link can be switched to other communication links in time to avoid service interruption.

[0063] Optionally, the network device may also determine that the detection result of the first communication link meets the first switching condition when the quality parameter of the first communication link is less than a preset quality threshold. The preset quality threshold can be set as required and will not be described in detail here.

[0064] The quality parameter of the first communication link is determined according to the first detection message and the response message corresponding to the first communication link. That is, the network device can determine the quality parameter of the first communication link according to the first detection message and the response message corresponding to the first communication link. The quality parameter may include but is not limited to at least one of delay, jitter or packet loss rate.

[0065] Further optionally, the network device may determine the delay according to the sending time of the first detection message and the receiving time of the response message. The sending time and the receiving time may be determined by the timestamp of the message. For example, if the sending time of the first detection message 1 corresponding to the communication link 1 sent by the network device is time A, and the receiving time of the response message corresponding to the first detection message 1 is time B, the network device may use the difference between time B and time A as the delay of the communication link 1.

[0066] The network device may also determine jitter based on multiple delays. For example, the network device may determine the jitter of the communication link 1 based on multiple consecutive delays of the communication link 1 over a period of time. The network device may also determine the packet loss rate based on the number of corresponding response messages received by at least one first detection message. For example, if the network device sends 4 first detection messages 1 to the communication link 1 within 1 minute, but only receives a response message corresponding to 1 first detection message 1, it can be determined that the packet loss rate of the communication link in this 1 minute is 75%.

[0067] In this way, the communication status of the first communication link can be determined timely and accurately through the quality parameters determined by the first detection message and the response message corresponding to the first communication link. Even if the response message of the first communication link is received, if the quality parameters of the first communication link are poor, the first communication link can be switched to other communication links.

[0068] Further, when the detection result of the first communication link satisfies the first switching condition, the network device can determine the target communication link according to the detection result of the second communication link, and communicate based on the target communication link. The second communication link is a backup communication link of the first communication link in the communication link to be tested. In one embodiment, the backup link of the first communication link can be a communication link other than the first communication link in the link to be tested. Continuing with the example of Figure 1, when the first communication link is communication link 1, the second communication link is communication link 2 to communication link n.

[0069] Optionally, the network device may determine the second communication link that receives the response message based on the detection result of the second communication link, and determine the target communication link from the second communication links that receive the response message. Further optionally, the network device may determine the target communication link from the second communication links that receive the response message based on the priority of each communication link.

[0070] The network device may also determine a second communication link whose quality parameter is greater than the first threshold according to the detection result of the second communication link, and determine the target communication link according to the second communication link whose quality parameter is greater than the first threshold, which is not limited in this embodiment.

[0071] Further, the network device can continue to communicate based on the target communication link. For example, assuming that after using communication link 1 for a period of time, the detection result of communication link 1 meets the first switching condition, the network device can use communication link 2 as the target communication link to access the network based on communication link 2.

[0072] In the above-mentioned link switching method, since it is possible to send the first detection message corresponding to each communication link to be tested, and monitor the response message corresponding to each first detection message, and obtain the detection result of each communication link to be tested, therefore, when the detection result of the first communication link meets the first switching condition, the target communication link can be determined according to the detection result of the second communication link, and communication can be performed based on the target communication link. In addition, since the first communication link is the communication link in use among the communication links to be tested, and the second communication link is the backup communication link of the first communication link in the communication links to be tested, it is possible to timely and accurately monitor the communication anomaly of the first communication link, and then switch the used first communication link to the backup communication link of the first communication link, thereby avoiding the service interruption caused by the network administrator manually switching to the backup communication link of the first communication link, and reducing the risk of service interruption.

[0073] In an exemplary embodiment, optionally, the link switching method may further include the following steps:

[0074] When the detection result of the first communication link meets the first switching condition, communication using the first communication link is prohibited.

[0075] In this embodiment, if the network device confirms that the detection result of the first communication link meets the first switching condition, the first communication link will be prohibited from being used for communication. Optionally, the network device can prohibit the use of the first communication link for communication by disabling the routing configuration of the first communication link.

[0076] Taking the routing configuration of the first communication link as static routing as an example, continuing the above example, when communication link 1 meets the first switching condition, the network device will prohibit enabling the static routing of communication link 1 to prohibit the use of communication link 1 for communication.

[0077] In the above embodiment, since the first communication link is prohibited from being used for communication when the detection result of the first communication link meets the first switching condition, the first communication link can be disconnected in time when the first communication link has communication abnormality.

[0078] In an exemplary embodiment, optionally, after "determining a target communication link according to the detection result of the second communication link, and communicating based on the target communication link" in S203 above, the link switching method may further include the following steps:

[0079] When the detection result of the first communication link satisfies the second switching condition, the first communication link is used as the target communication link, and communication is performed based on the target communication link.

[0080] In this embodiment, after the network device switches the first communication link to the target communication link, it will continue to determine whether the detection result of the first communication link meets the second switching condition. The second switching condition is used to determine whether to continue to switch back to the first communication link after switching the first communication link to other communication links. In one embodiment, optionally, the second switching condition can be a non-condition of the first switching condition.

[0081] The second switching condition can also be set as required. Optionally, the network device can determine that the detection result of the first communication link meets the second switching condition when a response message corresponding to the first communication link is received within a preset time period. The network device can also determine that the detection result of the first communication link meets the second switching condition when the quality parameter of the first communication link is not less than a preset quality threshold.

[0082] In this way, when the detection result of the first communication link meets the second switching condition, the network device can continue to use the first communication link as the target communication link and communicate based on the target communication link.

[0083] Continuing to take the first communication link as communication link 1 as an example, assuming that after using communication link 1 for a period of time, the detection result of communication link 1 meets the first switching condition, at this time the network device will use communication link 2 as the target communication link to switch to communication link 2 to access the network. After another period of time, the detection result of communication link 1 meets the second switching condition, at this time the network device will use communication link 1 as the target communication link to switch back to communication link 1 to access the network.

[0084] In an exemplary embodiment, optionally, when the detection result of the first communication link meets the second switching condition, the network device can continue to enable the routing configuration of the first communication link. For example, when the communication link 1 meets the second switching condition, the network device enables the static routing of the communication link 1, so that the network device can continue to use the communication link 1 for communication.

[0085] In the above embodiment, since the first communication link is used as the target communication link and communication is performed based on the target communication link when the detection result of the first communication link meets the second switching condition, when the first communication link resumes normal communication, communication can be switched back to the first communication link in time.

[0086] In order to more clearly introduce the link switching method of the present application, Figure 3 Provide explanation. Figure 3 FIG. 1 is a schematic diagram of the switching principle in an embodiment, as shown in FIG. Figure 3As shown, the network device includes a control plane and a data plane, and the user can configure the routing configuration of the first communication link through the control plane. When the detection result of the first communication link meets the first switching condition, the control plane controls the static routing of the first communication link to be invalid through the data plane to prohibit the use of the first communication link for communication. When the detection result of the first communication link meets the second switching condition, the control plane controls the static routing of the first communication link to take effect through the data plane to continue to communicate based on the first communication link.

[0087] Figure 4 FIG. 1 is a schematic diagram of updating a communication link to be tested in an embodiment. Figure 4 As shown, in an exemplary embodiment, as Figure 4 As shown, the above link switching method may further include S401 to S402.

[0088] S401, obtaining configuration information; the configuration information includes a target address of a communication link to be tested.

[0089] In this embodiment, the network device can obtain configuration information. Optionally, the network device can obtain configuration information input by a user, or can receive configuration information sent by other devices, which is not limited in this embodiment.

[0090] The configuration information is used to update the communication link to be tested. The configuration information includes the target address of the communication link to be tested. The target address can be a public network address or an address of an uplink device, which is not limited in this embodiment.

[0091] In some embodiments, the configuration information may also include at least one of priority, source interface, source address, next hop address, sending interval, sending quantity, first switching condition, preset quality threshold, and detection event identifier. Among them, priority indicates the priority of the communication link to be tested. The source interface indicates the source interface of the first detection message sent by the network device. The source address indicates the source address of the first detection message sent by the network device. The next hop address indicates the next hop address of the first detection message sent by the network device. The sending interval indicates the sending interval of the first detection message sent by the network device. The sending quantity indicates the sending quantity of the first detection message sent by the network device. The detection event is also an event of monitoring the response message corresponding to the first detection message to obtain the detection result of the communication link to be tested. The detection event identifier can be, for example, a detection event id, which is used to identify the detection event corresponding to a communication link to be tested. For example, detection event identifier A indicates the detection event corresponding to communication link 1, and detection event identifier B indicates the detection event corresponding to communication link 2.

[0092] Optionally, taking the configuration information including the detection event identifier as an example, after determining the configuration information of the communication link to be tested, the detection event identifier is associated with the communication link to be tested, so that the routing configuration of the communication link to be tested can be controlled according to the detection event corresponding to the detection event identifier. Further optionally, communication can be performed based on the communication link to be tested when the detection result in the detection event corresponding to the detection event identifier meets the first switching condition, and communication using the communication link to be tested can be prohibited when the detection result in the detection event corresponding to the detection event identifier meets the second switching condition. This embodiment is not limited to this. Exemplarily, assuming that communication link 1 is associated with detection event identifier B, the computer device can communicate based on communication link 1 by controlling the routing configuration of communication link 1 when the detection result of communication link 2 meets the first switching condition.

[0093] S402, parsing the configuration information and updating the communication link to be tested.

[0094] In this embodiment, after receiving the configuration information, the network device can parse the configuration information to update the communication link to be tested. Updating the communication link to be tested can be adding a new communication link to be tested, or deleting a communication link to be tested, or adjusting an existing communication link to be tested, which is not limited in this embodiment.

[0095] Furthermore, the network device can send the first detection message corresponding to each communication link to be tested based on the configuration information. In some embodiments, different communication links to be tested can correspond to different configuration information.

[0096] Figure 5 FIG. 1 is a schematic diagram of maintaining a communication link to be tested in one embodiment. Figure 5 As shown, in one embodiment, the network device obtains configuration information and parses the configuration information. If after parsing the configuration information, it is determined that a new communication link to be tested needs to be added, then a new target address is added. If after parsing the configuration information, it is determined that a communication link to be tested needs to be adjusted, then the target address is adjusted. If after parsing the configuration information, it is determined that a communication link to be tested needs to be deleted, then the target address is deleted. In this way, the communication link to be tested can be maintained, and the communication link to be tested that ultimately needs to send the first detection message can be determined, so as to send the corresponding first detection message to the target address of each communication link to be tested.

[0097] In the above embodiment, since the configuration information can be obtained, and the configuration information includes the target address of the communication link to be tested, the communication link to be tested can be updated after the configuration information is parsed. In this way, the user can customize the configuration information to efficiently maintain the communication link to be tested.

[0098] Figure 6FIG. 1 is a flow chart of sending a first detection message in an embodiment. In an exemplary embodiment, as shown in FIG. Figure 6 As shown, the above-mentioned S201 includes S601~S603.

[0099] S601, for each communication link to be tested, fill the identifier corresponding to the communication link to be tested into the load part of the initial detection message to generate a second detection message.

[0100] In this embodiment, different communication links to be tested have different corresponding identifiers. For each communication link to be tested, the network device will fill the identifier corresponding to the communication link to be tested into the load part of the initial detection message to generate a second detection message.

[0101] Among them, the initial detection message can be generated by the network device. Optionally, the initial detection message can be a message generated by the network device within the vector packet processing framework. Exemplarily, the network device can set the header part of the ICMP message, and the header part includes parameters such as the type, code, and checksum of the ICMP message to obtain the initial detection message. After generating the initial detection message, the network device fills the identifier corresponding to the communication link 1 into the payload part of the initial detection message to obtain the second detection message corresponding to the communication link 1. The same is true for other communication links, which will not be repeated here.

[0102] In an exemplary embodiment, the network device optionally sends the second detection message to an internal Active Byte Filter (ABF). ABF is an advanced packet processing mechanism that allows filtering and forwarding packets based on packet content (such as specific byte patterns or strings). ABF rules can match and perform specific actions based on any byte content of the packet, such as allowing the packet to pass, discarding, or redirecting it to a specific interface. This flexibility makes ABF very suitable for implementing complex network policies, such as content-based routing, access control, traffic engineering, etc.

[0103] Furthermore, the network device can determine the filtering rules corresponding to ABF, so that ABF distributes the second detection message with the identifier corresponding to the communication link to be tested to the outbound interface of each communication link to be tested, so as to realize the ABF routing function. Exemplarily, when the second detection message 1 contains the identifier corresponding to the communication link 1, ABF directs the second detection message 1 to the communication link 1; when the second detection message 2 contains the identifier corresponding to the communication link 2, ABF directs the second detection message 2 to the communication link 2, and so on.

[0104] S602: Generate a first detection message corresponding to the communication link to be tested according to the second detection message.

[0105] In this embodiment, the network device can obtain the third detection message according to the second detection message. Optionally, the network device can allocate a buffer and construct the third detection message based on the second detection message. Exemplarily, the network device can fill in the ICMP header and the IP header based on the second detection message to construct the third detection message.

[0106] Further, the network device may verify the third detection message, and if the verification passes, encapsulate the third detection message to obtain the first detection message. For example, the network device may calculate a checksum based on the third detection message to ensure data integrity, and if the checksum passes, perform a second layer (L2) encapsulation on the third detection message to obtain a first detection message corresponding to the communication link to be tested.

[0107] S603: Send a first detection message.

[0108] Furthermore, after generating the first detection message, the network device may send the first detection message, for example, by sending the corresponding first detection message to a target address in the communication link to be tested.

[0109] In the above embodiment, for each communication link to be tested, the identifier corresponding to the communication link to be tested can be filled into the load part of the initial detection message to generate a second detection message, and based on the second detection message, a first detection message corresponding to the communication link to be tested is generated, so that the first detection message can be sent. In addition, since the first detection message is determined based on the second detection message, and the second detection message is generated based on the initial detection message, the initial detection message includes the identifier corresponding to the communication link to be tested, and therefore, different communication links to be tested have different corresponding first detection messages.

[0110] Figure 7 FIG. 1 is an example diagram of link switching in an embodiment. Figure 7As shown, by setting a static routing network segment, it is possible to configure the default communication through the first communication link. After the network device determines the target address of the communication link to be tested, that is, the communication link to be tested is determined, for each communication link to be tested, the network device will fill the identifier corresponding to the communication link to be tested into the load part of the initial detection message to generate a second detection message, and then the network device sends the second detection message to the ABF inside it for ABF routing, so that the ABF distributes the second detection message with the identifier corresponding to the communication link to be tested to the outgoing interface of each communication link to be tested. Further, the network device generates a first detection message corresponding to the communication link to be tested according to the second detection message, and sends the first detection message. Then, the network device monitors the response message corresponding to each first detection message to obtain the detection result of each communication link to be tested. When the detection result of the first communication link meets the first switching condition, the static route of the first communication link is controlled to fail, thereby prohibiting the use of the first communication link for communication. When the detection result of the first communication link does not meet the second switching condition, the static route of the first communication link is controlled to take effect to continue to communicate through the first communication link.

[0111] Figure 8 FIG. 1 is an overall schematic diagram of a link switching method in an embodiment. Figure 8 As shown, in one embodiment, after the process of the network device is started, the network device will determine whether there is a communication link to be tested, and if there is a communication link to be tested, send a first detection message corresponding to each communication link to be tested, that is, send the corresponding first detection message to the target address in each communication link to be tested. Then, the network device can monitor the response message corresponding to each first detection message, obtain the detection result of each communication link to be tested, and then determine the target communication link, that is, when the detection result of the first communication link meets the first switching condition, determine the target communication link according to the detection result of the second communication link, and when the detection result of the first communication link meets the second switching condition, use the first communication link as the target communication link, and communicate based on the target communication link.

[0112] Fig. 9 FIG. 1 is a schematic diagram of a link switching method in an embodiment. Fig. 9 As shown, in one embodiment, the network device can execute the link switching method according to the following process.

[0113] S901, obtaining configuration information.

[0114] S902, parse the configuration information and update the communication link to be tested.

[0115] S903: For each communication link to be tested, fill the identifier corresponding to the communication link to be tested into the load part of the initial detection message to generate a second detection message.

[0116] S904: Generate a first detection message corresponding to the communication link to be tested according to the second detection message.

[0117] S905: Send a first detection message corresponding to each communication link to be tested.

[0118] S906, monitoring the response messages corresponding to the first detection messages, and obtaining the detection results of the communication links to be tested.

[0119] S907: If the detection result of the first communication link meets the first switching condition, prohibit the use of the first communication link for communication, determine the target communication link according to the detection result of the second communication link, and communicate based on the target communication link.

[0120] S908: When the detection result of the first communication link meets the second switching condition, use the first communication link as a target communication link, and perform communication based on the target communication link.

[0121] The processes of S901 to S908 may refer to the above embodiment and will not be described in detail here.

[0122] It can be seen that in order to improve the reliability and flexibility of the network, the network administrator will configure multiple communication links and set static routes for each communication link. The primary link is given a higher priority and is transmitted through the primary link when there is no failure.

[0123] Related technologies can use routing protocols, such as Routing Information Protocol (RIP), Open Shortest Path First (OSPF) or Border Gateway Protocol (BGP) to propagate and maintain routing information of the primary link, and dynamically adjust the routing table based on the status of the primary link (such as reachability). However, the primary link may pass through many nodes, and the routing protocol cannot perceive abnormalities at the far end of the primary link. Therefore, network administrators are still required to manually monitor whether the primary link fails, and manually switch to the backup link in the event of a primary link failure to avoid service interruption.

[0124] The link switching method provided by the present application can guide the static route switching according to the detection results, realize the automatic switching of data traffic, and select the optimal link for data traffic for data transmission. No manual operation is required in the whole process, ensuring the uninterrupted connection of the network and the continuity of business. In addition, the automated data flow switching mechanism reduces the dependence on manual operation, simplifies the network management process, and reduces the cost and complexity of operation and maintenance.

[0125] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0126] Based on the same inventive concept, the embodiment of the present application also provides a link switching device for implementing the link switching method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more link switching device embodiments provided below can refer to the limitations on the link switching method above, and will not be repeated here.

[0127] Fig.10 FIG. 1 is a block diagram of a link switching device in an embodiment. In an exemplary embodiment, as shown in FIG. Fig.10 As shown, a link switching device 1000 is provided, comprising: a sending module 1001, a monitoring module 1002 and a first determining module 1003, wherein:

[0128] The sending module 1001 is used to send a first detection message corresponding to each communication link to be tested.

[0129] The monitoring module 1002 is used to monitor the response message corresponding to each first detection message to obtain the detection result of each communication link to be tested.

[0130] The first determination module 1003 is used to determine the target communication link according to the detection result of the second communication link and communicate based on the target communication link when the detection result of the first communication link meets the first switching condition; the first communication link is a communication link in use among the communication links to be tested, and the second communication link is a backup communication link for the first communication link among the communication links to be tested.

[0131] In the above-mentioned link switching device, since it is possible to send the first detection message corresponding to each communication link to be tested, and monitor the response message corresponding to each first detection message, to obtain the detection result of each communication link to be tested, therefore, when the detection result of the first communication link meets the first switching condition, the target communication link can be determined according to the detection result of the second communication link, and communication can be performed based on the target communication link. In addition, since the first communication link is the communication link in use among the communication links to be tested, and the second communication link is the backup communication link of the first communication link in the communication links to be tested, it is possible to timely and accurately monitor the communication anomaly of the first communication link, and then switch the used first communication link to the backup communication link of the first communication link, thereby avoiding the service interruption caused by the network administrator manually switching to the backup communication link of the first communication link, and reducing the risk of service interruption.

[0132] Optionally, the link switching device 1000 further includes:

[0133] The second determination module is used to determine that the detection result of the first communication link meets the first switching condition when no response message corresponding to the first communication link is received within a preset time period; or to determine that the detection result of the first communication link meets the first switching condition when the quality parameter of the first communication link is less than a preset quality threshold; the quality parameter of the first communication link is determined based on the first detection message and the response message corresponding to the first communication link.

[0134] Optionally, the link switching device 1000 further includes:

[0135] The prohibition module is used to prohibit the use of the first communication link for communication when the detection result of the first communication link meets the first switching condition.

[0136] Optionally, the link switching device 1000 further includes:

[0137] The third determination module is used to use the first communication link as a target communication link and perform communication based on the target communication link when the detection result of the first communication link meets the second switching condition.

[0138] Optionally, the link switching device 1000 further includes:

[0139] The acquisition module is used to acquire configuration information; the configuration information includes the target address of the communication link to be tested.

[0140] The update module is used to parse the configuration information and update the communication link to be tested.

[0141] Optionally, the sending module 1001 includes:

[0142] The first generating unit is used to fill the identifier corresponding to each communication link to be tested into the load part of the initial detection message to generate a second detection message.

[0143] The second generating unit is used to generate a first detection message corresponding to the communication link to be tested according to the second detection message.

[0144] A sending unit is used to send a first detection message.

[0145] Each module in the link switching device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0146] FIG11 is an internal structure diagram of a network device in an embodiment. In an exemplary embodiment, a network device is provided, and its internal structure diagram may be shown in FIG11. The network device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the network device is used to provide computing and control capabilities. The memory of the network device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the network device is used to store relevant data. The input / output interface of the network device is used to exchange information between the processor and an external device. The communication interface of the network device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a link switching method is implemented.

[0147] Those skilled in the art will understand that the structure shown in FIG. 11 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0148] In one embodiment, a network device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0149] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0150] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0151] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0152] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0153] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A link switching method, characterized in that: The method comprises: Sending a first detection message corresponding to each communication link to be tested; Monitoring the response messages corresponding to the first detection messages to obtain the detection results of the communication links to be tested; When the detection result of the first communication link meets the first switching condition, the target communication link is determined according to the detection result of the second communication link, and communication is performed based on the target communication link; the first communication link is a communication link in use among the communication links to be tested, and the second communication link is a backup communication link for the first communication link among the communication links to be tested.

2. The method according to claim 1, characterized in that The method further comprises: If no response message corresponding to the first communication link is received within a preset time period, determining that the detection result of the first communication link meets the first switching condition; or, When the quality parameter of the first communication link is less than a preset quality threshold, it is determined that the detection result of the first communication link meets the first switching condition; the quality parameter of the first communication link is determined according to the first detection message and response message corresponding to the first communication link.

3. The method according to claim 1 or 2, characterized in that: The method further comprises: When the detection result of the first communication link satisfies the first switching condition, communication using the first communication link is prohibited.

4. The method according to claim 1, characterized in that: After determining the target communication link according to the detection result of the second communication link and communicating based on the target communication link, the method further includes: When the detection result of the first communication link satisfies the second switching condition, the first communication link is used as the target communication link, and communication is performed based on the target communication link.

5. The method according to claim 1, characterized in that The method further comprises: Acquire configuration information; the configuration information includes a target address of the communication link to be tested; The configuration information is parsed, and the communication link to be tested is updated.

6. The method according to claim 1, characterized in that The sending of the first detection message corresponding to each communication link to be tested includes: For each of the communication links to be tested, fill the identifier corresponding to the communication link to be tested into the load part of the initial detection message to generate a second detection message; Generating a first detection message corresponding to the communication link to be tested according to the second detection message; Send the first detection message.

7. A link switching device, characterized in that: The device comprises: A sending module, used for sending a first detection message corresponding to each communication link to be tested; A monitoring module, used for monitoring the response message corresponding to each of the first detection messages, and obtaining the detection result of each of the communication links to be tested; The first determination module is used to determine the target communication link according to the detection result of the second communication link when the detection result of the first communication link meets the first switching condition, and communicate based on the target communication link; the first communication link is a communication link in use among the communication links to be tested, and the second communication link is a backup communication link of the first communication link in the communication links to be tested.

8. A network device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Link switching method and device, equipment, system and storage medium

    CN112822102A

  • Network switching method and device, network equipment and storage medium

    CN113873598A

  • Load balancing method and device, electronic equipment and readable storage medium

    CN116192757A

  • Link state detection method, device and equipment and computer readable medium

    CN116633827A

  • Data transmission control method, device and system, storage medium and electronic equipment

    CN117439908A

Cited By

  • Dynamic link detection method and device for client front-end equipment

    CN121193641A