Method, device and network equipment for detecting BGP session status

The Seamless Bidirectional Forwarding Detection (SBFD) protocol simplifies BGP session status detection in BGP and BFD association, solves the problems of configuration complexity and high resource usage, and achieves fast link failure detection and BGP route convergence.

CN114765621BActive Publication Date: 2024-10-18HUAWEI TECH CO LTD

Patent Information

Application Number
CN202011632592.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-31
Publication Date
2024-10-18
Estimated Expiration
2040-12-31

AI Technical Summary

Technical Problem

When using BGP and BFD association, the configuration is complex and resource usage is high. Especially in delay-sensitive networks, existing technologies are difficult to quickly detect link failures, resulting in delayed BGP route convergence.

Method used

The Seamless Bidirectional Forwarding Detection (SBFD) protocol is used to send SBFD messages to the second network device through the first network device as the initiator, and determine the BGP session status based on the feedback, reducing configuration complexity and resource usage.

Benefits of technology

It realizes rapid detection of link failures, simplifies BGP session status detection, reduces configuration complexity and resource occupation, and improves BGP route convergence speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114765621B_ABST
    Figure CN114765621B_ABST
Patent Text Reader

Abstract

The present application provides a method, device and network device for detecting the status of a BGP session, and belongs to the field of network communication technology. The method is applied to a first network device, and the first network device and the second network device are in a BGP neighbor relationship. The method includes: the first network device creates an SBFD session, and the SBFD session is an SBFD session corresponding to the BGP session between the first network device and the second network device. The first network device is the initiator of the SBFD session, and the second network device is the reflector of the SBFD session. The BGP session is a session created based on the BGP neighbor relationship. The first network device sends an SBFD message to the second network device based on the SBFD session, and the first network device determines the status of the BGP session based on the feedback of the second network device to the SBFD message. By adopting the present application, the configuration of both parties of the BPG session can be simplified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network communication technology, and in particular to a method, device and network equipment for detecting the state of a Border Gateway Protocol (BGP) session. Background Art

[0002] BGP is a distance vector routing protocol that makes routes between autonomous systems (AS) reachable and selects the best route. In the BGP routing protocol, after the first network device establishes a BGP session with the second network device, the first network device and the second network device use a slow hello message mechanism to detect link failures. The slow hello message transmission interval is usually in seconds. In this way, in a network that is sensitive to latency, fault detection in seconds is unacceptable. At this time, bidirectional forwarding detection (BFD) came into being. BFD can provide millisecond-level fault detection and achieve rapid detection of link failures. Therefore, through the linkage of BGP and BFD, the first network device and the second network device can quickly perceive link failures, thereby converging BGP routes.

[0003] When using BFD, usually after creating a BGP session, the first network device and the second network device configure the configuration parameters required to create the BFD session to create the BFD session. In this way, since both parties of the BGP session need to add new configurations, the configuration will be complicated. Summary of the invention

[0004] The present application provides a method, apparatus and network device for detecting the state of a BGP session, so as to simplify the configuration of both parties of a BGP session when detecting the state of the BGP session.

[0005] In a first aspect, the present application provides a method for detecting the state of a BGP session, the method being applied to a first network device, the first network device and a second network device being in a BGP neighbor relationship, the method comprising:

[0006] The first network device creates a Seamless Bidirectional Forwarding Detection (SBFD) session, where the SBFD session is a SBFD session corresponding to a BGP session between the first network device and the second network device, where the first network device is the initiator of the SBFD session, and the second network device is the reflector of the SBFD session, and the BGP session is a session created based on a BGP neighbor relationship. The first network device sends an SBFD message to the second network device based on the SBFD session, and the first network device determines the state of the BGP session based on the feedback of the second network device to the SBFD message.

[0007] In the scheme shown in the present application, the method for detecting the state of a BGP session is executed by a first network device, the first network device and the second network device are in a BGP neighbor relationship, and the first network device and the second network create a BGP session corresponding to the BGP neighbor relationship. The first network device creates an SBFD session corresponding to the BGP session, and the SBFD session is an SBFD session between the first network device and the second network device. The first network device sends an SBFD message to the second network device based on the SBFD session, and the SBFD message is an SBFD control message or an SBFD echo message. The first network device can determine the state of the BGP session based on the feedback of the second network device to the SBFD message. In this way, since the reflector only needs to feedback the SBFD message and does not need to create an SBFD session, only the content required to create the SBFD session is configured at the initiator, and the reflector does not need to configure the content required to create the SBFD session, which can reduce the configuration content.

[0008] In a possible implementation, the first network device is a route reflector (RR), and the second network device is a router; or the first network device is a router, and the second network device is a RR; or both the first network device and the second network device are routers. In this way, the method for detecting the state of a BGP session can be adapted to scenarios including RR and scenarios not including RR.

[0009] In a possible implementation, the remaining processing capacity of the first network device is not less than the remaining processing capacity of the second network device. In this way, even if the network device with high remaining processing capacity occupies processing resources when creating an SBFD session, the impact on the network device processing service messages is relatively small.

[0010] In a possible implementation, the method also includes: the first network device receives configuration parameters of an SBFD session statically configured for a BGP session; or, the first network device obtains neighbor information of a dynamically created BGP session, the neighbor information including the configuration parameters of the SBFD session; wherein the configuration parameters are parameters used by the first network device to create the SBFD session; the first network device creates the SBFD session, including: the first network device creates the SBFD session based on the configuration parameters.

[0011] In the solution shown in the present application, the first network device can receive the configuration parameters of the SBFD session statically configured for the BGP session, or the first network device can obtain the neighbor information of the dynamically created BGP session, and the neighbor information includes the configuration parameters of the SBFD session. For example, the configuration information includes the address of the second network device when the BGP session is created. The first network device can use the configuration parameters to create the SBFD session corresponding to the BGP session. In this way, the configuration parameters used to create the SBFD session can be obtained in a variety of ways.

[0012] In a possible implementation, the first network device determines the state of the BGP session based on the feedback of the second network device to the SBFD message, including: the first network device receives the SBFD message sent by the second network device; the first network device determines the state of the BGP session based on the state information in the SBFD message sent by the second network device.

[0013] In the solution shown in the present application, when a first network device receives an SBFD message sent by a second network device, the first network device can use the status information in the SBFD message to determine the status indicated by the status information, and determine the status of the BGP session based on the status, so that the status of the BGP session can be accurately determined.

[0014] In one possible implementation, the first network device determines the state of the BGP session based on the feedback of the second network device on the SBFD message, including: if the first network device does not receive the SBFD message looped back by the second network device based on the SBFD message within the target time length, then determining that the state of the BGP session is disconnected; if the first network device receives the SBFD message looped back by the second network device based on the SBFD message within the target time length, then determining that the state of the BGP session is connected.

[0015] In the solution shown in the present application, after the first network device sends an SBFD message to the second network device, if the SBFD message looped back by the second network device is not received for a long time (such as the target duration), the state of the BGP session can be determined to be disconnected. If the SBFD message looped back by the second network device is received within the target duration, the state of the BGP session can be determined to be connected. In this way, the state of the BGP session can be accurately determined based on whether the looped SBFD message is received.

[0016] In a possible implementation, the first network device sends an SBFD message to the second network device based on the SBFD session, including: the first network device sends N SBFD messages to the second network device based on the SBFD session; the first network device determines the state of the BGP session based on the feedback of the second network device on the SBFD message, including: if the number of SBFD messages received by the first network device from the second network device based on the N SBFD messages is less than M, then the state of the BGP session is determined to be disconnected; if the number of SBFD messages received by the first network device from the second network device based on the N SBFD messages is greater than or equal to M, then the state of the BGP session is determined to be connected, wherein M is less than or equal to N, and M and N are both positive integers.

