Loop inspection method, device and electronic equipment
Patent Information
- Application Number
- CN202510903434.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2045-06-30
AI Technical Summary
[0002]在网络中,当一路由跨自治域(Autonomous System,AS)转发后,再被转发回该路由所经过的所有AS中的任一AS时,由于无法识别该路由是否为该AS发布过的路由,此时接收到该路由的网络设备会基于本地路由策略重新指导该路由的转发,也即将该路由再转发出去,这样就会形成一个环形通道循环转发该路由,从而造成路由出现环路现象,这种现象的发生会严重影响网络的性能
[0015]由以上技术方案可以看出,本申请实施例中,通过在发现待发布BGP路由携带的ASPath属性字段中的AS值被修改时,在该待发布BGP路由中增加该被修改的AS值对应的扩展团体属性字段以用于辅助进行环路检查,其中该扩展团体属性字段中至少包括该被修改的AS值和本网络设备的设备标识,基于此,向本网络设备的BGP邻居发布该待发布BGP路由,以使得本网络设备的BGP邻居在接收到该待发布BGP路由时,先基于该待发布BGP路由携带的ASPath属性字段中的AS值进行环路检查,在确定未出现环路时,再进一步基于该待发布BGP路由携带的扩展团体属性字段中的AS值进行环路检查,这样不仅能够实现自动化环路检查,避免了现有人工处理方式导致的诸如人工成本高、处理效率低等问题,还能够有效避免由于路由转发过程中ASPath属性字段中的AS值丢失而导致环路检查不准确的问题。
Smart Images

