Background
In order to ensure the reliability of links in a conventional network, backup protection is performed through a plurality of links, and in this scenario, a loop problem may be encountered, and a Spanning Tree Protocol (STP) and other related damage protocols must be deployed to prevent a network broadcast storm from being generated. Although the STP network solves the problem of loops, the STP network has the problems that links cannot share load and the utilization rate is not high. Although Multiple Spanning Tree Protocol (MSTP) can improve the load sharing capability of the link, it cannot completely solve the problem, and it is difficult to maintain the whole network.
Meanwhile, with the rise of virtualization, a large two-layer network is increasingly required, and virtual machines can be freely migrated among physical servers. Conventional STP networks clearly do not meet the requirements in this scenario. As shown IN fig. 1, Transparent Interconnection of Lots of Links (TRILL) forms a two-layer routing network using MAC-IN-MAC technology, and devices can be fully connected. Devices in the TRILL network are called Routing Bridges (RBs), and each RB has a unique routing id nickname. Network loops can be prevented by means of TRILL routing, and traffic can be load-shared by equivalent routing (ECMP) formed between links. The TRILL routing protocol forms a Unicast route and a Multicast route in the network to respectively instruct forwarding of known Unicast traffic and forwarding of Broadcast Unknown Unicast Multicast (BUM) traffic.
In the TRILL network, whenever a Link State DataBase (LSDB) of an RB is refreshed, the RB is triggered to recalculate a route, in the prior art, route calculation and issue storage unordered control of each Link is performed, and when a forwarding resource of the RB is insufficient, a route of an unstable Link often preempts resources, which causes interruption of a route bearer service of an original stable Link.
Disclosure of Invention
Embodiments of the present invention provide a method and an apparatus for calculating a route, which can preferentially calculate and store a route on a stable link, and ensure normal operation of a route bearer service on the stable link.
A first aspect of an embodiment of the present invention provides a method for calculating a route, where the method may include:
receiving a link state message synchronized by at least one neighbor router, wherein the link state message comprises a field value corresponding to a link in a network, and the field value is used for indicating the stability degree of the link;
sorting all links according to the field value of each link in the network, wherein the high stability is prior to the low stability;
and based on the sorted link sequence, preferentially calculating and storing the route on the link with high stability. In the method, a field value is added in the link state message to indicate the stability degree of the link, so that the route on the link with high stability degree is preferentially calculated through the size sequencing of the field values, and the normal operation of the route bearing service on the link with high stability degree is ensured.
Based on the first aspect, in a first possible implementation manner of the first aspect, the field value includes a value in a type length value TLV field, and the value is increased whenever a link state packet associated with the link is periodically synchronized in a network. The field value is further limited to be a value, and the value increase is increased when the network synchronizes the link state message associated with the link, so that the time length for establishing the link can be conveniently recorded, that is, the stability degree of the link is reflected, the route of the stable link is conveniently calculated preferentially, and the normal operation of the route bearing service of the stable link is ensured.
Based on the first possible implementation manner of the first aspect, in a second possible implementation manner of the first aspect, if a first link in the network is established for a target router and the network for the first time, field values corresponding to the first link are accumulated from 0;
the target router is a newly added router in the network, or the target router is a router which recovers to operate after being disconnected from the network due to failure. Further defining that a target router in the network is firstly connected with the network, and accumulating the field values corresponding to the first link from 0, namely counting the total establishment duration from the beginning of the link, so as to ensure that newly expanded routes are not calculated to store and preempt forwarding resources first when a router is newly added in the network, or the traffic is not led to the routes between the routers which are recovered to operate after the failure and the network are disconnected too early, so that packet loss is avoided.
In a third possible implementation manner of the first aspect, based on the first possible implementation manner of the first aspect, the method further includes:
when detecting that a second link between the target neighbor router and any one of the at least one neighbor router fails, zeroing a field value corresponding to the second link;
detecting whether a hello message sent by the target neighbor router is received in real time;
if yes, determining that the second link is recovered, and accumulating the field values corresponding to the second link from 0;
and when detecting that the field value corresponding to the second link reaches a preset threshold value, issuing a link state message including the second link state information to the at least one neighbor router. Further, when the link between the router and the neighbor router is disconnected, the purpose of delayed release of the link state information is controlled through the field value, so that the traffic cannot be introduced into the link too early to cause packet loss.
Based on the third feasible implementation manner of the first aspect, in a fourth feasible implementation manner of the first aspect, the link state packet including the second link state information includes a field value corresponding to the second link, where the field value is the preset threshold, and when the link state packet of the second link is periodically synchronized in the network, the field value corresponding to the second link is accumulated based on the preset threshold. Further limiting that when the link delays to release the link state information of the link after the link is recovered due to the fault, the corresponding field value before the link is released can be continuously maintained, so that the routing on the stable link is guaranteed to be calculated and stored preferentially, and the convergence speed of the link routing is improved.
A second aspect of the embodiments of the present invention provides a route calculation apparatus, including:
a receiving module, configured to receive a link state packet synchronized by at least one neighboring router, where the link state packet includes a field value corresponding to a link in a network, and the field value is used to indicate a stability degree of the link;
the sorting module is used for sorting all the links according to the field value of each link in the network, wherein the high stability degree is prior to the low stability degree;
and the route calculation module is used for preferentially calculating and storing the route on the link with high stability degree based on the sorted link sequence. In the method, a field value is added in the link state message to indicate the stability degree of the link, so that the route on the link with high stability degree is preferentially calculated through the size sequencing of the field values, and the running of the route bearing service on the link with high stability degree is ensured.
Based on the second aspect, in a first possible implementation manner of the second aspect, the field value includes a value in a type length value TLV field, and the value is increased whenever a link state packet associated with the link is periodically synchronized in a network. The field value is further limited to be a value, and the value increase is increased when the network synchronizes the link state message associated with the link, so that the time length for establishing the link can be conveniently recorded, that is, the stability degree of the link is reflected, the route of the stable link is conveniently calculated preferentially, and the normal operation of the route bearing service of the stable link is ensured.
Based on the first possible implementation manner of the second aspect, in a second possible implementation manner of the second aspect, if a first link in the network is a target router and a connection is established with the network for the first time, field values corresponding to the first link are accumulated from 0;
the target router is a newly added router in the network, or the target router is a router which recovers to operate after being disconnected from the network due to failure. Further defining that a target router in the network is firstly connected with the network, and accumulating the field values corresponding to the first link from 0, namely counting the total establishment duration from the beginning of the link, so as to ensure that newly expanded routes are not calculated to store and preempt forwarding resources first when a router is newly added in the network, or the traffic is not led to the routes between the routers which are recovered to operate after the failure and the network are disconnected too early, so that packet loss is avoided.
In a third possible implementation manner of the second aspect, based on the first possible implementation manner of the second aspect, the apparatus further includes:
the processing module is used for resetting a field value corresponding to a second link to zero when a second link failure between the processing module and any one target neighbor router in the at least one neighbor router is detected;
the detection module is used for detecting whether the hello message sent by the target neighbor router is received in real time;
the processing module is further configured to determine that the second link is recovered and accumulate field values corresponding to the second link from 0 if a hello packet sent by the target neighbor router is received;
and the issuing module is used for issuing a link state message including the second link state information to the at least one neighbor router when detecting that the field value corresponding to the second link reaches a preset threshold value. Further, when the link between the router and the neighbor router is disconnected, the purpose of delayed release of the link state information is controlled through the field value, so that the traffic cannot be introduced into the link too early to cause packet loss.
Based on the third possible implementation manner of the second aspect, in a fourth possible implementation manner of the second aspect, the link state packet including the second link state information includes a field value corresponding to the second link, where the field value is the preset threshold, and when the link state packet of the second link is periodically synchronized in the network, the field value corresponding to the second link is accumulated based on the preset threshold. Further limiting that when the link delays to release the link state information of the link after the link is recovered due to the fault, the corresponding field value before the link is released can be continuously maintained, so that the routing on the stable link is guaranteed to be calculated and stored preferentially, and the convergence speed of the link routing is improved.
In the embodiment of the invention, a link state message synchronized by at least one neighbor router is received, the link state message comprises a field value corresponding to a link in a network, the field value is used for representing the stability degree of the link, all links are sequenced according to the field value of each link in the network, the high stability degree is prior to the low stability degree, and the route on the link with the high stability degree is preferentially calculated and stored based on the sequenced link sequence, so that the route on the link with the high stability degree occupies equipment forwarding resources in advance, and the normal operation of the route bearing service on the link with the high stability degree is ensured.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The routing computing apparatus of the embodiment of the present invention may be a routing device or a part of a routing device, and the routing device may include a router, which is not limited in the present invention.
The application scenario of the embodiment of the present invention may be a TRILL network, and may also be other routing protocol networks.
The route calculation method provided by the embodiment of the present invention will be described and explained with reference to fig. 2 to 5.
Fig. 2 is a schematic flow chart of a route calculation method according to an embodiment of the present invention; as shown in fig. 2, the route calculation method includes:
s200, receiving a link state message synchronized by at least one neighbor router, wherein the link state message comprises a field value corresponding to a link in a network, and the field value is used for indicating the stability degree of the link;
in the embodiment of the present invention, the Link State message carries Link State information, and optionally, in an Open Shortest Path first protocol (OSPF), the Link State message may be a Link State protocol data unit (Link State PDUs, LSP) or a Link State Advertisement (LSA).
In the routing network, each router establishes an adjacency with its neighbor routers by using Hello messages, and periodically sends link-state messages (LSA, LSP, etc.) to each neighbor router, and each neighbor router sequentially forwards the link-state messages (flooding) to its neighbors after receiving the link-state messages. Meanwhile, each router needs to keep a backup of the link state messages received by it in its own LSDB, and the LSDBs of all routers should be the same.
Each router calculates the Shortest path to each router using Dijkstra algorithm, that is, Shortest Path First (SPF) algorithm, according to the network topology in the LSDB, and outputs the result to the routing table. It should be noted that, usually, an upper-layer software protocol of the router calculates each entry in the routing table by using an SPF algorithm, and issues the entry to a forwarding resource (a bottom-layer hardware chip) of the router for storage.
When a routing network changes, for example, a router is newly added in the network, or a link in the network fails, LSDB content of the router may be refreshed and trigger the router to recalculate a route, and when forwarding resources of the router are insufficient, and an upper layer software protocol calculates a route and issues no sequential control, it may cause a link just up (a link with low stability degree) to calculate and issue first, and preempt original route forwarding resources, resulting in service interruption carried by the route of the original stable link.
In order to solve the above problem, the embodiment of the present invention extends a link state packet, where the link state packet includes a field value corresponding to a link represented by the link state packet in a network, and the field value may represent a stability degree of the link.
Optionally, the field Value may be a Value in a Type Length Value (TLV) field, and here, it is described that a link state packet is an LSP packet, the LSP packet is extended, and a TLV field is added in the packet. The value in this field takes values from 0 to 255, and accumulates in sequence as the LSP period associated with this link in the network spreads, and the value does not increase until 255.
It should be noted that, when a certain link in the network is a target router and is first connected to the network, the field values corresponding to the link are accumulated from 0, for example, the target router is a newly added router in the network, as shown in fig. 4, when a target router RB6 is newly added in the network, RB6 establishes an adjacency relation with RB2 and RB4, respectively, and since the links established between RB6 and RB2 and RB4 are newly established links, they are not stable, and in the process of route convergence, the embodiment of the present invention preferentially converges routes on stable links. The corresponding field values of the link between RB6 and RB2 are accumulated from 0, and each time the LSP of the link is periodically synchronized in the network, the corresponding field value of the link is increased by 1 until 255 is not accumulated.
Similarly, as shown in fig. 5, the target router is a router which recovers operation after being disconnected from the network due to a failure, and due to the disconnection of the failed link between RB1 and RB2, when the link subsequently recovers operation, the link is also an extremely unstable link, so that the field value corresponding to the link still accumulates from 0, each time the LSP of the link is periodically synchronized in the network, the field value corresponding to the link is incremented by 1 until the LSP is not accumulated any more than 255, and the larger the field value, the higher the stability of the link.
S201, sorting all links according to the field value of each link in the network, wherein the high stability is prior to the low stability;
in the embodiment of the invention, the LSDB of the router stores a network topology map and the field value of each link in the network, and when the network topology structure changes, the router recalculates the routing table. When calculating each route in the routing table, all links are sorted according to the size of the field value of each link in the network, where the field value indicates the stability degree of the link, and it should be noted that the sorting order is higher in stability degree than lower in stability degree.
It should be noted that, in general, the field value of the link just up is relatively small, while the field value of the link which is always stable is relatively large, for example, the field value of all stable links is 255.
S202, based on the sorted link sequence, the route on the link with high stability degree is preferentially calculated and stored.
In the embodiment of the invention, based on the ordered link sequence, the upper layer software protocol of the router preferentially calculates the route on the link with high stability degree (namely, the link ordered at the top). It should be noted that the calculation method of the route still refers to the SPF algorithm in the OSPF routing protocol for calculation.
When the upper software protocol of the router calculates the route, the route is issued to the lower forwarding resource of the router for storage, the route calculated preferentially can preferentially preempt the forwarding resource for storage, and under the condition that the forwarding resource of the router is insufficient, the route of the stable link can preempt the forwarding resource, so that the interruption of the original stable link bearing service can not occur.
In the embodiment of the invention, a link state message synchronized by at least one neighbor router is received, the link state message comprises a field value corresponding to a link in a network, the field value is used for representing the stability degree of the link, all links are sequenced according to the field value of each link in the network, the high stability degree is prior to the low stability degree, and the route on the link with the high stability degree is preferentially calculated and stored based on the sequenced link sequence, so that the route on the link with the high stability degree occupies equipment forwarding resources in advance, and the normal operation of the route bearing service on the link with the high stability degree is ensured.
Fig. 3 is a schematic flow chart of another route calculation method according to an embodiment of the present invention; as shown in fig. 3, the route calculation method includes:
s300, receiving a link state message synchronized by at least one neighbor router, wherein the link state message comprises a field value corresponding to a link in a network, and the field value is used for indicating the stability degree of the link;
s301, sorting all links according to the field value of each link in the network, wherein the high stability is prior to the low stability;
s302, based on the sorted link sequence, the route on the link with high stability degree is preferentially calculated and stored.
Referring to steps S200 to S202 of fig. 2, steps S300 to S302 of the embodiment of the present invention are not described herein again.
S303, when detecting that a second link between the target neighbor router and any one of the at least one neighbor router fails, zeroing a field value corresponding to the second link;
in the embodiment of the invention, after the adjacency relation is established between the router and the neighbor router, the adjacency relation is maintained through periodic exchange Link update messages (LSUs), when the router detects that the target neighbor router does not send the LSUs, the failure of a second Link between the router and the target router is determined, and the field value corresponding to the second Link is reset to zero.
S304, detecting whether a hello message sent by the target neighbor router is received in real time;
in the embodiment of the invention, each router detects whether the Hello message sent by the target neighbor router is received or not by establishing an adjacency relation between the Hello message and the neighbor router thereof.
S305, if receiving, determining that the second link is recovered, and accumulating the field values corresponding to the second link from 0;
in the embodiment of the invention, if a Hello message sent by a target neighbor router is received, a second link between the target neighbor router and the Hello message is determined to be recovered, and after the second link is recovered, the field value corresponding to the second link is accumulated again from 0 according to the LSP synchronization period.
S306, when detecting that the field value corresponding to the second link reaches a preset threshold value, issuing a link state message including the second link state information to the at least one neighbor router.
In this embodiment of the present invention, when it is detected that the field value corresponding to the second link reaches a preset threshold value, for example, the field value is a value of a TLV field in an LSP packet, the preset threshold value may be 255, and the preset threshold value may be set by a user.
When the field value corresponding to the second link is detected to reach the preset threshold value, the link state message comprising the second link state information is issued to the at least one neighbor router, so that the purpose of delayed issuing of the link route after fault recovery can be achieved. Usually, link state changes occur in the whole network, when LSDB is refreshed, the router needs to recalculate the route, and it takes a certain time for the route calculation of the upper layer software protocol to be sent to the lower layer forwarding resource, if the fault recovery link state information is issued too early, the traffic will be introduced to the link too early, and the router forwarding resource does not store the routing table entry yet, thereby causing packet loss.
The link state packet including the second link state information includes a field value corresponding to the second link, where the field value is the preset threshold, and when the link state packet of the second link is periodically synchronized in the network, the field value corresponding to the second link is accumulated based on the preset threshold.
In the embodiment of the invention, a link state message synchronized by at least one neighbor router is received, the link state message comprises a field value corresponding to a link in a network, the field value is used for representing the stability degree of the link, all links are sequenced according to the field value of each link in the network, the high stability degree is prior to the low stability degree, and the route on the link with the high stability degree is preferentially calculated and stored based on the sequenced link sequence, so that the route on the link with the high stability degree occupies equipment forwarding resources in advance, and the normal operation of the route bearing service on the link with the high stability degree is ensured.
The following describes a specific implementation of the routing computation apparatus provided in the embodiment of the present invention with reference to fig. 6 to 7.
Referring to fig. 6, a schematic structural diagram of a route calculation device according to an embodiment of the present invention is shown in fig. 6, where the route calculation device according to the embodiment includes: a receiving module 100, a sorting module 101 and a route calculation module 102.
A receiving module 100, configured to receive a link state packet synchronized by at least one neighboring router, where the link state packet includes a field value corresponding to a link in a network, and the field value is used to indicate a stability degree of the link;
a sorting module 101, configured to sort all links according to a field value of each link in a network, where a high stability degree is prior to a low stability degree;
and the route calculation module 102 is configured to preferentially calculate and store the route on the link with the high stability degree based on the sorted link order.
Optionally, as shown in the figure, the route computing device may further include a processing module 103, a detection module 104, and a publishing module 105;
a processing module 103, configured to, when a failure of a second link between the second link and any one target neighbor router of the at least one neighbor router is detected, zero a field value corresponding to the second link;
the detection module 104 is configured to detect whether a hello packet sent by the target neighbor router is received in real time;
the processing module 103 is further configured to determine that the second link is recovered and accumulate field values corresponding to the second link from 0 if a hello packet sent by the target neighbor router is received;
the issuing module 105 is configured to issue a link status packet including the second link status information to the at least one neighbor router when it is detected that a field value corresponding to the second link reaches a preset threshold.
The link state packet including the second link state information includes a field value corresponding to the second link, where the field value is the preset threshold, and when the link state packet of the second link is periodically synchronized in the network, the field value corresponding to the second link is accumulated based on the preset threshold.
In the embodiment of the invention, a link state message synchronized by at least one neighbor router is received, the link state message comprises a field value corresponding to a link in a network, the field value is used for representing the stability degree of the link, all links are sequenced according to the field value of each link in the network, the high stability degree is prior to the low stability degree, and the route on the link with the high stability degree is preferentially calculated and stored based on the sequenced link sequence, so that the route on the link with the high stability degree occupies equipment forwarding resources in advance, and the normal operation of the route bearing service on the link with the high stability degree is ensured.
It is understood that the specific implementation of each module in the routing computing device described above may be further referred to in the related description of the method embodiments.
Referring to fig. 7, which is a schematic structural diagram of another route calculation device according to an embodiment of the present invention, as shown in the figure, the route calculation device 20 includes a processor 201, a memory 202, a transceiver 203, and a bus 204, the processor 201, the memory 202, and the transceiver 203 are all connected to the bus 204, the memory 202 is used for storing an execution instruction, and the processor 201 invokes the execution instruction stored in the memory 202:
the transceiver 203 is configured to receive a link state packet synchronized by at least one neighboring router, where the link state packet includes a field value corresponding to a link in a network, and the field value is used to indicate a stability degree of the link;
the processor 201 is configured to sort all links according to the field value of each link in the network, where a high degree of stability is prior to a low degree of stability;
the processor 201 is further configured to preferentially calculate and store routes on links with high stability based on the sorted link order.
Optionally, the field value includes a value in a type length value TLV field, and the value is increased whenever a link state packet associated with the link is periodically synchronized in a network.
Optionally, if a first link in the network is a first connection established between the target router and the network, field values corresponding to the first link are accumulated from 0;
the target router is a newly added router in the network, or the target router is a router which recovers to operate after being disconnected from the network due to failure.
The processor 201 is further configured to, when detecting a failure of a second link with any target neighbor router of the at least one neighbor router, zero a field value corresponding to the second link;
the processor 201 is further configured to detect whether a hello packet sent by the target neighbor router is received in real time;
if yes, the processor 201 is further configured to determine that the second link is recovered, and accumulate field values corresponding to the second link from 0;
when detecting that the field value corresponding to the second link reaches a preset threshold, the transceiver 203 is further configured to issue a link status packet including the second link status information to the at least one neighbor router.
Optionally, the link state packet including the second link state information includes a field value corresponding to the second link, where the field value is the preset threshold, and when the link state packet of the second link is periodically synchronized in the network, the field value corresponding to the second link is accumulated based on the preset threshold.
In the embodiment of the invention, a link state message synchronized by at least one neighbor router is received, the link state message comprises a field value corresponding to a link in a network, the field value is used for representing the stability degree of the link, all links are sequenced according to the field value of each link in the network, the high stability degree is prior to the low stability degree, and the route on the link with the high stability degree is preferentially calculated and stored based on the sequenced link sequence, so that the route on the link with the high stability degree occupies equipment forwarding resources in advance, and the normal operation of the route bearing service on the link with the high stability degree is ensured.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs.
The modules or units in the terminal of the embodiment of the invention can be combined, divided and deleted according to actual needs.
The components such as the microcontroller according to the embodiment of the present invention may be implemented by a general-purpose Integrated Circuit, such as a CPU, or an Application Specific Integrated Circuit (ASIC).
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present invention, and it is therefore to be understood that the invention is not limited by the scope of the appended claims.