[0017] In the solution shown in the present application, the first network device can send N SBFD messages to the second network device based on the SBFD session. The first network device determines the number of SBFD messages looped back by the second network device among the N SBFD messages. If the number of looped back SBFD messages is less than M, it can be determined that the state of the BGP session is disconnected. If the number of looped back SBFD messages is greater than or equal to M, the state of the BGP session is determined to be connected. M is less than or equal to N, and both are positive integers. In this way, the state of the BGP session can be determined using the looped back SBFD messages.

[0018] In a possible implementation manner, the first network device is directly connected or indirectly connected to the second network device.

[0019] In a possible implementation, the method further includes: the first network device obtains a descriptor of the second network device; the first network device sends an SBFD message to the second network device based on the SBFD session, including: the first network device sends an SBFD message including a descriptor to the second network device based on the SBFD session.

[0020] In the solution shown in the present application, the first network device can obtain the descriptor published by the second network device from the second network device, or the descriptor can be statically configured on the first network device. When the first network device sends an SBFD message to the second network device, it sends an SBFD message including the descriptor to the second network device. In this way, it can accurately indicate that the SBFD message is sent to the second network device.

[0021] In a second aspect, the present application provides a method for detecting the status of a BGP session, which is applied to a second network device, and the second network device establishes a BGP neighbor relationship with the first network device. The method includes: the second network device receives an SBFD message sent by the first network device based on seamless bidirectional forwarding to detect an SBFD session, wherein the SBFD session is an SBFD session created by the first network device, and is an SBFD session corresponding to the BGP session between the first network device and the second network device, the first network device is an initiator of the SBFD session, the second network device is a reflector of the SBFD session, and the BGP session is a session created based on the BGP neighbor relationship; the second network device feeds back the SBFD message, so that the first network device determines the status of the BGP session based on the feedback of the second network device on the SBFD message.

[0022] In the solution shown in the present application, the second network device receives an SBFD message sent by the first network device based on an SBFD session. The SBFD session is an SBFD session created by the first network device and is an SBFD session corresponding to the BGP session between the first network device and the second network device. The second network device can provide feedback on the SBFD message. The first network device can determine the state of the BGP session based on the feedback of the second network device on the SBFD message. In this way, since the second network device only needs to feedback the SBFD message and is not the initiator of the SBFD session, the content of the configured SBFD is relatively small, simplifying the configuration.

[0023] In a possible implementation, the remaining processing capacity of the first network device is not less than the remaining processing capacity of the second network device. In this way, even if the network device with high remaining processing capacity occupies processing resources when creating an SBFD session, the impact on the network device processing service messages is relatively small.

[0024] In a possible implementation, the second network device feeds back the SBFD message, including: the second network device sends a SBFD message including status information to the first network device, so that the first network device determines the status of the BGP session based on the status information; wherein the status indicated by the status information is the current status of the second network device.

[0025] In the solution shown in the present application, after the second network device receives the SBFD message sent by the first network device, it can determine the current state. The second network device sends an SBFD message including state information to the first network device, and the state indicated by the state information is the current state of the second network device. After the first network device receives the SBFD message, it can determine the state of the BGP session based on the state information in the SBFD message. In this way, the state of the BGP session can be determined based on the state information fed back by the second network device.

[0026] In a possible implementation manner, the second network device feeds back the SBFD message, including: the second network device loops back the SBFD message to the first network device.

[0027] In the solution shown in the present application, after receiving the SBFD message sent by the first network device, the second network device can directly loop back the SBFD message sent by the first network device to the first network device. In this way, the first network device can use the looped SBFD message to determine the state of the BGP session.

[0028] In a possible implementation, the SBFD message received by the second network device includes a descriptor of the second network device; and the second network device feeds back the SBFD message, including: based on the descriptor of the second network device included in the SBFD message, the second network device feeds back the SBFD message.

[0029] In the solution shown in the present application, the SBFD message sent by the first network device includes the descriptor of the second network device, and the second network device can determine whether the descriptor in the SBFD message is its own descriptor. If it is its own descriptor, it can determine that the SBFD message is a message for feedback and provide feedback to the SBFD message. In this way, the SBFD message sent to itself can be accurately fed back.

[0030] In a third aspect, the present application provides an apparatus for detecting the status of a BGP session, the apparatus being applied to a first network device, the apparatus comprising one or more modules, and the one or more modules being used to implement the method described in the first aspect above.

[0031] In a fourth aspect, the present application provides an apparatus for detecting the status of a BGP session, the apparatus being applied to a second network device, the apparatus comprising one or more modules, and the one or more modules being used to implement the method described in the second aspect above.

[0032] In a fifth aspect, the present application provides a network device, comprising a memory and a processor, wherein the memory is used to store computer instructions; the processor executes the computer instructions stored in the memory to implement the method described in the first aspect above.

[0033] In a sixth aspect, the present application provides a computer-readable storage medium storing a computer program code. When the computer program code is executed by a network device, the network device implements the method described in the first aspect above, or enables the computing device to implement the functions of the apparatus of the third aspect and its possible implementation methods.

[0034] In the seventh aspect, the present application provides a computer program product, which includes a computer program code. When the computer program code is executed by a network device, the network device implements the method described in the first aspect above, or enables the computing device to implement the functions of the apparatus of the third aspect and its possible implementation methods.

[0035] In an eighth aspect, the present application provides a network device, comprising a memory and a processor, wherein the memory is used to store computer instructions; the processor executes the computer instructions stored in the memory to implement the method described in the second aspect above.

[0036] In the ninth aspect, the present application provides a computer-readable storage medium storing a computer program code. When the computer program code is executed by a network device, the network device implements the method described in the second aspect above, or enables the computing device to implement the functions of the apparatus of the fourth aspect and its possible implementation methods.

[0037] In the tenth aspect, the present application provides a computer program product, which includes a computer program code. When the computer program code is executed by a network device, the network device implements the method described in the second aspect above, or enables the computing device to implement the functions of the apparatus of the fourth aspect and its possible implementation methods.

[0038] In the eleventh aspect, the present application provides a system for detecting the status of a BGP session, the system comprising a first network device and a second network device, the first network device being a network device to which the apparatus described in the third aspect is applied, and the second network device being a network device to which the apparatus described in the fourth aspect is applied. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 is a structural diagram of a first network device provided by an exemplary embodiment of the present application;

[0040] Figure 2 is a structural diagram of a first network device provided by an exemplary embodiment of the present application;

[0041] Figure 3 is a structural diagram of a second network device provided by an exemplary embodiment of the present application;

[0042] Figure 4 is a structural diagram of a second network device provided by an exemplary embodiment of the present application;

[0043] Figure 5 It is a flowchart of a method for detecting the state of a BGP session provided by an exemplary embodiment of the present application;

[0044] Figure 6 It is a flowchart of a method for detecting the state of a BGP session provided by an exemplary embodiment of the present application;

[0045] Figure 7 is a schematic diagram of a first network device directly connected to a second network device provided by an exemplary embodiment of the present application;

[0046] Figure 8 is a schematic diagram of a first network device and a second network device that are not directly connected, provided by an exemplary embodiment of the present application;

[0047] Fig. 9 It is an interactive schematic diagram of detecting the state of a BGP session provided by an exemplary embodiment of the present application;

[0048] Fig.10 is a schematic diagram of a scenario applied to RR provided by an exemplary embodiment of the present application;

[0049] Fig.11 is a schematic diagram of a scenario applied to RR provided by an exemplary embodiment of the present application;

[0050] Fig.12 is a schematic diagram of a scenario applied to non-RR provided by an exemplary embodiment of the present application;

[0051] Fig.13 It is a structural diagram of an apparatus for detecting the state of a BGP session provided by an exemplary embodiment of the present application;

[0052] Fig.14 It is a structural diagram of an apparatus for detecting the state of a BGP session provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0053] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0054] In order to facilitate the understanding of the embodiments of the present application, the concepts of the terms involved are first introduced below:

