Link switching method and apparatus, network device, and readable storage medium
By sending probe messages and listening for response messages, the system automatically switches to the backup link, solving the problem of service interruption caused by manual switching when the primary link fails under static routing protocols, and achieving efficient link switching and network continuity.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA TELECOM CLOUD TECH CO LTD
- Filing Date
- 2024-11-25
- Publication Date
- 2026-07-14
AI Technical Summary
In existing technologies, when relying on static routing protocols to manage multiple communication links, a failure of the primary link requires manual switching to a backup link, which poses a risk of service interruption.
By sending probe messages and listening for response messages, the system automatically switches to a backup link based on the probe results. This includes switching when no response message is received within a preset time or when the quality parameters are below a threshold, and timely monitoring and switching to a backup link.
It reduces the risk of service interruption caused by manual switching, realizes automated link switching, improves network reliability and flexibility, and reduces operation and maintenance costs.
Smart Images

Figure CN119484379B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a link switching method, apparatus, network device, and readable storage medium. Background Technology
[0002] In the field of network technology, in order to improve the reliability and flexibility of the network, users often configure multiple communication links, such as a primary link and a backup link.
[0003] Currently, static routing protocols are used to manage multiple communication links. Under normal circumstances, communication occurs through the primary link. However, if the primary link fails, the network administrator needs to manually switch to a backup link. Therefore, the current method of link determination carries the risk of service interruption. Summary of the Invention
[0004] Therefore, 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-mentioned technical problems.
[0005] Firstly, this application provides a link switching method, including:
[0006] Send the first probe message corresponding to each communication link under test;
[0007] Listen to the response messages corresponding to each first probe message to obtain the probe results of each communication link under test;
[0008] If the detection result of the first communication link meets the first switching condition, the target communication link is determined based on the detection result of the second communication link, and communication is carried out based on the target communication link; 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 among the communication links to be tested.
[0009] In one embodiment, the method further includes:
[0010] If no response message corresponding to the first communication link is received within a preset time period, it is determined that the detection result of the first communication link meets the first handover condition; or,
[0011] If the quality parameters of the first communication link are less than a preset quality threshold, the detection result of the first communication link is determined to meet the first switching condition; the quality parameters of the first communication link are determined based on the first detection message and response message corresponding to the first communication link.
[0012] In one embodiment, the method further includes:
[0013] If the detection results of the first communication link meet the first switching condition, communication using the first communication link shall be prohibited.
[0014] In one embodiment, after determining the target communication link based on the detection results of the second communication link and conducting communication based on the target communication link, the method further includes:
[0015] If the detection results of the first communication link meet the second switching condition, the first communication link is used as the target communication link, and communication is carried out based on the target communication link.
[0016] In one embodiment, the method further includes:
[0017] Obtain configuration information; the configuration information includes the target address of the communication link under test;
[0018] The configuration information is parsed and the communication link under test is updated.
[0019] In one embodiment, a first probe message corresponding to each communication link under test is sent, including:
[0020] For each communication link under test, the identifier corresponding to the communication link under test is filled into the payload of the initial probe message to generate the second probe message;
[0021] Based on the second probe message, generate the first probe message corresponding to the communication link under test;
[0022] Send the first probe message.
[0023] Secondly, this application also provides a link switching device, comprising:
[0024] The sending module is used to send the first probe message corresponding to each communication link under test;
[0025] The monitoring module is used to monitor the response messages corresponding to each first probe message to obtain the probe results of each communication link under test.
[0026] The first determining module is used to determine the target communication link based on the detection result of the second communication link when the detection result of the first communication link meets the first switching condition, and to perform communication based on the target communication link; 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 among the communication links to be tested.
[0027] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of any of the above methods.
[0028] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the above methods.
[0029] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the above methods.
[0030] The aforementioned link switching method, apparatus, network device, and readable storage medium, because they can send first probe messages corresponding to each communication link under test and listen to response messages corresponding to each first probe message to obtain the probe results of each communication link under test, can determine the target communication link based on the probe results of the second communication link and conduct communication based on the target communication link when the probe results of the first communication link meet the first switching condition. Furthermore, since the first communication link is the communication link in use among the communication links under test, and the second communication link is the backup communication link of the first communication link among the communication links under test, communication anomalies in the first communication link can be detected in a timely and accurate manner. This allows for switching the used first communication link to the backup communication link, avoiding service interruptions caused by network administrators manually switching to the backup communication link, and reducing the risk of service interruption. Attached Figure Description
[0031] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0032] Figure 1 This is an application environment diagram of the link switching method in one embodiment;
[0033] Figure 2 This is a flowchart illustrating a link switching method in one embodiment;
[0034] Figure 3 This is a schematic diagram illustrating the switching principle in one embodiment;
[0035] Figure 4 This is a schematic diagram illustrating the updating of the communication link under test in one embodiment;
[0036] Figure 5 This is a schematic diagram illustrating the maintenance of a communication link under test in one embodiment;
[0037] Figure 6This is a schematic diagram of the process of sending the first probe message in one embodiment;
[0038] Figure 7 This is an example diagram of link switching in one embodiment;
[0039] Figure 8 This is an overall schematic diagram of a link switching method in one embodiment;
[0040] Figure 9 This is a schematic diagram of the link switching method in one embodiment;
[0041] Figure 10 This is a structural block diagram of a link switching device in one embodiment;
[0042] Figure 11 This is a diagram of the internal structure of a network device in one embodiment. Detailed Implementation
[0043] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0044] Figure 1 This is an application environment diagram of the link switching method in one embodiment. The link switching method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, user terminal 101 accesses network 103 through network device 102. Multiple communication links exist between network device 102 and network 103, for example... Figure 1 The diagram shows communication links 1 to n, where n is a positive integer greater than or equal to 2. Typically, among multiple communication links, one is the primary link, and the rest are backup links. For example, communication link 1 is the primary link, and all other communication links are backup links.
[0045] User terminal 101 may be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices may include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, projection devices, etc. Portable wearable devices may include smartwatches, smart bracelets, head-mounted devices, etc. Head-mounted devices may include virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. Network device 102 may include, but is not limited to, routers.
[0046] Figure 2This is a flowchart illustrating a link switching method in one embodiment. In an exemplary embodiment, such as... Figure 2 As shown, a link switching method is provided, which can be applied to... Figure 1 The following explanation uses network devices as an example, including the following S201 to S203.
[0047] S201, send the first probe message corresponding to each communication link under test.
[0048] In this embodiment, each communication link under test refers to the communication link that needs to be monitored, such as all communication links set up on the network device. Optionally, the user can specify each communication link under test, or the network device can automatically determine each communication link under test. Figure 1 For example, the communication link to be tested may include communication link 1 to communication link n.
[0049] Then, the network device sends a corresponding first probe message to each communication link under test. That is, the network device sends a first probe message corresponding to each communication link under test. The network device can determine the target address to be probed in each communication link under test and send a corresponding first probe message to the target address of each communication link under test. It should be noted that the target addresses of each communication link under test can be the same or different; this embodiment is not limited to this.
[0050] Optionally, the network device can periodically send the first probe message corresponding to each communication link under test.
[0051] Alternatively, the first probe message can 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 typically encapsulated within IP packets and are used to diagnose network problems, such as host unreachability, routing problems, or connection timeouts.
[0052] In one embodiment, the first probe message may be a message sent by the network device within the Vector Packet Processing (VPP) framework. VPP is a high-performance network stack that provides fast, scalable, and programmable network packet processing capabilities.
[0053] continue Figure 1For example, a network device can send a first probe message 1 to communication link 1, a first probe message 2 to communication link 2, ... and a second probe message n to communication link n.
[0054] S202, listen to the response messages corresponding to each first probe message to obtain the probe results of each communication link under test.
[0055] In this embodiment, if the communication link under test (TUT) communicates normally with the network device, the TUT will return a response message corresponding to the first probe message to the network device after receiving the first probe message. In other words, under normal circumstances, the target address of the TUT will return a response message corresponding to the first probe message to the network device after receiving the corresponding first probe message. Therefore, the network device can listen to the response messages corresponding to the first probe messages to obtain the probe results of each TUT communication link.
[0056] The detection results can characterize the communication status of the communication link under test. For example, the detection results can indicate whether the communication link under test is normal or abnormal, or the communication quality level of the communication link under test; this embodiment is not limited to these aspects.
[0057] Optionally, both the first probe message and the response message can include identification information. In this way, after receiving the first probe message, the communication link under test can generate a corresponding response message based on the identification information of the first probe message and send the response message to the network device. Upon receiving the response message, the network device can determine which first probe message it corresponds to by using 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, if 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 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 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 the communication link in use among the communication links under test. In one embodiment, the network device can set a static route with the highest priority as the default route. Figure 1 For example, if the current network device uses communication link 1 for communication, then the first communication link is communication link 1.
[0061] The first switching condition is used to determine whether the first communication link has switched to another communication link. The first switching condition can be set according to requirements. Optionally, the network device can determine that the detection result of the first communication link meets the first switching condition if it does not receive a response message corresponding to the first communication link within a preset time period. For example, if the network device sends the first detection message 1 corresponding to communication link 1 to communication link 1, and does not receive a response message corresponding to the first detection message 1 within 1 minute, that is, if it does not receive a 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 uses a preset time period of 1 minute, and this embodiment is not limited to this.
[0062] In this way, by checking 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 in a timely and accurate manner. In the event of a communication failure in the first communication link, the first communication link can be switched to another communication link in a timely manner to avoid service interruption.
[0063] Optionally, the network device may also determine that the detection result of the first communication link meets the first handover condition if the quality parameters of the first communication link are less than a preset quality threshold. The preset quality threshold can be set according to requirements, and will not be elaborated here.
[0064] The quality parameters of the first communication link are determined based on the first probe and response messages corresponding to the first communication link. In other words, the network device can determine the quality parameters of the first communication link based on the first probe and response messages corresponding to the first communication link. The quality parameters may include, but are not limited to, at least one of latency, jitter, or packet loss rate.
[0065] Optionally, the network device can determine the delay based on the sending time of the first probe message and the receiving time of the response message. The sending and receiving times can be determined using the message timestamps. For example, if the network device sends the first probe message 1 corresponding to communication link 1 at time A, and receives the response message corresponding to the first probe message 1 at time B, then the network device can use the difference between time B and time A as the delay of communication link 1.
[0066] Network devices can also determine jitter based on multiple delays. For example, a network device can determine the jitter of communication link 1 based on multiple consecutive delays over a period of time. Furthermore, a network device can determine the packet loss rate based on the number of response packets received for at least one first probe packet. For instance, if a network device sends four first probe packets (1) to communication link 1 within one minute but only receives one response packet, the packet loss rate of the communication link in that minute can be determined to be 75%.
[0067] In this way, the communication status of the first communication link can be determined in a timely and accurate manner by using the quality parameters determined by the first probe message and response message corresponding to the first communication link. Even if the quality parameters of the first communication link are poor after receiving the response message of the first communication link, the first communication link can be switched to other communication links.
[0068] Furthermore, if the detection results of the first communication link meet the first switching condition, the network device can determine the target communication link based on the detection results of the second communication link and perform communication based on the target communication link. Here, the second communication link is a backup communication link for the first communication link among the communication links to be tested. In one embodiment, the backup link for the first communication link can be a communication link other than the first communication link among the links to be tested. (Continuing...) Figure 1 For example, if 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 can determine the second communication link that received the response message based on the detection results of the second communication link, and determine the target communication link from the second communication links that received the response message. Further optionally, the network device can determine the target communication link from the second communication links that received the response message based on the priority of each communication link.
[0070] The network device can also determine the second communication link with quality parameters greater than the first threshold based on the detection results of the second communication link, and determine the target communication link based on the second communication link with quality parameters greater than the first threshold. This embodiment does not impose any restrictions.
[0071] Furthermore, 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 aforementioned link switching method, since it can send first probe messages corresponding to each communication link under test and listen to the response messages corresponding to each first probe message to obtain the probe results of each communication link under test, if the probe results of the first communication link meet the first switching condition, the target communication link can be determined based on the probe results of the second communication link, and communication can be performed based on the target communication link. Furthermore, since the first communication link is the communication link in use among the communication links under test, and the second communication link is the backup communication link of the first communication link among the communication links under test, it is possible to detect communication anomalies in the first communication link in a timely and accurate manner, and then switch the used first communication link to the backup communication link of the first communication link, avoiding service interruptions caused by the network administrator manually switching to the backup communication link of the first communication link, thus reducing the risk of service interruption.
[0073] In an exemplary embodiment, the link switching method described above may optionally include the following steps:
[0074] If the detection results of the first communication link meet the first switching condition, communication using the first communication link shall be prohibited.
[0075] In this embodiment, if the network device confirms that the detection result of the first communication link meets the first switching condition, it will prohibit the use of the first communication link 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 first communication link's routing configuration as a static route as an example, continuing the above example, if communication link 1 meets the first switching condition, the network device will disable the static route of communication link 1 to prevent communication using communication link 1.
[0077] In the above embodiments, since communication is prohibited using the first communication link when the detection result of the first communication link meets the first switching condition, the first communication link can be cut off in a timely manner if the communication of the first communication link is abnormal.
[0078] In an exemplary embodiment, optionally, after "determining the target communication link based on the detection results of the second communication link and performing communication based on the target communication link" in S203 above, the link switching method may further include the following steps:
[0079] If the detection results of the first communication link meet the second switching condition, the first communication link is used as the target communication link, and communication is carried out 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 further 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 switch back to the first communication link after switching the first communication link to another communication link. In one embodiment, optionally, the second switching condition can be the negation of the first switching condition.
[0081] The second handover condition can also be set as needed. Optionally, the network device can determine that the detection result of the first communication link meets the second handover condition if it receives a response message corresponding to the first communication link within a preset time period. Alternatively, the network device can determine that the detection result of the first communication link meets the second handover condition if the quality parameters of the first communication link are not less than a preset quality threshold.
[0082] In this way, if 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 conduct communication based on the target communication link.
[0083] Continuing with the example of communication link 1, 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 will use communication link 2 as the target communication link to switch to communication link 2 for network access. After another period of time, the detection result of communication link 1 meets the second switching condition, and the network device will use communication link 1 as the target communication link to switch back to communication link 1 for network access.
[0084] In an exemplary embodiment, optionally, if the detection result of the first communication link meets the second handover condition, the network device can continue to enable the routing configuration of the first communication link. For example, if communication link 1 meets the second handover condition, the network device enables the static routing of communication link 1, so that the network device can continue to use communication link 1 for communication.
[0085] In the above embodiments, since the first communication link is used as the target communication link and communication is carried out based on the target communication link when the detection result of the first communication link meets the second switching condition, the communication can be switched back to the first communication link in a timely manner when the first communication link resumes normal communication.
[0086] To more clearly illustrate the link switching method of this application, this paper combines... Figure 3 Please provide an explanation. Figure 3 This is a schematic diagram illustrating the switching principle in one embodiment, such as... Figure 3As shown, the network device includes a control plane and a data plane. Users can configure the routing configuration of the first communication link through the control plane. If the detection result of the first communication link meets the first handover condition, the control plane controls the static route of the first communication link to become invalid through the data plane, thereby prohibiting communication using the first communication link. If the detection result of the first communication link meets the second handover condition, the control plane controls the static route of the first communication link to become effective through the data plane, so that communication based on the first communication link can continue.
[0087] Figure 4 This is a schematic diagram of updating the communication link under test in one embodiment, such as... Figure 4 As shown, in one exemplary embodiment, such as Figure 4 As shown, the link switching method described above may also include S401 to S402.
[0088] S401, Obtain configuration information; the configuration information includes the target address of the communication link under test.
[0089] In this embodiment, the network device can obtain configuration information. Optionally, the network device can obtain configuration information input by the user, or it can receive configuration information sent by other devices; this embodiment is not limited to these options.
[0090] The configuration information is used to update the communication link under test. This configuration information includes the target address of the communication link under test. The target address can be a public IP address or the address of the uplink device; this embodiment is not limited to either.
[0091] In some embodiments, the configuration information may further include at least one of priority, source interface, source address, next-hop address, transmission interval, transmission quantity, first switching condition, preset quality threshold, and probe event identifier. Here, priority represents the priority of the communication link under test. Source interface represents the source interface of the first probe packet sent by the network device. Source address represents the source address of the first probe packet sent by the network device. Next-hop address represents the next-hop address of the first probe packet sent by the network device. Transmission interval represents the transmission interval at which the network device sends the first probe packet. Transmission quantity represents the number of times the network device sends the first probe packet. A probe event is an event that listens for the response packet corresponding to the first probe packet to obtain the probe result of the communication link under test. The probe event identifier may be, for example, a probe event ID, used to identify a probe event corresponding to a certain communication link under test. For example, probe event identifier A represents the probe event corresponding to communication link 1, and probe event identifier B represents the probe event corresponding to communication link 2.
[0092] Optionally, taking the configuration information including a probe event identifier as an example, after determining the configuration information of the communication link under test, that is, associating the communication link under test with a probe event identifier, the routing configuration of the communication link under test can be controlled according to the probe event corresponding to the probe event identifier. Further optionally, communication can be performed based on the communication link under test if the probe result in the probe event corresponding to the probe event identifier meets a first switching condition, or communication can be prohibited using the communication link under test if the probe result in the probe event corresponding to the probe event identifier meets a second switching condition. This embodiment is not limited to these limitations. For example, assuming that communication link 1 is associated with probe event identifier B, the computer device can control the routing configuration of communication link 1 to perform communication based on communication link 1 if the probe result of communication link 2 meets the first switching condition.
[0093] S402 parses the configuration information and updates the communication link under test.
[0094] In this embodiment, after receiving the configuration information, the network device can parse the configuration information to update the communication link under test. Updating the communication link under test can be done by adding a new communication link under test, deleting a communication link under test, or adjusting an existing communication link under test; this embodiment is not limited to any of these methods.
[0095] Furthermore, the network device can send a first probe message corresponding to each communication link under test based on the configuration information. In some embodiments, different communication links under test can correspond to different configuration information.
[0096] Figure 5 This is a schematic diagram of maintaining the communication link under test in one embodiment, such as... Figure 5 As shown, in one embodiment, the network device obtains and parses configuration information. If, after parsing the configuration information, it is determined that a new communication link to be tested needs to be added, a target address is added. If, after parsing the configuration information, it is determined that the communication link to be tested needs to be adjusted, the target address is adjusted. If, after parsing the configuration information, it is determined that the communication link to be tested needs to be deleted, the target address is deleted. In this way, the communication links to be tested can be maintained, and the communication links to be tested that ultimately need to send the first probe message can be determined, so that the corresponding first probe message can be sent to the target address of each communication link to be tested.
[0097] In the above embodiments, since configuration information, including the target address of the communication link under test, can be obtained, the communication link under test can be updated after parsing the configuration information. This allows users to customize configuration information for efficient maintenance of the communication link under test.
[0098] Figure 6This is a schematic diagram of the process of sending a first probe message in one embodiment. In an exemplary embodiment, such as... Figure 6 As shown, S201 above includes S601 to S603.
[0099] S601, for each communication link under test, fill the identifier corresponding to the communication link under test into the payload of the initial probe message to generate the second probe message.
[0100] In this embodiment, different identifiers correspond to different communication links under test. For each communication link under test, the network device fills the identifier corresponding to the communication link under test into the payload of the initial probe message and generates a second probe message.
[0101] The initial probe message can be generated by the network device. Optionally, the initial probe message can be a message generated by the network device within the vector packet processing framework. For example, the network device can set the header of the ICMP message, including parameters such as the ICMP message type, code, and checksum, to obtain the initial probe message. After generating the initial probe message, the network device fills the identifier corresponding to communication link 1 into the payload of the initial probe message, obtaining the second probe message corresponding to communication link 1. The same applies to other communication links, and will not be elaborated further here.
[0102] In one exemplary embodiment, optionally, the network device sends the second probe packet to an internal Active Byte Filter (ABF). ABF is an advanced packet processing mechanism that allows filtering and forwarding of packets based on packet content, such as specific byte patterns or strings. ABF rules can match and execute specific actions based on arbitrary byte content of packets, such as allowing packets to pass, dropping, or redirecting them to specific interfaces. This flexibility makes ABF well-suited for implementing complex network policies, such as content-based routing, access control, and traffic engineering.
[0103] Furthermore, the network device can determine the filtering rules corresponding to the ABF, causing the ABF to distribute the second probe packet containing the identifier corresponding to the communication link under test to the outgoing interface of each communication link under test, thereby realizing the ABF routing function. For example, when the second probe packet 1 contains the identifier corresponding to communication link 1, the ABF directs the second probe packet 1 to communication link 1; when the second probe packet 2 contains the identifier corresponding to communication link 2, the ABF directs the second probe packet 2 to communication link 2, and so on.
[0104] S602, based on the second probe message, generate the first probe message corresponding to the communication link under test.
[0105] In this embodiment, the network device can obtain a third probe packet based on the second probe packet. Optionally, the network device can allocate a buffer and construct the third probe packet based on the second probe packet. For example, the network device can construct the third probe packet by filling in ICMP headers and IP headers on the second probe packet.
[0106] Furthermore, the network device can verify the third probe message, and if the verification passes, encapsulate the third probe message to obtain the first probe message. For example, the network device can calculate a checksum based on the third probe message to ensure data integrity, and if the checksum passes, encapsulate the third probe message at Layer 2 (L2) to obtain the first probe message corresponding to the communication link under test.
[0107] S603, send the first probe message.
[0108] Furthermore, after generating the first probe message, the network device can send the first probe message. For example, it can send the corresponding first probe message to the target address in the communication link under test.
[0109] In the above embodiments, for each communication link under test, the identifier corresponding to the communication link under test can be filled into the payload of the initial probe message to generate a second probe message, and a first probe message corresponding to the communication link under test can be generated based on the second probe message. Thus, the first probe message can be sent. Furthermore, since the first probe message is determined based on the second probe message, and the second probe message is generated based on the initial probe message, which includes the identifier corresponding to the communication link under test, the first probe message corresponding to different communication links under test is different.
[0110] Figure 7 Here is an example diagram of link switching in one embodiment, such as... Figure 7As shown, by setting a static route segment, communication can be configured to default to the first communication link. After the network device determines the target address of the communication link under test, it determines the communication link under test. For each communication link under test, the network device fills the payload of the initial probe packet with the identifier corresponding to the communication link under test, generating a second probe packet. Then, the network device sends the second probe packet to its internal ABF for ABF routing. The ABF then distributes the second probe packet with the identifier corresponding to the communication link under test to the outgoing interface of each communication link under test. Further, the network device generates a first probe packet corresponding to the communication link under test based on the second probe packet and sends the first probe packet. Next, the network device listens for the response packets corresponding to each first probe packet to obtain the probe results of each communication link under test. If the probe result of the first communication link meets the first switching condition, the static route of the first communication link is disabled, thereby prohibiting communication using the first communication link. If the probe result of the first communication link does not meet the second switching condition, the static route of the first communication link is enabled, so that communication can continue through the first communication link.
[0111] Figure 8 This is a schematic diagram of the link switching method in one embodiment, such as... Figure 8 As shown, in one embodiment, after the network device's process starts, the network device determines whether a communication link to be tested exists. If a communication link to be tested exists, the network device sends a first probe message corresponding to each communication link to be tested, that is, it sends the corresponding first probe message to the target address in each communication link to be tested. Furthermore, the network device can listen to the response messages corresponding to each first probe message to obtain the probe results of each communication link to be tested, and thus determine the target communication link. That is, if the probe result of the first communication link meets the first switching condition, the target communication link is determined based on the probe result of the second communication link; and if the probe result of the first communication link meets 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.
[0112] Figure 9 This is a schematic diagram of the link switching method in one embodiment, such as... Figure 9 As shown, in one embodiment, the network device may execute the link switching method according to the following process.
[0113] S901, obtain configuration information.
[0114] S902 parses the configuration information and updates the communication link under test.
[0115] S903: For each communication link under test, the identifier corresponding to the communication link under test is filled into the payload of the initial probe message to generate the second probe message.
[0116] S904, based on the second probe message, generate the first probe message corresponding to the communication link under test.
[0117] S905 sends the first probe message corresponding to each communication link under test.
[0118] S906 monitors the response messages corresponding to each first probe message to obtain the probe results of each communication link under test.
[0119] S907, if the detection result of the first communication link meets the first switching condition, the use of the first communication link for communication is prohibited, and the target communication link is determined based on the detection result of the second communication link, and communication is carried out based on the target communication link.
[0120] S908, if the detection result of the first communication link meets the second switching condition, the first communication link is used as the target communication link, and communication is carried out based on the target communication link.
[0121] The processes S901 to S908 can be referred to in the above embodiments, and will not be repeated here.
[0122] As can be seen, to improve network reliability and flexibility, network administrators currently configure multiple communication links and set static routes for each link. The primary link is given higher priority and transmission is carried out through the primary link when there are no faults.
[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 for the primary link and dynamically adjust the routing table based on the primary link's status (such as reachability). However, the primary link may traverse many nodes, and the routing protocol cannot detect anomalies at the far end of the primary link. Therefore, network administrators still need to manually monitor whether the primary link has failed and, in the event of a primary link failure, manually switch to a backup link to avoid service interruption.
[0124] The link switching method provided in this application can guide static route switching based on the detection results, achieving automatic switching of data traffic and selecting the optimal link for data transmission. The entire process requires no manual operation, ensuring uninterrupted network connectivity and service continuity. Furthermore, the automated data flow switching mechanism reduces reliance on manual operation, simplifies network management processes, and lowers operational costs and complexity.
[0125] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0126] Based on the same inventive concept, this application also provides a link switching device for implementing the link switching method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more link switching device embodiments provided below can be found in the limitations of the link switching method described above, and will not be repeated here.
[0127] Figure 10 This is a structural block diagram of a link switching device in one embodiment. In an exemplary embodiment, such as... Figure 10 As shown, a link switching device 1000 is provided, including: a sending module 1001, a listening module 1002, and a first determining module 1003, wherein:
[0128] The sending module 1001 is used to send the first probe message corresponding to each communication link under test.
[0129] The monitoring module 1002 is used to monitor the response messages corresponding to each first probe message to obtain the probe results of each communication link under test.
[0130] The first determining module 1003 is used to determine the target communication link based on the detection result of the second communication link when the detection result of the first communication link meets the first switching condition, and to perform communication based on the target communication link; 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 among the communication links to be tested.
[0131] In the aforementioned link switching device, since it can send first probe messages corresponding to each communication link under test and listen to the response messages corresponding to each first probe message to obtain the probe results of each communication link under test, when the probe results of the first communication link meet the first switching condition, the target communication link can be determined based on the probe results of the second communication link, and communication can be performed based on the target communication link. Furthermore, since the first communication link is the communication link in use among the communication links under test, and the second communication link is the backup communication link of the first communication link among the communication links under test, communication anomalies in the first communication link can be detected in a timely and accurate manner. This allows for switching the used first communication link to the backup communication link, avoiding service interruptions caused by network administrators manually switching to the backup communication link, and reducing the risk of service interruption.
[0132] Optionally, the link switching device 1000 also includes:
[0133] The second determining module is used to determine that the detection result of the first communication link meets the first switching condition if no response message corresponding to the first communication link is received within a preset time period; or, if the quality parameter of the first communication link is less than a preset quality threshold, determine that the detection result of the first communication link meets the first switching condition; the quality parameter of the first communication link is determined based on the first detection message and response message corresponding to the first communication link.
[0134] Optionally, the link switching device 1000 also includes:
[0135] The blocking module is used to block communication using the first communication link if the detection result of the first communication link meets the first switching condition.
[0136] Optionally, the link switching device 1000 also includes:
[0137] The third determining module is used to, when the detection result of the first communication link meets the second switching condition, take the first communication link as the target communication link and conduct communication based on the target communication link.
[0138] Optionally, the link switching device 1000 also includes:
[0139] The acquisition module is used to acquire configuration information, including the target address of the communication link under test.
[0140] The update module is used to parse the configuration information and update the communication link under test.
[0141] Optionally, the transmitting module 1001 includes:
[0142] The first generation unit is used to fill the identifier corresponding to the communication link under test into the payload of the initial probe message for each communication link under test, and generate the second probe message.
[0143] The second generation unit is used to generate a first probe message corresponding to the communication link under test based on the second probe message.
[0144] The sending unit is used to send the first probe message.
[0145] Each module in the aforementioned link switching device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0146] Figure 11 This is an internal structure diagram of a network device in one embodiment. In an exemplary embodiment, a network device is provided whose internal structure diagram can be as follows: Figure 11 As shown, this network device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores relevant data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a link switching method.
[0147] Those skilled in the art will understand that Figure 11 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0148] In one embodiment, a network device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0149] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.
[0150] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0151] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this 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. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0152] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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 embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A link switching method, characterized in that, The method includes: Obtain configuration information; the configuration information includes the target address, transmission interval, transmission quantity, preset quality threshold, and detection event identifier of each communication link under test; each communication link under test refers to all communication links set up on the network device; Based on the target address of each communication link under test, the transmission interval of each communication link under test, the number of transmissions of each communication link under test, and the detection event identifier of each communication link under test, multiple first detection messages corresponding to each communication link under test are sent. The number of response messages fed back by multiple first probe messages corresponding to each of the communication links under test is monitored to obtain the packet loss rate of each of the communication links under test. The delay and jitter of each communication link under test are determined based on multiple delays determined by the sending time of multiple first probe messages corresponding to each communication link under test and the receiving time of the response message. The packet loss rate, latency, and jitter of each of the communication links under test are included in the quality parameters; If the quality parameters of the first communication link are less than the preset quality threshold, the target communication link is determined based on the detection results of the second communication link, and communication is performed based on the target communication link; 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 among the communication links to be tested.
2. The method according to claim 1, characterized in that, When the quality parameters of the first communication link are less than the preset quality threshold, determining the target communication link based on the detection results of the second communication link includes: If the quality parameter of the first communication link is less than the preset quality threshold, it is determined that the detection result of the first communication link meets the first switching condition, and the target communication link is determined based on the detection result of the second communication link.
3. The method according to claim 2, characterized in that, The method further includes: If the detection result of the first communication link meets the first switching condition, communication using the first communication link is prohibited.
4. The method according to any one of claims 1-3, characterized in that, After determining the target communication link based on the detection results of the second communication link and conducting communication based on the target communication link, the method further includes: If the detection result of the first communication link meets 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 any one of claims 1-3, characterized in that, The method further includes: The configuration information is parsed, and the communication link under test is updated.
6. The method according to any one of claims 1-3, characterized in that, Sending multiple first probe messages corresponding to each of the communication links under test includes: For each of the communication links under test, the identifier corresponding to the communication link under test is filled into the payload of the initial probe message to generate a second probe message; Based on the second probe message, a first probe message corresponding to the communication link under test is generated; Send multiple first probe messages corresponding to each of the communication links under test.
7. A link switching device, characterized in that, The device includes: The acquisition module is used to acquire configuration information; the configuration information includes the target address, transmission interval, transmission quantity, preset quality threshold, and detection event identifier of each communication link under test; each communication link under test refers to all communication links set on the network device; The sending module is used to send multiple first probe messages corresponding to each of the communication links under test according to the target address of each communication link under test, the sending interval of each communication link under test, the number of transmissions of each communication link under test, and the probe event identifier of each communication link under test. The monitoring module is used to monitor the number of response messages fed back to multiple first probe messages corresponding to each of the communication links under test, thereby obtaining the packet loss rate of each communication link under test; based on multiple delays determined by the sending time of multiple first probe messages corresponding to each communication link under test and the receiving time of the response messages, the module determines the delay and jitter of each communication link under test; and includes the packet loss rate, delay, and jitter of each communication link under test in the quality parameters. The first determining module is used to determine a target communication link based on the detection result of the second communication link when the quality parameter of the first communication link is less than the preset quality threshold, and to perform communication 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 among 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, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.