Disclosure of Invention
The invention provides a GR processing method and equipment based on an OSPF protocol, which are used for reducing the occurrence of flow interruption.
In order to achieve the above object, the present invention provides a graceful restart GR processing method based on an open shortest path first OSPF protocol, which is applied to a system including a GR restart device and a GR auxiliary device, and in a process that the GR auxiliary device and the GR restart device perform a GR procedure, the method includes the following steps:
when the GR auxiliary equipment determines that a link state information announcement (LSA) changes, the GR auxiliary equipment obtains a reason for the LSA changing;
if the reason for the LSA change is that a link between the GR auxiliary equipment and the GR restarting equipment fails, the GR auxiliary equipment exits a GR process between the GR auxiliary equipment and the GR restarting equipment; and if the reason for the LSA change is not that the link between the GR auxiliary equipment and the GR restarting equipment fails, the GR auxiliary equipment continues to execute a GR process between the GR auxiliary equipment and the GR restarting equipment.
When the GR auxiliary device continues to perform GR procedures with the GR restart device, the method further comprises:
if the GR auxiliary equipment is currently positioned before the neighbor state EXCHANGE EXCHANGE, the GR auxiliary equipment informs the GR restarting equipment of the changed LSA through a link state information base description DD message; or,
and if the GR auxiliary equipment is currently in the neighbor state EXCHANGE, the GR auxiliary equipment informs the changed LSA to the GR restarting equipment by updating an UPDATE message.
When the GR auxiliary device continues to perform GR procedures with the GR restart device, the method further comprises:
and when the GR auxiliary equipment determines that a routing loop exists, the GR auxiliary equipment exits from a GR process between the GR auxiliary equipment and the GR restarting equipment.
The GR auxiliary device determines that a routing loop exists, and specifically includes:
the GR auxiliary equipment obtains a next hop which is a route of the GR restarting equipment, and sends a loop detection message through the route, wherein in an IP (Internet protocol) head of the loop detection message, a source address is an interface address of the GR auxiliary equipment, and in an OSPF (open shortest path first) head of the loop detection message, an opposite end equipment identifier is an equipment identifier of the GR auxiliary equipment;
after the GR auxiliary device receives the loop detection packet, if the device identifier in the OSPF header is the device identifier of itself and the source address in the IP header is the interface address of itself, the GR auxiliary device determines that a routing loop exists.
The loop detection packet includes: and virtual connection VLINK Hello message based on OSPF protocol.
The invention provides a GR (graceful restart) auxiliary device, which is applied to a system comprising a GR restart device and the GR auxiliary device, wherein in the process that the GR auxiliary device and the GR restart device carry out a GR process, the GR auxiliary device comprises:
the determining module is used for determining that the LSA changes;
the obtaining module is used for obtaining the reason of the LSA change when the LSA change is determined;
the processing module is used for exiting the GR process between the GR auxiliary equipment and the GR restarting equipment when the reason that the LSA is changed is that a link between the GR auxiliary equipment and the GR restarting equipment fails;
and when the reason for the LSA change is not that the link between the GR auxiliary equipment and the GR restarting equipment fails, continuously executing a GR process between the GR auxiliary equipment and the GR restarting equipment.
The processing module is further configured to, when the GR process between the GR restart device and the GR restart device is continuously executed, notify the GR restart device of the changed LSA through a link state information base description DD packet if the GR restart device is currently in front of a neighbor state EXCHANGE; or,
and if the current state is in the neighbor state EXCHANGE, notifying the GR restarting equipment of the changed LSA by updating an UPDATE message.
The processing module is further configured to, when the GR procedure with the GR restart apparatus is continuously executed, if it is determined that a routing loop exists, exit from the GR procedure with the GR restart apparatus.
The determining module is further configured to obtain a next hop as a route of the GR restart device, and send a loop detection packet through the route, where a source address in an IP header of the loop detection packet is an interface address of the GR auxiliary device, and an opposite end device identifier in an open shortest path first OSPF header of the loop detection packet is a device identifier of the GR auxiliary device;
after receiving the loop detection message, if the device identifier in the OSPF header is the device identifier of itself and the source address in the IP header is the interface address of itself, it is determined that a routing loop exists.
The loop detection packet includes: and virtual connection VLINK Hello message based on OSPF protocol.
Compared with the prior art, the invention has at least the following advantages: by analyzing the reason of LSA change, GR processing of OSPF protocol is more reliable, GR processing failure is reduced, flow interruption is reduced, and reliability and fault tolerance of GR processing are improved.
Detailed Description
The invention provides a GR processing method based on OSPF protocol, which is applied to a system comprising GR restarting equipment (such as a router) and GR auxiliary (HELPER) equipment (such as a router); the GR restart equipment is equipment for restarting an OSPF protocol, the GR auxiliary equipment is equipment connected with the GR restart equipment, and the GR auxiliary equipment and the GR restart equipment are neighbor equipment; after the OSPF protocol on the GR restart device is restarted, in order to ensure that no traffic interruption occurs, a GR procedure needs to be performed between the GR auxiliary device and the GR restart device, as shown in fig. 1, which is a schematic diagram of performing the GR procedure between the GR restart device and the GR auxiliary device, and the procedure may include the following steps:
step 101, after the restart of the OSPF protocol on the GR restart device is completed, based on the OSPF GR protocol, the GR restart device sends a Hello packet carrying a Link Local Signaling (lss) Data to the GR auxiliary device; in the Hello message of LLS Data, RS (to notify the neighbor of the current device entering the GR procedure) and LR (to implement the negotiation of OOB (Out-of-band LSDB resynchnization) capability) flag bits in the Extended Options field of the EO (Extended Options) TLV (Tag Length Value) are both set to 1.
102, after receiving a Hello message carrying RS and LR flag bits both set to 1 from GR restart equipment, skipping a 2-way check process of the Hello message, namely keeping the original state of a neighbor unchanged; and the GR auxiliary equipment replies a Hello message with an LR flag bit set to be 1 and an RS flag bit cleared to be 0 to the GR restarting equipment.
103, after receiving a Hello message carrying an LR flag bit of 1, the GR restart device sets the neighbor state to 2-way, and the subsequent flow is consistent with the OSPF protocol flow, that is, waits for DR (Designated Router) election, sets the neighbor state to exception (start switching) after DR election, and starts to send a first link state DD (Database Description) message (rabit is set to 1) to formally enter the OOB flow; in addition, in the Hello message sent after DR election, the RS flag bit will not be set to 1.
And step 104, after the GR auxiliary equipment receives the DD message with the R bit set to 1 from the GR restarting equipment, setting the corresponding neighbor state to be an Exstart, and entering an OOB flow formally.
The subsequent flow is the same as the process of establishing the neighbor by OSPF until the FULL (complete) state, and is not described in detail in the present invention.
In the GR process, if the GR auxiliary device learns that the LSA in the entire area changes, the GR auxiliary device will directly exit the GR process, and send a Hello message of 1WAY to the GR restart device, so as to disconnect the neighbor and reestablish the neighbor, thereby causing traffic interruption. In view of the above problem, in the process of performing the GR procedure between the GR auxiliary device and the GR restart device, as shown in fig. 2, the GR processing method based on the OSPF protocol provided in the present invention includes the following steps:
in step 201, the GR accessory determines that the LSA has changed.
Step 202, when the GR auxiliary device determines that the LSA changes, the GR auxiliary device obtains a reason for the LSA changing.
Specifically, the reasons for the LSA change in the entire area include, but are not limited to: (1) when there is a change in the external route introduced in this area, the LSA will be changed (e.g. the LSA of type 5 will be changed); (2) when there is a change in routing in other areas of OSPF, it will cause LSAs to change (e.g., cause LSAs of type 3 and type 4); (3) when the link state in this area or the OSPF enabled interface state in each router changes, the LSA will change (e.g., causing the LSA to change for type 1 and type 2).
Based on the reason for the LSA change, in the present invention, if the reason for the LSA change is that the OSPF link between the GR auxiliary device and the GR restart device fails (which may correspond to the link state change in (3) above), step 203 is executed; if the reason for the change of the LSA is not that the OSPF link between the GR auxiliary device and the GR restart device fails (which may correspond to the change of the LSA caused by (1) or (2) above, or the link between the OSPF-enabled loopback port DOWN or other routers on each router in (3) above, etc.), step 204 is executed.
Step 203, the GR auxiliary device exits from the GR procedure with the GR restart device. Specifically, if an OSPF link between the GR auxiliary device and the GR restart device fails, the GR auxiliary device needs to directly exit the GR process, send a Hello message of 1WAY to the GR restart device, to disconnect the neighbor, and reestablish the neighbor with the GR restart device.
It should be noted that, in the present invention, if an OSPF link between the GR accessory and the GR restart device fails, the GR restart device may also sense the occurrence of the condition, actively exit from the GR procedure with the GR accessory, and send a Hello message of 1WAY to the GR accessory, so as to reestablish a neighbor with the GR accessory.
In step 204, the GR auxiliary device continues to perform the GR procedure with the GR restart device, i.e. the GR auxiliary device does not exit the GR procedure with the GR restart device.
In the invention, when the GR auxiliary equipment continuously executes the GR process between the GR auxiliary equipment and the GR restarting equipment, after the LSA is changed and before the current adjacent state EXCHANGE, the GR auxiliary equipment informs the changed LSA to the GR restarting equipment through a link state DD message so as to ensure the synchronization through the link state DD message; or, if the current state is after the neighbor state EXCHANGE, the GR auxiliary device notifies the GR restart device of the changed LSA through an UPDATE message, so as to ensure synchronization by sending the UPDATE message and a reply ACK message.
When the GR auxiliary device continues to execute the GR procedure with the GR restart device, if the GR auxiliary device determines that a routing loop exists, the GR auxiliary device needs to exit the GR procedure with the GR restart device. Specifically, the determining, by the GR auxiliary device, that a routing loop exists includes: the GR auxiliary equipment obtains a route with the next hop being GR restarting equipment, and sends a loop detection message through the route (in the route with the next hop being GR restarting equipment, a plurality of addresses can be correspondingly arranged, the GR auxiliary equipment can randomly select one or more addresses from the addresses as destination addresses to send the loop detection message), in an IP header of the loop detection message (including but not limited to a Hello message of virtual connection VLINK based on OSPF protocol), a source address is an interface address of the GR auxiliary equipment, and in the OSPF header of the loop detection message, an opposite end equipment identifier is an equipment identifier of the GR auxiliary equipment; after the GR auxiliary device receives the loop detection packet, if the device identifier in the OSPF header is the device identifier of itself, and the source address in the IP header is the interface address of itself, the GR auxiliary device determines that a routing loop exists.
Since the routing loop may be caused by the LSA change in the GR procedure, the GR accessory needs to be able to sense the existence of the routing loop in the present invention, so as to actively exit the GR procedure with the GR restart device. To accomplish this, the following analysis is performed:
the reason for the routing loop caused by the LSA change in the GR flow is: the GR restarting equipment cannot update the list items of the FIB (forwarding table) in the GR process and cannot quickly sense the change of the route; after knowing that the LSA changes, the GR auxiliary equipment updates an FIB table entry; in the GR flow, only the FIB table entry of GR restart equipment is not latest; therefore, the FIB table entry of the GR restart device does not update the generated routing loop, and the routing loop must pass through the GR restart device. Taking the application scenario shown in fig. 3 as an example, when the LSA in the GR flow changes, the GR auxiliary device 1 and the GR auxiliary device 2 may sense and update the routing information and issue the routing information to the FIB entry; the GR restarting equipment does not carry out routing information and does not update the FIB table item; the resulting routing loop must be restarted by the GR.
Based on the above analysis, for a routing loop generated by restarting the device through the GR, the GR auxiliary device needs to be able to sense the existence of the routing loop in the presence of the loop; if the message sent from one port by the GR auxiliary equipment returns to the same port, the routing loop can be confirmed to appear; alternatively, a message sent by the GR auxiliary device from one port may confirm the presence of a routing loop if it is returned to the GR auxiliary device from a different port.
Specifically, in order to detect the foregoing situation, the GR auxiliary device may calculate, through the SPF tree, all routes whose next hop is GR restart device, and then send a specified number (e.g., 3 to 5) of loop detection messages (the loop detection messages may be constructed using a Hello message based on VLINK of the OSPF protocol) with a plurality of addresses corresponding to the routes as destination addresses, respectively; at the IP header, the source address uses the interface address of the sending end (GR auxiliary device), the destination address uses the address corresponding To the matched GR restart device route, and TTL (Time To Live) is 255; at the OSPF head, the router id of the opposite end uses its own router id.
Based on this, once the GR auxiliary device receives the loop detection message in the GR procedure, and the router id is its own router id, and the source IP address is its own interface address, it may be determined that the loop detection message sent by itself is received, which indicates that the routing loop is caused by the change of the LSA in the GR procedure. In addition, if the GR auxiliary device receives a loop detection message sent by itself after the GR procedure is finished, the GR auxiliary device directly discards the loop detection message without performing other processing.
By the method, the GR auxiliary equipment can effectively detect the routing loop caused by the change of the LSA, the routing loop can be controlled in the minimum time, and the sending number of the loop detection messages can be controlled, so that the flow in the GR process can be effectively ensured not to be interrupted.
In summary, in the present invention, by redesigning the GR procedure based on the OSPF protocol, the fault tolerance of the OSPF protocol is enhanced, the reliability and maintainability of the OSPF protocol are enhanced, and the flow in the GR procedure is better ensured not to be interrupted; specifically, when external route oscillation occurs in the GR flow of the OSPF protocol, it can be ensured that the GR flow does not exit and the flow is not interrupted; when part of topology changes occur in GR flow of OSPF protocol, GR flow can be guaranteed not to exit and flow is not interrupted.
Based on the same inventive concept as the method, the present invention further provides a graceful restart GR auxiliary device, which is applied to a system including a GR restart device and the GR auxiliary device, and in a process of performing a GR procedure between the GR auxiliary device and the GR restart device, as shown in fig. 4, the GR auxiliary device includes:
a determining module 11, configured to determine that a link state information advertisement (LSA) changes;
an obtaining module 12, configured to obtain a reason for the LSA changing when it is determined that the LSA changes;
a processing module 13, configured to exit a GR procedure with the GR restart device when a reason for the change of the LSA is that a link between the GR auxiliary device and the GR restart device fails;
and when the reason for the LSA change is not that the link between the GR auxiliary equipment and the GR restarting equipment fails, continuously executing a GR process between the GR auxiliary equipment and the GR restarting equipment.
The processing module 13 is further configured to, when the GR process between the GR restart device and the GR restart device is continuously executed, notify the GR restart device of the changed LSA through a link state information base description DD packet if the GR restart device is currently in front of a neighbor state EXCHANGE; or,
and if the current state is in the neighbor state EXCHANGE, notifying the GR restarting equipment of the changed LSA by updating an UPDATE message.
The processing module 13 is further configured to, when the GR procedure with the GR restart apparatus is continuously executed, if it is determined that a routing loop exists, exit the GR procedure with the GR restart apparatus.
The determining module 11 is further configured to obtain a next hop as a route of the GR restart device, and send a loop detection packet through the route, where a source address in an IP header of the loop detection packet is an interface address of the GR auxiliary device, and an opposite end device identifier in an open shortest path first OSPF header of the loop detection packet is a device identifier of the GR auxiliary device;
after receiving the loop detection message, if the device identifier in the OSPF header is the device identifier of itself and the source address in the IP header is the interface address of itself, it is determined that a routing loop exists.
The loop detection packet includes: and virtual connection VLINK Hello message based on OSPF protocol.
The modules of the device can be integrated into a whole or can be separately deployed. The modules can be combined into one module, and can also be further split into a plurality of sub-modules.
Through the above description of the embodiments, those skilled in the art will clearly understand that the present invention may be implemented by hardware, or by software plus a necessary general hardware platform. Based on such understanding, the technical solution of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a usb disk, a removable hard disk, etc.), and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments of the present invention.
Those skilled in the art will appreciate that the drawings are merely schematic representations of one preferred embodiment and that the blocks or flow diagrams in the drawings are not necessarily required to practice the present invention.
Those skilled in the art will appreciate that the modules in the devices in the embodiments may be distributed in the devices in the embodiments according to the description of the embodiments, and may be correspondingly changed in one or more devices different from the embodiments. The modules of the above embodiments may be combined into one module, or further split into multiple sub-modules.
The above-mentioned serial numbers of the present invention are for description only and do not represent the merits of the embodiments.
The above disclosure is only for a few specific embodiments of the present invention, but the present invention is not limited thereto, and any variations that can be made by those skilled in the art are intended to fall within the scope of the present invention.