[0055] 1. BGP neighbor relationship refers to the two network devices that have established a BGP session.

[0056] 2. SBFD is a fast detection protocol. SBFD achieves reachable detection by rapidly and continuously publishing protocol messages. SBFD is divided into an initiator and a reflector. The initiator can create an SBFD session. For more information about SBFD, see RFC7880, the entire contents of which are incorporated herein by reference as if fully stated.

[0057] In the BGP routing protocol, the first network device and the second network device establish a BGP session, and both the first network device and the second network device configure BFD parameters, and the first network device and the second network device use the BFD parameters to create a BFD session. Since BFD can provide millisecond-level fault detection, it can achieve rapid detection of link faults, so that the first network device and the second network device can quickly perceive the link fault, thereby achieving BGP routing convergence. However, since both parties in the BGP session need to configure BFD parameters, there will be more configuration content, which is inconvenient in deployment, especially when the BGP neighbors are cross-operator.

[0058] Moreover, in some scenarios, when many BGP sessions are created on a network device (such as RR), BFD occupies more resources in the network device. Especially for devices with poor performance, excessive resource occupation may cause systemic problems, such as failure to forward packets normally.

[0059] Based on the above problem, the embodiment of the present application provides a method for detecting the state of a BGP session. The method for detecting the state of a BGP session can be implemented by a device for detecting the state of a BGP session, and the device can be a hardware device, that is, a first network device and a second network device. The first network device can be a router, a switch, etc., and the second network device can also be a router, a switch, etc. The device can also be a software device, such as a set of software programs running on a hardware device.

[0060] The embodiment of the present application also provides a structural diagram of the first network device. Figure 1 A possible architecture diagram of the first network device 100 is provided by way of example.

[0061] The first network device 100 includes a memory 101, a processor 102, a communication interface 103 and a bus 104. The memory 101, the processor 102 and the communication interface 103 are connected to each other through the bus 104.

[0062] The memory 101 may be a read only memory (ROM), a static storage device, a dynamic storage device or a random access memory (RAM). The memory 101 may store a program. When the program stored in the memory 101 is executed by the processor 102, the processor 102 and the communication interface 103 are used to execute the method for detecting the state of the BGP session. The memory 101 may also store data required or generated in the process of detecting the state of the BGP session, such as storing routing information.

[0063] The processor 102 may be a general-purpose central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), a graphics processing unit (GPU), or one or more integrated circuits.

