WO2021018150A1 - Link detection method and apparatus - Google Patents
Link detection method and apparatus Download PDFInfo
- Publication number
- WO2021018150A1 WO2021018150A1 PCT/CN2020/105265 CN2020105265W WO2021018150A1 WO 2021018150 A1 WO2021018150 A1 WO 2021018150A1 CN 2020105265 W CN2020105265 W CN 2020105265W WO 2021018150 A1 WO2021018150 A1 WO 2021018150A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- network device
- bfd
- session
- timeout
- bgp
- Prior art date
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 42
- 238000000034 method Methods 0.000 claims abstract description 60
- 230000008569 process Effects 0.000 claims abstract description 22
- 230000015654 memory Effects 0.000 claims description 27
- 230000002457 bidirectional effect Effects 0.000 claims description 12
- 238000004590 computer program Methods 0.000 claims description 8
- 238000012545 processing Methods 0.000 claims description 7
- 230000000977 initiatory effect Effects 0.000 abstract 1
- 230000006870 function Effects 0.000 description 24
- 238000010586 diagram Methods 0.000 description 11
- 230000007246 mechanism Effects 0.000 description 8
- 238000004891 communication Methods 0.000 description 7
- 238000005516 engineering process Methods 0.000 description 4
- 230000003993 interaction Effects 0.000 description 3
- 230000006855 networking Effects 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000012790 confirmation Methods 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000013589 supplement Substances 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/40—Support for services or applications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/50—Testing arrangements
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/141—Setup of application sessions
Definitions
- the present invention relates to the field of network technology, in particular to a method and device for link detection in a network.
- Border Gateway Protocol (Border Gateway Protocol, BGP) is a dynamic routing protocol used between Autonomous Systems (AS). It achieves reachability between ASs by maintaining IP routing tables or ‘prefix’ tables.
- AS Autonomous Systems
- BGP Border Gateway Protocol
- Each AS must designate a node running BGP to exchange routing information with other ASs on behalf of the AS.
- This node can be a host, but it is usually a router to perform BGP.
- the routers in the two ASs that use BGP to exchange information are also called Border Gateways or Border Routers. BGP nodes that exchange messages are called peers.
- BGP uses Transmission Control Protocol (TCP) as its transport layer protocol.
- TCP Transmission Control Protocol
- a TCP connection is established between BGP peers first, and after the TCP connection is established, a connection relationship (ie, a BGP session) between the BGP peers is established through an Open message (start message). After that, the BGP node will periodically send Keepalive messages (keep messages) to the peer to maintain the validity of the connection.
- BGP can implement the neighbor detection mechanism by periodically sending Keepalive messages.
- the sending cycle of Keepalive messages is more than 1 second. Therefore, the detection cycle of this detection mechanism is relatively long. When the data reaches the Gbit/s rate level, the detection time of this mechanism will cause a large amount of data loss .
- BFD bidirectional forwarding detection
- BGP linkage function uses the fast detection mechanism of BFD to quickly discover the link failures between BGP peers and report them to the BGP protocol.
- BFD is a universal and standardized rapid fault detection mechanism that is independent of media and protocol.
- BFD establishes a session on two network devices to detect the bidirectional forwarding path between the network devices and serve upper-layer applications.
- BFD itself does not have a neighbor discovery mechanism, but relies on the served upper application to notify its neighbor information to establish a session. After the session is established, BFD packets will be quickly sent periodically.
- BFD and BGP linkage After a BGP node establishes a BGP session with a peer, the BGP node establishes a BFD session with the peer based on the peer information, and uses BFD to detect link failures. When a link failure is detected, the BFD session between the BGP node and the peer is interrupted, and the BGP session between the associated BGP node and the peer is interrupted. Because BFD can achieve millisecond level detection, BGP can achieve rapid convergence through linkage.
- the problem with using the BFD detection mechanism in BGP is that the establishment of the BFD session and the establishment of the BGP session are asynchronous, that is, the establishment of the BFD session starts after the establishment of the BGP session. If link flutter occurs after the BGP session is established and before the BFD session is established, BGP can only rely on Keeplive to detect the status of the peer, which may still cause data loss for a long period of time.
- the present invention provides a method and a device for dividing an IGP domain in a network to solve the problem of high maintenance overhead during network expansion or adjustment in the prior art.
- the present invention adopts the following technical solutions:
- an embodiment of the present invention provides a link detection method, which is applied in a linkage scenario where the upper layer is applied to BFD.
- the method includes: the first network device and the second network device negotiate a timeout period for establishing a bidirectional forwarding detection (BFD) session in the process of establishing an application layer session.
- the first network device sets and starts a timer according to the negotiated timeout time, and establishes a bidirectional forwarding detection (BFD) session with the second network device. If the establishment of the BFD session is not completed before the timer ends, the first network device interrupts the application layer session with the second network device.
- BFD bidirectional forwarding detection
- the application layer session will be interrupted, the path between the two network devices will be converged, and data will not be sent to the path, thereby reducing data loss.
- the first network device performs link detection through the BFD session.
- the embodiment of the present invention may use BFD to quickly detect the link, thereby accelerating the convergence speed.
- the first network device and the second network device may carry the timeout period defined for the BFD session in the negotiation message for establishing the application layer session. Then, one of the timeout periods defined by the first network device and the second network device is selected as the timeout period of the BFD session.
- the negotiation message of the application layer session to negotiate the timeout period of the BFD session, the changes to the device can be reduced and the implementation of the solution is easier.
- the solutions of the embodiments of the present invention can be applied to the linkage between BGP and BFD.
- the first network device and the second network device can be Border Gateway Protocol (BGP) nodes, and the first The network device and the second network device respectively carry the timeout time defined for the BFD session in the negotiation message for establishing the application layer session, including: after the first network device establishes a connection with the second network device , Sending a first start (OPEN) message to the second network device, and receiving a second OPEN message sent by the second network device, in the first OPEN message and the second OPEN message Respectively carry the timeout time defined by the first network device and the second network device for the BFD session.
- the embodiment of the present invention directly uses the OPEN message to implement the negotiation of the timeout time, which not only improves the ease of implementation, but also achieves good compatibility.
- the first OPEN message and the second OPEN message carry the timeout time defined for the BFD session through a BFD enable field (BFD enable TLV);
- BFD enable TLV includes the type, length, and value, and the timeout period defined for the BFD session is carried in the value of the BFD enable TLV.
- the first network device and the second network device may select a maximum time value from the timeout time defined by the first network device and the second network device as the timeout time of the BFD session.
- the present invention provides a network device.
- the network device is used to execute the first aspect or the method in any possible implementation manner of the first aspect.
- the network device includes a module for executing the method in the first aspect or any possible implementation of the first aspect, for example, a negotiation unit that performs functions related to negotiation in an application layer session, and performs a BFD session A BFD unit that establishes related functions, and an interrupt unit that performs interrupt processing for judging whether the establishment of a BFD session has timed out and after the timeout.
- the present invention provides a network device, which includes a communication interface, a processor, a memory, and a bus.
- the processor is respectively coupled to the communication interface and the memory through the bus.
- the basic input output system solidified in the memory or the bootloader in the embedded system is used to guide the system to start, and the network device is guided to enter a normal operating state.
- the application program and the operating system in the memory are then run, so that the processor executes the first aspect or the method in any possible implementation manner of the first aspect.
- the present invention provides a computer-readable medium for storing a computer program, and the computer program includes instructions for executing the first aspect or any possible implementation of the first aspect.
- FIG. 1 is a schematic diagram of a networking of an upper-layer application and BFD linkage provided by an embodiment of the present invention
- Figure 2 is an interaction diagram of a link detection method provided by an embodiment of the present invention.
- FIG. 3 is a schematic structural diagram of a BGP network provided by an embodiment of the present invention.
- Figure 4 is a flowchart of a link detection method provided by an embodiment of the present invention.
- FIG. 5 is a schematic diagram of a format of BFD enable TLV provided by an embodiment of the present invention.
- Figure 6 is a schematic structural diagram of a network device provided by an embodiment of the present invention.
- Fig. 7 is a schematic structural diagram of a network device provided by an embodiment of the present application.
- the linkage function means that upper-layer applications use BFD's rapid detection mechanism to quickly find link failures and report them to the upper-layer applications, so that the upper-layer applications quickly converge.
- the establishment of application layer sessions that is, the sessions of upper-layer applications
- the establishment of BFD sessions are asynchronous, which leads to link failures during the establishment of the upper-layer application sessions but the BFD session is not established. It is impossible to use BFD to quickly find out, which may result in data loss for a long period of time.
- the embodiment of the present invention negotiates the timeout period for establishing the BFD session during the process of establishing the session by the upper application of the two network devices, and sets and starts the timer according to the negotiated timeout period.
- the BFD session is established, If the establishment of the BFD session is not completed at the end of the timer, the established application layer session is interrupted. In this way, if the BFD session is not established for a long time, the application layer session will be interrupted, the path between the two network devices will be converged, and data will not be sent to the path, thereby reducing data loss.
- FIG. 1 is a schematic diagram of a networking of an upper layer application and BFD linkage provided by an embodiment of the present invention.
- the networking includes network devices 101-104.
- the network device can be a host, a router, or a switch.
- Network devices can be located in the same network or in different networks.
- the network device 101 establishes an application layer session with the network device 103 and the network device 104 respectively, and establishes a BFD session after the establishment of the application layer session is completed.
- the route outbound interface from the network device 101 to the network device 102 is the interface 1, and the network device 103 reaches the network device 102 through the network device 103.
- the BFD first perceives and informs the upper layer application of the network device 103.
- the network device 103 processes the Down event (that is, interrupts the application layer session), re-calculates the route, and the new route outgoing interface is interface 2, which passes through the network device 104 to the network device 102.
- the above is the linkage process between upper-layer applications and BFD.
- the embodiment of the present invention further supplements the above process.
- the network device 101 and the network device 103 when the network device 101 and the network device 103 establish an application layer session, they further negotiate the timeout period for establishing a BFD session.
- the network device 101 also performs Down event processing to converge the link between the network device 101 and the network device 103, and the new route outgoing interface is interface 2, which passes through the network device 104 to the network device 102. That is to say, in the embodiment of the present invention, the application layer session will be interrupted in the case of link failure and BFD session establishment timeout, so as to avoid long-term data loss.
- the above-mentioned solution mainly involves the use of two network devices (for example, network device 101 and network device 103) that link upper-layer applications with BFD.
- these two network devices are referred to as a first network device and a second network device, and the first network device and the second network device may be referred to as opposite end network devices.
- the first network device and the second network device establish an application layer session, they perform application layer session negotiation.
- the negotiation of the timeout period for establishing the BFD session can be added to the negotiation message of the application layer session.
- Figure 2 is an interaction diagram of the link detection method provided by an embodiment of the present invention.
- the method includes an application layer session establishment process and a BFD session establishment process.
- the application layer session establishment process includes:
- Steps S201-S202 The first network device sends a negotiation message for establishing an application layer session to the second network device, and receives a negotiation message for establishing an application layer session sent by the second network device. Wherein, the first network device and the second network device send the negotiation message to carry the timeout time defined for the BFD session.
- the negotiation message may be a message with a negotiation function during the session establishment process, for example, a session creation message or an initial message.
- the BFD session establishment process includes:
- Steps S203-S204 the first network device and the second network device select one of the timeout periods defined by the first network device and the second network device as the timeout period of the BFD session, and the first network device and the second network device negotiate Set the timeout period and start the timer.
- the first network device and the second network device can be selected according to a uniform rule.
- the maximum time value can be selected as the timeout time of the BFD session in the timeout time.
- the timeout time selected according to the uniform rule is the timeout time of the negotiated BFD session.
- Step S205 The first network device and the second network device start to establish a BFD session.
- Step S206 It is judged whether the establishment of the BFD session is completed before the timer ends.
- the first network device interrupts the application layer session with the second network device. If the establishment of the BFD session is completed before the timer ends, the first network device detects the link with the second network device through the BFD session.
- the solution of the embodiment of the present invention can be applied to scenarios where a variety of upper-layer applications and BFD are linked, for example, BFD is linked with Open Shortest Path First (OSPF), and BFD is linked with an intermediate system to an intermediate system (Intermediate System). to Intermediate System (IS-IS) linkage, BFD and BGP linkage, BFD and Virtual Router Redundancy Protocol (VRRP) linkage, etc.
- OSPF Open Shortest Path First
- IRP Intermediate System
- the upper layer application protocols enabled on the first network device and the second network device are different.
- the first network device and the second network device may be devices with OSPF enabled.
- the first network device and the second network device It may be a device with the IS-IS function enabled; in the scenario where BFD and BGP are linked, the first network device and the second network device may be devices with the BGP function enabled.
- the embodiment of the present invention takes the linkage of BFD and BGP as an example for description.
- the device that sends BGP messages is called the BGP speaker. It receives or generates new message information and advertises to other BGP Speakers.
- the BGP speaker is a BGP-enabled network device.
- BGP Speaker is referred to as a BGP node.
- Peer Speakers exchanging messages are called peers or neighbors.
- BGP is generally applied between ASs, as shown in FIG. 3, which is a schematic structural diagram of a network using BGP according to an embodiment of the present invention.
- the network includes two autonomous systems, AS1 and AS2.
- AS1 includes BGP nodes 101, 102, 103.
- AS2 includes BGP nodes 104 and 105.
- a BGP node is a network device with the BGP function enabled.
- the network device can be a host, router, switch, etc.
- the BGP nodes at both ends shown by the dotted arrows are peers.
- the BGP node 101 is a peer of the BGP node 102
- the BGP node 102 is also a peer of the BGP node 101.
- AS1 and AS2 exchange information through the BGP node 102 and the BGP node 104. It should be noted that not any two BGP nodes can interact with each other. Two BGP nodes must form a pair (ie BGP peer) to interact. Two BGP nodes establish a BGP session to form a peer. If the two BGP nodes that form a peer have the BFD capability enabled, the two BGP nodes can further establish a BFD session, and realize rapid detection through the linkage between BGP and BFD. When two BGP nodes realize the linkage between BGP and BFD, the solution of the embodiment shown in FIG. 2 can be implemented to reduce data loss.
- Fig. 4 is a flowchart of a link detection method provided by an embodiment of the present invention. The method includes:
- the first BGP node establishes a TCP connection with the second BGP node.
- BGP uses TCP as its transport layer protocol. Before establishing a BGP session, a TCP connection can be established first. The process of establishing the TCP connection can adopt the existing technology, which will not be repeated here.
- the first BGP node sends a BGP start message (ie, BGP OPEN message) for establishing a BGP session to the second BGP node, and the BGP OPEN message carries the timeout period for establishing a BFD session defined by the first BGP node.
- BGP start message ie, BGP OPEN message
- the Open message is the first message sent after the TCP connection is established, and is used to establish a connection relationship between BGP peers (ie, a BGP session).
- This message can negotiate various capabilities when the BGP session is initially established, such as address family capabilities, Refresh capabilities, GR (Graceful Restart) capabilities, and so on.
- the embodiment of the present invention may use the message to negotiate the BFD capability, and the negotiated BFD capability may include the timeout period for establishing the BFD session.
- a BFD enable field can be added to the OPEN message to negotiate BFD capabilities.
- Type-Length-Value (Type-Length-Value, TLV) is a message format.
- the BFD enable TLV is used to inform the local BFD capability (that is, whether to support BFD) and negotiate the timeout period for establishing a BFD session.
- FIG. 5 is a schematic diagram of a format of BFD-enable TLV according to an embodiment of the present invention. Among them, the meaning of each parameter in the message format is as follows:
- TLV type (identifies whether BFD is enabled)
- Length Length (2Byte)
- Timer identifies the timer time, this parameter can be used to define the timeout time for establishing a BFD session
- the configurable range of Timer is 1-65534, and the maximum value of 65535 means that the timer is not enabled.
- the BGP OPEN message sent by the first BGP node to the second BGP node may carry BFDenable TLV to indicate that the first BGP node has enabled the BFD capability.
- the Value in the BFDenable TLV can be set to 10, which means that the timer is set to 10S, that is, the timeout period for establishing a BFD session defined by the first BGP node is 10S.
- the second BGP node sends a BGP OPEN message to the first BGP node, and the BGP OPEN message carries the timeout period for establishing a BFD session defined by the second BGP node.
- the BGP OPEN message sent by the second BGP node to the first BGP node may also carry BFDenable TLV to indicate that the second BGP node has enabled the BFD capability.
- the Value in the BFDenable TLV can be set to 20, which means that the timer is set to 20S, that is, the timeout period for establishing a BFD session defined by the second BGP node is 20S.
- S404-S405 After receiving the BGP OPEN message sent by the opposite end, the first BGP node and the second BGP node send a Keepalive message to the opposite end for confirmation, and keep the connection.
- the BGP session After receiving the Keepalive message from the peer, the BGP session is established.
- S406-S408 After the BGP session is established, the first BGP node and the second BGP node respectively set and start timers according to the received BGP OPEN message, and establish a BFD session.
- the first BGP node and the second BGP node negotiate a timer value (that is, the timeout period for establishing a BFD session) according to the BFDenable TLV carried in the BGP OPEN message.
- a timer value that is, the timeout period for establishing a BFD session
- the larger value (such as 20s) of the timer values defined by the two can be taken as the timer value, the timer is set, and the timer is started.
- the received BGP OPEN message does not carry BFD enable TLV, it means that the other party does not support BFD enable TLV or has no BFD capability. In this case, the timer is not started. In this embodiment, the carrying of BFD-enable TLV is taken as an example for description.
- the establishment of the BFD session can be achieved by using the existing technology, which will not be repeated here.
- the BGP Notification message is a message to notify that an error has been detected. After the first network device and the second network device send the BGP Notification message, they will set the peer down at the local end (that is, the BGP session with the peer will be interrupted).
- the establishment of the BFD session is not completed before the timer expires as an example. If the establishment of the BFD session is completed before the timer ends, the first network device and the second network device pass the established Link detection for the BFD session.
- the foregoing embodiment implements the control over whether the establishment of the BFD session is overtime by extending the OPEN message in the BGP, which greatly reduces the service damage time. Moreover, the method of expanding existing messages makes the changes to existing equipment small and has good compatibility.
- Fig. 6 schematically shows a network device 600 provided by an embodiment of the present invention.
- the network device 600 includes a negotiation unit 601, a BFD unit 602, and an interrupt unit 603.
- the negotiating unit 601 is configured to negotiate a timeout period for establishing a bidirectional forwarding detection (BFD) session with the peer network device in the process of establishing an application layer session.
- BFD bidirectional forwarding detection
- the peer network device is the second network device or the second BGP node in the foregoing method embodiment.
- the negotiation unit 601 refer to the function of the first network device or the first BGP node and the second network device or the second BGP node in the method embodiments shown in FIG. 2 and FIG. 4 to negotiate a timeout period for establishing a BFD session.
- the BFD unit 602 is configured to set and start a timer according to the timeout time negotiated by the negotiation unit 601, and establish a bidirectional forwarding detection (BFD) session with the peer network device.
- BFD bidirectional forwarding detection
- the interrupting unit 603 is configured to interrupt the application layer session with the peer network device when the BFD unit 602 does not complete the establishment of the BFD session before the timer ends.
- the interrupt unit 603 refer to the part of the first network device or the first BGP node interrupting the application layer session with the second network device or the second BGP node in the method embodiments shown in FIG. 2 and FIG. 4.
- the BFD unit 602 may also perform link detection through the established BFD session when the establishment of the BFD session has been completed before the timer ends.
- the above-mentioned network equipment can be used in different scenarios to enable different upper-layer application functions.
- the network equipment can enable the BGP function and execute the first method in the method embodiment shown in Figure 4.
- the network device 600 here is embodied in the form of a functional unit. In an optional example, those skilled in the art can understand that the network device 600 may correspond to the network device in the foregoing embodiment.
- the first network device, the second network device, the first BGP node, and the second BGP node can be used In order to avoid repetition, the various processes and/or steps corresponding to the related equipment in the foregoing method embodiments are not repeated here.
- the network device (for example, the first network device, the second network device, the first BGP node, the second BGP node) implementing the embodiments of the present invention may be a host, a router, or a switch.
- the hardware structure of the network device in the embodiment of the present invention is introduced below.
- Figure 7 is a schematic structural diagram of a network device provided by an embodiment of the present invention.
- the network device 700 includes: a communication interface 701, a processor 702, and a memory 703.
- the network device 700 may further include a bus 704.
- the communication interface 701, the processor 702, and the memory 703 may be connected to each other through a bus 704.
- the processor may be composed of one or more general-purpose processors, such as a central processing unit (CPU).
- the processor can be used to run programs for processing functions in related program codes. That is to say, the program code executed by the processor can realize the functions of the negotiation unit, the BFD unit, and the interrupt unit in the embodiment shown in FIG. 6, or realize the function of the first network device in FIG. 2, and the first BGP in FIG. The function of the node.
- the communication interface 701 may be a wired interface (such as an Ethernet interface) or a wireless interface (such as a cellular network interface or using a wireless local area network interface) for communicating with other modules or devices.
- the communication interface 7011 in the first network device in the embodiment of the present application may be specifically used to receive a message sent by the second network device, or send a message to the second network device.
- the memory 703 may include volatile memory (Volatile Memory), such as random access memory (Random Access Memory, RAM); the memory may also include non-volatile memory (Non-Volatile Memory), such as read-only memory (Read-Only Memory). Memory, ROM), Flash Memory (Flash Memory), Hard Disk Drive (HDD), or Solid-State Drive (SSD); the memory 703 may also include a combination of the foregoing types of memories.
- volatile memory such as random access memory (Random Access Memory, RAM
- non-Volatile Memory such as read-only memory (Read-Only Memory).
- Memory ROM
- Flash Memory Flash Memory
- HDD Hard Disk Drive
- SSD Solid-State Drive
- the memory may be used to store a set of program codes, so that the processor can call the program codes stored in the memory to implement the functions of the communication module and/or processing module involved in the embodiment of the present application, which is not limited in the embodiment of the present application.
- the features, functions, and/or methods described in the embodiments of the present application may be implemented in the network device 700.
- the features, functions, or methods in the embodiments of the present application may be implemented by hardware, firmware, and/or software installed and running on hardware.
- the network device 700 may be any device (for example, a switch, a router, a bridge, a server, a client, etc.) that transmits data through a network, a system, and/or a domain.
- network nodes, network components, network devices, network elements, and/or similar terms can be used interchangeably to describe network devices in general; and unless otherwise specified and/or stated in this application, these terms have no specific meaning. Or special meaning.
- the network device 700 may be a device for implementing the linkage between an upper layer application and BFD to detect a link. It should be noted that FIG. 7 is only a possible implementation of the embodiment of the present application. In practical applications, the network device may also include more or fewer components, which is not limited here. Regarding the content not shown or described in the embodiment of the present application, please refer to the relevant description in the embodiment described in FIG. 2 or FIG. 4, which will not be repeated here.
- the network device may also be a virtual network device implemented based on a general physical server and network function virtualization (English: Netwrk Function Virtulization, NFV) technology, and the virtual network device may be a virtual router.
- the virtual network device may be a virtual machine (Virtual Machine) running to provide an upper-layer application in conjunction with BFD to detect a link, and the virtual machine is deployed on a hardware device (for example, a physical server).
- Virtual machine refers to a complete computer system with complete hardware system functions that is simulated by software and runs in a completely isolated environment. This virtual network device performs all the functions and operations of the network device 600 or the network device 700.
- An embodiment of the present invention also provides a computer non-transitory storage medium, which stores instructions in the computer non-transitory storage medium. When it runs on a processor, the flow of any method described in FIG. 2 or FIG. 4 Achieved.
- the embodiment of the present invention also provides a computer program product.
- the computer program product runs on a processor, any method flow described in FIG. 2 or FIG. 4 is realized.
- the steps of the method or algorithm described in conjunction with the disclosure of the embodiments of the present invention may be implemented in a hardware manner, or may be implemented in a manner that a processor executes software instructions.
- Software instructions can be composed of corresponding software modules.
- the software modules can be stored in Random Access Memory (RAM), flash memory, Read Only Memory (ROM), and erasable programmable read-only memory (Random Access Memory, RAM). Erasable Programmable ROM (EPROM), Electrically Erasable Programmable Read-Only Memory (Electrically EPROM, EEPROM), register, hard disk, mobile hard disk, CD-ROM or any other form of storage medium known in the art.
- An exemplary storage medium is coupled to the processor, so that the processor can read information from the storage medium and can write information to the storage medium.
- the storage medium may also be an integral part of the processor.
- the processor and the storage medium may be located in the ASIC.
- the ASIC may be located in the computing device.
- the processor and the storage medium may also exist as discrete components in the computing device.
- the program can be stored in a computer readable storage medium. When executed, it may include the procedures of the above-mentioned method embodiments.
- the aforementioned storage media include: ROM, RAM, magnetic disks, or optical disks and other media that can store program codes.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Multimedia (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
A link detection method, comprising: negotiating and establishing a time-out period of a BFD session during the process of upper applications of two network devices establishing a session, and configuring and initiating a timer according to the negotiated time-out period; and during the establishment of the BFD session, if the establishment of the BFD session is not completed by the time the timer expires, interrupting the established application layer session. In this way, if a BFD session is not established for a long time, an application layer session is interrupted, a path between two network devices is converged, and data is not sent to the path, thereby reducing data loss.
Description
本申请要求了2019年7月29日提交的,申请号为201910691227.8,发明名称为“一种链路检测的方法和装置”的中国申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese application filed on July 29, 2019, the application number is 201910691227.8, and the invention title is "a method and device for link detection", the entire content of which is incorporated into this application by reference.
本发明涉及网络技术领域,尤其涉及一种在网络中进行链路检测的方法及装置。The present invention relates to the field of network technology, in particular to a method and device for link detection in a network.
边界网关协议(Border Gateway Protocol,BGP)是一种用于自治系统(Autonomous System,AS)之间的动态路由协议。它通过维护IP路由表或‘前缀’表来实现AS之间的可达性。当两个AS需要交换路由信息时,每个AS都必须指定一个运行BGP的节点,来代表AS与其他的AS交换路由信息。这个节点可以是一个主机,但通常是路由器来执行BGP。两个AS中利用BGP交换信息的路由器也被称为边界网关(Border Gateway)或边界路由器(Border Router)。相互交换消息的BGP节点之间互称对等体(Peer)。Border Gateway Protocol (Border Gateway Protocol, BGP) is a dynamic routing protocol used between Autonomous Systems (AS). It achieves reachability between ASs by maintaining IP routing tables or ‘prefix’ tables. When two ASs need to exchange routing information, each AS must designate a node running BGP to exchange routing information with other ASs on behalf of the AS. This node can be a host, but it is usually a router to perform BGP. The routers in the two ASs that use BGP to exchange information are also called Border Gateways or Border Routers. BGP nodes that exchange messages are called peers.
BGP使用传输控制协议(Transmission Control Protocol,TCP)作为其传输层协议。BGP对等体间先建立TCP连接,在建立TCP连接后,通过Open消息(开始消息)建立BGP对等体之间的连接关系(即:BGP会话)。此后,BGP节点会周期性地向对等体发送Keepalive消息(保持消息),用来保持连接的有效性。也就是说,BGP可通过周期性的发送Keepalive消息实现邻居检测机制。但是,通常情况下,Keepalive消息的发送周期在1秒以上,因此,这种检测机制的检测周期比较长,当数据达到Gbit/s的速率等级时,这种机制的检测时间将导致大量数据丢失。BGP uses Transmission Control Protocol (TCP) as its transport layer protocol. A TCP connection is established between BGP peers first, and after the TCP connection is established, a connection relationship (ie, a BGP session) between the BGP peers is established through an Open message (start message). After that, the BGP node will periodically send Keepalive messages (keep messages) to the peer to maintain the validity of the connection. In other words, BGP can implement the neighbor detection mechanism by periodically sending Keepalive messages. However, under normal circumstances, the sending cycle of Keepalive messages is more than 1 second. Therefore, the detection cycle of this detection mechanism is relatively long. When the data reaches the Gbit/s rate level, the detection time of this mechanism will cause a large amount of data loss .
目前,为了加快BGP收敛,BGP协议通过引入双向转发检测(Bidirectional Forwarding Detection,BFD)与BGP联动功能,利用BFD的快速检测机制,迅速发现BGP对等体间链路的故障,并报告给BGP协议,从而实现BGP路由的快速收敛。其中,BFD是一个通用的标准化的介质无关和协议无关的快速故障检测机制。BFD在两台网络设备上建立会话,用来检测网络设备间的双向转发路径,为上层应用服务。BFD本身并没有邻居发现机制,而是靠被服务的上层应用通知其邻居信息以建立会话。会话建立后会周期性地快速发送BFD报文,如果在检测时间内没有收到BFD报文则认为该双向转发路径发生了故障,通知被服务的上层应用进行相应的处理。在实现BFD与BGP联动时,BGP节点在与对等体建立BGP会话之后,BGP节点根据对等体信息与该对等体建立BFD会话,使用BFD来检测链路故障。当检测到链路故障后,BGP节点与该对等体的BFD会话中断,同时联动BGP节点与该对等体的BGP会话中断。由于BFD可以达到毫秒级检测,因此,通过联动可使BGP达到快速收敛的目的。At present, in order to speed up BGP convergence, the BGP protocol introduces the bidirectional forwarding detection (BFD) and BGP linkage function, and uses the fast detection mechanism of BFD to quickly discover the link failures between BGP peers and report them to the BGP protocol. , So as to achieve rapid convergence of BGP routing. Among them, BFD is a universal and standardized rapid fault detection mechanism that is independent of media and protocol. BFD establishes a session on two network devices to detect the bidirectional forwarding path between the network devices and serve upper-layer applications. BFD itself does not have a neighbor discovery mechanism, but relies on the served upper application to notify its neighbor information to establish a session. After the session is established, BFD packets will be quickly sent periodically. If no BFD packets are received within the detection time, it is considered that the bidirectional forwarding path has failed, and the served upper layer application is notified to perform corresponding processing. When implementing BFD and BGP linkage, after a BGP node establishes a BGP session with a peer, the BGP node establishes a BFD session with the peer based on the peer information, and uses BFD to detect link failures. When a link failure is detected, the BFD session between the BGP node and the peer is interrupted, and the BGP session between the associated BGP node and the peer is interrupted. Because BFD can achieve millisecond level detection, BGP can achieve rapid convergence through linkage.
但是,在BGP中采用BFD检测机制的问题是,BFD会话的建立与BGP会话的建立是异步的,即在BGP会话建立之后才开始建立BFD会话。如果在BGP会话建立之后且BFD会话建立之前出现链路抖动,那么BGP只能依靠Keeplive检测对等体的状态,这就仍可能导 致较长一段时间内的数据丢失。However, the problem with using the BFD detection mechanism in BGP is that the establishment of the BFD session and the establishment of the BGP session are asynchronous, that is, the establishment of the BFD session starts after the establishment of the BGP session. If link flutter occurs after the BGP session is established and before the BFD session is established, BGP can only rely on Keeplive to detect the status of the peer, which may still cause data loss for a long period of time.
发明内容Summary of the invention
本发明提供一种网络中划分内部网关协议IGP域的方法及装置,以解决现有技术中存在的网络扩容或调整时,维护开销高的问题。The present invention provides a method and a device for dividing an IGP domain in a network to solve the problem of high maintenance overhead during network expansion or adjustment in the prior art.
为达到上述目的,本发明采用如下技术方案:To achieve the above objective, the present invention adopts the following technical solutions:
第一方面,本发明实施例提供了一种链路检测方法,应用于上层应用于BFD的联动场景中。该方法包括:第一网络设备与第二网络设备在建立应用层会话的过程中协商建立双向转发检测(BFD)会话的超时时间。第一网络设备按照协商出的所述超时时间设置并启动定时器,以及与所述第二网络设备进行双向转发检测(BFD)会话的建立。若在定时器结束前,未完成所述BFD会话的建立,则所述第一网络设备中断与所述第二网络设备的应用层会话。通过实施本发明实施例的方案,如果BFD会话长久没建立,则应用层会话就会被中断,两个网络设备间的路径被收敛,数据就不会发往该路径,从而减少数据的丢失。In the first aspect, an embodiment of the present invention provides a link detection method, which is applied in a linkage scenario where the upper layer is applied to BFD. The method includes: the first network device and the second network device negotiate a timeout period for establishing a bidirectional forwarding detection (BFD) session in the process of establishing an application layer session. The first network device sets and starts a timer according to the negotiated timeout time, and establishes a bidirectional forwarding detection (BFD) session with the second network device. If the establishment of the BFD session is not completed before the timer ends, the first network device interrupts the application layer session with the second network device. By implementing the solution of the embodiment of the present invention, if the BFD session is not established for a long time, the application layer session will be interrupted, the path between the two network devices will be converged, and data will not be sent to the path, thereby reducing data loss.
若在所述定时器结束前,已完成所述BFD会话的建立,则第一网络设备通过所述BFD会话进行链路检测。在BFD会话的建立成功的情况下,本发明实施例可以采用BFD来快速检测链路,从而加快收敛速度。If the establishment of the BFD session has been completed before the timer ends, the first network device performs link detection through the BFD session. In the case that the BFD session is successfully established, the embodiment of the present invention may use BFD to quickly detect the link, thereby accelerating the convergence speed.
在一些可能的实现方式中,第一网络设备与第二网络设备可以在建立所述应用层会话的协商消息中携带各自为所述BFD会话定义的超时时间。然后从所述第一网络设备与第二网络设备定义的超时时间中选择一个作为所述BFD会话的超时时间。通过利用应用层会话的协商消息来协商BFD会话的超时时间,可以减小对设备的改动,使方案更容易实施。In some possible implementation manners, the first network device and the second network device may carry the timeout period defined for the BFD session in the negotiation message for establishing the application layer session. Then, one of the timeout periods defined by the first network device and the second network device is selected as the timeout period of the BFD session. By using the negotiation message of the application layer session to negotiate the timeout period of the BFD session, the changes to the device can be reduced and the implementation of the solution is easier.
在一些可能的实现方式中,本发明实施例的方案可以应用到BGP与BFD的联动中,这种情况下,第一网络设备与第二网络设备可以为边界网关协议(BGP)节点,第一网络设备与第二网络设备分别在建立所述应用层会话的协商消息中携带各自为所述BFD会话定义的超时时间,包括:所述第一网络设备在与所述第二网络设备建立连接后,向所述第二网络设备发送第一开始(OPEN)报文,并接收所述第二网络设备发送的第二OPEN报文,所述第一OPEN报文和所述第二OPEN报文中分别携带所述第一网络设备和所述第二网络设备各自为所述BFD会话定义的超时时间。在BGP与BFD的联动的场景下,本发明实施例直接利用OPEN报文来实现超时时间的协商,不仅提高了易实施性,也可以达到良好的兼容性。In some possible implementation manners, the solutions of the embodiments of the present invention can be applied to the linkage between BGP and BFD. In this case, the first network device and the second network device can be Border Gateway Protocol (BGP) nodes, and the first The network device and the second network device respectively carry the timeout time defined for the BFD session in the negotiation message for establishing the application layer session, including: after the first network device establishes a connection with the second network device , Sending a first start (OPEN) message to the second network device, and receiving a second OPEN message sent by the second network device, in the first OPEN message and the second OPEN message Respectively carry the timeout time defined by the first network device and the second network device for the BFD session. In the scenario of BGP and BFD linkage, the embodiment of the present invention directly uses the OPEN message to implement the negotiation of the timeout time, which not only improves the ease of implementation, but also achieves good compatibility.
在一些可能的实现方式中,所述第一OPEN报文和所述第二OPEN报文通过BFD使能字段(BFD enable TLV)来携带所述为所述BFD会话定义的超时时间;所述BFD enable TLV中包括类型,长度和值,所述为所述BFD会话定义的超时时间携带在所述BFD enable TLV的值中。In some possible implementations, the first OPEN message and the second OPEN message carry the timeout time defined for the BFD session through a BFD enable field (BFD enable TLV); the BFD The enable TLV includes the type, length, and value, and the timeout period defined for the BFD session is carried in the value of the BFD enable TLV.
在一些可能的实现方式中,第一网络设备和第二网络设备可从所述第一网络设备与第二网络设备定义的超时时间中选择最大时间值作为所述BFD会话的超时时间。In some possible implementation manners, the first network device and the second network device may select a maximum time value from the timeout time defined by the first network device and the second network device as the timeout time of the BFD session.
第二方面,本发明提供了一种网络设备。该网络设备用于执行第一方面或第一方面的任意可能的实现方式中的方法。具体地,该网络设备包括用于执行第一方面或第一方面的任意可能的实现方式中的方法的模块,比如,执行与应用层会话中的协商相关的功能的协商单元,执行与BFD会话建立相关的功能的BFD单元,以及执行判断BFD会话建立是否超 时以及超时后的中断处理的中断单元。In the second aspect, the present invention provides a network device. The network device is used to execute the first aspect or the method in any possible implementation manner of the first aspect. Specifically, the network device includes a module for executing the method in the first aspect or any possible implementation of the first aspect, for example, a negotiation unit that performs functions related to negotiation in an application layer session, and performs a BFD session A BFD unit that establishes related functions, and an interrupt unit that performs interrupt processing for judging whether the establishment of a BFD session has timed out and after the timeout.
第三方面,本发明提供一种网络设备,该网络设备包括:通信接口、处理器、存储器、以及总线。其中,处理器通过总线分别耦接通信接口、存储器。其中,当需要运行网络设备时,通过固化在存储器中的基本输入输出系统或者嵌入式系统中的bootloader引导系统进行启动,引导网络设备进入正常运行状态。在网络设备进入正常运行状态后,再运行存储器中的应用程序和操作系统,使得该处理器执行第一方面或第一方面的任意可能的实现方式中的方法。In a third aspect, the present invention provides a network device, which includes a communication interface, a processor, a memory, and a bus. Among them, the processor is respectively coupled to the communication interface and the memory through the bus. Among them, when the network device needs to be operated, the basic input output system solidified in the memory or the bootloader in the embedded system is used to guide the system to start, and the network device is guided to enter a normal operating state. After the network device enters the normal operating state, the application program and the operating system in the memory are then run, so that the processor executes the first aspect or the method in any possible implementation manner of the first aspect.
第四方面,本发明提供一种计算机可读介质,用于存储计算机程序,该计算机程序包括用于执行第一方面或第一方面的任意可能的实现方式中的方法的指令。In a fourth aspect, the present invention provides a computer-readable medium for storing a computer program, and the computer program includes instructions for executing the first aspect or any possible implementation of the first aspect.
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly describe the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only These are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work.
图1是本发明实施例提供的一种上层应用和BFD联动的组网示意图;FIG. 1 is a schematic diagram of a networking of an upper-layer application and BFD linkage provided by an embodiment of the present invention;
图2是本发明实施例提供的链路检测方法的交互图;Figure 2 is an interaction diagram of a link detection method provided by an embodiment of the present invention;
图3是本发明实施例提供的应用BGP的网络的结构示意图;FIG. 3 is a schematic structural diagram of a BGP network provided by an embodiment of the present invention;
图4是本发明实施例提供的链路检测方法的流程图;Figure 4 is a flowchart of a link detection method provided by an embodiment of the present invention;
图5是本发明实施例提供的BFD enable TLV的一种格式示意图;FIG. 5 is a schematic diagram of a format of BFD enable TLV provided by an embodiment of the present invention;
图6是本发明实施例提供的网络设备的结构示意图;Figure 6 is a schematic structural diagram of a network device provided by an embodiment of the present invention;
图7是本申请实施例提供的网络设备的结构示意图。Fig. 7 is a schematic structural diagram of a network device provided by an embodiment of the present application.
下面将结合本实施例中的附图,对本实施例中的技术方案进行清楚、完整地描述。The technical solution in this embodiment will be clearly and completely described below in conjunction with the drawings in this embodiment.
目前,为了进行快速检测,很多上层应用中都引入了与BFD的联动功能。联动功能是指上层应用利用BFD的快速检测机制,迅速发现链路故障,并报告给上层应用,从而联动上层应用快速收敛。但在与BFD联动过程中,应用层会话(即上层应用的会话)的建立与BFD会话的建立是异步的,这就导致该在上层应用的会话完成建立但BFD会话未建立期间的链路故障无法利用BFD来快速发现,从而可能出现较长一段时间内的数据丢失。Currently, in order to perform rapid detection, many upper-layer applications have introduced the linkage function with BFD. The linkage function means that upper-layer applications use BFD's rapid detection mechanism to quickly find link failures and report them to the upper-layer applications, so that the upper-layer applications quickly converge. However, in the process of linkage with BFD, the establishment of application layer sessions (that is, the sessions of upper-layer applications) and the establishment of BFD sessions are asynchronous, which leads to link failures during the establishment of the upper-layer application sessions but the BFD session is not established. It is impossible to use BFD to quickly find out, which may result in data loss for a long period of time.
针对这一问题,本发明实施例通过在两个网络设备的上层应用建立会话的过程中协商建立BFD会话的超时时间,并按照协商出的超时时间设置并启动定时器,在建立BFD会话时,若在该定时器结束时,未完成BFD会话的建立,则中断已建立的应用层会话。这样,如果BFD会话长久没建立,则应用层会话就会被中断,两个网络设备间的路径被收敛,数据就不会发往该路径,从而减少数据的丢失。To solve this problem, the embodiment of the present invention negotiates the timeout period for establishing the BFD session during the process of establishing the session by the upper application of the two network devices, and sets and starts the timer according to the negotiated timeout period. When the BFD session is established, If the establishment of the BFD session is not completed at the end of the timer, the established application layer session is interrupted. In this way, if the BFD session is not established for a long time, the application layer session will be interrupted, the path between the two network devices will be converged, and data will not be sent to the path, thereby reducing data loss.
本发明实施例的方案可应用在上层应用和BFD的联动的场景中。如图1所示,图1为本发明实施例提供的一种上层应用和BFD联动的组网示意图。该组网中包括网络设备101-104。其中,网络设备可以是主机,路由器或交换机等。网络设备可以位于同一网络中,也可位于不同的网络中。网络设备101分别与网络设备103和网络设备104建立应用层会话,并在应用层会话建立完成后,建立BFD会话。假设网络设备101到网络设备102的路由出接口为接口1,经过网络设备103到达网络设备102。当网络设备101和网络设备103之间链路出现故障,BFD首先感知到并通知网络设备103的上层应用。网络设备103处理Down事件(即中断应用层会话),重新进行路由计算,新的路由出接口为接口2,经过网络设备104到达网络设备102。上述是上层应用与BFD的联动过程。而本发明实施例对上述过程进行了更进一步的补充,在本发明实施例中,网络设备101与网络设备103在建立应用层会话时,进一步协商建立BFD会话的超时时长,在建立BFD会话的过程中,如果超时,则网络设备101也进行Down事件处理,收敛网络设备101与网络设备103的链路,新的路由出接口为接口2,经过网络设备104到达网络设备102。也就是说,在本发明实施例中,在链路故障和BFD会话建立超时的情况下均会中断应用层会话,避免造成长时间的数据丢失。The solution of the embodiment of the present invention can be applied in a scenario where an upper layer application and BFD are linked. As shown in FIG. 1, FIG. 1 is a schematic diagram of a networking of an upper layer application and BFD linkage provided by an embodiment of the present invention. The networking includes network devices 101-104. Among them, the network device can be a host, a router, or a switch. Network devices can be located in the same network or in different networks. The network device 101 establishes an application layer session with the network device 103 and the network device 104 respectively, and establishes a BFD session after the establishment of the application layer session is completed. Assume that the route outbound interface from the network device 101 to the network device 102 is the interface 1, and the network device 103 reaches the network device 102 through the network device 103. When the link between the network device 101 and the network device 103 fails, the BFD first perceives and informs the upper layer application of the network device 103. The network device 103 processes the Down event (that is, interrupts the application layer session), re-calculates the route, and the new route outgoing interface is interface 2, which passes through the network device 104 to the network device 102. The above is the linkage process between upper-layer applications and BFD. The embodiment of the present invention further supplements the above process. In the embodiment of the present invention, when the network device 101 and the network device 103 establish an application layer session, they further negotiate the timeout period for establishing a BFD session. During the process, if it times out, the network device 101 also performs Down event processing to converge the link between the network device 101 and the network device 103, and the new route outgoing interface is interface 2, which passes through the network device 104 to the network device 102. That is to say, in the embodiment of the present invention, the application layer session will be interrupted in the case of link failure and BFD session establishment timeout, so as to avoid long-term data loss.
上述方案在具体实施时,主要涉及采用将上层应用与BFD联动的两个网络设备(例如,网络设备101和网络设备103)。本发明实施例中将这两个网络设备称为第一网络设备和第二网络设备,第一网络设备与第二网络设备可互称对端网络设备。通常情况下第一网络设备和第二网络设备在建立应用层会话时,会进行应用层会话协商。本发明实施例可将建立BFD会话的超时时间的协商加入到应用层会话的协商消息中。具体实施过程如图2所示,图2为本发明实施例提供的链路检测方法的交互图。该方法包括应用层会话建立过程和BFD会话建立过程。When the above-mentioned solution is specifically implemented, it mainly involves the use of two network devices (for example, network device 101 and network device 103) that link upper-layer applications with BFD. In the embodiment of the present invention, these two network devices are referred to as a first network device and a second network device, and the first network device and the second network device may be referred to as opposite end network devices. Generally, when the first network device and the second network device establish an application layer session, they perform application layer session negotiation. In the embodiment of the present invention, the negotiation of the timeout period for establishing the BFD session can be added to the negotiation message of the application layer session. The specific implementation process is shown in Figure 2, which is an interaction diagram of the link detection method provided by an embodiment of the present invention. The method includes an application layer session establishment process and a BFD session establishment process.
其中,应用层会话建立过程包括:Among them, the application layer session establishment process includes:
步骤S201-S202:第一网络设备向第二网络设备发送建立应用层会话的协商消息,并接收第二网络设备发送建立应用层会话的协商消息。其中,第一网络设备和第二网络设备在发送协商消息中携带各自为BFD会话定义的超时时间。Steps S201-S202: The first network device sends a negotiation message for establishing an application layer session to the second network device, and receives a negotiation message for establishing an application layer session sent by the second network device. Wherein, the first network device and the second network device send the negotiation message to carry the timeout time defined for the BFD session.
协商消息可以是会话建立过程中具有协商功能的消息,例如,会话的创建消息或初始消息等。The negotiation message may be a message with a negotiation function during the session establishment process, for example, a session creation message or an initial message.
BFD会话建立过程包括:The BFD session establishment process includes:
步骤S203-S204,第一网络设备和第二网络设备从第一网络设备与第二网络设备定义的超时时间中选择一个作为BFD会话的超时时间,第一网络设备和第二网络设备按照协商出的超时时间设置并启动定时器。Steps S203-S204, the first network device and the second network device select one of the timeout periods defined by the first network device and the second network device as the timeout period of the BFD session, and the first network device and the second network device negotiate Set the timeout period and start the timer.
在选择时,第一网络设备与第二网络设备可按统一的规则来选,例如,可在超时时间中选择最大时间值作为BFD会话的超时时间。按统一规则选择出的超时时间即为协商出的 BFD会话的超时时间。When selecting, the first network device and the second network device can be selected according to a uniform rule. For example, the maximum time value can be selected as the timeout time of the BFD session in the timeout time. The timeout time selected according to the uniform rule is the timeout time of the negotiated BFD session.
步骤S205,第一网络设备和第二网络设备开始建立BFD会话。Step S205: The first network device and the second network device start to establish a BFD session.
步骤S206,判断是否在定时器结束前完成了BFD会话的建立。Step S206: It is judged whether the establishment of the BFD session is completed before the timer ends.
若在定时器结束前,未完成所述BFD会话的建立,则第一网络设备中断与第二网络设备的应用层会话。若在定时器结束前,已完成BFD会话的建立,则第一网络设备通过BFD会话检测与第二网络设备之间的链路。If the establishment of the BFD session is not completed before the timer ends, the first network device interrupts the application layer session with the second network device. If the establishment of the BFD session is completed before the timer ends, the first network device detects the link with the second network device through the BFD session.
通过上述方式,避免了较长时间内无法进行链路检测的情况的发生,可有效减少数据的丢失。Through the above method, the occurrence of a situation where link detection cannot be performed for a long time is avoided, and data loss can be effectively reduced.
本发明实施例的方案可应用在多种上层应用和BFD的联动的场景中,例如,BFD与开放式最短路径优先(Open Shortest Path First,OSPF)联动,BFD与中间系统到中间系统(Intermediate System to Intermediate System,IS-IS)联动,BFD与BGP联动,BFD与虚拟路由冗余协议(Virtual Router Redundancy Protocol,VRRP)联动等等。不同的联动场景下,第一网络设备和第二网络设备上使能的上层应用协议不同。例如,在BFD与OSPF联动的场景下,第一网络设备和第二网络设备可以是使能了OSPF功能的设备,在BFD与IS-IS联动的场景下,第一网络设备和第二网络设备可以是使能了IS-IS功能的设备;在BFD与BGP联动的场景下,第一网络设备和第二网络设备可以是使能了BGP功能的设备。为了便于理解,本发明实施例以BFD与BGP联动为例进行说明。The solution of the embodiment of the present invention can be applied to scenarios where a variety of upper-layer applications and BFD are linked, for example, BFD is linked with Open Shortest Path First (OSPF), and BFD is linked with an intermediate system to an intermediate system (Intermediate System). to Intermediate System (IS-IS) linkage, BFD and BGP linkage, BFD and Virtual Router Redundancy Protocol (VRRP) linkage, etc. In different linkage scenarios, the upper layer application protocols enabled on the first network device and the second network device are different. For example, in the scenario of BFD and OSPF linkage, the first network device and the second network device may be devices with OSPF enabled. In the scenario of BFD and IS-IS linkage, the first network device and the second network device It may be a device with the IS-IS function enabled; in the scenario where BFD and BGP are linked, the first network device and the second network device may be devices with the BGP function enabled. For ease of understanding, the embodiment of the present invention takes the linkage of BFD and BGP as an example for description.
为了方便理解本申请的各个实施例,首先介绍在BFD与BGP联动的场景中可能出现的几个概念。应理解的是,以下的概念解释可能会因为本申请的具体情况有所限制,但并不代表本申请仅能局限于该具体情况,以下概念的解释伴随不同实施例的具体情况可能也会存在差异。In order to facilitate the understanding of the various embodiments of the present application, firstly, several concepts that may appear in the scenario where BFD and BGP are linked are introduced. It should be understood that the following conceptual explanations may be limited due to the specific circumstances of this application, but it does not mean that this application can only be limited to this specific situation. The following conceptual explanations may also exist with specific circumstances of different embodiments. difference.
BGP报文交互中分为发言者(Speaker)和对等体(Peer)两种角色。There are two roles in BGP message interaction: Speaker and Peer.
Speaker(发言者):发送BGP报文的设备称为BGP发言者,它接收或产生新的报文信息,并发布(Advertise)给其它BGP Speaker。BGP发言者为使能了BGP的网络设备。为了方便描述,本发明实施例中将BGP Speaker称为BGP节点。Speaker: The device that sends BGP messages is called the BGP speaker. It receives or generates new message information and advertises to other BGP Speakers. The BGP speaker is a BGP-enabled network device. For ease of description, in the embodiment of the present invention, BGP Speaker is referred to as a BGP node.
Peer(对等体):相互交换报文的Speaker之间互称对等体,也可互称邻居。Peer: Speakers exchanging messages are called peers or neighbors.
BGP通常应用于AS之间,如图3所示,图3是本发明实施例提供的应用BGP的网络的结构示意图。该网络中包括AS1和AS2两个自治系统。AS1中包括BGP节点101,102,103。AS2中包括BGP节点104,105。BGP节点是使能了BGP功能的网络设备,该网络设备可以是主机,路由器,交换机等。其中,虚线箭头所示两端的BGP节点互为对等体。比如,BGP节点101为BGP节点102的对等体,BGP节点102也为BGP节点101的对等体。AS1与AS2之间通过BGP节点102和BGP节点104交换信息。需要说明的是,不是任意两 个BGP节点之间均能交互,两个BGP节点必须组成一对(即BGP peer)才能交互。两个BGP节点通过建立BGP会话来结成对等体。结成对等体的两个BGP节点如果使能了BFD能力,那么这两个BGP节点可以进一步建立BFD会话,通过BGP与BFD的联动来实现快速检测。两个BGP节点在实现BGP与BFD的联动时,可实施图2所示实施例的方案来减少数据的丢失。BGP is generally applied between ASs, as shown in FIG. 3, which is a schematic structural diagram of a network using BGP according to an embodiment of the present invention. The network includes two autonomous systems, AS1 and AS2. AS1 includes BGP nodes 101, 102, 103. AS2 includes BGP nodes 104 and 105. A BGP node is a network device with the BGP function enabled. The network device can be a host, router, switch, etc. Among them, the BGP nodes at both ends shown by the dotted arrows are peers. For example, the BGP node 101 is a peer of the BGP node 102, and the BGP node 102 is also a peer of the BGP node 101. AS1 and AS2 exchange information through the BGP node 102 and the BGP node 104. It should be noted that not any two BGP nodes can interact with each other. Two BGP nodes must form a pair (ie BGP peer) to interact. Two BGP nodes establish a BGP session to form a peer. If the two BGP nodes that form a peer have the BFD capability enabled, the two BGP nodes can further establish a BFD session, and realize rapid detection through the linkage between BGP and BFD. When two BGP nodes realize the linkage between BGP and BFD, the solution of the embodiment shown in FIG. 2 can be implemented to reduce data loss.
下面结合图4对BGP中实现快速检测进行详细说明。图4为本发明实施例提供的链路检测方法的流程图。该方法包括:The implementation of fast detection in BGP will be described in detail below in conjunction with Figure 4. Fig. 4 is a flowchart of a link detection method provided by an embodiment of the present invention. The method includes:
S401,第一BGP节点与第二BGP节点建立TCP连接。S401: The first BGP node establishes a TCP connection with the second BGP node.
BGP使用TCP作为其传输层协议。在建立BGP会话前,可先建立TCP连接。建立TCP连接的过程可采用现有技术,这里不再赘述。BGP uses TCP as its transport layer protocol. Before establishing a BGP session, a TCP connection can be established first. The process of establishing the TCP connection can adopt the existing technology, which will not be repeated here.
S402,第一BGP节点向第二BGP节点发送用于建立BGP会话的BGP开始消息(即BGP OPEN消息),并在BGP OPEN消息中携带第一BGP节点定义的建立BFD会话的超时时间。S402: The first BGP node sends a BGP start message (ie, BGP OPEN message) for establishing a BGP session to the second BGP node, and the BGP OPEN message carries the timeout period for establishing a BFD session defined by the first BGP node.
Open消息(开始消息)是TCP连接建立后发送的第一个消息,用于建立BGP对等体之间的连接关系(即:BGP会话)。该消息可在BGP会话初始建立时协商各种能力,比如地址族能力、Refresh能力、GR(Graceful Restart,平滑重起)能力等。本发明实施例可利用该消息来协商BFD能力,协商的BFD能力中可包括建立BFD会话的超时时间。The Open message (start message) is the first message sent after the TCP connection is established, and is used to establish a connection relationship between BGP peers (ie, a BGP session). This message can negotiate various capabilities when the BGP session is initially established, such as address family capabilities, Refresh capabilities, GR (Graceful Restart) capabilities, and so on. The embodiment of the present invention may use the message to negotiate the BFD capability, and the negotiated BFD capability may include the timeout period for establishing the BFD session.
具体的,OPEN消息中可新增一个BFD使能字段(BFD enable TLV)来协商BFD能力。类型-长度-值(Type-Length-Value,TLV)是一种报文格式。BFD enable TLV用于告知本端的BFD能力(即是否支持BFD)并协商建立BFD会话的超时时间。BFD enable TLV可参考图5,图5为本发明实施例提供的BFD enable TLV的一种格式示意图。其中,该报文格式中各参数的含义如下:Specifically, a BFD enable field (BFD enable TLV) can be added to the OPEN message to negotiate BFD capabilities. Type-Length-Value (Type-Length-Value, TLV) is a message format. The BFD enable TLV is used to inform the local BFD capability (that is, whether to support BFD) and negotiate the timeout period for establishing a BFD session. For BFD-enable TLV, refer to FIG. 5, which is a schematic diagram of a format of BFD-enable TLV according to an embodiment of the present invention. Among them, the meaning of each parameter in the message format is as follows:
Type:TLV的类型(标识是否使能了BFD)Type: TLV type (identifies whether BFD is enabled)
Length:长度(2Byte)Length: Length (2Byte)
Value:Timer(标识定时器时间,可利用该参数定义建立BFD会话的超时时间)Value: Timer (identifies the timer time, this parameter can be used to define the timeout time for establishing a BFD session)
Timer的可配置范围为1-65534,最大值65535表示不启用定时器。The configurable range of Timer is 1-65534, and the maximum value of 65535 means that the timer is not enabled.
第一BGP节点向第二BGP节点发送BGP OPEN消息中可携带BFD enable TLV来表示第一BGP节点使能了BFD能力。其中,BFD enable TLV中的Value可设置为10,表示将定时器设置为10S,即第一BGP节点定义的建立BFD会话的超时时间为10S。The BGP OPEN message sent by the first BGP node to the second BGP node may carry BFDenable TLV to indicate that the first BGP node has enabled the BFD capability. Among them, the Value in the BFDenable TLV can be set to 10, which means that the timer is set to 10S, that is, the timeout period for establishing a BFD session defined by the first BGP node is 10S.
S403,第二BGP节点向第一BGP节点发送BGP OPEN消息,并在BGP OPEN消息中携带第二BGP节点定义的建立BFD会话的超时时间。S403: The second BGP node sends a BGP OPEN message to the first BGP node, and the BGP OPEN message carries the timeout period for establishing a BFD session defined by the second BGP node.
同样的,第二BGP节点向第一BGP节点发送的BGP OPEN消息中也可以携带BFD enable TLV来表示第二BGP节点使能了BFD能力。其中,BFD enable TLV中的Value可设置为20,表示将定时器设置为20S,即第二BGP节点定义的建立BFD会话的超时时间为20S。Similarly, the BGP OPEN message sent by the second BGP node to the first BGP node may also carry BFDenable TLV to indicate that the second BGP node has enabled the BFD capability. Among them, the Value in the BFDenable TLV can be set to 20, which means that the timer is set to 20S, that is, the timeout period for establishing a BFD session defined by the second BGP node is 20S.
S404-S405,第一BGP节点和第二BGP节点在接收到对端发送的BGP OPEN消息后,向对端发送Keepalive消息进行确认,并保持连接。S404-S405: After receiving the BGP OPEN message sent by the opposite end, the first BGP node and the second BGP node send a Keepalive message to the opposite end for confirmation, and keep the connection.
当收到对端回应的Keepalive信息后,BGP会话完成建立。After receiving the Keepalive message from the peer, the BGP session is established.
S406-S408,BGP会话建立后,第一BGP节点和第二BGP节点分别根据接收到的BGP OPEN消息设置并启动定时器,并建立BFD会话。S406-S408: After the BGP session is established, the first BGP node and the second BGP node respectively set and start timers according to the received BGP OPEN message, and establish a BFD session.
第一BGP节点和第二BGP节点根据BGP OPEN消息中携带的BFD enable TLV协商出定时器值(即建立BFD会话的超时时间)。具体的,可以取两者定义的timer值中的大值(如20s)作为定时器值,对定时器进行设置,并启动定时器。The first BGP node and the second BGP node negotiate a timer value (that is, the timeout period for establishing a BFD session) according to the BFDenable TLV carried in the BGP OPEN message. Specifically, the larger value (such as 20s) of the timer values defined by the two can be taken as the timer value, the timer is set, and the timer is started.
需要说明的是,如果接收到的BGP OPEN消息中不携带BFD enable TLV,则表示对方不支持BFD enableTLV或没有BFD能力,此时,则不启动定时器。本实施例均以携带BFD enable TLV为例进行说明。It should be noted that if the received BGP OPEN message does not carry BFD enable TLV, it means that the other party does not support BFD enable TLV or has no BFD capability. In this case, the timer is not started. In this embodiment, the carrying of BFD-enable TLV is taken as an example for description.
建立BFD会话可采用现有技术来实现,这里不再赘述。The establishment of the BFD session can be achieved by using the existing technology, which will not be repeated here.
S409,在定时器结束前,未完成BFD会话的建立,第一网络设备和第二网络设备向对方发送BGP通知(Notification)消息,中断和对方的BGP会话。S409: Before the timer expires, the establishment of the BFD session is not completed, and the first network device and the second network device send a BGP notification (Notification) message to each other to interrupt the BGP session with each other.
BGP Notification消息是一种通知检测到错误的消息。第一网络设备和第二网络设备发送BGP Notification消息后,会在本端将对等体置down(即中断与对等体的BGP会话)。The BGP Notification message is a message to notify that an error has been detected. After the first network device and the second network device send the BGP Notification message, they will set the peer down at the local end (that is, the BGP session with the peer will be interrupted).
本实实施例是以定时器结束前,未完成BFD会话的建立为例进行说明的,如果在定时器结束前,已完成BFD会话的建立,则第一网络设备和第二网络设备通过已建立的BFD会话进行链路检测。In this embodiment, the establishment of the BFD session is not completed before the timer expires as an example. If the establishment of the BFD session is completed before the timer ends, the first network device and the second network device pass the established Link detection for the BFD session.
由BFD会话进行链路检测的过程可参考现有技术来实现,这里不再赘述。The process of link detection by the BFD session can be implemented with reference to the prior art, which will not be repeated here.
上述实施例通过扩展BGP中的OPEN消息,实现了对BFD会话建立是否超时的控制,极大可能的缩短了业务受损时间。而且,采用扩展现有消息的方式使得对现有设备的改动小,兼容性好。The foregoing embodiment implements the control over whether the establishment of the BFD session is overtime by extending the OPEN message in the BGP, which greatly reduces the service damage time. Moreover, the method of expanding existing messages makes the changes to existing equipment small and has good compatibility.
以上是以BFD与BGP联动为例进行说明。在其它上层应用与BFD联动的场景中可以参考BFD与BGP联动类似实现,这里不再一一赘述。The above description is based on the linkage between BFD and BGP as an example. In other scenarios where upper-layer applications are linked with BFD, you can refer to the similar implementation of BFD and BGP linkage, which will not be repeated here.
图6示意性地示出了本发明实施例提供的网络设备600。该网络设备600包括协商单 元601,BFD单元602以及中断单元603。Fig. 6 schematically shows a network device 600 provided by an embodiment of the present invention. The network device 600 includes a negotiation unit 601, a BFD unit 602, and an interrupt unit 603.
其中,协商单元601用于与对端网络设备在建立应用层会话的过程中协商建立双向转发检测(BFD)会话的超时时间。例如,当该协商单元601所属网络设备为上述方法实施例中的第一网络设备或第一BGP节点时,对端网络设备为上述方法实施例中的第二网络设备或第二BGP节点。协商单元601的具体实现可参见图2和图4所示方法实施例中第一网络设备或第一BGP节点与第二网络设备或第二BGP节点协商建立BFD会话的超时时间的功能。Wherein, the negotiating unit 601 is configured to negotiate a timeout period for establishing a bidirectional forwarding detection (BFD) session with the peer network device in the process of establishing an application layer session. For example, when the network device to which the negotiation unit 601 belongs is the first network device or the first BGP node in the foregoing method embodiment, the peer network device is the second network device or the second BGP node in the foregoing method embodiment. For the specific implementation of the negotiation unit 601, refer to the function of the first network device or the first BGP node and the second network device or the second BGP node in the method embodiments shown in FIG. 2 and FIG. 4 to negotiate a timeout period for establishing a BFD session.
BFD单元602用于按照协商单元601协商出的超时时间设置并启动定时器,以及与对端网络设备建立双向转发检测(BFD)会话。BFD单元602的具体实现可参见图2和图4所示方法实施例中第一网络设备或第一BGP节点设置定时器以及建立BFD会话部分。The BFD unit 602 is configured to set and start a timer according to the timeout time negotiated by the negotiation unit 601, and establish a bidirectional forwarding detection (BFD) session with the peer network device. For the specific implementation of the BFD unit 602, refer to the part of the first network device or the first BGP node in the method embodiments shown in FIG. 2 and FIG. 4 for setting a timer and establishing a BFD session.
中断单元603,用于在BFD单元602未在定时器结束前完成BFD会话的建立的情况下,中断与对端网络设备的应用层会话。中断单元603的具体实现可参见图2和图4所示方法实施例中第一网络设备或第一BGP节点中断与第二网络设备或第二BGP节点的应用层会话部分。The interrupting unit 603 is configured to interrupt the application layer session with the peer network device when the BFD unit 602 does not complete the establishment of the BFD session before the timer ends. For the specific implementation of the interrupt unit 603, refer to the part of the first network device or the first BGP node interrupting the application layer session with the second network device or the second BGP node in the method embodiments shown in FIG. 2 and FIG. 4.
BFD单元602还可以在定时器结束前已完成所述BFD会话的建立的情况下,通过建立的BFD会话进行链路检测。The BFD unit 602 may also perform link detection through the established BFD session when the establishment of the BFD session has been completed before the timer ends.
上述网络设备应用在不同的场景下,可以使能不同的上层应用功能,例如,应用在BFD与BGP联动的场景下,网络设备可以使能BGP功能并执行图4所示方法实施例中第一BGP节点或第二BGP节点的功能。The above-mentioned network equipment can be used in different scenarios to enable different upper-layer application functions. For example, in a scenario where BFD and BGP are linked, the network equipment can enable the BGP function and execute the first method in the method embodiment shown in Figure 4. The function of the BGP node or the second BGP node.
应理解,这里的网络设备600以功能单元的形式体现。在一个可选例子中,本领域技术人员可以理解,网络设备600可以对应于上述实施例中的网络设备,第一网络设备,第二网络设备,第一BGP节点,第二BGP节点,可以用于执行上述方法实施例中与相关设备对应的各个流程和/或步骤,为避免重复,在此不再赘述。It should be understood that the network device 600 here is embodied in the form of a functional unit. In an optional example, those skilled in the art can understand that the network device 600 may correspond to the network device in the foregoing embodiment. The first network device, the second network device, the first BGP node, and the second BGP node can be used In order to avoid repetition, the various processes and/or steps corresponding to the related equipment in the foregoing method embodiments are not repeated here.
通常情况下,实现本发明实施例的网络设备(如,第一网络设备,第二网络设备,第一BGP节点,第二BGP节点)可以是主机,路由器或交换机等。下面对本发明实施例中的网络设备的硬件结构进行介绍。图7为本发明实施例提供的网络设备的结构示意图。如图7所示,网络设备700包括:通信接口701、处理器702、存储器703。可选地,网络设备700还可以包括总线704。其中,通信接口701、处理器702以及存储器703可以通过总线704相互连接。Generally, the network device (for example, the first network device, the second network device, the first BGP node, the second BGP node) implementing the embodiments of the present invention may be a host, a router, or a switch. The hardware structure of the network device in the embodiment of the present invention is introduced below. Figure 7 is a schematic structural diagram of a network device provided by an embodiment of the present invention. As shown in FIG. 7, the network device 700 includes: a communication interface 701, a processor 702, and a memory 703. Optionally, the network device 700 may further include a bus 704. Wherein, the communication interface 701, the processor 702, and the memory 703 may be connected to each other through a bus 704.
其中,处理器可以由一个或者多个通用处理器构成,例如中央处理器(Central Processing Unit,CPU)。处理器可用于运行相关的程序代码中处理功能的程序。也就是说,处理器执行程序代码可以实现图6所示实施例中的协商单元,BFD单元以及中断单元的功能,或者实现如图2中的第一网络设备的功能,图4中第一BGP节点的功能。Among them, the processor may be composed of one or more general-purpose processors, such as a central processing unit (CPU). The processor can be used to run programs for processing functions in related program codes. That is to say, the program code executed by the processor can realize the functions of the negotiation unit, the BFD unit, and the interrupt unit in the embodiment shown in FIG. 6, or realize the function of the first network device in FIG. 2, and the first BGP in FIG. The function of the node.
通信接口701可以为有线接口(例如以太网接口)或无线接口(例如蜂窝网络接口或使用无线局域网接口),用于与其他模块或设备进行通信。例如,本申请实施例中第一网络设备中的通信接口7011具体可用于接收第二网络设备发送的消息,或者向第二网络设备发送消息等。The communication interface 701 may be a wired interface (such as an Ethernet interface) or a wireless interface (such as a cellular network interface or using a wireless local area network interface) for communicating with other modules or devices. For example, the communication interface 7011 in the first network device in the embodiment of the present application may be specifically used to receive a message sent by the second network device, or send a message to the second network device.
存储器703可以包括易失性存储器(Volatile Memory),例如随机存取存储器(Random Access Memory,RAM);存储器也可以包括非易失性存储器(Non-Volatile Memory),例如只读存储器(Read-Only Memory,ROM)、快闪存储器(Flash Memory)、硬盘(Hard Disk Drive,HDD)或固态硬盘(Solid-State Drive,SSD);存储器703还可以包括上述种类的存储器的组合。存储器可用于存储一组程序代码,以便于处理器调用存储器中存储的程序代码以实现本申请实施例中涉及的通信模块和/或处理模块的功能,本申请实施例并不做限定。The memory 703 may include volatile memory (Volatile Memory), such as random access memory (Random Access Memory, RAM); the memory may also include non-volatile memory (Non-Volatile Memory), such as read-only memory (Read-Only Memory). Memory, ROM), Flash Memory (Flash Memory), Hard Disk Drive (HDD), or Solid-State Drive (SSD); the memory 703 may also include a combination of the foregoing types of memories. The memory may be used to store a set of program codes, so that the processor can call the program codes stored in the memory to implement the functions of the communication module and/or processing module involved in the embodiment of the present application, which is not limited in the embodiment of the present application.
本申请实施例中所描述的特征,功能和/或方法(如,图2或图4所示的方法)可以在网络设备700中实现。例如,本申请实施例中的特征、功能或方法可以通过硬件、固件和/或安装在硬件上运行的软件来实现。网络设备700可以是通过网络、系统,和/或域传送数据的任意设备(例如,交换机、路由器、网桥、服务器、客户端等)。此外,网络节点、网络部件、网络设备、网元和/或类似术语可以互换使用,用于概括性地描述网络设备;并且除非本申请另有特别规定和/或声明,这些术语不具有特定或特殊含义。在一项示例实施例中,网络设备700可以是用于实施上层应用与BFD联动来检测链路的装置。需要说明的,图7仅仅是本申请实施例的一种可能的实现方式,实际应用中,网络设备还可以包括更多或更少的部件,这里不作限制。关于本申请实施例中未示出或未描述的内容,可参见前述图2或图4所述实施例中的相关阐述,这里不再赘述。The features, functions, and/or methods described in the embodiments of the present application (for example, the method shown in FIG. 2 or FIG. 4) may be implemented in the network device 700. For example, the features, functions, or methods in the embodiments of the present application may be implemented by hardware, firmware, and/or software installed and running on hardware. The network device 700 may be any device (for example, a switch, a router, a bridge, a server, a client, etc.) that transmits data through a network, a system, and/or a domain. In addition, network nodes, network components, network devices, network elements, and/or similar terms can be used interchangeably to describe network devices in general; and unless otherwise specified and/or stated in this application, these terms have no specific meaning. Or special meaning. In an example embodiment, the network device 700 may be a device for implementing the linkage between an upper layer application and BFD to detect a link. It should be noted that FIG. 7 is only a possible implementation of the embodiment of the present application. In practical applications, the network device may also include more or fewer components, which is not limited here. Regarding the content not shown or described in the embodiment of the present application, please refer to the relevant description in the embodiment described in FIG. 2 or FIG. 4, which will not be repeated here.
在其它可能的实施例中,网络设备也可以是基于通用的物理服务器和网络功能虚拟化(英文:Netwrk Function Virtulization,NFV)技术实现的虚拟网络设备,所述虚拟网络设备可以为虚拟路由器。所述虚拟网络设备可以是运行有用于提供上层应用与BFD联动来检测链路的虚拟机(Virtual Machine),所述虚拟机部署在硬件设备上(例如,物理服务器)。虚拟机指通过软件模拟的具有完整硬件系统功能的、运行在一个完全隔离环境中的完整计算机系统。这种虚拟的网络设备执行网络设备600或网络设备700所有的功能和操作。In other possible embodiments, the network device may also be a virtual network device implemented based on a general physical server and network function virtualization (English: Netwrk Function Virtulization, NFV) technology, and the virtual network device may be a virtual router. The virtual network device may be a virtual machine (Virtual Machine) running to provide an upper-layer application in conjunction with BFD to detect a link, and the virtual machine is deployed on a hardware device (for example, a physical server). Virtual machine refers to a complete computer system with complete hardware system functions that is simulated by software and runs in a completely isolated environment. This virtual network device performs all the functions and operations of the network device 600 or the network device 700.
本发明实施例还提供一种计算机非瞬态存储介质,所述计算机非瞬态存储介质中存储有指令,当其在处理器上运行时,图2或者图4中所描述的任一方法流程得以实现。An embodiment of the present invention also provides a computer non-transitory storage medium, which stores instructions in the computer non-transitory storage medium. When it runs on a processor, the flow of any method described in FIG. 2 or FIG. 4 Achieved.
本发明实施例还提供一种计算机程序产品,当所述计算机程序产品在处理器上运行时,图2或者图4中所描述的任一方法流程得以实现。The embodiment of the present invention also provides a computer program product. When the computer program product runs on a processor, any method flow described in FIG. 2 or FIG. 4 is realized.
结合本发明实施例公开内容所描述的方法或者算法的步骤可以硬件的方式来实现,也可以是由处理器执行软件指令的方式来实现。软件指令可以由相应的软件模块组成,软件模块可以被存放于随机存取存储器(Random Access Memory,RAM)、闪存、只读存储器(Read Only Memory,ROM)、可擦除可编程只读存储器(Erasable Programmable ROM,EPROM)、电可擦可编程只读存储器(Electrically EPROM,EEPROM)、寄存器、硬盘、移动硬盘、只读光盘(CD-ROM)或者本领域熟知的任何其它形式的存储介质中。一种示例性的存储介质耦合至处理器,从而使处理器能够从该存储介质读取信息,且可向该存储介质写入信息。当然,存储介质也可以是处理器的组成部分。处理器和存储介质可以位于ASIC中。另外,该ASIC可以位于计算设备中。当然,处理器和存储介质也可以作为分立组件存在于计算设备中。The steps of the method or algorithm described in conjunction with the disclosure of the embodiments of the present invention may be implemented in a hardware manner, or may be implemented in a manner that a processor executes software instructions. Software instructions can be composed of corresponding software modules. The software modules can be stored in Random Access Memory (RAM), flash memory, Read Only Memory (ROM), and erasable programmable read-only memory (Random Access Memory, RAM). Erasable Programmable ROM (EPROM), Electrically Erasable Programmable Read-Only Memory (Electrically EPROM, EEPROM), register, hard disk, mobile hard disk, CD-ROM or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor, so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium may also be an integral part of the processor. The processor and the storage medium may be located in the ASIC. In addition, the ASIC may be located in the computing device. Of course, the processor and the storage medium may also exist as discrete components in the computing device.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing relevant hardware through a computer program. The program can be stored in a computer readable storage medium. When executed, it may include the procedures of the above-mentioned method embodiments. The aforementioned storage media include: ROM, RAM, magnetic disks, or optical disks and other media that can store program codes.
Claims (14)
- 一种链路检测方法,其特征在于,包括:A method for link detection, characterized in that it comprises:第一网络设备与第二网络设备在建立应用层会话的过程中协商建立双向转发检测(BFD)会话的超时时间;The first network device and the second network device negotiate a timeout period for establishing a bidirectional forwarding detection (BFD) session during the process of establishing an application layer session;所述第一网络设备按照协商出的所述超时时间设置并启动定时器,以及与所述第二网络设备进行双向转发检测(BFD)会话的建立;The first network device sets and starts a timer according to the negotiated timeout time, and establishes a bidirectional forwarding detection (BFD) session with the second network device;若在所述定时器结束前,未完成所述BFD会话的建立,则所述第一网络设备中断与所述第二网络设备的应用层会话。If the establishment of the BFD session is not completed before the timer ends, the first network device interrupts the application layer session with the second network device.
- 如权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1, wherein the method further comprises:若在所述定时器结束前,已完成所述BFD会话的建立,则所述第一网络设备通过所述BFD会话进行链路检测。If the establishment of the BFD session has been completed before the timer ends, the first network device performs link detection through the BFD session.
- 如权利要求1或2所述的方法,其特征在于,第一网络设备与第二网络设备在建立应用层会话的过程中协商建立双向转发检测(BFD)会话的超时时间,包括:The method according to claim 1 or 2, wherein the first network device and the second network device negotiate a timeout period for establishing a bidirectional forwarding detection (BFD) session during the process of establishing an application layer session, comprising:所述第一网络设备与第二网络设备分别在建立所述应用层会话的协商消息中携带各自为所述BFD会话定义的超时时间;The first network device and the second network device respectively carry a timeout period defined for the BFD session in a negotiation message for establishing the application layer session;从所述第一网络设备与第二网络设备定义的超时时间中选择一个作为所述BFD会话的超时时间。One of the timeout periods defined by the first network device and the second network device is selected as the timeout period of the BFD session.
- 如权利要求3所述的方法,其特征在于,所述第一网络设备与第二网络设备为边界网关协议(BGP)节点,所述第一网络设备与第二网络设备分别在建立所述应用层会话的协商消息中携带各自为所述BFD会话定义的超时时间,包括:The method of claim 3, wherein the first network device and the second network device are Border Gateway Protocol (BGP) nodes, and the first network device and the second network device are respectively establishing the application The negotiation message of the layer session carries the timeout time each defined for the BFD session, including:所述第一网络设备在与所述第二网络设备建立连接后,向所述第二网络设备发送第一开始(OPEN)报文,并接收所述第二网络设备发送的第二OPEN报文,所述第一OPEN报文和所述第二OPEN报文中分别携带所述第一网络设备和所述第二网络设备各自为所述BFD会话定义的超时时间。After establishing a connection with the second network device, the first network device sends a first start (OPEN) message to the second network device, and receives a second OPEN message sent by the second network device The first OPEN message and the second OPEN message respectively carry the timeout time defined by the first network device and the second network device for the BFD session.
- 如权利要求4所述的方法,其特征在于,所述第一OPEN报文和所述第二OPEN报文通过BFD使能字段(BFD enable TLV)来携带所述为所述BFD会话定义的超时时间;所述BFD enable TLV中包括类型,长度和值,所述为所述BFD会话定义的超时时间携带在所述BFD enable TLV的值中。The method of claim 4, wherein the first OPEN message and the second OPEN message carry the timeout defined for the BFD session through a BFD enable field (BFD enable TLV) Time; the BFD-enable TLV includes a type, a length, and a value, and the timeout period defined for the BFD session is carried in the value of the BFD-enable TLV.
- 如权利要求3-5任一项所述的方法,其特征在于,所述从所述第一网络设备与第二网络设备定义的超时时间中选择一个作为所述BFD会话的超时时间,包括:从所述第一网络设备与第二网络设备定义的超时时间中选择最大时间值作为所述BFD会话的超时时间。The method according to any one of claims 3-5, wherein the selecting one of the timeout periods defined by the first network device and the second network device as the timeout period of the BFD session comprises: The maximum time value is selected from the timeout time defined by the first network device and the second network device as the timeout time of the BFD session.
- 一种网络设备,其特征在于,包括:A network device, characterized by comprising:协商单元,用于与对端网络设备在建立应用层会话的过程中协商建立双向转发检测(BFD)会话的超时时间;The negotiation unit is used to negotiate the timeout period for establishing a bidirectional forwarding detection (BFD) session with the peer network device in the process of establishing an application layer session;BFD单元,用于按照所述协商单元协商出的所述超时时间设置并启动定时器,以及与所述对端网络设备建立双向转发检测(BFD)会话;The BFD unit is configured to set and start a timer according to the timeout time negotiated by the negotiation unit, and establish a bidirectional forwarding detection (BFD) session with the peer network device;中断单元,用于在所述BFD单元未在所述定时器结束前完成所述BFD会话的建立的情况下,中断与所述对端网络设备的应用层会话。The interrupting unit is configured to interrupt the application layer session with the peer network device when the BFD unit does not complete the establishment of the BFD session before the timer ends.
- 如权利要求7所述的网络设备,其特征在于,若在所述定时器结束前,已完成所述BFD会话的建立,则所述BFD单元还用于通过所述BFD会话进行链路检测。8. The network device according to claim 7, wherein if the establishment of the BFD session is completed before the timer ends, the BFD unit is further configured to perform link detection through the BFD session.
- 如权利要求7或8所述的网络设备,其特征在于,所述协商单元具体用于向所述对端网络设备发送本端为所述BFD会话定义的超时时间,并接收所述对端网络设备发送的所述对端网络设备为所述BFD会话定义的超时时间;所述本端以及所述对端网络设备为所述BFD会话定义的超时时间携带在建立所述应用层会话的协商消息中;The network device according to claim 7 or 8, wherein the negotiation unit is specifically configured to send a timeout time defined by the local end for the BFD session to the opposite-end network device, and receive The timeout period defined by the peer network device for the BFD session sent by the device; the timeout period defined by the local end and the peer network device for the BFD session is carried in the negotiation message for establishing the application layer session in;从所述本端以及所述对端网络设备定义的超时时间中选择一个作为所述BFD会话的超时时间。One of the timeout periods defined by the local end and the opposite end network device is selected as the timeout period of the BFD session.
- 如权利要求9所述的网络设备,其特征在于,所述网络设备以及所述对端网络设备为边界网关协议(BGP)节点,所述协商单元用于向所述对端网络设备发送本端为所述BFD会话定义的超时时间,并接收所述对端网络设备发送的所述对端网络设备为所述BFD会话定义的超时时间,包括:The network device according to claim 9, wherein the network device and the opposite end network device are Border Gateway Protocol (BGP) nodes, and the negotiation unit is used to send the local end to the opposite end network device The timeout period defined for the BFD session and receiving the timeout period defined by the peer network device for the BFD session sent by the peer network device includes:在与所述对端网络设备建立连接后,所述协商单元用于向所述对端网络设备发送第一开始(OPEN)报文,并接收所述对端网络设备发送的第二OPEN报文,所述第一OPEN报文和所述第二OPEN报文中分别携带所述网络设备和所述对端网络设备各自为所述BFD会话定义的超时时间。After establishing a connection with the opposite network device, the negotiation unit is configured to send a first start (OPEN) message to the opposite network device, and receive a second OPEN message sent by the opposite network device The first OPEN message and the second OPEN message respectively carry the timeout time defined by the network device and the opposite network device for the BFD session.
- 如权利要求10所述的网络设备,其特征在于,所述第一OPEN报文和所述第二OPEN报文通过BFD使能字段(BFD enable TLV)来携带所述为所述BFD会话定义的超时时间;所述BFD enable TLV中包括类型,长度和值,所述为所述BFD会话定义的超时时间携带在所述BFD enable TLV的值中。The network device according to claim 10, wherein the first OPEN message and the second OPEN message carry the definition for the BFD session through a BFD enable field (BFD enable TLV) Timeout period: The BFD-enable TLV includes a type, a length and a value, and the timeout period defined for the BFD session is carried in the value of the BFD-enable TLV.
- 如权利要求9-11所述的网络设备,其特征在于,所述协商单元用于从所述本端与对端网络设备定义的超时时间中选择一个作为所述BFD会话的超时时间,包括:所述协商单元用于从所述本端与所述对端网络设备定义的超时时间中选择最大时间值作为所述BFD会话的超时时间。11. The network device according to claims 9-11, wherein the negotiation unit is configured to select one of the timeout periods defined by the local and peer network devices as the timeout period of the BFD session, comprising: The negotiation unit is configured to select a maximum time value from the timeout time defined by the local end and the opposite end network device as the timeout time of the BFD session.
- 一种网络设备,应用于链路检测系统中,所述链路检测系统包括第一网络设备和第二网络设备,所述网络设备为第一网络设备,其特征在于,所述网络设备包括处理器和存储器;所述存储器用于存储指令;所述处理器,用于调用存储器中的指令,执行如上权利要求1-6中任一项所述方法。A network device is applied to a link detection system. The link detection system includes a first network device and a second network device. The network device is the first network device, and is characterized in that the network device includes processing The memory is used to store instructions; the processor is used to call instructions in the memory to execute the method according to any one of claims 1-6.
- 一种计算机非瞬态存储介质,所述计算机非瞬态存储介质存储有计算机程序,其特征在于,所述计算机程序被计算设备执行时实现如权利要求1至6任一项所述方法。A computer non-transitory storage medium, wherein the computer non-transitory storage medium stores a computer program, wherein the computer program implements the method according to any one of claims 1 to 6 when the computer program is executed by a computing device.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910691227.8 | 2019-07-29 | ||
CN201910691227.8A CN112311613A (en) | 2019-07-29 | 2019-07-29 | Link detection method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021018150A1 true WO2021018150A1 (en) | 2021-02-04 |
Family
ID=74230243
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2020/105265 WO2021018150A1 (en) | 2019-07-29 | 2020-07-28 | Link detection method and apparatus |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN112311613A (en) |
WO (1) | WO2021018150A1 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114363342A (en) * | 2021-12-30 | 2022-04-15 | 科大讯飞股份有限公司 | Fault convergence method and related device and load balancing cluster thereof |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101110848A (en) * | 2006-07-20 | 2008-01-23 | 华为技术有限公司 | Method for detecting channel trouble |
CN101483647A (en) * | 2009-02-05 | 2009-07-15 | 中兴通讯股份有限公司 | Protocol version negotiating method and network entity apparatus |
CN102769573A (en) * | 2012-08-01 | 2012-11-07 | 杭州华三通信技术有限公司 | Method for sending BGP (border gateway protocol) keep-alive information by the aid of BFD (bidirectional forwarding detection) messages and routing devices |
US20190207803A1 (en) * | 2017-07-05 | 2019-07-04 | Juniper Networks, Inc. | DETECTING LINK FAULTS IN NETWORK PATHS THAT INCLUDE LINK AGGREGATION GROUPS (LAGs) |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101170459B (en) * | 2007-11-28 | 2010-07-14 | 中兴通讯股份有限公司 | Failure detection and link recovery method based on bidirectional forward link |
CN109245961B (en) * | 2018-09-29 | 2020-12-22 | 优刻得科技股份有限公司 | Link quality detection method, device, storage medium and equipment |
-
2019
- 2019-07-29 CN CN201910691227.8A patent/CN112311613A/en active Pending
-
2020
- 2020-07-28 WO PCT/CN2020/105265 patent/WO2021018150A1/en active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101110848A (en) * | 2006-07-20 | 2008-01-23 | 华为技术有限公司 | Method for detecting channel trouble |
CN101483647A (en) * | 2009-02-05 | 2009-07-15 | 中兴通讯股份有限公司 | Protocol version negotiating method and network entity apparatus |
CN102769573A (en) * | 2012-08-01 | 2012-11-07 | 杭州华三通信技术有限公司 | Method for sending BGP (border gateway protocol) keep-alive information by the aid of BFD (bidirectional forwarding detection) messages and routing devices |
US20190207803A1 (en) * | 2017-07-05 | 2019-07-04 | Juniper Networks, Inc. | DETECTING LINK FAULTS IN NETWORK PATHS THAT INCLUDE LINK AGGREGATION GROUPS (LAGs) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114363342A (en) * | 2021-12-30 | 2022-04-15 | 科大讯飞股份有限公司 | Fault convergence method and related device and load balancing cluster thereof |
Also Published As
Publication number | Publication date |
---|---|
CN112311613A (en) | 2021-02-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9705735B2 (en) | System and method using RSVP hello suppression for graceful restart capable neighbors | |
JP5913635B2 (en) | Redundant network connection | |
JP5981533B2 (en) | Hitless switchover from active TCP application to standby TCP application | |
US10164824B2 (en) | Indicating a master network controller in a virtual router redundancy protocol | |
WO2008077333A1 (en) | A method, a system and a router for implementing communication between the ip devices | |
WO2015184739A1 (en) | Fault detection method and device | |
WO2008031334A1 (en) | Route updating method, system and router | |
WO2011161575A1 (en) | Notifying a controller of a change to a packet forwarding configuration of a network element over a communication channel | |
TW201134151A (en) | RSVP-TE graceful restart under fast re-route conditions | |
JP2006135970A (en) | SoftRouter DYNAMIC BINDING PROTOCOL | |
WO2017054547A1 (en) | Bidirectional forwarding detection method and apparatus | |
CN111988213B (en) | Method, equipment and medium for synchronizing VXLAN tunnel in EVPN MLAG environment | |
EP2748989B1 (en) | Methods and apparatus for avoiding inter-chassis redundancy switchover to non-functional standby nodes | |
WO2021109997A1 (en) | Anti-fiber breakage method and device for segment routing tunnel, ingress node and storage medium | |
EP2577921B1 (en) | Method, system and router for changing application in bgp session | |
JP2022052741A (en) | Target neighbor search for boundary gateway protocol | |
EP3750073B1 (en) | A method for seamless migration of session authentication to a different stateful diameter authenticating peer | |
US7609618B1 (en) | Dynamically controlling HSRP preemption dependent on stateful NAT convergence | |
EP2575306B1 (en) | Ospf nonstop routing synchronization nack | |
WO2021018150A1 (en) | Link detection method and apparatus | |
US20150334019A1 (en) | Routing control method and non-transitory computer-readable recording medium storing routing control program | |
WO2017036176A1 (en) | Pseudo node identifying method and apparatus | |
WO2020048214A1 (en) | Message sending method, network device and computer storage medium | |
WO2020103718A1 (en) | Connection establishment method, packet transmission method, device, and storage medium | |
WO2022143689A1 (en) | Method and system for session protection |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 20847844 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 20847844 Country of ref document: EP Kind code of ref document: A1 |