Routing loop detection method, device and system
By generating packets carrying specific TTL values and forwarding them back to the first device in the loop for detection, the problem of insufficient routing loop detection capability is solved, the detection speed is improved and the cost is reduced.
Patent Information
- Application Number
- CN202410941697.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2026-01-13
AI Technical Summary
The existing routing loop detection capability is insufficient, which causes packets to fail to be sent to their destination correctly, resulting in abnormal traffic forwarding.
By generating a message carrying a Time-to-Live (TTL) value greater than or equal to a first value, the device in the loop forwards the message back to the first device for detection, avoiding protocol interaction with other devices and simplifying the detection process.
It improves the speed of routing loop detection, reduces communication costs, and ensures that packets can be detected in loops, thus reducing the impact of routing loops.
Smart Images

Figure CN121334036A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of routing loop detection, and in particular to routing loop detection methods, devices and systems. Background Technology
[0002] Currently, packets can be transmitted in a network through routing, such as static routing or dynamic routing. However, during packet transmission, routing loops may occur between different devices.
[0003] To avoid routing loops, routing loop detection can be performed based on the loop prevention mechanisms defined by network routing protocols, such as Border Gateway Protocol (BGP) and Interior Gateway Protocol (IGP). However, current routing loop detection capabilities are insufficient, resulting in packets transmitted along the routing path failing to reach their destination correctly, leading to abnormal traffic forwarding. Summary of the Invention
[0004] This application provides a routing loop detection method, apparatus, and system to reduce the impact of routing loops.
[0005] Firstly, a routing loop detection method is provided, which can be applied to a routing loop detection device. This routing loop detection device can be, for example, a first device, a component configured within the first device (such as a chip, chip system, processor, etc.), or a logic module or software capable of implementing all or part of the functions of the first device, etc. This application does not limit this. The first device can be a network device. For example, the first device can be a router, switch, firewall, controller, or other typical data communication field device in various networks, or it can be a communication network element, electronic device, control and management device, etc., from other fields outside the data communication field that enables routing protocols.
[0006] For example, the method includes: a first device generating a first message, the first message carrying a time-to-live (TTL) value greater than or equal to a first value, the first value being determined based on the number of hops on a route path to be detected, the route path being determined by the source Internet Protocol address (IP address) of the first message and the destination IP address of the first message; and sending the first message.
[0007] Based on the above scheme, the first device sets a first value to the TTL carried in the first packet. In the case of a loop, this first value ensures that the first packet, after being repeatedly forwarded in the route path to be detected, is forwarded back to the first device. This achieves the detection of routing loops. Furthermore, when the first device performs routing loop detection based on this method, it does not involve protocol interactions with other devices, thus reducing the difficulty of routing loop detection, solving the problem of protocol compatibility, and simplifying implementation.
[0008] In conjunction with the first aspect, in some possible implementations of the first aspect, the first value is twice the number of hops on the routing path.
[0009] In the presence of a loop, it can be ensured that the first message can be forwarded back to the first device by the device in the loop. This helps the first device to complete the loop detection on the route to be detected based on a first message, thereby improving the speed of loop detection and reducing communication costs.
[0010] One possible scenario is that the first device is not active on the route to be detected. In this case, in conjunction with the first aspect, in some possible implementations of the first aspect, sending the first message includes: sending the first message based on a first forwarding table, the first forwarding table being determined based on the destination IP address of the first message and the outgoing interface information of the first message. Thus, even when the route to be detected is not yet active, this helps the first device send the first message based on the generated first forwarding table, thereby completing the route loop detection.
[0011] In conjunction with the first aspect, in some possible implementations of the first aspect, the source IP address of the first message is determined based on the destination IP address of the first message and / or the outgoing interface information of the first message.
[0012] The first device can select one interface address from all interface addresses within the same subnet as the outgoing interface information as the source IP address of the first packet. This ensures that the source IP address of the first packet and the outgoing interface information are in the same subnet, thereby improving the effectiveness and accuracy of the communication system.
[0013] In conjunction with the first aspect, in some possible implementations of the first aspect, the destination IP address and outgoing interface information are pre-configured.
[0014] When the first device has not yet taken effect on the route to be detected, it can pre-configure the destination IP address and outgoing interface information. Based on the pre-configured destination IP address and outgoing interface information, the first device can determine the destination IP address and outgoing interface information of the generated first packet. This helps the first device perform route loop detection on the route to be detected before the route takes effect, thus avoiding the impact of route loops.
[0015] Another possibility is that the first device is already active on the route path to be detected. In this case, the first device can generate a first packet and perform route loop detection based on that first packet.
[0016] In conjunction with the first aspect, in some possible implementations of the first aspect, the method further includes: receiving at least one second message, each second message having the same sequence number as the first message and the source IP address of the second message belonging to the first device; setting the first device to a first state, in which the first device is not active in the routing path.
[0017] Each packet's sequence number uniquely identifies it. The first device can determine whether a loop exists in the routing path based on the sequence number of the first sent packet, the sequence number of a received packet (e.g., the second packet), and the source IP addresses of both packets. This allows the first device to determine the detection result of a routing loop based on the packet sequence numbers, and the implementation is relatively simple.
[0018] In conjunction with the first aspect, in some possible implementations of the first aspect, after setting the first device to the first state, the method further includes: performing N checks on whether a routing loop exists in the routing path, and setting the first device to the first state or a second state based on the check results, wherein the first device is effective in the routing path in the second state; wherein, during each check, the first message is sent; if no at least one second message is received during each check, the first device is set to the second state; if at least one second message is received during at least one of the N checks, the first device is set to the first state.
[0019] When the first device determines that a routing loop exists, it can set itself to a first state, meaning the first device is not active on the routing path to be detected. The first device can then periodically perform loop detection on the routing path based on the routing loop detection method described above. This helps the first device to repeatedly perform loop detection on the routing path after the routing has taken effect, thus avoiding the impact of routing loops.
[0020] In conjunction with the first aspect, in some possible implementations of the first aspect, when the first device is a dynamic routing device, before sending the first message during each of the N detections, the method further includes setting the first device to the second state.
[0021] Because a routing loop exists in the route path to be detected, the first device is set to the first state. Before periodically detecting loops in this route path, the first device needs to transition from the first state to the second state. This allows the first device to repeatedly perform loop detection on route paths where loops are detected after the route has taken effect, thereby reducing the occurrence of routing loops and facilitating normal traffic forwarding.
[0022] In conjunction with the first aspect, in some possible implementations of the first aspect, setting the first device to a first state includes setting the first device to the first state when the effective time of the first device is less than or equal to a second value.
[0023] The first device determines whether to set itself to the first state based on its activation time. This helps to quickly set newly activated routes that have caused routing loops to an inactive state. In this way, routing loops can be quickly blocked, reducing their impact.
[0024] Secondly, a routing loop detection method is provided, which can be applied to a routing loop detection device. This routing loop detection device can be, for example, a first logic unit, a component configured within the first logic unit (such as a chip, chip system, processor, etc.), or a logic module or software capable of implementing all or part of the functions of the first logic unit, etc. This application does not limit this. The first logic unit can be implemented as a network device or a component within a network device, which can be a base station, a cloud server, or a local server, etc.
[0025] For example, the method includes: obtaining routing adjustment information for adding or updating at least one routing path; and for each routing path, detecting whether a routing loop exists in the routing path based on a first message, wherein the TTL value carried by the first message is greater than or equal to a first value, the first value being determined based on the number of hops on the routing path.
[0026] Based on the above scheme, the first logical unit updates at least one routing path in its local routing information database based on the acquired routing adjustment information. The first logical unit can generate a first packet for each routing path and perform simulated routing loop detection based on this first packet. The detection result determines whether a routing loop exists. This helps the first logical unit perform simulated routing loop detection on the routing path to be detected before issuing new configurations, thereby avoiding the generation of routing loops. Furthermore, when the first logical unit performs simulated routing loop detection based on this routing loop detection method, it does not involve protocol interactions with other devices, thus reducing the difficulty of routing loop detection, solving protocol compatibility issues, and simplifying implementation.
[0027] In conjunction with the second aspect, in some possible implementations of the second aspect, the method further includes: in the case that there is no routing loop in the at least one routing path, sending routing configuration information to at least one routing device, the routing configuration information being determined based on the routing adjustment information.
[0028] The first logic unit can perform different actions based on different detection results. The detection result can indicate whether at least one routing path to be detected has a loop or not.
[0029] If the first logical unit determines, after detection, that there are no loops in at least one routing path, it can obtain updated routing configuration information based on routing adjustment information and the routing information database stored locally in the first logical unit, and then send the updated routing configuration information to the corresponding routing device. This helps to pre-detect newly added or updated routing paths before they take effect, thus avoiding the impact of routing loops.
[0030] If the first logical unit determines, through detection, that at least one routing path contains a loop, the first logical unit may choose not to send the obtained routing configuration information to the routing device corresponding to the routing adjustment information. This avoids the generation of routing loops.
[0031] Thirdly, this application provides a routing loop detection device, including modules or units for implementing the methods of the first aspect and any possible implementation of the first aspect. Specifically, the modules, units, or means can be implemented in software, hardware, or a combination of software and hardware.
[0032] Fourthly, this application provides a routing loop detection device, including one or more processors, which are used to execute a computer program (also referred to as code or instructions) in a memory, such that the routing loop detection device implements the routing loop detection method in the first aspect and any possible implementation of the first aspect.
[0033] Optionally, the device further includes a memory for storing computer programs and data. The memory is coupled to the processor, which, when executing the computer program stored in the memory, can implement the method described in the first aspect above.
[0034] Optionally, the device further includes a communication interface for communicating with other devices. For example, the communication interface may be a transceiver, circuit, bus, module, or other type of communication interface.
[0035] For example, the apparatus in the third or fourth aspect is the first device, or a component in the first device, such as a chip, chip system, processor, etc.
[0036] Fifthly, this application provides a chip system including at least one processor for supporting the implementation of the functions involved in the first aspect and any possible implementation of the first aspect, such as processing the messages involved in the above method.
[0037] In one possible design, the chip system also includes a memory for storing computer programs and data, which may be located inside or outside the processor.
[0038] The chip system can consist of chips or include chips and other discrete components.
[0039] In one possible design, the chip system also includes a power supply circuit for supplying power to the chip system.
[0040] Sixthly, this application provides a routing loop detection device, including modules or units for implementing the methods in the second aspect and any possible implementation of the second aspect. Specifically, the modules, units, or means can be implemented in software, hardware, or a combination of software and hardware.
[0041] In a seventh aspect, this application provides a routing loop detection device, including one or more processors, which execute a computer program (also referred to as code or instructions) in a memory, such that the routing loop detection device implements the routing loop detection method in the second aspect and any possible implementation of the second aspect.
[0042] Optionally, the device further includes a memory for storing computer programs and data. The memory is coupled to the processor, which, when executing the computer program stored in the memory, can implement the method described in the second aspect above.
[0043] Optionally, the device further includes a communication interface for communicating with other devices. For example, the communication interface may be a transceiver, circuit, bus, module, or other type of communication interface.
[0044] For example, the device in the sixth or seventh aspect is a first logic unit, or a component in the first logic unit, such as a chip, a chip system, a processor, etc.
[0045] Eighthly, this application provides a chip system including at least one processor for supporting the implementation of the functions involved in the second aspect and any possible implementation of the second aspect, such as processing the messages involved in the above methods.
[0046] In one possible design, the chip system also includes a memory for storing computer programs and data, which may be located inside or outside the processor.
[0047] The chip system can consist of chips or include chips and other discrete components.
[0048] In one possible design, the chip system also includes a power supply circuit for supplying power to the chip system.
[0049] Ninthly, this application provides a computer-readable storage medium including a computer program that, when run on a computer, causes the computer to implement the methods of the first and second aspects and any possible implementation of the first and second aspects.
[0050] In a tenth aspect, this application provides a computer program product comprising: a computer program that, when run, causes a computer to perform the methods of the first and second aspects and any possible implementation thereof.
[0051] Eleventhly, embodiments of this application provide a system including the aforementioned first device or first logic unit.
[0052] The third to eleventh aspects of this application correspond to the technical solutions of the first and second aspects of this application. The beneficial effects achieved by each aspect and the corresponding feasible implementation are similar, and will not be repeated here. Attached Figure Description
[0053] Figure 1This is a schematic diagram of the system architecture applicable to the embodiments of this application;
[0054] Figure 2 This is a schematic diagram of a routing loop scenario provided in an embodiment of this application;
[0055] Figure 3 This is a schematic diagram of the routing loop provided in an embodiment of this application;
[0056] Figure 4 This is a schematic flowchart of the routing loop detection method provided in the embodiments of this application;
[0057] Figure 5 This is a schematic diagram of the process for detecting routing loops before the routing becomes effective, provided in an embodiment of this application.
[0058] Figure 6 This is a schematic diagram of the process for detecting routing loops after the routing becomes effective, provided in an embodiment of this application.
[0059] Figure 7 This is another schematic flowchart of the routing loop detection method provided in the embodiments of this application;
[0060] Figure 8 This is a schematic diagram of the centralized computing scenario of the first logic unit provided in the embodiments of this application;
[0061] Figure 9 This is a schematic diagram of the process of performing routing loop detection before the configuration is issued and takes effect by the first logical unit according to the embodiments of this application;
[0062] Figure 10 This is a schematic diagram of the routing loop detection device provided in the embodiments of this application;
[0063] Figure 11 This is a schematic diagram of routing loop detection provided in an embodiment of this application;
[0064] Figure 12 This is a schematic diagram of the device provided in the embodiments of this application;
[0065] Figure 13 This is another schematic diagram of the device provided in the embodiments of this application. Detailed Implementation
[0066] The technical solution provided in this application will now be described with reference to the accompanying drawings.
[0067] To facilitate understanding of the embodiments of this application, the following points will be explained first:
[0068] First, in this application, the indication includes explicit indication (also known as direct indication) and implicit indication (also known as indirect indication). Explicit indication information A means including information A; implicit indication information A means indicating information A through the correspondence between information A and information B, and direct indication information B. The correspondence between information A and information B can be predefined, pre-stored, pre-burned, or pre-configured; or it can refer to indicating information A through information B and preset rules.
[0069] Second, in this application, information C is used to determine information D, which includes both determining information D based solely on information C and determining it based on information C and other information. Furthermore, information C can also be used to determine information D indirectly, for example, in the case where information D is determined based on information E, and information E is determined based on information C.
[0070] Third, in this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates an "or" relationship between the preceding and following related objects, but it does not exclude the possibility of indicating an "and" relationship; the specific meaning can be understood in context. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c; a and b; a and c; b and c; or a and b and c. Here, a, b, and c can be single or multiple.
[0071] Fourth, in this application, the use of prefixes such as "first" and "second" is merely for the purpose of distinguishing and describing different things belonging to the same name category, and does not constrain the order, size, or quantity of things. For example, "first message" and "second message" are simply different messages, and there is no temporal sequence, size, or priority relationship between them.
[0072] Fifth, in this application, "send" and "receive" indicate the direction of signal transmission. For example, "send a first message to a second device" can be understood as the destination of the information being the second device, which may include direct transmission via the air interface or indirect transmission via the air interface by other units or modules. "Receive a second message from a third device" can be understood as the source of the information being the third device, which may include direct reception from the third device via the air interface or indirect reception from the third device via the air interface by other units or modules. "Send" can also be understood as the "output" of the chip interface, and "receive" can also be understood as the "input" of the chip interface.
[0073] In other words, sending and receiving can be done between devices, such as between a first device and a second device; or it can be done within a device, such as between components, modules, chips, software modules, or hardware modules within a device via a bus, wiring, or interface.
[0074] Sixth, in the embodiments of this application, "when," "if," and "if" all refer to the device making corresponding processing under certain objective circumstances, and are not limited to a time, nor do they require the device to make a judgment action when it is implemented, nor do they mean that there are other limitations.
[0075] Seventh, in this application, the words "example," "exemplarily," "for example," or "such as" are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "example," "exemplarily," "for example," or "such as" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the words "example," "exemplarily," "for example," or "such as" is intended to present the relevant concepts in a specific manner.
[0076] To better understand the methods provided in the embodiments of this application, the terms involved in this application will be briefly explained below.
[0077] 1. Static Routing: This is a special type of routing that requires manual configuration by the administrator. When the network structure is relatively simple, configuring static routes is sufficient for the network to function properly. Alternatively, static routes can be used when devices cannot use dynamic routing protocols or cannot establish routes to the destination network.
[0078] 2. Dynamic Routing: This refers to a router's ability to automatically build its own routing table based on different algorithms and adjust it in a timely manner according to changes in the actual situation. Different dynamic routing protocols use different routing algorithms and can automatically adapt to changes in network topology, making them suitable for networks with a certain number of Layer 3 devices. Based on their scope of operation, routing protocols can be divided into: IGP and Exterior Gateway Protocol (EGP).
[0079] IGPs operate within an autonomous system. Common IGPs include Routing Information Protocol (RIP), Open Shortest Path First (OSPF), and Intermediate System to Intermediate System (IS-IS). EGPs operate between different autonomous systems, with BGP being the most commonly used EGP protocol.
[0080] Static routing protocols, IGP, and EGP are the main Layer 3 routing protocols used in communication networks, and they are widely used in carrier networks and enterprise networks.
[0081] 3. Tracert: Also known as traceroute, this embodiment uses tracecert as an example for ease of understanding and explanation. tracert is used to test the route a data packet takes from the source device to the destination device, supporting path probing between the source and destination devices. The execution process differs depending on the network on which the tracert command is executed on a single device. The following explanation uses Internet Protocol version 4 (IPv4) and Internet Protocol version 6 (IPv6) networks as examples.
[0082] Over IPv4 networks, tracert works by sending a series of probe packets with incrementing Time-To-Live (TTL) values. The TTL value of each packet determines the number of routers the packet can traverse; the number of routers a packet passes through from the source device to the destination device is called the hop count. Each time a packet passes through a router, the TTL value is decremented by 1. When the TTL value reaches 0, the router can discard the packet and return an Internet Control Message Protocol (ICMP) timeout message to the source device. By analyzing the returned ICMP messages, tracert can determine the IP address and response time of each hop.
[0083] For example, after executing the tracert command over an IPv4 network, the execution process is as follows:
[0084] Step 1: Send a data packet with a TTL of 1. If the TTL expires (time exceeded), the first hop sends back an ICMP error message to indicate that the data packet cannot be sent.
[0085] Step 2: Send a data packet with a TTL of 2. When the TTL times out, the second hop sends back an ICMP error message to indicate that the data packet cannot be sent.
[0086] Step 3: Send a data packet with a TTL of 3. When the TTL expires, the third hop sends back an ICMP error message to indicate that the data packet cannot be sent.
[0087] This process continues until the data packet reaches the destination device. Upon receiving the IPv4 packet at each hop, the destination device, because the port specified by the packet probe is not used on the destination device, will respond with an ICMP port unreachable message to the source device, indicating that the destination port is unreachable and that tracert has completed its execution. Finally, the path the packet traversed from the source device to the destination device can be seen in the results displayed on the source device.
[0088] Over IPv6 networks, tracert works by sending a series of probe packets with hop limit values. Each time a packet reaches a router, the hop limit value is decremented by 1. When a router receives a packet with a hop limit of 0, it can discard the packet and send an ICMPv6 error message to the source device.
[0089] For example, after executing the tracert command over an IPv6 network, the execution process is as follows:
[0090] Step 1: Send a packet with hop-limit of 1. When the hop-limit times out, the first hop sends back an ICMPv6 error message to indicate that the packet cannot be sent.
[0091] Step 2: Send a packet with hop-limit of 2. When the hop-limit times out, the second hop sends back an ICMPv6 error message to indicate that this packet cannot be sent.
[0092] Step 3: Send a packet with hop-limit of 3. When the hop-limit times out, the third hop sends back an ICMPv6 error message to indicate that the packet cannot be sent.
[0093] The above process continues until the packet reaches the destination device. Upon receiving the IPv6 packet at each hop, the destination device, because the port specified by the packet probe is not used on the destination device, will respond with an ICMPv6 port unreachable message to the source device, indicating that the destination port is unreachable and that tracert has completed its execution. Finally, the path the packet traversed from the source device to the destination device can be seen in the results displayed on the source device.
[0094] The following explanation uses three IPv4 network devices, A, B, and C, as examples to illustrate the working principle of tracert. Figure 1 This is a schematic diagram of the system architecture applicable to the embodiments of this application.
[0095] Step 1: Device A sends a User Datagram Protocol (UDP) message with a TTL field of 1 to destination device C. Upon receiving this message, device B decrements the TTL by 1, making it 0. Since device B is not the destination device, it discards the message and replies with an ICMP error message (TTL Timeout). This message contains the destination address of device A's IP address, the source address of device B's IP address, and all the contents of the source IP message. Upon receiving this message, device A knows that the first hop to destination device C is device B's IP address.
[0096] Step 2: Device A sends a UDP packet with a TTL field of 2 to Device C. After receiving the packet, Device B decrements the TTL by 1, making the TTL 1, and forwards the packet to Device C. After receiving the packet, Device C decrements the TTL by 1, making the TTL 0.
[0097] It should be noted that when tracert sends a UDP packet to the destination device, it usually selects a port number that the application will not use, for example, a port number above 30000. This ensures that the port number is unreachable on the destination device, thereby triggering the destination device to return a destination port unreachable error message to the source device.
[0098] Since device C is the destination device of this UDP packet, and the packet's port number is unreachable, device C will discard the packet and reply to device A with an ICMP packet indicating that the destination port is unreachable. Device A eventually obtains the IP address of device C, and further, based on the IP address of device B obtained in step 1, can obtain the complete path information from device A to device C.
[0099] 4. Routing Loop: A routing loop occurs when different devices in the network point to each other via routes, causing data that depends on these routes to fail to reach its destination correctly, resulting in abnormal traffic forwarding. Routing loops include static routing loops and dynamic routing loops.
[0100] Static route loops: Static route referencing is generally caused by manual configuration. For example, if two directly connected or not directly connected devices are configured with static routes to the same destination address, the routes between the two devices will form a loop. In default route scenarios, such as when two devices within a domain simultaneously publish default routes, the devices will learn each other's default routes, forming a default route loop.
[0101] Dynamic routing loop: refers to the phenomenon in networks using dynamic routing protocols where data packets continuously loop through the network and fail to reach their destination due to errors or delays in the propagation and updating of routing information.
[0102] Routing loops caused by routing protocol errors can be mainly categorized into three types: The first type is caused by improper configuration that renders the current protocol's loop prevention mechanism ineffective, such as when the BGP AS_PATH attribute is modified. The AS_Path attribute records, in vector order, all the Autonomous System (AS) numbers that a route must traverse from the source device to the destination device. When receiving a route, if a device finds its own AS number in the AS_Path list, it will not accept the route, thus avoiding routing loops between ASes.
[0103] The second type is where the introduction of external routes results in the loss of routing costs, leading to routing loops when Shortest Path First (SPF) is calculated within a single domain. For example, after inter-process referencing between IS-IS or OSPF, route costs are lost, causing SPF to be unable to reference the original cost of the routing information, thus creating routing loops.
[0104] The third type is when different types of routes using the same protocol have different priorities, leading to routing loops. For example, OSPF type 1 and type 2 routes have different priorities, affecting route learning and causing routing loops.
[0105] Figure 2 This is a schematic diagram of a routing loop scenario provided in an embodiment of this application. Wherein, Figure 2 (a) shows a routing loop between two directly connected devices, i.e., device A and device B are two directly connected devices, and a routing loop occurs between device A and device B. Figure 2 (b) illustrates a routing loop between multiple non-directly connected devices, meaning that at least two of devices A, B, and C are unidirectionally connected, or at least two are not bidirectionally directly connected, and a routing loop occurs between these three devices. For example, device A can send messages to device B, but device B cannot send messages to device A, etc., which will not be elaborated further. Figure 2 Any one of the multiple devices shown can be a network device such as a router. After receiving a message that needs to be forwarded, any device in the network (or a network device) can forward the message to its next-hop device based on the forwarding table.
[0106] Figure 3 This is a schematic diagram of a routing loop provided in an embodiment of this application. After device A sends a tracert message with a TTL of 1, in the absence of a routing loop in the network, the tracert message will be sent to device C via device B. Device A will receive a normal tracert result from device C, displaying the path from device A to device C, i.e., the normal path is "device A -> device B -> device C" three hops. When a loop occurs, for example, if there is a loop path between device A, device B, and device D, the loop path is "device A -> device B -> device D -> device A". Device A will receive the tracert message sent by its own device (i.e., device A). The message will be continuously forwarded in this loop, thus determining that a routing loop exists in the network.
[0107] Current network routing protocol standards define their own loop prevention mechanisms to avoid routing loops. For example, BGP uses AS-PATH to prevent loops; BGP discards routes containing its own AS number upon receipt, thus preventing routing loops. ISIS and OSPF can use SPF to prevent loops, calculating routes using the SPF algorithm to avoid routing loops, and also support route tagging (TAG) for loop prevention. OSPF has loop prevention capabilities.
[0108] However, due to the high complexity of routing loop scenarios and the current insufficient routing loop detection capabilities, when a routing loop occurs in the network, packets transmitted based on the routing path will continuously loop in the network and cannot be correctly sent to the destination, resulting in abnormal traffic forwarding.
[0109] In view of this, this application provides a method that sets a fixed first value for the TTL carried in the tracert message. This first value enables the first device to forward the tracert message back to the first device even after it has been repeatedly forwarded in the route path to be detected, in the event of a routing loop. The first device can then determine whether a routing loop exists in the route path to be detected based on the received message, thereby reducing the impact of routing loops.
[0110] The methods provided in the embodiments of this application will now be described in detail with reference to several accompanying drawings.
[0111] Figure 4 This is a schematic flowchart of the routing loop detection method provided in the embodiments of this application. Figure 4 The method provided in this application is described from the perspective of the interaction between the first device and the second device, but this should not constitute any limitation on this application. The first device and the second device can be network devices. For example, the first device and the second device can be typical data communication devices such as routers, switches, firewalls, and controllers in various networks, or they can be communication network elements, electronic devices, control and management devices that have enabled routing protocols in other fields outside the data communication field. This application does not limit them in this regard.
[0112] The first device and the second device can be adjacent hops in the same routing path. For example, on the routing path to be detected, the second device is the next-hop device of the first device. Therefore, the first device can send the first message to its next-hop device, which is the second device.
[0113] It is understood that the first device can also be replaced by components configured in the first device, such as chips, chip systems, processors, etc., or logic modules or software that can be used to implement some or all of the functions of the first device; the second device can also be replaced by components configured in the second device, such as chips, chip systems, processors, etc., or logic modules or software that can be used to implement some or all of the functions of the second device. This application does not limit this.
[0114] In some embodiments, if a routing path loop exists, the interaction between the first device and the third device will be described. The third device and the second device may be the same or different devices. When the third device is different from the second device, the third device may be on the same routing path as the first device and the second device, and the third device may be the previous hop node in the routing loop in which the first device is located.
[0115] Figure 4 The routing loop detection method 400 shown may include steps 410 to 440. The various steps in method 400 are described in detail below.
[0116] In step 410, the first device generates a first message, the first message carrying a TTL value greater than or equal to a first value, the first value being determined based on the number of hops on the route path to be detected, the route path being determined by the source IP address and the destination IP address of the first message.
[0117] To facilitate understanding and explanation, we will first explain and describe the routing information and routing path.
[0118] The first device can contain one or more routing information entries, and can transmit different data packets from one network to another based on different routing information entries. Each routing information entry can include, for example, the source IP address, subnet mask, next hop address, outgoing interface information, etc.
[0119] A routing path consists of all the routers and network devices that a packet passes through from its source IP address to its destination IP address. When a data packet arrives at a router, the router can look up its routing table and select the best next-hop router based on the destination IP address, thus determining the forwarding path of the data packet.
[0120] Optionally, the first device can determine the corresponding routing information based on the newly configured or reactivated route, and obtain the corresponding routing path based on the routing information. For example, the first device can calculate and select the optimal routing path based on the routing information. The routing path can be static or dynamic. For example, a static routing path can be manually configured, while a dynamic routing path can be automatically calculated and updated through a routing protocol.
[0121] In this embodiment, the routing loop detection method is described using a newly configured or reactivated route of the first device as an example, and should not be construed as limiting this application in any way. Before or after the newly configured or reactivated route takes effect, in order to avoid routing loops, the first device can generate a first packet based on each newly configured or reactivated route, and perform routing loop detection on the corresponding newly configured or reactivated route based on each first packet.
[0122] The first message generated by the first device can carry information such as the source IP address, destination IP address, outgoing interface information, and TTL. This first message can be, for example, a tracert message. Therefore, the routing loop detection method in this embodiment can also be described as generating tracert messages in different scenarios based on the "self tracert" mechanism, and performing routing loop detection based on the characteristics and detection functions of the tracert message. For ease of understanding and explanation, the specific content of this embodiment is described below in the form of a first message.
[0123] The first device can determine the routing path for forwarding the first packet based on the source IP address, destination IP address, and routing information. This routing path is the routing path to be detected. In other words, the first device can perform routing loop detection on the routing path to be detected to determine whether a routing loop exists.
[0124] The TTL value carried in the first packet can be greater than or equal to a first value, which is determined based on the number of hops on the route path to be detected. In other words, the first device can determine the number of hops the first packet takes from the source IP address to the destination IP address based on the route path, and then determine the TTL value of the first packet based on the number of hops.
[0125] One possible design for the first value is that it is twice the number of hops on the aforementioned route to be detected.
[0126] In other words, the first value can be set to twice the maximum number of hops in the routing path from the source IP address to the destination IP address of the first packet. Based on this, the first device can complete the detection of routing loops with a single first packet.
[0127] For example, the average number of hops on the route path to be detected in the network is currently between 13 and 14, and is usually less than 17. For instance, if the source IP address of the first packet passes through 17 routers to the destination IP address, that is, the number of hops on the route path to be detected is 17, then the TTL value carried by the first packet can be set to 40.
[0128] As mentioned earlier, the route path to be detected can be static or dynamic. Accordingly, devices configured with static routes may or may not be effective in the route path to be detected, while devices configured with dynamic routes are effective in the route path to be detected. The following provides a detailed explanation of the source IP address, destination IP address, and outgoing interface information of the first packet for both of these possible scenarios.
[0129] One possible scenario is that the first device is not active in the route path to be tested, hereinafter referred to as Scenario 1. In this case, the newly configured or reactivated static route on the first device has not yet taken effect, the routing information of the static route is also not active, and the routing path corresponding to the routing information is also in an inactive state.
[0130] Therefore, the first device can obtain or calculate the source IP address, destination IP address, and outgoing interface information of the routing path based on pre-configured configuration information. The first device can determine the destination IP address and outgoing interface information of the first packet based on the pre-configured configuration information. In other words, the destination IP address and outgoing interface information of the first packet can be pre-configured, or can be directly obtained from the configuration information.
[0131] Optionally, the source IP address of the first message can be determined based on the destination IP address of the first message and / or the outgoing interface information of the first message, or it can be pre-configured, for example, the first device can pre-configure the source IP address of the first message, etc. This application does not limit this.
[0132] For example, the first device can determine the source IP address of the first packet based on the outgoing interface information of the first packet. For instance, the first device can obtain the destination IP address and outgoing interface information from the configuration information, and determine the network segment or subnet where the outgoing interface is located based on the outgoing interface information. Further, it can search for IP addresses in the same network segment as the outgoing interface information from all pre-configured interface addresses of the first device, and select a suitable IP address from the found IP addresses as the source IP address of the first packet. For example, it can select a suitable IP address as the source IP address of the first packet based on the priority or availability of different IP addresses. In other words, the first device can select one interface address as the source IP address of the first packet from all interface addresses in the same subnet as the outgoing interface information.
[0133] In another example, the first device can determine the source IP address of the first packet based on its destination IP address. For instance, the first device can obtain a routing table through multiple iterations based on the destination IP address of the first packet, and determine the outgoing interface information of the first packet from the routing table. The first device can further determine the source IP address of the first packet based on the outgoing interface information. For details regarding the first device determining the source IP address of the first packet based on the outgoing interface information, please refer to the foregoing content, which will not be repeated here.
[0134] Optionally, if the destination IP address of the first message belongs to a virtual private network (VPN) address, the first device may select a configured IP address from within the VPN as the source IP address of the first message. This application does not impose any limitations on this.
[0135] In another example, the first device can determine the source IP address of the first packet based on the destination IP address and the outgoing interface information. For instance, after determining the outgoing interface information of the first packet based on its destination IP address, the first device can select an appropriate IP address as the source IP address of the first packet based on that outgoing interface information and pre-configured outgoing interface information of the first device.
[0136] The first device can generate the first packet based on the source IP address, destination IP address, outgoing interface information, and TTL value of the first packet obtained above.
[0137] One possible scenario is that the first device is active in the route path to be tested, hereinafter referred to as Scenario 2. In this case, the new configuration or newly activated static or dynamic route of the first device has taken effect, the corresponding routing information has also taken effect, and the routing path corresponding to the routing information is also in effect.
[0138] For example, when a first device receives a packet with a TTL value of 1, it can report the packet to itself or a component within the first device (e.g., the central processing unit, CPU) for detection. The destination IP address of this packet is 'a', and the first device confirms that the destination IP address is valid by checking its routing table. Normally, packets are not repeatedly forwarded in the network until the TTL value decreases to 1. However, the fact that the first device can still receive packets with a TTL value of 1 indicates that the packet has already been forwarded multiple times in the network and is about to be discarded, suggesting the existence of a routing loop in the current network.
[0139] Furthermore, the first device can obtain the routing information of the destination IP address a based on the routing table of the first device, including the source IP address, the destination IP address, and the outgoing interface information, etc. The first device can confirm whether there is a routing loop based on the obtained routing information.
[0140] For example, the first device can obtain the next-hop address and outgoing interface information of the destination IP address from the routing table. The first device can select a suitable source IP address as the source IP address of the first packet based on its configuration and routing information. For instance, the source IP address of the first packet can be the IP address of the outgoing interface, or it can be the IP address of one of the interfaces of the first device.
[0141] The first device can generate the first packet based on the source IP address, destination IP address, outgoing interface information, and TTL value of the first packet obtained above.
[0142] In step 420, the first device sends the first message. Correspondingly, the second device receives the first message from the first device.
[0143] For example, the first device can send the first message based on the forwarding table. The forwarding table will be explained below for two cases: whether the first device is active in the route path to be detected.
[0144] In the first scenario, where the first device is not active in the route path to be detected, the first device can send a first packet based on the first forwarding table, which can be determined based on the destination IP address of the first packet and the outgoing interface information of the first packet.
[0145] Since the first device is a newly configured device or a reactivated static routing device, meaning it is not yet effective, it has not yet generated routing table entries and forwarding table entries. In this case, the first device can construct a first forwarding table, i.e., a temporary forwarding table, using its CPU based on the destination IP address and outgoing interface information of the first packet obtained in step 410. This first forwarding table can be used to guide the forwarding of the first packet. In other words, the first packet can be sent to the next-hop device (i.e., the second device) of the first device based on the first forwarding table.
[0146] The generated first forwarding table can be automatically deleted after a certain period of time, or updated or replaced under specific conditions. For example, after loop detection based on the method described below, if a routing loop is found to exist, the first forwarding table can be deleted; if no routing loop is found to exist, after the static route takes effect, the first forwarding table can be updated or replaced, etc. This application does not limit this.
[0147] In the second scenario, when the first device has just taken effect in the route path to be detected, the first device can send the first message based on the second forwarding table. The second forwarding table can be dynamically generated and updated by the first device based on the routing protocol, or it can be determined by the first device based on the routing information of the static route that has already taken effect, etc. This application does not limit this.
[0148] For example, when the first device is newly configured, or newly introduced, or newly activated a dynamic route and the dynamic route is a newly effective route, the first device can look up the routing table based on the routing information of the aforementioned destination IP address a, determine the second forwarding table for forwarding the first packet based on the routing table of the first device, look up the specific forwarding information in the second forwarding table, and then forward the first packet to the next-hop device of the first device based on the second forwarding table.
[0149] After the first device sends out the generated first message, there are three possible scenarios:
[0150] Scenario 3: The first device receives no messages. In this case, the first device can assume that there is no loop.
[0151] Scenario 4: The first device can receive a response message to the first message. For example, after receiving the first message, the device at the destination IP address can send a response message to the first device. This response message can be obtained by packaging the first message into data. In this case, the first device that receives the response message can assume that there is no loop.
[0152] Scenario 5: The first device receives a second message whose sequence number is the same as the first message's, and the source IP address of the second message belongs to the first device. In this case, the first device can determine that a loop exists.
[0153] Optionally, the method further includes: step 430, whereby the third device sends at least one second message, each second message having the same sequence number as the first message and its source IP address belonging to the first device. Correspondingly, the first device receives at least one second message from the third device.
[0154] It can be understood that the third device is the upstream device of the first device. That is, after processing the received packet, the third device further forwards the packet as a second packet to the first device. The sequence number field of each second packet is used to identify each second packet, and each second packet has a unique sequence number. The sequence number carried in the sequence number field of the second packet is generated by the device with the source IP address of the second packet.
[0155] For example, a first device generates and sends a first message, which is forwarded based on a routing path until a third device receives the first message and processes it. For example, the TTL value of the first message is decremented by 1. The third device then forwards the processed first message to the first device in the form of a second message.
[0156] It can be understood that the sequence number of the first message is the same as the sequence number of the second message, and the sequence number fields of both messages are generated by the first device. Furthermore, the source IP address of the second message is also the source IP address of the first message, and this source IP address belongs to the first device.
[0157] Based on this, the first device can determine that the second message was sent by the first device, and that the message sent by the first device was forwarded back to the local device, i.e., the first device. Thus, it can be determined that when a newly configured or reactivated route takes effect, a routing loop may occur within the network.
[0158] Optionally, after determining that a routing loop exists, the first device can determine whether the destination IP address of the loop uses a static route or a dynamic route.
[0159] For example, the first device can make a comprehensive judgment based on information such as operation time or route effective time. For instance, static routes are usually manually configured, and the configuration and effective times are recorded in the configuration history. Therefore, the first device can determine if a route is static by checking the configuration history. As another example, dynamic routes are usually automatically learned and updated by the routing protocol, and the effective time can be displayed in the routing table; moreover, the update time of dynamic routes changes frequently. Therefore, the first device can determine if a route is dynamic based on its effective time and the route's update time.
[0160] The first device determines the detection result of the routing loop based on the method in step 430 above. The detection result is used to indicate whether a routing loop will be generated after a newly configured route or a reactivated route takes effect.
[0161] Optionally, the method further includes: step 440, whereby the first device sets itself to a first state in which it is not active in the routing path.
[0162] In scenario one, where the first device is not active in the route path to be detected, if the detection result indicates that the first device has determined that there is no loop, the first device can be set to the second state. In the second state, the first device is active in the route path to be detected, meaning that traffic or data can be forwarded normally. If the detection result indicates that the first device has determined that there is a loop, the first device can be set to the first state. In the first state, the first device is not active in the route path to be detected, meaning that the newly configured or reactivated route is not effective.
[0163] Optionally, if a loop is determined to exist in the first device, the first device may also generate a loop alarm and record a log.
[0164] Optionally, when it is determined that a loop exists in the first device, the first device may also output loop path information and the detection result of the loop path.
[0165] In scenario two, where the first device has just taken effect in the route path to be tested, if the test result indicates that the first device has determined that no loop exists, the first device can be set to a second state, in which the first device is effective in the route path. If the test result indicates that the first device has determined that a loop exists, the first device can be set to a first state, that is, the first device is not effective in the route path to be tested. In other words, the newly configured or reactivated route is not effective.
[0166] One possible design for setting the first device to a first state is that the first device can set the first device to a first state based on the first device's effective time. For example, if the first device's effective time is less than or equal to a second value, the first device can set the first device to a first state; if the first device's effective time is greater than the second value, the first device may not process the state of the first device.
[0167] It should be noted that the effective time of the first device can also be understood as the effective time of the newly configured route on the first device. For example, when the effective time of the newly effective route is less than or equal to the second value, the first device can set itself to the first state; when the effective time of the newly effective route is greater than the second value, the first device may not need to process the state of the first device.
[0168] It is understood that the second value can be predefined by the first device, preconfigured, or manually set; this application does not impose any limitations on this. It should also be understood that if the first device does not set the second value, then the first device may disregard whether the newly effective route is a newly effective route.
[0169] After setting the first device to the first state, one possibility is that the route path that has taken effect and contains loops is a static route path; another possibility is that the route path that has taken effect and contains loops is a dynamic route path.
[0170] Optionally, the method further includes: the first device performs N checks on whether a routing loop exists in the routing path to be detected, and sets the first device to a first state or a second state according to the detection results, wherein the first device is effective in the routing path in the second state.
[0171] For example, for the first device set to the first state based on the method in step 440, the first device can be configured with a timer to periodically perform loop detection N times on the first device in the first state. For example, the detection can be started once every 5 minutes. If a loop is found during continuous detection, the detection interval or detection cycle can be gradually increased to avoid frequent detection.
[0172] It is understood that the first device is periodically subjected to N routing loop detections. The number of detections (e.g., N times) can be predefined by the first device, preconfigured by the first device, or manually configured, etc. This application does not limit this.
[0173] For example, when the first device is a static routing device, it can periodically perform N loop detections on itself when it is in the first state, based on the routing loop detection method described in steps 410 to 440 regarding when the routing path to be detected is ineffective. During each detection, the first device can generate and send a first message based on pre-configured configuration information. For details regarding this first message, please refer to the detailed explanation in step 410; further elaboration is omitted here.
[0174] If, during each of the N detections, the first device does not receive at least one second message, the first device can set itself to the second state. In other words, when there is no routing loop, the first device can reset itself to the active state, meaning the routing path to be detected becomes active.
[0175] If the first device receives at least one second message during at least one of the N detections, the first device can set itself to the first state. In other words, a routing loop still exists in the current network, and the first device will continue to remain in an inactive state, meaning the route to be detected will remain inactive.
[0176] In another example, when the first device is a dynamic routing device, it can periodically perform N loop detections on itself in the second state, based on the routing loop detection method described in steps 410 to 440 regarding the first device's routing information being effective in the route to be detected. During each detection process, the first device can generate and send a first message based on the effective routing information. For details regarding this first message, please refer to the detailed explanation in step 410; further elaboration is omitted here.
[0177] In each of the N detections, before the first device sends the first message, the method may optionally further include: the first device setting itself to a second state.
[0178] In other words, before performing N tests on the route path to be tested, the first device needs to reset the first device in the first state to the second state, that is, during each route loop detection, the first device is in a state where it is effective in the route path to be tested.
[0179] If, during each of the N detections, the first device does not receive at least one second message, the first device can maintain the second state; in other words, the first device sets itself to the second state. That is, when there is no routing loop, the first device resets itself to the active state, meaning the route to be detected becomes active.
[0180] If the first device receives at least one second message during at least one of the N detections, the first device can set itself to the first state. In other words, if the detection result indicates that the first device still has a routing loop, the first device will be reset to the inactive state, meaning the routing path to be detected will remain inactive again.
[0181] Understandably, in the two examples above, one possible design for setting the first device to the first state is that the first device can set the first device to the first state based on the effective time of the newly configured route. For example, if the effective time of the newly effective route is less than or equal to a second value, the first device can set the first device to the first state; if the effective time of the newly effective route is greater than the second value, the first device may not need to process the state of the first device.
[0182] Optionally, if the first device determines that a loop exists, the first device may also stop traffic forwarding.
[0183] Optionally, if the first device determines that a loop exists, the first device can also generate a loop alarm and record it in the log.
[0184] Based on the above technical solution, the first device sets the TTL value carried in the first packet to be greater than or equal to a first value. In the event of a loop, this first value ensures that the first packet, after being repeatedly forwarded along the route to be detected, is forwarded back to the first device, meaning the first device receives its own first packet (i.e., the second packet). This helps to quickly detect routing loops before or after newly configured or reactivated routes take effect, thereby reducing the impact of routing loops. Furthermore, when the first device performs routing loop detection based on this method, it does not involve protocol interactions with other devices, thus reducing the difficulty of routing loop detection, solving protocol compatibility issues, and simplifying implementation.
[0185] The following is based on Figure 4 Based on the illustrated embodiments, combined with Figure 5 and Figure 6 The method provided in the embodiments of this application is described in detail below. Figure 4 The content already described in the illustrated embodiments will not be repeated here.
[0186] Figure 5 This is a schematic diagram of the process for detecting routing loops before a route takes effect, provided in an embodiment of this application. Figure 5The method provided in this application is described from the perspective of a first device, but this should not be construed as limiting the application in any way. The first device may be a network device. It is understood that the first device may also be replaced by components configured in the first device, such as chips, chip systems, processors, etc., or logic modules or software that can be used to implement some or all of the functions of the first device, etc., and this application does not limit them in this regard.
[0187] Figure 5 The routing loop detection method 500 shown may include steps 501 to 514. The various steps in method 500 are described in detail below.
[0188] In step 501, a new static route is configured or a static route is reactivated. For example, a new or reactivated static route can be configured manually.
[0189] In step 502, the configuration management module processes the data.
[0190] For example, this configuration management module can be responsible for and optimize network routing configuration, and can also manage routing tables, such as creating, updating, and deleting routing table entries. In this embodiment, the configuration management module can, for example, create or update newly configured or reactivated routes.
[0191] In step 503, the routing management protocol module processes the data.
[0192] For example, this routing management protocol module can support the configuration and management of routing protocols, such as OSPF and BGP. This module can also adjust parameters of the routing protocol, such as timers and metrics.
[0193] In step 504, the first device obtains the destination IP address, source IP address, and outgoing interface information based on the configured static routing information.
[0194] In step 505, the first device generates a first message, which carries the source IP address, outgoing interface information and TTL, and sets the TTL value of the first message.
[0195] In step 506, the CPU generates the first forwarding table based on the outgoing interface information obtained in step 504.
[0196] In step 507, the first device sends the first message based on the generated first forwarding table.
[0197] In step 508, the first device determines whether it has received the first message it sent.
[0198] It is understandable that the first message sent by itself is the same as the aforementioned second message. For details regarding steps 504 to 508, please refer to the detailed explanation in method 400, which will not be repeated here.
[0199] It should be noted that the execution order of steps 505 and 506 can be interchanged. For example, the first device can generate the first forwarding table first and then generate the first message. Alternatively, steps 505 and 506 can be executed simultaneously. For example, the first device can generate the first message and the first forwarding table at the same time. This application does not limit this.
[0200] After executing step 508, the first device can determine whether a loop exists based on the judgment result. If a loop is determined to exist, step 509 can be executed; if no loop is determined to exist, step 513 can be executed. For a detailed explanation of determining whether a loop exists based on the first message, please refer to the relevant content of step 430 in method 400, which will not be repeated here.
[0201] In step 509, the first device determines that a loop exists.
[0202] If the first device receives the first message (i.e., the second message) it sent out, the first device can determine that a routing loop exists. Based on this, the first device can execute steps 510, 511, and 512.
[0203] It should be noted that after the first device completes step 509, it may only execute step 510, or only execute steps 510 and 511, or only execute steps 510 and 512, or it may execute steps 510, 511, and 512, etc. This application does not limit this. It is understood that steps 510, 511, and 512 may be executed sequentially or simultaneously, and this application does not limit this.
[0204] Steps 510, 511, and 512 will be explained below.
[0205] In step 510, the route calculation fails, and the route settings on the first device are ineffective.
[0206] In step 511, the first device prints an alarm and records a log.
[0207] In step 512, the first device outputs the loop determination result.
[0208] In step 513, the first device determines that there is no routing loop.
[0209] If the first device does not receive the first message (i.e., the second message) it sent out, the first device can determine that there is no routing loop. Based on this, the first device can execute step 514.
[0210] In step 514, the route calculation is successful, and the route settings take effect.
[0211] Based on the above technical solution, when the first device performs route loop detection using the aforementioned route loop detection method, it can execute different actions based on different detection results. This helps to ensure that newly configured or reactivated routes undergo route loop detection before taking effect, thereby reducing the impact of route loops. Furthermore, when the first device performs route loop detection using this method, it does not involve protocol interactions with other devices, thus reducing the difficulty of route loop detection, solving protocol compatibility issues, and simplifying implementation.
[0212] Figure 6 This is a schematic diagram of the process of detecting routing loops after the routing becomes effective, provided in an embodiment of this application. Figure 6 The method provided in this application is described from the perspective of a first device, but this should not be construed as limiting the application in any way. The first device may be a network device. It is understood that the first device may also be replaced by components configured in the first device, such as chips, chip systems, processors, etc., or logic modules or software that can be used to implement some or all of the functions of the first device, etc., and this application does not limit them in this regard.
[0213] Figure 6 The routing loop detection method 600 shown may include steps 601 to 614. The steps in method 600 are described in detail below.
[0214] In step 601, the first device configures the newly activated route. The newly activated route can be, for example, a newly introduced route, a newly configured route, or a newly activated route.
[0215] In step 602, the CPU detects messages with a TTL value of 1.
[0216] For details regarding the message with a TTL value of 1 reported by the CPU, please refer to the detailed explanation of step 410 in method 400, which will not be repeated here.
[0217] In step 603, the first device determines whether a routing loop exists using a routing loop detection method.
[0218] For details regarding the first device's determination of whether a routing loop exists based on the routing loop detection method, please refer to the detailed content of Case 2 in Method 400, which will not be repeated here.
[0219] In step 604, the first device determines whether the destination IP address where the loop exists belongs to a dynamic route or a static route.
[0220] The first device determines whether the destination IP address of the loop belongs to a dynamic route or a static route. For details, please refer to method 400, which will not be repeated here. If the first device determines that it is a dynamic route, it can continue to step 605; if the first device determines that it is a static route, it can continue to step 609.
[0221] In step 605, the first device is determined to be a dynamic route.
[0222] After executing step 605, the first device may execute steps 606 and 608. It should be noted that after executing step 605, the first device may execute only step 606, or it may execute both steps 606 and 608. Steps 606 and 608 may be executed sequentially or simultaneously, etc., and this application does not limit this.
[0223] In step 606, the first device determines whether it is a newly effective route based on the effective time. If it is a newly effective route, the first device is set to the first state.
[0224] In step 607, the first device sets a timer to periodically change the first device from the first state set in step 606 to the second state, and performs routing loop detection based on the method in step 603. If a routing loop still exists, the first device is set to the first state; if no routing loop is found after N consecutive detections, the first device is set to the second state.
[0225] In step 608, the first device prints an alarm and records a log.
[0226] In step 609, the first device is determined to be a static route.
[0227] In step 610, the first device determines whether it is a newly effective route based on the effective time. If it is a newly effective route, the first device is set to the first state.
[0228] In step 611, the first device sets a timer to maintain the first device in the first state set in step 606. Based on the method in method 400 or method 500 where the first device is not effective on the route to be detected, the first device periodically performs route loop detection. If a route loop still exists, the first device will continue to maintain the first state; if no route loop is found after N consecutive detections, the first device is set to the second state.
[0229] In step 612, the first device prints an alarm and records a log.
[0230] In step 613, the first device determines that a routing loop has been discovered.
[0231] In step 614, there are no routing loops, and traffic is forwarded normally. In other words, the first device can forward traffic normally when there are no routing loops.
[0232] For details regarding steps 605 to 614, please refer to the detailed explanation in method 400, which will not be repeated here.
[0233] Based on the above technical solution, when the first device performs route loop detection using the aforementioned route loop detection method, it can execute different actions based on different detection results. This helps to ensure that newly configured or reactivated routes undergo route loop detection after taking effect, thereby reducing the impact of route loops. Furthermore, when the first device performs route loop detection using this method, it does not involve protocol interactions with other devices, thus reducing the difficulty of route loop detection, solving protocol compatibility issues, and simplifying implementation.
[0234] This application also provides a method in which a first logical unit updates at least one routing path in its locally stored routing information database by acquiring information for adding or updating at least one routing path. The first logical unit can generate a tracert message for each routing path and perform simulated detection based on the tracert message, determining whether a routing loop exists based on the detection results. This helps the first logical unit perform simulated routing loop detection on the routing path to be detected before issuing new configurations, thereby avoiding the generation of routing loops. Furthermore, when the first logical unit performs simulated routing loop detection based on this routing loop detection method, it does not involve protocol interactions with other devices, thus reducing the difficulty of routing loop detection, solving protocol compatibility issues, and simplifying implementation.
[0235] Figure 7 This is another schematic flowchart of the routing loop detection method provided in the embodiments of this application. Figure 7 The method provided in this application is described using a first logic unit as an example, but this should not be construed as limiting the application in any way. Furthermore, the first logic unit can be replaced by components configured within it, such as chips, chip systems, processors, or logic modules or software that can be used to implement some or all of the functions of the first logic unit. This application does not impose any limitations in this regard.
[0236] Figure 7The routing loop detection method 700 shown may include steps 710 to 720. The various steps in method 700 are described in detail below.
[0237] In step 710, the first logic unit obtains routing adjustment information, which is used to add or update at least one routing path.
[0238] The first logical unit can manage all devices and collect routing information from each device. It can also distribute routing results from the first logical unit to each device. The routing results include destination IP address, next-hop IP address, outgoing interface information, and path cost.
[0239] Figure 8 This is a schematic diagram of a centralized path calculation scenario for the first logical unit provided in an embodiment of this application. The first logical unit can be, for example, a network cloud engine (NCE). It is understood that the first logical unit can also be called a path calculation unit, or the name of a device with the same or similar functions as the first logical unit, and this should not constitute any limitation on this application.
[0240] Routing adjustment information may include, for example, newly added configuration information, adjusted path costs, or inter-process referencing between configured routing protocols. This routing adjustment information can be configured globally for each routing device in the network, or locally for one or more specified routing devices in the network, etc., and this application does not limit it in this way.
[0241] The first logical unit can store a complete routing information database for the entire network. When the first logical unit obtains routing adjustment information, it can overlay the obtained routing adjustment information onto the routing information database stored locally in the first logical unit, and perform local routing calculations for the IP addresses involved in at least one newly added or updated routing path.
[0242] In step 720, for each routing path, the first logic unit detects whether a routing loop exists based on the first message. The TTL value carried by the first message is greater than or equal to a first value, which is determined based on the number of hops on the routing path.
[0243] After the first logical unit performs routing-related configurations on multiple devices, before the new configuration information or routing adjustments are distributed to each device, the first logical unit can, based on the routing information database of each device in the network stored locally and the new configuration information, perform local routing calculations and, based on the routing loop detection method described above after the routing takes effect, simulate and detect whether the routing path of the routing device corresponding to the routing adjustment information will generate a routing loop.
[0244] For example, the first logical unit has the function of generating a first packet and simulating forwarding. Based on this, for each routing path, the first logical unit can generate a first packet and simulate forwarding the first packet, and detect whether a routing loop exists in the routing path based on the first packet. Assuming that the first logical unit can generate a first packet for the routing adjustment information of device 1, such as a newly added route, the first logical unit can perform simulated routing loop detection on the newly configured routing path to be detected on device 1 based on the first packet and the simulated forwarding function of the first logical unit.
[0245] For details regarding the first message and loop detection based on the first message, please refer to Method 400 for the detailed content on the first message and the detection method when the first device has taken effect on the route path to be detected, which will not be repeated here.
[0246] After performing path loop detection using the above method, the first logic unit can determine either the existence of a loop or the absence of a loop. These two possibilities are explained in detail below.
[0247] One possible scenario is that the first logical unit does not encounter a routing loop in the at least one routing path. In this case, the method may optionally further include: the first logical unit may send routing configuration information to at least one routing device, the routing configuration information being determined based on the routing adjustment information.
[0248] In other words, if the first logical unit determines that the route adjustment information will not cause a route loop after performing loop detection using the path loop detection method, the first logical unit can perform local calculations based on the original route information in the locally stored route information database to obtain the route configuration information. The first logical unit can then send the route configuration information to the corresponding routing device.
[0249] For example, after the first logical unit sends the routing configuration information to the corresponding routing device, the corresponding routing device can update the routing table and routing path based on the routing configuration information.
[0250] Another possibility is that a routing loop exists in at least one routing path. In this case, the first logical unit can cancel the newly added routing path or the updated routing path.
[0251] In other words, if the first logical unit determines, after performing loop detection using the path loop detection method, that the route adjustment information can lead to a route loop, the first logical unit does not need to calculate the route configuration information based on the route adjustment information. That is, it does not need to send the route configuration information calculated based on the route adjustment information to the corresponding routing device to avoid routing loops in that device. In other words, the routing information configured on the corresponding routing device remains unchanged.
[0252] Routing adjustment information that can cause loops can be deleted periodically, or it can continue to be stored in the first logical unit. The first logical unit can periodically perform simulated routing loop detection on the corresponding routing device based on the routing adjustment information, according to method 400 or method 500, which will not be elaborated further.
[0253] Optionally, when the first logic unit determines that a loop exists, the first logic unit may also generate a loop alarm and record a log.
[0254] Optionally, when the first logic unit determines that a loop exists, the first logic unit may also output the routing path information of the loop and the detection result of the path loop.
[0255] Based on the above technical solution, the first logical unit updates at least one routing path in its local routing information database based on the acquired routing adjustment information. The first logical unit can generate a first packet for each routing path and perform simulated detection based on this first packet, determining whether a routing loop exists based on the detection result. This helps the first logical unit perform simulated routing loop detection on the routing path to be detected before issuing new configurations, thereby avoiding the generation of routing loops. Furthermore, when the first logical unit performs simulated routing loop detection based on this routing loop detection method, it does not involve protocol interactions with other devices, thus reducing the difficulty of routing loop detection, solving protocol compatibility issues, and simplifying implementation.
[0256] The following is based on Figure 7 Based on the illustrated embodiments, combined with Figure 9 The method provided in the embodiments of this application is described in detail below. Figure 7 The content already described in the illustrated embodiments will not be repeated here.
[0257] Figure 9 This is a schematic diagram of the process of performing routing loop detection before the configuration is issued and taken effect by the first logical unit provided in this application embodiment. Figure 9The method provided in this application is described from the perspective of a first logical unit, but this should not constitute any limitation on this application. The first logical unit may be, for example, a network device. It is understood that the first logical unit may also be replaced by components configured in the first logical unit, such as chips, chip systems, processors, etc., or logical modules or software that can be used to implement some or all of the functions of the first logical unit, etc., and this application does not limit this.
[0258] Figure 9 The routing loop detection method 900 shown may include steps 901 to 913. The steps in method 900 are described in detail below.
[0259] In step 901, the first logical unit configures a new route or performs a route adjustment operation.
[0260] In step 902, the configuration management module processes the data.
[0261] In step 903, the routing management protocol module processes the data.
[0262] In step 904, the first logic unit adds the newly configured route or the route change caused by the route adjustment to the existing route information database and performs local route calculation.
[0263] In step 905, the first logic unit performs routing loop detection based on the obtained route.
[0264] For details regarding the routing loop of the first logical unit, please refer to the detailed explanation of Case 2 in Method 400, which will not be repeated here.
[0265] In step 906, the first logic unit determines whether a routing loop exists.
[0266] If the first logic unit determines that a routing loop exists, the first logic unit may continue to execute step 907; if the first logic unit determines that no routing loop exists, the first logic unit may continue to execute step 911.
[0267] In step 907, the first logic unit determines that the new configuration causes a routing loop.
[0268] After executing step 907, the first logic unit can execute steps 908, 909, and 910. It should be noted that after executing step 907, the first logic unit can execute only step 908, or execute steps 908 and 909, or execute steps 908 and 910, or execute steps 908, 909, and 910. Steps 909 and 910 can be executed sequentially or simultaneously, etc., and this application does not limit this.
[0269] In step 908, the first logical unit does not send out routing configuration information.
[0270] In step 909, the first logic unit prints an alarm and records a log.
[0271] In step 910, the first logic unit outputs the loop determination result.
[0272] In step 911, the first logic unit determines that the new configuration will not cause a routing loop.
[0273] In step 912, the first logical unit sends out routing configuration information.
[0274] In step 913, at least one routing device can detect whether a routing loop exists in the newly configured route based on the loop detection method after the route takes effect.
[0275] For details regarding the steps in Method 900, please refer to the detailed explanations in Methods 400, 600, and 700; they will not be repeated here.
[0276] Based on the above technical solution, the first logical unit updates at least one routing path in its local routing information database based on the acquired routing adjustment information. The first logical unit can generate a first packet for each routing path and perform simulated detection based on this first packet, determining whether a routing loop exists based on the detection result. This helps the first logical unit perform simulated routing loop detection on the routing path to be detected before issuing new configurations, thereby avoiding the generation of routing loops. Furthermore, when the first logical unit performs simulated routing loop detection based on this routing loop detection method, it does not involve protocol interactions with other devices, thus reducing the difficulty of routing loop detection, solving protocol compatibility issues, and simplifying implementation.
[0277] Figure 10This is a schematic diagram of a routing loop detection device provided in an embodiment of this application. It can be seen that the routing loop detection device can perform routing loop detection on static routes, dynamic routes, and routes issued by the first logic unit. The detection device can be in two states: on or off. If the detection device is on, loop detection can be performed on the aforementioned three types of routes; if the detection device is off, loop detection cannot be performed on the aforementioned three types of routes. The detection device can be manually turned on or off, periodically turned on or off, or turned on or off in response to a control signal, etc., and this application does not limit this. Through this detection device, it is possible to quickly confirm whether a routing loop exists before or after a newly configured or activated route takes effect, thereby preventing the generation of routing loops and reducing their impact.
[0278] Figure 11 This is a schematic diagram of the routing loop detection process provided in an embodiment of this application. The detection process may include a routing configuration module, a phased detection module, and a detection result and execution action module.
[0279] The routing configuration module can be divided into three different configuration scenarios: newly configured or newly effective static routes, newly configured or newly introduced dynamic routes or route adjustments to dynamic routes, and routing configuration information issued by the first logical unit. For details regarding these three different configuration scenarios, please refer to the detailed explanations in methods 400 and 700, which will not be repeated here.
[0280] The phased detection module may include a configuration management module, a routing management protocol module, and a loop detection module. For details regarding the configuration management module and routing management protocol module, please refer to the detailed explanation in Method 500, which will not be repeated here. The loop detection module can employ different loop detection methods for the three different routing configuration scenarios described above.
[0281] For example, when the routing configuration scenario involves a newly configured or newly activated static route, the loop detection module can use the loop detection method before the route takes effect. For details, please refer to the detailed explanation of Case 1 in Method 400, or to the detailed explanation of the method for performing route loop detection before the route takes effect in Method 500. Further details will not be elaborated here.
[0282] In another example, when the routing configuration scenario involves a new configuration, the introduction of a new dynamic route, or adjustments to a dynamic route, the loop detection module can use the loop detection method after the route takes effect. For details, please refer to the detailed explanation of Case 2 in Method 400, or the detailed explanation of the method for performing route loop detection after the route takes effect in Method 600, which will not be repeated here.
[0283] In another example, when the routing configuration scenario involves the first logical unit issuing routing configuration information, the loop detection module can use the loop detection method before the configuration takes effect. For details, please refer to the detailed explanation of the routing loop detection method in method 700, or the detailed explanation of the method for performing routing loop detection before the first logical unit issues the configuration and takes effect in method 900. Further details will not be repeated here.
[0284] The detection result and action module can include one or more of the following: route not working, first logical unit not issuing route configuration information, route set to invalid state, stop traffic forwarding, and application module. This application module can include operations such as printing alarms and logging. It can be understood that route not working and route set to invalid state mean the route is in the aforementioned first state, or in other words, the first device is set to the first state. Different loop detection modules will have different detection results and actions.
[0285] For example, if the first device uses the loop detection method before the route takes effect, and a loop is detected, the first device can disable the route, i.e., set the first device to the first state. The first device can also perform actions such as printing alarms and logging by the application module.
[0286] In another example, when the first device uses the loop detection method after the route has taken effect, if a loop is determined to exist, the first device can perform the action of setting the route to a disabled state, that is, setting the first device to the first state. The first device can also stop traffic forwarding, or the first device can also perform actions such as printing alarms and recording logs by the application module.
[0287] In another example, when the first device uses the loop detection method before the configuration takes effect, if a loop is determined to exist, the first logic unit can execute the action of not issuing routing configuration information. The first logic unit can also execute actions such as printing alarms and recording logs from the application module.
[0288] For details regarding setting the first device to the first state and other actions performed, please refer to the relevant content in method 400 or method 700, and will not be repeated here.
[0289] The method provided by the embodiments of this application has been described in detail above with reference to the accompanying drawings. The apparatus provided by the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0290] Figure 12 and Figure 13These are schematic block diagrams illustrating possible apparatuses provided for embodiments of this application. These apparatuses can be used to implement the functions of the first device or first logic unit in the above method embodiments, and thus also achieve the beneficial effects of the above method embodiments. In embodiments of this application, the apparatus may be as follows: Figure 4 The first device in the method embodiment shown may also be a component configured in the first device (such as a chip, chip system, processor, etc.), or a logic module or software capable of implementing some or all of the functions of the first device; the device may be as follows Figure 7 The first logic unit in the method embodiment shown may also be a component (such as a chip, chip system, processor, etc.) configured in the first logic unit, or a logic module or software capable of implementing some or all of the functions of the first logic unit.
[0291] The device provided in this application is as follows: Figure 12 As shown, the device 1200 includes a transceiver unit 1210 and a processing unit 1220.
[0292] One possible design is that device 1200 can be a first route loop detection device, which is used to implement the above. Figure 4 The method embodiment shown illustrates the function of the first device. For example, the device 1200 may correspond to... Figure 4 The first device in the process.
[0293] For example, the processing unit 1220 is used to generate a first message, the first message carrying a Time-to-Live (TTL) value greater than or equal to a first value, the first value being determined based on the number of hops on the route path to be detected, the route path being determined by the source IP address and the destination IP address of the first message; the transceiver unit 1210 is used to send the first message.
[0294] Optionally, the first value is twice the number of hops on the route path.
[0295] Optionally, the transceiver unit 1210 is further configured to send the first message based on a first forwarding table, wherein the first forwarding table is determined based on the destination IP address of the first message and the outgoing interface information of the first message.
[0296] Optionally, the source IP address of the first message is determined based on the destination IP address of the first message and / or the outgoing interface information of the first message.
[0297] Optionally, the transceiver unit 1210 is further configured to receive at least one second message, each second message having the same sequence number as the first message and the source IP address of the second message belonging to the first device; the processing unit 1220 is further configured to set the first device to a first state, in which the first device is not active in the routing path.
[0298] Optionally, the processing unit 1220 is further configured to perform N checks on whether a routing loop exists in the routing path, and set the first device to a first state or a second state according to the check results, wherein the first device is active in the routing path in the second state; wherein, during each check, the transceiver unit 1210 is further configured to send the first message; if no at least one second message is received during each check, the processing unit 1220 is further configured to set the first device to the second state; if at least one second message is received during at least one of the N checks, the processing unit 1220 is further configured to set the first device to the first state.
[0299] Optionally, when the first device is a dynamic routing device, before sending the first message during each of the N detections, the processing unit 1220 is also used to set the first device to a second state.
[0300] Optionally, if the effective time of the first device is less than or equal to the second value, the processing unit 1220 is further configured to set the first device to a first state.
[0301] One possible design is that device 1200 can be a second routing loop detection device, which is used to implement the above. Figure 7 The method embodiment shown illustrates the function of the first logic unit. For example, the device 1200 may correspond to... Figure 7 The first logical unit in the process.
[0302] For example, the processing unit 1220 is used to obtain routing adjustment information, which is used to add or update at least one routing path; the processing unit 1220 is also used to detect, for each routing path, whether there is a routing loop based on a first message, wherein the TTL value carried by the first message is greater than or equal to a first value, which is determined based on the number of hops on the routing path.
[0303] Optionally, if there is no routing loop in the at least one routing path, the transceiver unit 1210 is further configured to send routing configuration information to at least one routing device, the routing configuration information being determined based on the routing adjustment information.
[0304] For a more detailed description of the transceiver unit 1210 and the processing unit 1220, please refer to [link / reference needed]. Figure 4 or Figure 7 The relevant descriptions in any of the embodiments shown are directly obtained and will not be repeated here.
[0305] In one possible design, when device 1200 is a first device or a communication module within a first device, or when device 1200 is a first logic unit or a communication module within a first logic unit, the function of processing unit 1220 can be implemented by one or more processors. Specifically, the processor may include a modem chip, or a SoC chip or SIP chip containing a modem core. The function of transceiver unit 1210 can be implemented by transceiver circuitry.
[0306] In one possible design, when the device 1200 is a circuit or chip responsible for communication functions in a first device or first logic unit, such as a modem chip or a SoC chip or SIP chip containing a modem core, the function of the processing unit 1220 can be implemented by a circuit system in the aforementioned chip that includes one or more processors or processor cores. The function of the transceiver unit 1210 can be implemented by interface circuitry or data transceiver circuitry on the aforementioned chip.
[0307] It should also be understood that the transceiver unit in device 1200 may include a transmitting unit but not a receiving unit. Alternatively, the transceiver unit 1210 may include a receiving unit but not a transmitting unit. Specifically, it depends on whether the above-described scheme performed by device 1200 includes both transmitting and receiving actions. The receiving unit can be used to perform the receiving action in the above-described scheme, and the transmitting unit can be used to perform the transmitting action in the above-described scheme.
[0308] It is understood that the division of units in the above-described device is merely a logical functional division. Each function can correspond to a functional unit, or two or more functions can be integrated into one functional unit. In actual implementation, all or some units can be integrated into a single physical entity, or they can be distributed across different physical entities. Furthermore, the aforementioned functional units can be implemented in hardware, software, or a combination of both. Whether a function is executed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0309] Figure 13 This is another schematic block diagram of the device provided in the embodiments of this application. For example... Figure 13 As shown, device 1300 includes one or more processors 1310. The processor 1310 can be a general-purpose processor or a dedicated processor, such as a baseband processor or a central processing unit. The baseband processor can be used to process communication protocols and communication data, while the central processing unit can be used to control the device (e.g., a vehicle or a chip), execute software programs, and process data from the software programs.
[0310] Optionally, in one design, processor 1310 may include a program (also referred to as code or instructions) that can be executed on processor 1310, causing device 1300 to perform the method executed by the first device or first logic unit in the above method embodiments. In yet another possible design, device 1300 includes circuitry (…). Figure 13 (Not shown), the circuit is used to implement the function of the first device or the first logic unit in the above method embodiments.
[0311] For example, processor 1310 can be used to execute computer programs or instructions in memory to achieve Figure 4 or Figure 7 The steps performed by the first device or the first logic unit in the illustrated embodiment.
[0312] Optionally, the device 1300 may include one or more memories 1320 storing programs (sometimes referred to as code or instructions) that can be run on the processor 1310, causing the device 1300 to perform the methods executed by the first device or first logic unit in the above embodiments.
[0313] Optionally, the processor 1310 and / or memory 1320 may also store data. The processor and memory may be configured separately or integrated together.
[0314] Optionally, the device 1300 may further include a communication interface 1330. The processor 1310, sometimes referred to as a processing unit, controls the device (e.g., the first device or the first logic unit). The communication interface 1330, sometimes referred to as a transceiver unit, transceiver, transceiver circuit, or transceiver, is used to implement the transceiver function of the device; for example, the communication interface 1330 can be used to receive a first message.
[0315] Optionally, the device 1300 also includes a communication interface 1330. The processor 1310 and the communication interface 1330 are coupled to each other. It is understood that the communication interface 1330 can be a transceiver or an input / output interface.
[0316] When device 1300 is used to achieve Figure 4 or Figure 7 In the method shown, processor 1310 can be used to execute the functions of processing unit 1220, and communication interface 1330 can be used to execute the functions of transceiver unit 1210. Whether communication interface 1330 is used for sending or receiving depends on whether the device 1300 is used to perform a sending or receiving operation in the execution scheme.
[0317] When the aforementioned device 1300 is a chip applied to the first device, the chip implements the functions of the first device in the above method embodiments. The chip of the first device receives signals from other modules (such as radio frequency modules or antennas) in the first device, and these signals may be sent to the first device by a third device; or, the chip of the first device sends signals to other modules (such as radio frequency modules or antennas) in the first device, and these signals may be sent from the first device to a second device.
[0318] When the aforementioned device 1300 is a chip applied to the first logic unit, the chip implements the functions of the first logic unit in the above method embodiment. The chip of the first logic unit receives signals from other modules in the first logic unit, which may be sent to the first logic unit by the routing management protocol module; or, the chip of the first logic unit sends signals to other modules in the first logic unit, which may be sent by the first logic unit to at least one routing device.
[0319] It is understood that when the device 1300 is a first device or a first logic unit, the communication interface 1330 can be a transceiver, specifically including a transmitter and a receiver, with the transmitter used to send signals and the receiver used to receive signals. When the device 1300 is a chip applied to the first device or the first logic unit, the communication interface 1330 can be an input / output circuit, wherein the input circuit can be used for receiving and the output interface can be used for sending.
[0320] Optionally, the device 1300 also includes a power supply circuit for supplying power to the device 1300.
[0321] It should be noted that the above method embodiments can be applied to a processor, or implemented by a processor. A processor may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method embodiments can be completed by integrated logic circuits in the processor's hardware or by software instructions.
[0322] The aforementioned processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or any combination thereof. A general-purpose processor can be a microprocessor or any conventional processor.
[0323] The steps of the method disclosed in the embodiments of this application can be directly manifested as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can reside in mature storage media in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.
[0324] The memory in this application embodiment can be volatile memory or non-volatile memory, or it can include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM). It should be noted that the memory used in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0325] This application also provides a chip system including at least one processor for supporting the implementation of the functions of the first device or first logic unit involved in any of the above method embodiments, such as receiving, sending, or processing information involved in the above methods.
[0326] In one possible design, the chip system also includes a memory for storing computer programs and data, which may be located within or outside the processor.
[0327] The chip system can consist of chips or include chips and other discrete components.
[0328] This application also provides a computer program product, which includes: a computer program, which, when run,... Figure 4 The method executed by the first device in the illustrated embodiment is performed, or Figure 7 In the illustrated embodiment, the method executed by the first logic unit is performed.
[0329] This application also provides a computer-readable storage medium storing a computer program. When the computer program is run, Figure 4 The method executed by the first device in the illustrated embodiment is performed, or Figure 7 In the illustrated embodiment, the method executed by the first logic unit is performed.
[0330] This application also provides a system comprising the aforementioned first routing loop detection device or second routing loop detection device.
[0331] The methods provided in the above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any combination thereof. When implemented in software, they can be implemented, in whole or in part, in the form of a computer program product. The computer program product may include one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic disk), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0332] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0333] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0334] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0335] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0336] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0337] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, or a part thereof, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory, random access memory, magnetic disks, or optical disks.
Claims
1. A method for detecting routing loops, characterized in that, Applied to a first device, the method includes: Generate a first message, wherein the Time-to-Live (TTL) value carried by the first message is greater than or equal to a first value, wherein the first value is determined based on the number of hops on the route path to be detected, and the route path is determined by the source IP address and the destination IP address of the first message. Send the first message.
2. The method as described in claim 1, characterized in that, The first value is twice the number of hops on the routing path.
3. The method as described in claim 1 or 2, characterized in that, Sending the first message includes: Based on the first forwarding table, the first message is sent. The first forwarding table is determined based on the destination IP address of the first message and the outgoing interface information of the first message.
4. The method according to any one of claims 1 to 3, characterized in that, The source IP address of the first message is determined based on the destination IP address of the first message and / or the outgoing interface information of the first message.
5. The method according to any one of claims 1 to 4, characterized in that, The destination IP address and outgoing interface information are pre-configured.
6. The method according to any one of claims 1 to 5, characterized in that, The method further includes: Receive at least one second message, wherein the sequence number of each second message is the same as the sequence number of the first message and the source IP address of the second message belongs to the first device; Set the first device to a first state, in which the first device is not active in the routing path.
7. The method as described in claim 6, characterized in that, After setting the first device to the first state, the method further includes: The system performs N checks to determine if a routing loop exists along the routing path. Based on the check results, the first device is set to either the first state or the second state. In the second state, the first device is active within the routing path. During each detection process, the first message is sent; If no second message is received during each detection process, the first device is set to the second state; If at least one of the second messages is received during at least one of the N detections, the first device is set to the first state.
8. The method according to claim 7, characterized in that, When the first device is a dynamic routing device, before sending the first message during each of the N detection processes, the process further includes: Set the first device to the second state.
9. The method according to any one of claims 6 to 8, characterized in that, Setting the first device to a first state includes: If the effective time of the first device is less than or equal to the second value, the first device is set to the first state.
10. A method for detecting routing loops, characterized in that, Applied to a first logic unit, the method includes: Obtain route adjustment information, which is used to add or update at least one route path; For each of the routing paths, based on the first message, it is detected whether a routing loop exists in the routing path. The TTL value carried by the first message is greater than or equal to a first value, which is determined based on the number of hops on the routing path.
11. The method as described in claim 10, characterized in that, The method further includes: If no routing loop exists in the at least one routing path, routing configuration information is sent to at least one routing device, the routing configuration information being determined based on the routing adjustment information.
12. A routing loop detection device, characterized in that, It includes a unit for performing the method as described in any one of claims 1 to 9, or a unit for performing the method as described in any one of claims 10 to 11.
13. A routing loop detection device, characterized in that, The device includes one or more processors, which are configured to execute computer programs or instructions in memory, causing the routing loop detection device to perform the method as described in any one of claims 1 to 9, or to perform the method as described in any one of claims 10 to 11.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it causes the method as described in any one of claims 1 to 9 to be executed, or causes the method as described in any one of claims 10 to 11 to be executed.
15. A computer program product, characterized in that, Includes a computer program that, when run, causes the method of any one of claims 1 to 9 to be performed, or causes the method of any one of claims 10 to 11 to be performed.