[0064] The processor 102 may also be an integrated circuit chip with signal processing capabilities. In the implementation process, some or all of the functions of the device for detecting the state of the BGP session of the present application may be completed by the hardware integrated logic circuit or software instructions in the processor 102. The above-mentioned processor 102 may also be a general-purpose processor, a digital signal processor (digital signal processing, DSP), an application-specific integrated circuit, a field programmable gate array (field programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in a decoding processor. The software module may be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 101, and the processor 102 reads the information in the memory 101, and combines its hardware to complete part of the functions of the device for detecting the state of the BGP session in the embodiment of the present application.

[0065] The communication interface 103 uses a transceiver module such as, but not limited to, a transceiver to implement communication between the first network device 100 and other devices or communication networks. For example, feedback on SBFD messages can be received through the communication interface 103 .

[0066] The bus 104 may include a path for transmitting information between various components of the first network device 100 (eg, the memory 101 , the processor 102 , and the communication interface 103 ).

[0067] like Figure 2 As shown, the embodiment of the present application also provides another structural schematic diagram of a first network device. The first network device 200 includes a main control board 201 and an interface board 202. The main control board 201 belongs to the control plane of the first network device 200, and the interface board 202 belongs to the data plane of the first network device 200. The main control board 201 includes a processor 2011 and a memory 2012. The interface board 202 includes a processor 2021, a memory 2022 and an interface card 2023. A communication connection is established between the main control board 201 and the interface board 202.

[0068] The processor 2011 may be a CPU, an ASIC, etc. The processor 2011 may include one or more chips. The memory 2012 may be a ROM, a static storage device, a dynamic storage device, or a RAM. The memory 2012 may store computer instructions. When the computer instructions stored in the memory 2012 are executed by the processor 2011, the processor 2011 executes the method for detecting the state of the BGP session.

[0069] The processor 2021 may be a CPU, an ASIC, etc. The processor 2021 may include one or more chips. The memory 2022 may be a ROM, a static storage device, a dynamic storage device, or a RAM. The memory 2022 may store computer instructions. When the computer instructions stored in the memory 2022 are executed by the processor 2021, the processor 2021 executes the method for detecting the state of the BGP session. The interface card 2023 may implement the reception and transmission processing of the SBFD message.

[0070] The embodiment of the present application also provides a structural diagram of a second network device. Figure 3 A possible architecture diagram of the second network device 300 is provided by way of example.

[0071] The second network device 300 includes a memory 301 , a processor 302 , a communication interface 303 and a bus 304 . The memory 301 , the processor 302 , and the communication interface 303 are connected to each other through the bus 304 .

[0072] The memory 301 may be a ROM, a static storage device, a dynamic storage device or a RAM. The memory 301 may store a program. When the program stored in the memory 301 is executed by the processor 302, the processor 302 and the communication interface 303 are used to execute the method for detecting the state of the BGP session. The memory 301 may also store data required or generated in the process of executing the detection of the state of the BGP session, such as storing routing information.

[0073] The processor 302 may be a general-purpose CPU, a microprocessor, an ASIC, a GPU, or one or more integrated circuits.

[0074] The processor 302 may also be an integrated circuit chip with signal processing capability. In the implementation process, some or all functions of the device for detecting the state of the BGP session of the present application may be completed by the hardware integrated logic circuit or software instructions in the processor 302. The above-mentioned processor 302 may also be a general-purpose processor, a DSP, an application-specific integrated circuit, an FPGA or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. The methods, steps and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed by a hardware decoding processor, or may be executed by a combination of hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 301, and the processor 302 reads the information in the memory 301, and completes part of the functions of the device for detecting the state of the BGP session of the embodiment of the present application in combination with its hardware.

[0075] The communication interface 303 uses a transceiver module such as, but not limited to, a transceiver to implement communication between the second network device 300 and other devices or communication networks. For example, feedback on the SBFD message can be received through the communication interface 303 .

[0076] The bus 304 may include a path for transmitting information between various components of the second network device 300 (eg, the memory 301 , the processor 302 , and the communication interface 303 ).

[0077] like Figure 4As shown, the embodiment of the present application also provides a structural schematic diagram of another second network device. The second network device 400 includes a main control board 401 and an interface board 402. The main control board 401 belongs to the control plane of the second network device 400, and the interface board 402 belongs to the data plane of the second network device 400. The main control board 401 includes a processor 4011 and a memory 4012. The interface board 402 includes a processor 4021, a memory 4022 and an interface card 4023. A communication connection is established between the main control board 401 and the interface board 402.

[0078] The processor 4011 may be a CPU, an ASIC, etc. The processor 4011 may include one or more chips. The memory 4012 may be a ROM, a static storage device, a dynamic storage device, or a RAM. The memory 4012 may store computer instructions. When the computer instructions stored in the memory 4012 are executed by the processor 4011, the processor 4011 executes the method for detecting the state of the BGP session.

[0079] The processor 4021 may be a CPU, an ASIC, etc. The processor 4021 may include one or more chips. The memory 4022 may be a ROM, a static storage device, a dynamic storage device, or a RAM. The memory 4022 may store computer instructions. When the computer instructions stored in the memory 4022 are executed by the processor 4021, the processor 4021 executes the method for detecting the state of the BGP session. The interface card 4023 may implement the reception and transmission processing of the SBFD message.

[0080] Before describing the process of the method for detecting the status of a BGP session, possible application scenarios are provided:

[0081] Scenario 1: The method for detecting the state of a BGP session is applied to a RR scenario. In the RR scenario, the first network device is an RR, and the second network device is a router or a switch, or the first network device is a router or a switch, and the second network device is an RR.

[0082] Scenario 2: The method for detecting the state of a BGP session is applied to a non-RR scenario. In the non-RR scenario, the first network device is a router, the second network device is a router, or the first network device is a switch, the second network device is a switch.

[0083] The following will be combined Figure 5 The method for detecting a BGP session provided in an embodiment of the present application is described, and the method is executed by a first network device. Figure 5 As shown, the processing flow of this method is as follows:

[0084] Step 501: A first network device creates an SBFD session, wherein the SBFD session is an SBFD session corresponding to a BGP session between the first network device and a second network device, the first network device is an initiator of the SBFD session, and the second network device is a reflector of the SBFD session.

[0085] The first network device and the second network device are in a BGP neighbor relationship, that is, the first network device is a BGP neighbor of the second network device, and the second network device is a BGP neighbor of the first network device. A BGP session is established between the first network device and the second network device. The BGP session is a session created based on the BGP neighbor relationship.

[0086] In this embodiment, the first network device acts as the initiator of the SBFD session, and the second network device acts as the reflector of the SBFD session. The reflector has no mechanism for detecting the BGP session and will not actively create an SBFD session. After the BGP session is established between the first network device and the second network device, the first network device creates an SBFD session corresponding to the BGP session. Since the BGP session belongs to the first network device and the second network device, the SBFD session belongs to the SBFD session corresponding to the BGP session between the first network device and the second network device. The meaning of the SBFD session corresponding to the BGP session here is: a binding relationship is established between the BGP session and the SBFD session, and the status of the BGP session can be detected through the SBFD session. The status of the BGP session includes connection and disconnection.

[0087] Optionally, when the first network device creates an SBFD session corresponding to the BGP session, it can also negotiate with the second network device the minimum SBFD message sending time interval supported by both parties, and the minimum SBFD message receiving time interval supported by both parties, where the units of the sending time interval and the receiving time interval are both microseconds.

[0088] Step 502: The first network device sends an SBFD message to the second network device based on the SBFD session.

[0089] In this embodiment, after the first network device creates the SBFD session, the first network device may send an SBFD message to the second network device when the condition for detecting the state of the BGP session is met. The SBFD message is an SBFD control message or an SBFD echo message.

[0090] Optionally, the condition for detecting the state of the BGP session is that: the first network device detects that the period for detecting the state of the BGP session is reached, or the first network device receives an instruction for detecting the state of the BGP session sent by the management node. The period for detecting the state of the BGP session here can be preset, and can be at the microsecond level, such as 10 microseconds. The management node here is used to manage the network to which the first network device belongs, and the management node establishes a communication connection with the first network device.

[0091] When the link between the first network device and the second network device is normal, the second network device can receive the SBFD message sent by the first network device and can feedback the SBFD message. When the link between the first network device and the second network device fails or the second network device fails, the second network device cannot receive the SBFD message and will not feedback the SBFD message.

[0092] Exemplarily, the SBFD message may be a message in a user datagram protocol (UDP) format.

[0093] Step 503: The first network device determines the state of the BGP session based on the feedback of the second network device to the SBFD message.

[0094] In this embodiment, each time after the first network device sends out an SBFD message, the first network device determines the feedback of the second network device to the SBFD message, and determines the state of the BGP session based on the feedback.

[0095] In addition, in some cases, the first network device may send an SBFD control message and an SBFD echo message to the second network device. The first network device determines the state of the BGP session based on the feedback of the second network device to the SBFD control message and the SBFD echo message.

[0096] The following will be combined Figure 6 The method for detecting a BGP session provided in an embodiment of the present application is described, and the method is executed by the second network device. Figure 6 As shown, the processing flow of this method is as follows:

[0097] Step 601: A second network device receives an SBFD message sent by a first network device based on an SBFD session.

[0098] Among them, the first network device and the second network device are in a BGP neighbor relationship, a BGP session is created between the first network device and the second network device, the SBFD session is a session created by the first network device, and is an SBFD session corresponding to the BGP session, the first network device is the initiator of the SBFD session, and the second network device is the reflector of the SBFD session.

[0099] In this embodiment, the second network device receives the SBFD message sent by the first network device after the SBFD session is created.

[0100] Step 602: The second network device feeds back the SBFD message, so that the first network device determines the state of the BGP session based on the feedback of the SBFD message by the second network device.

[0101] In this embodiment, the second network device may feed back the SBFD message, and the first network device determines the state of the BGP session based on the feedback of the second network device on the SBFD message.

[0102] Through the embodiments of the present application, the reflector only needs to feed back SBFD messages and does not need to create an SBFD session. Therefore, only the content required to create an SBFD session is configured on the initiator, and the reflector does not need to configure the content required to create an SBFD session, thereby reducing the configuration content.

[0103] As follows Figure 5 and Figure 6 The process shown is supplemented by:

[0104] In a possible implementation, the first network device and the second network device are directly connected or indirectly connected. Figure 7 As shown, there is no other network device on the link between the first network device and the second network device, and the first network device and the second network device are directly connected. Figure 8 As shown, there are other network devices on the link between the first network device and the second network device, for example, network device A and network device B, and the first network device and the second network device are not directly connected. It should be noted that Figure 8 The network devices A and B are only used as examples. In the case of a non-direct connection, the number of other network devices on the link between the first network device and the second network device is not limited in this embodiment of the application.

[0105] In a possible implementation manner, the first network device and the second network device may belong to the same AS or different ASs.

[0106] In one possible implementation, creating an SBFD session occupies processing resources, and the SBFD session is created by a network device with high residual processing capacity, that is, the residual processing capacity of the first network device is not less than the residual processing capacity of the second network device. In this way, even if the network device with high residual processing capacity creates an SBFD session and occupies processing resources, the impact on the network device processing service packets is relatively small. Exemplarily, the residual processing capacity can be reflected by the residual CPU resources and / or residual memory, such as weighting the residual CPU resources of the first network device and the residual memory to obtain a first weighted value, and weighting the residual CPU resources of the second network device and the residual memory to obtain a second weighted value, and the first weighted value is not less than the second weighted value.

[0107] Optionally, a management node is provided in the network, and the management node establishes communication connections with the first network device and the second network device respectively. The management node can obtain the remaining processing capacity of the first network device and the second network device to which the BGP session belongs through the communication connection. The management node determines the network device with high remaining processing capacity among the first network device and the second network device. Assuming that the device with high remaining processing capacity is the first network device, the management node sends an indication message of creating an SBFD session to the first network device, instructing the first network device to create the SBFD session.

[0108] In a possible implementation, the first network device may establish an SBFD session with the second network device in a static configuration manner, and the process is as follows:

[0109] The first network device receives configuration parameters of the SBFD session statically configured for the BGP session; the configuration parameters are parameters used by the first network device to create the SBFD session. The first network device uses the configuration parameters to create the SBFD session.

[0110] In this embodiment, the management node of the first network device provides an interactive interface, and the technician can statically configure the BGP session between the first network device and the second network device in the management node, and configure the configuration parameters of the SBFD session of the BGP session, and the configuration parameters may include the address of the second network device when creating the BGP session, and the address may be the Internet Protocol (IP) address of the second network device. The first network device uses the address to actively create an SBFD session with the second network device.

[0111] In another possible implementation, the first network device may create an SBFD session with the second network device in a dynamic configuration manner, and the process is as follows:

[0112] The first network device obtains neighbor information of a dynamically created BGP session, wherein the neighbor information includes configuration parameters of the SBFD session, wherein the configuration parameters are parameters used by the first network device to create the SBFD session. The first network device uses the configuration parameters to create the SBFD session.

[0113] In this embodiment, after the first network device detects the establishment of a BGP session with the second network device, the neighbor information of the BGP session can be obtained. The neighbor information of the BGP session includes the address of the second network device when the BGP session is established, and the address can be an IP address. The first network device uses the address to actively establish an SBFD session with the second network device. In this way, the SBFD session can be automatically established.

[0114] Exemplarily, the first network device includes a BGP module and a SBFD module. After the BGP module in the first network device creates a BGP session, the BGP module sends a notification message to the SBFD module in the first network device, and the notification message is used to notify the creation of the SBFD session. After receiving the notification message, the SBFD module creates an SBFD session based on the content included in the notification message. The notification message includes but is not limited to basic SBFD parameter information such as neighbor information of the BGP session (such as the address of the second network device when creating the BGP session), time interval for sending SBFD messages, etc., wherein the time interval for sending SBFD messages can be a configured time interval. Alternatively, the SBFD module in the first network device monitors the BGP session created by the BGP module and obtains the above basic SBFD parameter information from the BGP module. The creation of the SBFD session by the SBFD module here can refer to the description in RFC7880.

[0115] Optionally, the first network device may statically configure BGP neighbors or dynamically discover BGP neighbors. In an embodiment of the present application, the BGP neighbor of the first network device is the second network device, and the BGP neighbor of the second network device is the first network device.

[0116] In a possible implementation, the second network device is configured with an SBFD descriptor (SBFDDiscriminator), which may also be referred to as a descriptor for short. The descriptor uniquely indicates the second network device. Only one descriptor may be configured on the second network device, which is used for multiple network devices to establish SBFD sessions corresponding to the BGP sessions with the second network device. For example, the second network device is configured with a descriptor M, and BGP sessions are established between the second network device and the first network device and the third network device, respectively. The first network device and the second network device create an SBFD session corresponding to the BGP session using descriptor M, and the third network device and the second network device create an SBFD session corresponding to the BGP session using descriptor M. In this way, the second network device, as a reflector, does not need to configure the descriptor based on the BGP neighbor granularity, and only one descriptor may be configured.

[0117] When the first network device sends an SBFD message to the second network device, the SBFD message includes a descriptor of the second network device, and the processing is as follows:

[0118] The first network device obtains the descriptor of the second network device; the first network device sends an SBFD message including the descriptor to the second network device based on the SBFD session. The second network device feeds back the SBFD message based on the descriptor of the second network device included in the SBFD message.

[0119] In this embodiment, the first network device is statically configured with the descriptor of the second network device, or, after the second network device generates its own descriptor, it notifies its own descriptor to the network device that creates a BGP session with itself, so that the first network device receives the descriptor of the second network device, or, the first network device sends an SBFD control message to the second network device, adds the descriptor of the first network device to the SBFD control message, and the second network device receives the SBFD control message, adds the descriptor of the second network device to it, and sends it to the first network device, so that the first network device can obtain the descriptor of the second network device.

[0120] When the first network device sends an SBFD message to the second network device, the SBFD message including the descriptor of the second network device is sent. After receiving the SBFD message, the second network device identifies the descriptor therein. If the descriptor is the descriptor of the second network device, the second network device determines that the SBFD message is an SBFD message to be fed back and feeds back the SBFD message; if the descriptor is not the descriptor of the second network device, the second network device discards the SBFD message.

[0121] In addition, the first network device is also configured with a descriptor, which uniquely indicates the first network device. When the first network device sends an SBFD message to the second network device, the descriptor of the first network device and the descriptor of the second network device are added to the SBFD message. Exemplarily, the descriptor of the first network device is added to the Mydiscriminator field, and the descriptor of the second network device is added to the Yourdiscriminator field. In this way, the second network device obtains the descriptor in the Your discriminator field to determine whether it is its own descriptor. When the second network device sends an SBFD message to the first network device, the sent SBFD message includes the descriptor of the first network device and the descriptor of the second network device. Exemplarily, the second network device swaps the contents of the My discriminator field and the Your discriminator field in the SBFD message sent by the first network device, that is, the My discriminator field in the sent SBFD message includes the descriptor of the second network device, and the Yourdiscriminator field includes the descriptor of the first network device. In this way, the first network device can determine that the received SBFD message is sent to itself based on the descriptor of the first network device in the received SBFD message, and can also determine that the SBFD message is sent by the second network device based on the descriptor of the second network device in the received SBFD message.

[0122] The process of the first network device obtaining the descriptor of the second network device based on the SBFD control message is as follows:

[0123] The first network device sends an SBFD control message to the second network device. The SBFD control message includes a descriptor of the first network device, which is used as My discriminator. In the SBFD control message, Yourdiscriminator is not filled in or a preset field is filled in. The destination address of the SBFD control message is the address of the BGP neighbor configured on the first network device, and the source address is the address of the outbound interface of the SBFD control message or the address selected by the SBFD module. After receiving the SBFD control message, the second network device swaps the source address and the destination address in the SBFD message, that is, the destination address is the address of the outbound interface of the first network device sending the SBFD control message or the address selected by the SBFD module, and the source address is the address of the BGP neighbor to which the BGP session belongs configured on the first network device, and adds the descriptor of the second network device as My discriminator in the SBFD message, and uses the descriptor of the first network device as Yourdiscriminator, and feeds back the SBFD control message to the first network device. In this way, the first network device obtains the descriptor of the second network device. Here, the address of the BGP neighbor configured on the first network device is the address of the second network device when the BGP session is created.

[0124] In a possible implementation manner, after the second network device determines that the SBFD message is an SBFD message to be fed back, the second network device processes as follows:

[0125] The second network device sends a SBFD message including state information to the first network device, so that the first network device determines the state of the BGP session based on the state information; wherein the state indicated by the state information is the current state of the second network device.

[0126] In this embodiment, the second network device obtains its current state, which may be an administratively closed (admin down) state or an online state, etc. The second network device may send an SBFD message including state information to the first network device, where the state information indicates the current state of the second network device. Here, the admin down state may be configured as an offline state by the management end, or it may be a state when the second network device detects that the current processing resources are occupied too much and actively shuts down the SBFD function.

[0127] The corresponding processing of the first network device is:

[0128] The first network device receives the SBFD message sent by the second network device; the first network device determines the state of the BGP session based on the state information in the SBFD message sent by the second network device.

[0129] In this embodiment, the first network device receives the SBFD message sent by the second network device, and obtains the state information in the SBFD message. If the state indicated by the state information is an online state, the state of the BGP session is determined to be connected; if the state indicated by the state information is an admin down state, the state of the BGP session is determined to be disconnected. In this way, the state of the BGP session can be determined based on the state information in the SBFD message.

[0130] In this case, the SBFD message may be a SBFD control message, and the second network device may add indication information of the state of the second network device to the SBFD control message sent by the first network device.

[0131] In another possible implementation, when the SBFD message is an SBFD control message, after the first network device sends the SBFD control message to the second network device, if the SBFD message sent by the second network device based on the SBFD message is not received within the target duration, the state of the BGP session is determined to be disconnected; if the first network device receives the SBFD message sent by the second network device based on the SBFD message within the target duration, and the state indicated by the state information in the received SBFD message is the admin down state, the state of the BGP session is determined to be disconnected; if the state indicated by the state information in the received SBFD message is the online state, the state of the BGP session is determined to be connected. The target duration here is described later.

[0132] In another possible implementation, after the second network device receives the SBFD message sent by the first network device, the processing of step 602 is:

[0133] The second network device loops back the SBFD message to the first network device.

[0134] In this embodiment, after receiving the SBFD message sent by the first network device, the second network device can loop back the SBFD message to the first network device. If the physical link between the second network device and the first network device is normal, the looped back SBFD message can reach the first network device. If the physical link between the first network device and the second network device is disconnected, although the second network device feeds back the SBFD message, it cannot reach the first network device. Here, "loopback" indicates that the second network device sends the SBFD message sent by the first network device to the first network device.

[0135] Accordingly, in step 503, the processing of the first network device may be:

[0136] If the first network device does not receive the SBFD message looped back by the second network device based on the SBFD message within the target time length, the state of the BGP session is determined to be disconnected; if the first network device receives the SBFD message looped back by the second network device within the target time length, the state of the BGP session is determined to be connected.

[0137] The target duration may be preset and stored in the first network device. Optionally, the first network device sends the SBFD message periodically, and the target duration may be the duration of n periods, where n is a positive integer, and illustratively, n may be 1, 2, etc. Of course, the target duration may also be a fixed value, and illustratively, the target duration is twice the duration of the transmission from the first network device to the second network device.

[0138] In this embodiment, when the first network device sends an SBFD message to the second network device, the timing starts. If the first network device has not received the SBFD message looped back by the second network device when the timing duration reaches the target duration, it can be determined that the state of the BGP session is disconnected. Exemplarily, a timer can be set in the first network device, and the timer can be used for timing. If the first network device has received the SBFD message looped back by the second network device before the target duration is reached, it can be determined that the state of the BGP session is connected.

[0139] In this case, the SBFD message may be a SBFD echo message.

[0140] It should be noted here that after the second network device receives the SBFD message sent by the first network device, if the state of the second network device is administratively closed, indicating that the SBFD function of the second network device is closed, the second network device does not loop back the SBFD message to the first network device. In this way, if the first network device does not receive the SBFD message looped back by the second network device within the target time, it can be determined that the state of the BGP session is disconnected.

[0141] In another possible implementation, the first network device sends N SBFD packets to the second network device. The first network device may determine the state of the BGP session based on the number of SBFD packets fed back by the second network device, and the processing is as follows:

[0142] If the number of SBFD messages received by the first network device from the second network device based on N SBFD messages looped back is less than M, the state of the BGP session is determined to be disconnected; if the number of SBFD messages received by the first network device from the second network device based on N SBFD messages looped back is greater than or equal to M, the state of the BGP session is determined to be connected.

[0143] Wherein, M is less than or equal to N, and both M and N are positive integers. For example, N is 10, M is 6, and so on.

[0144] In this embodiment, the first network device sends N SBFD messages to the second network device within a period of time. Under normal circumstances, the second network device will loop back each SBFD message. The first network device can determine the number of looped SBFD messages among the N SBFD messages. If the number is less than M, it can be determined that the state of the BGP session is disconnected; if the number is greater than or equal to M, it can be determined that the state of the BGP session is connected. In this way, the state of the BGP session can be determined based on the number of received SBFD messages.

[0145] In this case, the SBFD message may be a SBFD echo message.

[0146] In another possible implementation, after the second network device receives the SBFD message sent by the first network device, if its own state is online, it can loop back the SBFD message to the first network device, and if its own state is admindown, it does not loop back the SBFD message to the first network device. In this way, the first network device can accurately determine the state of the BGP session based on whether it receives the SBFD message looped back by the second network device. In this case, the SBFD message can be an SBFD echo message.

[0147] like Fig. 9 As shown, a schematic diagram is provided in which a first network device sends an SBFD echo message to a second network device, and the second network device loops back the SBFD echo message to the first network device.

[0148] Exemplarily, the first network device includes a BGP module and an SBFD module. When the SBFD module in the first network device determines that the BGP session state is disconnected, the SBFD module sends an indication message of BGP session disconnection to the BGP module. The BGP module receives the indication message of BGP session disconnection, determines that the state of the BGP session is disconnected, and performs convergence processing on the BGP route. In this way, since the SBFD detection is a millisecond-level detection, the BGP module can know the state of the BGP session in a timely manner, and then quickly perform BGP route convergence.

[0149] In the embodiment of the present application, the situation where the second network device does not loop back SBFD to the first network device may include but is not limited to: 1. The physical link between the first network device and the second network device is disconnected, and the SBFD message sent by the first network device to the second network device cannot reach the second network device, and the second network device does not receive the SBFD message, and thus cannot feedback the SBFD message. 2. Although the second network device receives the SBFD message sent by the first network device, the physical link between the first network device and the second network device is disconnected during the process of the second network device looping back the SBFD message, and the first network device does not receive the SBFD message looped back by the second network device. 3. The SBFD function of the second network device is turned off.

[0150] Exemplarily, when detecting the state of a BGP session is applied in a scenario where an RR exists, the first network device is an RR and the second network device is a router. Fig.10 As shown, the first network device is RR, the second network device is router A, after RR creates a BGP session with router A, RR initiates a SBFD session corresponding to the BGP session created with router A. In addition, Fig.10 In the figure, the SBFD sessions established between RR and routers E and F other than router A are also shown. In this way, after RR establishes BGP sessions with multiple routers respectively, only the content required for establishing the SBFD session is configured on RR, and it is not necessary to configure the content required for establishing the SBFD session on each router that establishes a BGP session with RR, so the configuration amount can be reduced.

[0151] Exemplarily, when detecting the state of a BGP session is applied in a scenario where an RR exists, the first network device is a router and the second network device is an RR. Fig.11 As shown, the first network device is router B, the second network device is RR, and after router B creates a BGP session with RR, router B initiates a SBFD session corresponding to the BGP session created with RR. Fig.11 In FIG. 5 , it is also shown that router G and router H respectively initiate SBFD sessions with RR.

[0152] In this way, when the detection of the status of the BGP session is applied in a scenario where RR exists, when the processing capability of RR is relatively poor, even if RR has many BGP sessions, the pressure on RR can be reduced because the router that establishes a BGP session with RR can be set as the initiator and the router that establishes a BPG session with RR can be set as the reflector. The reflector does not need to create an SBFD session, so the pressure on RR can be reduced. When the processing capability of RR is relatively strong, but the processing capability of the router that establishes a BPG session with RR is relatively poor, RR can be set as the initiator and the router that establishes a BPG session with RR can be set as the reflector, so the pressure on the router that establishes a BPG session with RR can be reduced. Here, the router that establishes a BPG session with RR can also be called an RR client. In addition, in the scenario of RR, both the initiator and the reflector do not need to be configured. Only the configuration of the initiator needs to be modified. The dependency is relatively small and the deployment flexibility is relatively high.

[0153] Exemplarily, the first network device is a router, and the second network device is a router. Fig.12 As shown, the first network device is router C, the second network device is router D, and after router C and router D establish a BGP session, router C initiates a SBFD session corresponding to the BGP session established with router D. Fig.12 In the figure, router C initiates the SBFD session corresponding to the BGP session created by router C. Of course, router D can also initiate the SBFD session corresponding to the BGP session created by router C.

[0154] In this way, when the detection of the status of the BGP session is applied to the scenario where there is no RR, only one of the routers to which the BGP session belongs can be used as the initiator to initiate the creation of an SBFD session with another router, without the need to configure both routers to which the BGP session belongs, so that the resources occupied by SBFD can be reduced. In addition, in the scenario where there is no RR, the initiator and the reflector do not need to be configured, and only the initiator needs to modify the configuration, which has a relatively small dependency and high deployment flexibility.

[0155] against Figures 10 to 12 It should be noted that Figures 10 to 12 The double solid arrows in the middle indicate the created BGP session, and the single dashed arrow indicates the created SBFD session. The arrow of the single dashed arrow points from the initiator to the reflector.

[0156] In the embodiment of the present application, since the reflector only needs to feed back SBFD messages and does not need to create an SBFD session, only the content required to create an SBFD session is configured on the initiating end, and the reflector does not need to configure the content required to create an SBFD session, so the configuration content can be reduced. Moreover, since only the initiating end creates the SBFD session, only the processing resources are occupied on the initiating end, and both the initiating end and the reflector do not need to occupy processing resources, which can reduce the processing resource overhead of the network device. Moreover, since only the initiating end creates the SBFD session, only the function of creating an SBFD session is deployed on the initiating end, and both the initiating end and the reflector do not need to deploy the function of creating an SBFD session, which can reduce the dependency between devices.

[0157] Fig.13 1 is a structural diagram of a device for detecting the state of a BGP session provided in an embodiment of the present application. The device is applied to a first network device, and the first network device and the second network device are in a BGP neighbor relationship. The device provided in an embodiment of the present application can realize the embodiment of the present application Figure 5 The process described above, the device includes: an SBFD module 1310 and a sending module 1320, wherein:

[0158] The SBFD module 1310 is used to create a seamless bidirectional forwarding detection SBFD session, wherein the SBFD session is a SBFD session corresponding to the BGP session between the first network device and the second network device, the first network device is the initiator of the SBFD session, the second network device is the reflector of the SBFD session, and the BGP session is a session created based on the BGP neighbor relationship, and can be specifically used to implement the creation function of step 501 and execute the implicit steps included in step 501;

[0159] A sending module 1320, configured to send an SBFD message to the second network device based on the SBFD session, and specifically to implement the sending function of step 502 and to execute the implicit steps included in step 502;

[0160] The SBFD module 1310 is further used to determine the state of the BGP session based on the feedback of the second network device to the SBFD message, and can be specifically used to implement the detection function of step 503 and execute the implicit steps included in step 503.

[0161] In a possible implementation manner, the first network device is a route reflector RR, and the second network device is a router; or,

[0162] The first network device is a router, and the second network device is a RR; or,

[0163] The first network device and the second network device are both routers.

[0164] In a possible implementation manner, the remaining processing capacity of the first network device is not less than the remaining processing capacity of the second network device.

[0165] In a possible implementation, the SBFD module 1310 is further configured to:

[0166] receiving configuration parameters of the SBFD session statically configured for the BGP session; or,

[0167] Obtaining neighbor information of the dynamically created BGP session, where the neighbor information includes configuration parameters of the SBFD session; wherein the configuration parameters are parameters used by the first network device to create the SBFD session;

[0168] The SBFD module 1310 is used to:

[0169] An SBFD session is created based on the configuration parameters.

[0170] In a possible implementation, the SBFD module 1310 is further configured to:

[0171] Receiving the SBFD message sent by the second network device;

[0172] The state of the BGP session is determined based on the state information in the SBFD message sent by the second network device.

[0173] In a possible implementation, the SBFD module 1310 is further configured to:

[0174] If the first network device does not receive the SBFD message looped back by the second network device based on the SBFD message within the target time length, determining that the state of the BGP session is disconnected;

[0175] If the first network device receives the SBFD message looped back by the second network device based on the SBFD message within the target time period, it is determined that the state of the BGP session is connected.

[0176] In a possible implementation, the SBFD module 1310 is configured to:

[0177] Sending N SBFD packets to the second network device based on the SBFD session;

[0178] The SBFD module 1310 is further used for:

[0179] If the number of SBFD messages received by the first network device based on the loopback of the N SBFD messages by the second network device is less than M, the state of the BGP session is determined to be disconnected; if the number of SBFD messages received by the first network device based on the loopback of the N SBFD messages by the second network device is greater than or equal to M, the state of the BGP session is determined to be connected, wherein M is less than or equal to N, and both M and N are positive integers.

[0180] In a possible implementation, the SBFD module 1310 is further configured to:

[0181] Obtaining a descriptor of the second network device;

[0182] The sending module 1320 is used to:

[0183] A SBFD message including the descriptor is sent to the second network device based on the SBFD session.

[0184] Embodiments of the present application Fig.13 The division of modules in the embodiment is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, the functional modules in various embodiments of the present application may be integrated in Figure 1 or Figure 2 In a processor of the first network device shown, it may also be in Figure 1 or Figure 2 The first network device shown in the figure may exist physically separately, or two or more modules may be integrated into one module. The above integrated module may be implemented in the form of hardware or in the form of software function modules.

[0185] Fig.14 1 is a structural diagram of a device for detecting the state of a BGP session provided in an embodiment of the present application. The device is applied to a second network device, and the first network device and the second network device are in a BGP neighbor relationship. The device provided in an embodiment of the present application can realize the embodiment of the present application Figure 6 The process described above, the device includes: a receiving module 1410 and a feedback module 1420, wherein:

[0186] The receiving module 1410 is used to receive an SBFD message sent by the first network device based on the SBFD session, wherein the SBFD session is an SBFD session created by the first network device and is an SBFD session corresponding to the BGP session between the first network device and the second network device, the first network device is an initiator of the SBFD session, the second network device is a reflector of the SBFD session, and the BGP session is a session created based on the BGP neighbor relationship, and can be specifically used to implement the receiving function of step 601 and execute the implicit steps included in step 601;

[0187] Feedback module 1420 is used to provide feedback on the SBFD message so that the first network device determines the state of the BGP session based on the feedback of the second network device on the SBFD message. It can be specifically used to implement the feedback function of step 602 and execute the implicit steps included in step 602.

[0188] In a possible implementation manner, the remaining processing capacity of the first network device is not less than the remaining processing capacity of the second network device.

[0189] In a possible implementation, the feedback module 1420 is used to:

[0190] An SBFD message including state information is sent to the first network device, so that the first network device determines the state of the BGP session based on the state information; wherein the state indicated by the state information is the current state of the second network device.

[0191] In a possible implementation, the feedback module 1420 is used to:

[0192] The SBFD message is looped back to the first network device.

[0193] In a possible implementation manner, the SBFD message includes a descriptor of the second network device;

[0194] The feedback module 1420 is used to:

[0195] Based on the descriptor of the second network device included in the SBFD message, the SBFD message is fed back.

[0196] Embodiments of the present application Fig.14 The division of modules in the embodiment is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, the functional modules in various embodiments of the present application may be integrated in Figure 3 or Figure 4In a processor of the second network device shown, it may also be Figure 3 or Figure 4 The second network device shown in the figure may exist physically separately, or two or more modules may be integrated into one module. The above integrated module may be implemented in the form of hardware or in the form of software function module.

[0197] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the network device, the process or function described in the embodiment of the present application is generated in whole or in part. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by the network device or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (such as a floppy disk, a hard disk and a tape, etc.), an optical medium (such as a digital video disk (digital video disk, DVD), etc.), or a semiconductor medium (such as a solid state drive, etc.).

Claims

1. A method for detecting the state of a Border Gateway Protocol (BGP) session, characterized in that: The method is applied to a first network device, the first network device and the second network device are in a BGP neighbor relationship, and the method includes: The first network device creates a seamless bidirectional forwarding detection SBFD session, wherein the SBFD session is an SBFD session corresponding to a BGP session between the first network device and the second network device, the first network device is an initiator of the SBFD session, the second network device is a reflector of the SBFD session, and the BGP session is a session created based on the BGP neighbor relationship; The first network device sends an SBFD message to the second network device based on the SBFD session; The first network device determines the state of the BGP session based on feedback from the second network device on the SBFD message.

2. The method according to claim 1, characterized in that: The first network device is a route reflector RR, and the second network device is a router; or, The first network device is a router, and the second network device is a RR; or, The first network device and the second network device are both routers.

3. The method according to claim 1 or 2, characterized in that: The remaining processing capacity of the first network device is not less than the remaining processing capacity of the second network device.

4. The method according to claim 1 or 2, characterized in that: The method further comprises: The first network device receives configuration parameters of the SBFD session statically configured for the BGP session; or, The first network device obtains neighbor information of the dynamically created BGP session, where the neighbor information includes configuration parameters of the SBFD session; wherein the configuration parameters are parameters used by the first network device to create the SBFD session; The first network device creates an SBFD session, including: The first network device creates a SBFD session based on the configuration parameters.

5. The method according to claim 1 or 2, characterized in that: The first network device determines the state of the BGP session based on feedback from the second network device on the SBFD message, including: The first network device receives the SBFD message sent by the second network device; The first network device determines the state of the BGP session based on the state information in the SBFD message sent by the second network device.

6. The method according to claim 1 or 2, characterized in that: The first network device determines the state of the BGP session based on feedback from the second network device on the SBFD message, including: If the first network device does not receive the SBFD message looped back by the second network device based on the SBFD message within the target time length, determining that the state of the BGP session is disconnected; If the first network device receives the SBFD message looped back by the second network device based on the SBFD message within the target time period, it is determined that the state of the BGP session is connected.

7. The method according to claim 1 or 2, characterized in that: The first network device sending an SBFD message to the second network device based on the SBFD session includes: The first network device sends N SBFD packets to the second network device based on the SBFD session; The first network device determines the state of the BGP session based on feedback from the second network device on the SBFD message, including: If the number of SBFD packets received by the first network device and looped back by the second network device based on the N SBFD packets is less than M, determining that the state of the BGP session is disconnected; If the number of SBFD messages received by the first network device from the second network device based on the N SBFD messages looped back is greater than or equal to M, it is determined that the state of the BGP session is connected, where M is less than or equal to N, and both M and N are positive integers.

8. The method according to claim 1 or 2, characterized in that: The method further comprises: The first network device obtains a descriptor of the second network device; The first network device sending an SBFD message to the second network device based on the SBFD session includes: The first network device sends a SBFD message including the descriptor to the second network device based on the SBFD session.

9. A method for detecting the state of a Border Gateway Protocol (BGP) session, characterized in that: The method is applied to a second network device, where the second network device has established a BGP neighbor relationship with the first network device, and the method includes: The second network device receives an SBFD message sent by the first network device based on a seamless bidirectional forwarding detection SBFD session, wherein the SBFD session is an SBFD session created by the first network device and is an SBFD session corresponding to the BGP session between the first network device and the second network device, the first network device is an initiator of the SBFD session, the second network device is a reflector of the SBFD session, and the BGP session is a session created based on the BGP neighbor relationship; The second network device feeds back the SBFD message, so that the first network device determines the state of the BGP session based on the feedback of the second network device on the SBFD message.

10. The method according to claim 9, characterized in that The remaining processing capacity of the first network device is not less than the remaining processing capacity of the second network device.

11. The method according to claim 9 or 10, characterized in that: The second network device feeds back the SBFD message, including: The second network device sends an SBFD message including state information to the first network device, so that the first network device determines the state of the BGP session based on the state information; wherein the state indicated by the state information is the current state of the second network device.

12. The method according to claim 9 or 10, characterized in that: The second network device feeds back the SBFD message, including: The second network device loops back the SBFD message to the first network device.

13. The method according to claim 9 or 10, characterized in that: The SBFD message received by the second network device includes a descriptor of the second network device; The second network device feeds back the SBFD message, including: Based on the descriptor of the second network device included in the SBFD message, the second network device feeds back the SBFD message.

14. A device for detecting the state of a Border Gateway Protocol (BGP) session, characterized in that: The device is applied to a first network device, the first network device and the second network device are in a BGP neighbor relationship, and the device includes: A seamless bidirectional forwarding detection SBFD module, used to create an SBFD session, wherein the SBFD session is an SBFD session corresponding to a BGP session between the first network device and the second network device, the first network device is an initiator of the SBFD session, the second network device is a reflector of the SBFD session, and the BGP session is a session created based on the BGP neighbor relationship; A sending module, configured to send an SBFD message to the second network device based on the SBFD session; The SBFD module is further configured to determine the state of the BGP session based on feedback from the second network device to the SBFD message.

15. The device according to claim 14, characterized in that The first network device is a route reflector RR, and the second network device is a router; or, The first network device is a router, and the second network device is a RR; or, The first network device and the second network device are both routers.

16. The device according to claim 14 or 15, characterized in that The remaining processing capacity of the first network device is not less than the remaining processing capacity of the second network device.

17. The device according to claim 14 or 15, characterized in that The SBFD module is also used to: receiving configuration parameters of the SBFD session statically configured for the BGP session; or, Obtaining neighbor information of the dynamically created BGP session, where the neighbor information includes configuration parameters of the SBFD session; wherein the configuration parameters are parameters used by the first network device to create the SBFD session; The SBFD module is used to: An SBFD session is created based on the configuration parameters.

18. The device according to claim 14 or 15, characterized in that The SBFD module is also used to: Receiving the SBFD message sent by the second network device; The state of the BGP session is determined based on the state information in the SBFD message sent by the second network device.

19. The device according to claim 14 or 15, characterized in that The SBFD module is also used to: If the first network device does not receive the SBFD message looped back by the second network device based on the SBFD message within the target time length, determining that the state of the BGP session is disconnected; If the first network device receives the SBFD message looped back by the second network device based on the SBFD message within the target time period, it is determined that the state of the BGP session is connected.

20. The device according to claim 14 or 15, characterized in that The sending module is used for: Sending N SBFD packets to the second network device based on the SBFD session; The SBFD module is also used to: If the number of SBFD packets received by the first network device and looped back by the second network device based on the N SBFD packets is less than M, determining that the state of the BGP session is disconnected; If the number of SBFD messages received by the first network device from the second network device based on the N SBFD messages looped back is greater than or equal to M, it is determined that the state of the BGP session is connected, where M is less than or equal to N, and both M and N are positive integers.

21. The device according to claim 14 or 15, characterized in that The SBFD module is also used to: Obtaining a descriptor of the second network device; The sending module is used for: A SBFD message including the descriptor is sent to the second network device based on the SBFD session.

22. A device for detecting the state of a Border Gateway Protocol (BGP) session, characterized in that: The device is applied to a second network device, the second network device and the first network device have established a BGP neighbor relationship, and the device includes: A receiving module, configured to receive an SBFD message sent by the first network device based on a seamless bidirectional forwarding detection SBFD session, wherein the SBFD session is an SBFD session created by the first network device and is an SBFD session corresponding to the BGP session between the first network device and the second network device, the first network device is an initiator of the SBFD session, the second network device is a reflector of the SBFD session, and the BGP session is a session created based on the BGP neighbor relationship; A feedback module is used to provide feedback on the SBFD message, so that the first network device determines the state of the BGP session based on the feedback of the second network device on the SBFD message.

23. The device according to claim 22, characterized in that The remaining processing capacity of the first network device is not less than the remaining processing capacity of the second network device.

24. The device according to claim 22 or 23, characterized in that The feedback module is used to: An SBFD message including state information is sent to the first network device, so that the first network device determines the state of the BGP session based on the state information; wherein the state indicated by the state information is the current state of the second network device.

25. The device according to claim 22 or 23, characterized in that The feedback module is used to: The SBFD message is looped back to the first network device.

26. The device according to claim 22 or 23, characterized in that The SBFD message received by the second network device includes a descriptor of the second network device; The feedback module is used to: Based on the descriptor of the second network device included in the SBFD message, the SBFD message is fed back.

27. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program code. When the computer program code is executed by a network device, the network device executes the method according to any one of claims 1 to 13.

28. A network system, characterized in that: The network system includes a first network device to which the apparatus according to any one of claims 14 to 21 is applied and a second network device to which the apparatus according to any one of claims 22 to 26 is applied.

Citation Information

Patent Citations

  • BFD session establishing method, BFD session establishing device and routing device

    CN101163060A

  • Method and device for configuring seamless bidirectional forwarding detection (SBFD) mechanism

    WO2020134739A1

Cited By

  • Method for detecting state of BGP session, apparatus and network devices

    WO2022143874A1