Figure CN120528857B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to loop inspection methods, apparatus and electronic equipment. Background Technology
[0002] In a network, when a route is forwarded across Autonomous Systems (AS) and then forwarded back to any of the ASs that the route passed through, the network device receiving the route will re-guide the forwarding of the route based on its local routing policy, thus forwarding the route again. This creates a loop channel that continuously forwards the route, resulting in a routing loop phenomenon. This phenomenon can seriously affect network performance.
[0003] Currently, in practical applications, the problem of routing loops is usually handled manually. However, manual handling has problems such as high labor costs and low processing efficiency. Summary of the Invention
[0004] In view of this, this application provides a loop inspection method, apparatus, and electronic equipment to automate loop inspection.
[0005] This application provides a loop detection method, which is applied to a network device, and the method includes:
[0006] After modifying the first AS value in the Autonomous System Path (ASPath) attribute field carried by the first Border Gateway Protocol (BGP) route to be published, add an extended community attribute field corresponding to the first AS value to the first BGP route to be published. The extended community attribute field corresponding to the first AS value includes at least the first AS value and the device identifier of this network device.
[0007] The first BGP route to be advertised is advertised to its BGP neighbors. When a BGP neighbor receives the first BGP route to be advertised, if it finds that the ASPath attribute field of the first BGP route contains an AS value matching its local AS number, it determines that a loop has occurred. If it finds that the ASPath attribute field of the first BGP route does not contain an AS value matching its local AS number, then if the extended community attribute field of the first BGP route contains an AS value matching its local AS number, it determines that a loop has occurred. If the extended community attribute field of the first BGP route does not contain an AS value matching its local AS number, it determines that no loop has occurred.
[0008] This application embodiment also provides a loop detection device, which is applied to a network device, and the device includes:
[0009] An additional module is added to the first BGP route to be published after the first AS value in the ASPath attribute field is modified. The extended community attribute field corresponding to the first AS value includes at least the first AS value and the device identifier of this network device.
[0010] The publishing module is used to publish the first BGP route to be published to BGP neighbors. When a BGP neighbor receives the first BGP route to be published, if it finds that the ASPath attribute field of the first BGP route to be published contains an AS value matching its local AS number, it determines that a loop has occurred. If it finds that the ASPath attribute field of the first BGP route to be published does not contain an AS value matching its local AS number, then if the extended community attribute field of the first BGP route to be published contains an AS value matching its local AS number, it determines that a loop has occurred. If the extended community attribute field of the first BGP route to be published does not contain an AS value matching its local AS number, it determines that no loop has occurred.
[0011] This application also provides an electronic device, which includes:
[0012] Processor; and
[0013] A computer-readable storage medium storing computer program instructions that, when executed by a processor, cause the processor to perform the steps of the method described above.
[0014] This application also provides a computer-readable storage medium storing computer program instructions that, when executed by a processor, cause the processor to perform the steps in the above method.
[0015] As can be seen from the above technical solutions, in this embodiment, when the AS value in the ASPath attribute field carried by the BGP route to be published is found to have been modified, an extended community attribute field corresponding to the modified AS value is added to the BGP route to be published to assist in loop checking. The extended community attribute field includes at least the modified AS value and the device identifier of the network device. Based on this, the BGP route to be published is published to the BGP neighbors of the network device. When the BGP neighbors of the network device receive the BGP route to be published, they first perform a loop check based on the AS value in the ASPath attribute field carried by the BGP route to be published. If no loop is found, they then further perform a loop check based on the AS value in the extended community attribute field carried by the BGP route to be published. This not only enables automated loop checking and avoids problems such as high labor costs and low processing efficiency caused by existing manual processing methods, but also effectively avoids the problem of inaccurate loop checking due to the loss of the AS value in the ASPath attribute field during route forwarding. Attached Figure Description
[0016] The accompanying drawings, which are incorporated in and form part of this application, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0017] Figure 1 This is a schematic diagram of the method flow provided in the embodiments of this application.
[0018] Figure 2 This is a schematic diagram of another method flow provided for an embodiment of this application.
[0019] Figure 3 This is a schematic diagram of another method flow provided in an embodiment of this application.
[0020] Figure 4 This is a schematic diagram of another method flow provided in an embodiment of this application.
[0021] Figure 5 This is a schematic diagram of another method flow provided in an embodiment of this application.
[0022] Figure 6 This is a schematic diagram of the device structure provided in the embodiments of this application.
[0023] Figure 7 This is a schematic diagram of the electronic device structure provided in an embodiment of this application. Detailed Implementation
[0024] To enable those skilled in the art to better understand the technical solutions provided in the embodiments of this application, and to make the above-mentioned objectives, features and advantages of the embodiments of this application more apparent and understandable, the technical solutions in the embodiments of this application will be further described in detail below with reference to the accompanying drawings.
[0025] See Figure 1 , Figure 1 This is a flowchart illustrating a loop detection method provided in an embodiment of this application. As one embodiment, this method is applied to a network device. Optionally, the network device may be a router or similar device; this embodiment does not specifically limit this.
[0026] like Figure 1 As shown, the process may include the following steps:
[0027] Step 101: After modifying the first AS value in the ASPath attribute field carried by the first BGP route to be published, add an extended community attribute field corresponding to the first AS value to the first BGP route to be published. The extended community attribute field corresponding to the first AS value includes at least the first AS value and the device identifier of this network device.
[0028] In this embodiment, the first BGP route to be published can refer to a BGP route to be published. This BGP route to be published can be, for example, a BGP route received by this network device or a BGP route generated by this network device. There is no specific limitation here.
[0029] The ASPath attribute field is an attribute information carried in a BGP route. The AS value in the ASPath attribute field indicates at least one AS that the BGP route has traversed since its publication. Here, AS can be understood as a combination of all Internet Protocol (IP) networks and network devices such as routers under the jurisdiction of one or more entities in the Internet; that is, the Internet is equivalent to being divided into multiple different ASs, where network devices under each AS typically implement the same routing policy.
[0030] As an example, when any network device prepares to send a BGP route across ASes—that is, when preparing to send a BGP route to network devices in ASes other than its own—it first adds the AS value, which identifies the AS it belongs to, to the ASPath attribute field of the BGP route before sending it out. In this way, the ASPath attribute field of the BGP route contains the AS values corresponding to each AS the BGP route has traversed since its publication.
[0031] Based on the above description, in this embodiment, loop checking can be performed based on the AS value in the ASPath attribute field carried by the BGP route. For example, as an embodiment, when the network device receives a BGP route, it can check whether the ASPath attribute field carried by the BGP route contains an AS value that matches the local AS number (i.e., the AS value corresponding to the AS where the network device is located). If it does, it means that the BGP route has been forwarded back to one of the ASs that the route has passed through, and it can be determined that the BGP route has a loop. Conversely, if it does not contain an AS value, it can be determined that the BGP route has not a loop.
[0032] However, during BGP route forwarding, the AS value in the ASPath attribute field may be lost. This can affect the accuracy of loop checks based on the AS value in the ASPath attribute field of the BGP route, causing loop checks to fail. For example, if AS1 in the ASPath attribute field of a BGP route is lost during forwarding, when the BGP route is forwarded back to AS1, because AS1 in the ASPath attribute field of the BGP route has been lost, the loop in the BGP route cannot be detected based on the ASPath attribute field, thus causing the loop check to fail.
[0033] Based on this, in order to avoid the problem of loop detection failure due to the loss of AS value in the ASPath attribute field, this embodiment further adds an extended community attribute field corresponding to each lost AS value to the BGP route when it is found that the AS value in the ASPath attribute field carried by the BGP route to be published is lost. The extended community attribute field corresponding to each lost AS value includes at least the lost AS value, so as to assist in loop detection.
[0034] Optionally, the extended community attribute field corresponding to the lost AS value may also include the device identifier of the network device, which is used to indicate that the AS value loss event occurred on the network device corresponding to the device identifier. This can help relevant technical personnel analyze which network device the AS value loss event occurred on based on the device identifier in the extended community attribute field carried by the BGP route, so as to use for corresponding business analysis, etc.
[0035] In this embodiment, there are many situations in which the AS value in the ASPath attribute field may be lost. For example, as an embodiment, when a BGP route is received or a BGP route is prepared to be sent to a BGP neighbor, the network device needs to modify the ASPath attribute field carried by the BGP route according to the routing policy configured in the network device based on actual application requirements. If the AS value in the ASPath attribute field carried by the BGP route is modified, this will cause the AS value in the ASPath attribute field carried by the BGP route to be lost. In this case, the modified AS value can be regarded as the lost AS value.
[0036] For example, suppose a BGP route to be published carries an ASPath attribute field that includes AS1, AS2, and AS3. If this network device modifies AS2 in the ASPath attribute field of this BGP route to AS5 based on a configured routing policy, then AS2 can be considered the modified AS value. Based on this, an extended community attribute field corresponding to AS2 can be added to the BGP route. This extended community attribute field must include at least the AS2 value for subsequent loop-aided checks.
[0037] Step 102: Publish the first BGP route to be published to the BGP neighbor. When the BGP neighbor receives the first BGP route to be published, if it finds that the ASPath attribute field of the first BGP route contains an AS value matching the local AS number, it determines that a loop has occurred; if it finds that the ASPath attribute field of the first BGP route does not contain an AS value matching the local AS number, then if the extended community attribute field of the first BGP route contains an AS value matching the local AS number, it determines that a loop has occurred; if the extended community attribute field of the first BGP route does not contain an AS value matching the local AS number, it determines that no loop has occurred.
[0038] In this embodiment, BGP neighbors can include neighbors within the AS where the network device is located (i.e., IBGP neighbors) and neighbors outside the AS where the network device is located (i.e., EBGP neighbors). Here, IBGP is an abbreviation for Internal Border Gateway Protocol, and EBGP is an abbreviation for External Border Gateway Protocol.
[0039] This concludes the process. Figure 1 The process is shown below.
[0040] pass Figure 1As can be seen from the process shown, in this embodiment of the application, when it is discovered that the AS value in the ASPath attribute field carried by the BGP route to be published has been modified, an extended community attribute field corresponding to the modified AS value is added to the BGP route to be published to assist in loop checking. The extended community attribute field includes at least the modified AS value and the device identifier of the network device. Based on this, the BGP route to be published is published to the BGP neighbors of the network device. When the BGP neighbors of the network device receive the BGP route to be published, they first perform a loop check based on the AS value in the ASPath attribute field carried by the BGP route to be published. If no loop is found, they then further perform a loop check based on the AS value in the extended community attribute field carried by the BGP route to be published. This not only realizes automated loop checking and avoids problems such as high labor costs and low processing efficiency caused by existing manual processing methods, but also effectively avoids the problem of inaccurate loop checking due to the loss of the AS value in the ASPath attribute field during route forwarding.
[0041] As an example, this application also provides a loop detection method. This method is applied to network devices. For example, see... Figure 2 As shown, the method includes the following steps:
[0042] Step 201: After deleting the second AS value from the ASPath attribute field carried by the second BGP route to be published, add an extended community attribute field corresponding to the second AS value to the second BGP route to be published. The extended community attribute field corresponding to the second AS value includes at least the second AS value and the device identifier of this network device.
[0043] In this embodiment, the second route to be published is similar to the first route to be published described above. For example, it can be a BGP route received by this network device or a BGP route generated by this network device.
[0044] In this embodiment, as one example, the loss of the AS value in the ASPath attribute field may also include the deletion of the AS value in the ASPath attribute field. Specifically, when a BGP route is received, or when preparing to send a BGP route to a BGP neighbor, the network device, based on actual application requirements and according to the routing policy configured in the network device, needs to delete at least one AS value in the ASPath attribute field carried by the BGP route. This will result in the loss of the AS value in the ASPath attribute field carried by the BGP route. In this case, the deleted AS value can be considered as the lost AS value.
[0045] Based on this, when the second AS value in the ASPath attribute field carried by the second BGP route to be published is deleted, in order to avoid the problem of loop check failure due to the loss of the AS value in the ASPath attribute field, this embodiment can add an extended community attribute field corresponding to the second AS value to the second BGP route to be published. Here, the extended community attribute field corresponding to the second AS value includes at least the second AS value and the device identifier of this network device, so as to be used for subsequent loop auxiliary checks.
[0046] For example, suppose a BGP route to be published carries an ASPath attribute field that includes AS1, AS2, and AS3. If this network device deletes AS1 from the ASPath attribute field of this BGP route based on a configured routing policy, then AS1 can be considered the deleted AS value. Based on this, an extended community attribute field corresponding to AS1 can be added to the BGP route. This extended community attribute field must include at least the AS1 value for subsequent loop-aided checks.
[0047] Step 202: Publish the second BGP route to be published to the BGP neighbor. When the BGP neighbor receives the second BGP route, if it finds that the ASPath attribute field of the second BGP route contains an AS value matching the local AS number, it determines that a loop has occurred; if it finds that the ASPath attribute field of the second BGP route does not contain an AS value matching the local AS number, then if the extended community attribute field of the second BGP route contains an AS value matching the local AS number, it determines that a loop has occurred; if the extended community attribute field of the second BGP route does not contain an AS value matching the local AS number, it determines that no loop has occurred.
[0048] This concludes the process. Figure 2 The process is shown below.
[0049] pass Figure 2As can be seen from the process shown, in this embodiment of the application, when it is discovered that the AS value in the ASPath attribute field carried by the BGP route to be published has been deleted, an extended community attribute field corresponding to the modified AS value is added to the BGP route to be published and the BGP route to be published is published to the BGP neighbor of the network device. The extended community attribute field includes at least the modified AS value. This allows the BGP neighbor of the network device to perform an auxiliary loop check based on the AS value in the ASPath attribute field carried by the BGP route to be published when it receives the BGP route to be published. After determining that no loop has occurred, the neighbor further performs an auxiliary loop check based on the AS value in the extended community attribute field carried by the BGP route to be published. This not only enables automated loop checking and avoids problems such as high labor costs and low processing efficiency caused by existing manual processing methods, but also effectively avoids the problem of inaccurate loop checks due to the loss of the AS value in the ASPath attribute field during route forwarding.
[0050] As an example, this application also provides a loop detection method. This method is applied to network devices. For example, see... Figure 3 As shown, the method includes the following steps:
[0051] Step 301: When converting the third BGP route to be published into the first IGP route, add an extended community attribute field corresponding to each AS value in the ASPath attribute field carried by the third BGP route to the first IGP route. The extended community attribute field corresponding to each AS value in the ASPath attribute field carried by the third BGP route to be published includes at least the AS value and the device identifier of this network device.
[0052] In this context, IGP stands for Interior Gateway Protocol.
[0053] In this embodiment, the third route to be published is similar to the first route to be published described above. For example, it can be a BGP route received by this network device or a BGP route generated by this network device.
[0054] In this embodiment, as one example, the loss of the AS value in the ASPath attribute field can also include the complete discarding of the entire ASPath attribute field. Specifically, when a BGP route is received, or when preparing to send a BGP route to a BGP neighbor, the network device converts the BGP route into an IGP route (i.e., an IGP route) based on actual application requirements. Since the ASPath attribute is a BGP attribute, and other protocols besides BGP, such as IGP, do not support the ASPath attribute, the IGP route does not contain the AS value from the ASPath attribute field of the BGP route after conversion. This results in the complete discarding of the ASPath attribute field in the BGP route, meaning the AS value in the ASPath attribute field carried by the BGP route is lost. Here, the lost AS value can be considered as all AS values in the ASPath attribute field carried by the BGP route.
[0055] Based on this, when converting the third BGP route to be published into the first IGP route, in order to avoid the problem of loop check failure due to the loss of AS value in the ASPath attribute field, this embodiment can add an extended community attribute field corresponding to each AS value in the ASPath attribute field carried by the third BGP route to be published to the first IGP route. Here, the extended community attribute field corresponding to each AS value in the ASPath attribute field carried by the third BGP route to be published includes at least the AS value and the device identifier of this network device, so as to be used for subsequent loop auxiliary checks.
[0056] For example, suppose a BGP route carries ASPath attribute fields including AS1, AS2, and AS3. If this network device converts this BGP route to an IGP route, as described above, the resulting IGP route will not contain the AS values from the ASPath attribute field of the original BGP route. That is, AS1, AS2, and AS3 can be considered lost AS values. Based on this, extended community attribute fields corresponding to AS1, AS2, and AS3 can be added to the BGP route for loop-aided checks.
[0057] Step 302: Publish the first IGP route to the BGP neighbor, so that when the BGP neighbor receives the first IGP route, if it finds that the extended community attribute field carried by the first IGP route contains an AS value that matches the local AS number, it determines that a loop has occurred; if it finds that the extended community attribute field carried by the first IGP route does not contain an AS value that matches the local AS number, it determines that no loop has occurred.
[0058] This concludes the process. Figure 3 The process is shown below.
[0059] pass Figure 3 As can be seen from the process shown, in this embodiment of the application, when a BGP route to be published is discovered to be converted into an IGP route, an extended community attribute field corresponding to all AS values in the ASPath attribute field of the BGP route to be published is added to the IGP route obtained after conversion, and the IGP route is published to the BGP neighbors of this network device. This enables the BGP neighbors of this network device to perform auxiliary loop checks based on the AS values in the extended community attribute field carried by the IGP route when they receive the IGP route. This not only realizes automated loop checks and avoids problems such as high labor costs and low processing efficiency caused by existing manual processing methods, but also effectively avoids the problem of inaccurate loop checks due to the loss of AS values in the ASPath attribute field during route forwarding.
[0060] As an example, this application also provides a loop detection method. This method is applied to network devices. For example, see... Figure 4 As shown, the method includes the following steps:
[0061] Step 401: Receive BGP routes.
[0062] Step 402: If the ASPath attribute field carried by the BGP route is found to contain an AS value that matches the local AS number, then a loop is determined to have occurred.
[0063] Step 403: If it is found that the ASPath attribute field carried by the BGP route does not contain an AS value that matches the local AS number, then if the extended community attribute field carried by the BGP route contains an AS value that matches the local AS number, it is determined that a loop has occurred; if the extended community attribute field carried by the BGP route does not contain an AS value that matches the local AS number, it is determined that no loop has occurred.
[0064] This concludes the process. Figure 4 The process is shown below.
[0065] pass Figure 4 As can be seen from the process shown, in this embodiment of the application, when a BGP route is received, a loop check is first performed based on the AS value in the ASPath attribute field carried by the BGP route to be published. If no loop is found, an auxiliary loop check is then performed based on the AS value in the extended community attribute field carried by the BGP route to be published. This not only enables automated loop checking and avoids problems such as high labor costs and low processing efficiency caused by existing manual processing methods, but also effectively avoids the problem of inaccurate loop checking due to the loss of AS value in the ASPath attribute field during route forwarding.
[0066] As an example, this application also provides a loop detection method. This method is applied to network devices. For example, see... Figure 5 As shown, the method includes the following steps:
[0067] Step 501: Receive the second IGP route.
[0068] Step 502: If the extended community attribute field carried by the second IGP route contains an AS value that matches the local AS number, then a loop is determined to have occurred.
[0069] Step 503: If it is found that the extended community attribute field carried by the second IGP route does not contain an AS value that matches the local AS number, then it is determined that no loop has occurred.
[0070] This concludes the process. Figure 5 The process is shown below.
[0071] pass Figure 5 As can be seen from the process shown, in this embodiment of the application, by performing auxiliary loop checks based on the AS value in the extended community attribute field carried by the IGP route when the IGP route is received, not only can automated loop checks be achieved, avoiding problems such as high labor costs and low processing efficiency caused by existing manual processing methods, but also the problem of inaccurate loop checks caused by the loss of AS value in the ASPath attribute field during route forwarding can be effectively avoided.
[0072] The following is a further description of the extended community attribute fields mentioned above:
[0073] In this embodiment, the size and content of the extended community attribute field are not specifically limited and can be flexibly set based on actual application needs. For example, as an embodiment, the size of the extended community attribute field can be set to 8 bytes, where the first byte can be used to record the loop auxiliary check identifier, the second byte can be used to record the type of content recorded in the next four bytes, the third to sixth bytes can be used to record the lost AS value, and the remaining two bytes can be used to record the device identifier of the network device.
[0074] The routing process after a loop is identified is described in further detail below:
[0075] In this embodiment, as one example, when a loop is determined to exist, a loop handling strategy can be executed to eliminate the loop. Optionally, this embodiment does not specifically limit the setting of the loop handling strategy, and it can be flexibly set based on actual application needs. For example, the route that causes the loop can be discarded, which can prevent it from continuing to circulate in the network, thereby achieving the purpose of eliminating the loop.
[0076] The routing process described above after confirming that no loops have occurred is further described below:
[0077] In this embodiment, as one example, when a loop is determined to occur, the route can be processed according to the configured routing policy. Optionally, this embodiment does not specifically limit the setting of the routing policy and can be flexibly set based on actual application needs. For example, the route can be recorded in the local routing table first, and then, when it is determined based on the configured routing policy that the route needs to be forwarded, the route can be forwarded to the BGP neighbor.
[0078] This concludes the description of the method provided in the embodiments of this application. The apparatus provided in the embodiments of this application will now be described:
[0079] As an example, this application also provides a loop detection device. For example, see... Figure 6 , Figure 6 This is a schematic diagram of a loop inspection device provided in an embodiment of this application. Figure 6 As shown, the loop detection device 600 is applied to network equipment. The loop detection device 600 includes: an addition module 601 and a publishing module 602.
[0080] The module 601 is added to the first BGP route to be published after the first AS value in the Autonomous System Path (ASPath) attribute field carried by the first BGP route to be published is modified. The extended community attribute field corresponding to the first AS value includes at least the first AS value and the device identifier of the network device.
[0081] The publishing module 602 is used to publish the first BGP route to be published to BGP neighbors, such that when the BGP neighbor receives the first BGP route to be published, if it finds that the ASPath attribute field carried by the first BGP route to be published contains an AS value that matches the local AS number, it determines that a loop has occurred; if it finds that the ASPath attribute field carried by the first BGP route to be published does not contain an AS value that matches the local AS number, it determines that a loop has occurred if the extended community attribute field carried by the first BGP route to be published contains an AS value that matches the local AS number; and if the extended community attribute field carried by the first BGP route to be published does not contain an AS value that matches the local AS number, it determines that no loop has occurred.
[0082] As an example, module 601 is further configured to add an extended community attribute field corresponding to the second AS value to the second BGP route to be published after deleting the second AS value in the ASPath attribute field carried by the second BGP route to be published. The extended community attribute field corresponding to the second AS value includes at least the second AS value and the device identifier of the network device.
[0083] The publishing module 602 is further configured to publish the second BGP route to be published to BGP neighbors, such that when the BGP neighbor receives the second BGP route to be published, if it finds that the ASPath attribute field carried by the second BGP route to be published contains an AS value that matches the local AS number, it determines that a loop has occurred; if it finds that the ASPath attribute field carried by the second BGP route to be published does not contain an AS value that matches the local AS number, it determines that a loop has occurred if the extended community attribute field carried by the second BGP route to be published contains an AS value that matches the local AS number; and if the extended community attribute field carried by the second BGP route to be published does not contain an AS value that matches the local AS number, it determines that no loop has occurred.
[0084] As an example, module 601 is further configured to add an extended community attribute field corresponding to each AS value in the ASPath attribute field carried by the third BGP route to be published to the first IGP route when the third BGP route to be published is converted into a first Interior Gateway Protocol (IGP) route. The extended community attribute field corresponding to each AS value in the ASPath attribute field carried by the third BGP route to be published includes at least the AS value and the device identifier of the network device.
[0085] The publishing module 602 is further configured to publish the first IGP route to BGP neighbors, such that when the BGP neighbor receives the first IGP route, if it finds that the extended community attribute field carried by the first IGP route contains an AS value that matches the local AS number, it determines that a loop has occurred; if it finds that the extended community attribute field carried by the first IGP route does not contain an AS value that matches the local AS number, it determines that no loop has occurred.
[0086] As one embodiment, the device further includes: a loop detection module;
[0087] The loop detection module is used to determine that a loop has occurred when a BGP route is received and the ASPath attribute field of the BGP route contains an AS value that matches the local AS number.
[0088] If the ASPath attribute field carried by the BGP route does not contain an AS value that matches the local AS number, then if the extended community attribute field carried by the BGP route contains an AS value that matches the local AS number, then a loop is determined to have occurred; if the extended community attribute field carried by the BGP route does not contain an AS value that matches the local AS number, then no loop is determined to have occurred.
[0089] As an example, the loop detection module is further configured to, when receiving a second IGP route, determine that a loop has occurred if the extended community attribute field carried by the second IGP route contains an AS value that matches the local AS number; and determine that no loop has occurred if the extended community attribute field carried by the second IGP route does not contain an AS value that matches the local AS number.
[0090] This concludes the process. Figure 6 Structural description of the device shown.
[0091] The specific implementation process of the functions and roles of each module in the above device can be found in the implementation process of the corresponding steps in the above method, and will not be repeated here.
[0092] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this application according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0093] Please see Figure 7 This is a schematic diagram of the hardware structure of an electronic device provided as an exemplary embodiment of this application. The electronic device includes a processor and a computer-readable storage medium; the computer-readable storage medium stores a plurality of computer program instructions, which, when executed by the processor, implement the method disclosed in the above example of this application. Depending on the actual function of the electronic device, other hardware may also be included, which will not be elaborated further.
[0094] Based on the same concept as the above method, this application also provides a computer-readable storage medium storing a plurality of computer program instructions, which, when executed by a processor, can implement the method disclosed in the above examples of this application.
[0095] For example, the aforementioned computer-readable storage medium can be any electronic, magnetic, optical, or other physical storage device that can contain or store information, such as executable instructions, messages, etc. For instance, computer-readable storage media can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or combinations thereof.
[0096] The above are merely preferred embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A loop detection method, characterized in that, This method is applied to network devices, and the method includes: After modifying the first AS value in the Autonomous System Path (ASPath) attribute field carried by the first BGP route to be published, add an extended community attribute field corresponding to the first AS value to the first BGP route to be published. The extended community attribute field corresponding to the first AS value includes at least the first AS value and the device identifier of this network device. The first BGP route to be advertised is advertised to its BGP neighbors. When a BGP neighbor receives the first BGP route to be advertised, if it finds that the ASPath attribute field of the first BGP route contains an AS value matching its local AS number, it determines that a loop has occurred. If it finds that the ASPath attribute field of the first BGP route does not contain an AS value matching its local AS number, then if the extended community attribute field of the first BGP route contains an AS value matching its local AS number, it determines that a loop has occurred. If the extended community attribute field of the first BGP route does not contain an AS value matching its local AS number, it determines that no loop has occurred.
2. The method according to claim 1, characterized in that, The method also includes: After deleting the second AS value from the ASPath attribute field carried by the second BGP route to be published, add an extended community attribute field corresponding to the second AS value to the second BGP route to be published. The extended community attribute field corresponding to the second AS value includes at least the second AS value and the device identifier of this network device. The second BGP route to be advertised is advertised to its BGP neighbors. When a BGP neighbor receives the second BGP route to be advertised, if it finds that the ASPath attribute field of the second BGP route contains an AS value matching its local AS number, it determines that a loop has occurred. If it finds that the ASPath attribute field of the second BGP route does not contain an AS value matching its local AS number, then if the extended community attribute field of the second BGP route contains an AS value matching its local AS number, it determines that a loop has occurred. If the extended community attribute field of the second BGP route does not contain an AS value matching its local AS number, it determines that no loop has occurred.
3. The method according to claim 1, characterized in that, The method also includes: When a third BGP route to be published is converted into a first Interior Gateway Protocol (IGP) route, an extended community attribute field corresponding to each AS value in the ASPath attribute field carried by the third BGP route to be published is added to the first IGP route. The extended community attribute field corresponding to each AS value in the ASPath attribute field carried by the third BGP route to be published includes at least the AS value and the device identifier of this network device. The first IGP route is advertised to BGP neighbors, such that when the BGP neighbor receives the first IGP route, if it finds that the extended community attribute field carried by the first IGP route contains an AS value that matches the local AS number, it determines that a loop has occurred; if it finds that the extended community attribute field carried by the first IGP route does not contain an AS value that matches the local AS number, it determines that no loop has occurred.
4. The method according to claim 1, characterized in that, The method also includes: When a BGP route is received, if the ASPath attribute field carried by the BGP route contains an AS value that matches the local AS number, a loop is determined to have occurred. If the ASPath attribute field carried by the BGP route does not contain an AS value that matches the local AS number, then if the extended community attribute field carried by the BGP route contains an AS value that matches the local AS number, then a loop is determined to have occurred; if the extended community attribute field carried by the BGP route does not contain an AS value that matches the local AS number, then no loop is determined to have occurred.
5. The method according to claim 1, characterized in that, The method also includes: When a second IGP route is received, if the extended community attribute field carried by the second IGP route contains an AS value that matches the local AS number, a loop is determined to have occurred; if the extended community attribute field carried by the second IGP route does not contain an AS value that matches the local AS number, a loop is determined not to have occurred.
6. A loop inspection device, characterized in that, This device is used in network equipment and includes: An additional module is added to the first BGP route to be published after the first AS value in the Autonomous System Path (ASPath) attribute field carried by the first BGP route to be published is modified. The extended community attribute field corresponding to the first AS value includes at least the first AS value and the device identifier of the network device. The publishing module is used to publish the first BGP route to be published to BGP neighbors. When a BGP neighbor receives the first BGP route to be published, if it finds that the ASPath attribute field of the first BGP route to be published contains an AS value matching its local AS number, it determines that a loop has occurred. If it finds that the ASPath attribute field of the first BGP route to be published does not contain an AS value matching its local AS number, then if the extended community attribute field of the first BGP route to be published contains an AS value matching its local AS number, it determines that a loop has occurred. If the extended community attribute field of the first BGP route to be published does not contain an AS value matching its local AS number, it determines that no loop has occurred.
7. The apparatus according to claim 6, characterized in that, The adding module is further configured to add an extended community attribute field corresponding to the second AS value to the second BGP route to be published after deleting the second AS value in the ASPath attribute field carried by the second BGP route to be published. The extended community attribute field corresponding to the second AS value includes at least the second AS value and the device identifier of this network device. The publishing module is further configured to publish the second BGP route to be published to BGP neighbors, such that when the BGP neighbor receives the second BGP route to be published, if it finds that the ASPath attribute field carried by the second BGP route to be published contains an AS value that matches the local AS number, it determines that a loop has occurred; if it finds that the ASPath attribute field carried by the second BGP route to be published does not contain an AS value that matches the local AS number, it determines that a loop has occurred if the extended community attribute field carried by the second BGP route to be published contains an AS value that matches the local AS number; and if the extended community attribute field carried by the second BGP route to be published does not contain an AS value that matches the local AS number, it determines that no loop has occurred.
8. The apparatus according to claim 6, characterized in that, The addition module is further configured to, when converting the third BGP route to be published into the first Interior Gateway Protocol (IGP) route, add an extended community attribute field corresponding to each AS value in the ASPath attribute field carried by the third BGP route to the first IGP route. The extended community attribute field corresponding to each AS value in the ASPath attribute field carried by the third BGP route to be published includes at least the AS value and the device identifier of the network device. The publishing module is further configured to publish the first IGP route to BGP neighbors, so that when the BGP neighbor receives the first IGP route, if it finds that the extended community attribute field carried by the first IGP route contains an AS value that matches the local AS number, it determines that a loop has occurred; if it finds that the extended community attribute field carried by the first IGP route does not contain an AS value that matches the local AS number, it determines that no loop has occurred. And / or, The device also includes: a loop inspection module; The loop detection module is used to determine that a loop has occurred when a BGP route is received and the ASPath attribute field of the BGP route contains an AS value that matches the local AS number. If the ASPath attribute field carried by the BGP route does not contain an AS value that matches the local AS number, then if the extended community attribute field carried by the BGP route contains an AS value that matches the local AS number, then a loop is determined to have occurred; if the extended community attribute field carried by the BGP route does not contain an AS value that matches the local AS number, then no loop is determined to have occurred. And / or, The loop detection module is further configured to, when receiving a second IGP route, determine if a loop has occurred if the extended community attribute field carried by the second IGP route contains an AS value that matches the local AS number; and determine if no loop has occurred if the extended community attribute field carried by the second IGP route does not contain an AS value that matches the local AS number.
9. An electronic device, characterized in that, The electronic device includes: Processor; and A computer-readable storage medium storing computer program instructions that, when executed by the processor, cause the processor to perform the steps of the method according to any one of claims 1 to 5.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions that, when executed by a processor, cause the processor to perform the steps of the method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
BGP route leakage detection method and system based on block chain
CN113395208A
Method, equipment and system for detecting routing loop
CN114338508A