CN109039908B - Recursive routing switching method, router, switch and electronic equipment - Google Patents

Recursive routing switching method, router, switch and electronic equipment Download PDF

Info

Publication number
CN109039908B
CN109039908B CN201810614666.4A CN201810614666A CN109039908B CN 109039908 B CN109039908 B CN 109039908B CN 201810614666 A CN201810614666 A CN 201810614666A CN 109039908 B CN109039908 B CN 109039908B
Authority
CN
China
Prior art keywords
route
recursive
address
virtual host
next hop
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810614666.4A
Other languages
Chinese (zh)
Other versions
CN109039908A (en
Inventor
徐仁飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Star Net Ruijie Networks Co Ltd
Original Assignee
Beijing Star Net Ruijie Networks Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Star Net Ruijie Networks Co Ltd filed Critical Beijing Star Net Ruijie Networks Co Ltd
Priority to CN201810614666.4A priority Critical patent/CN109039908B/en
Publication of CN109039908A publication Critical patent/CN109039908A/en
Application granted granted Critical
Publication of CN109039908B publication Critical patent/CN109039908B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/02Topology update or discovery
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/24Multipath

Abstract

The embodiment of the invention provides a switching method of a recursive router, a switch and electronic equipment. The method comprises the following steps: determining a virtual host route of each recursive route according to a non-direct connection next hop IP address of the recursive route in a routing table; calculating a direct connection next hop IP address of the virtual host route according to the routing table; associating the recursive route, the virtual host route, and the direct next hop IP address in a forwarding table; and if the change of the direct-connection next-hop IP address of the virtual host route is detected, updating the direct-connection next-hop IP address of the virtual host route in the forwarding table. The recursive route switching time of the embodiment of the invention is irrelevant to the quantity of the recursive routes, the network cutoff time is reduced, the granularity is switched into a single route level without being configured according to the actual scene, other routes cannot be mistakenly cut, unnecessary cutoff is avoided, and the network availability is improved.

Description

Recursive routing switching method, router, switch and electronic equipment
Technical Field
The embodiment of the invention relates to the technical field of communication, in particular to a recursive route switching method, a router, a switch and electronic equipment.
Background
When the Routing device forwards the packet, it needs to rely on the Routing Information in the Routing Information Base (RIB), and the Routing Information includes: prefix (/ mask length), next hop address (egress) and routing behavior, for example: 2.0.0.0/24 next hop IP 3.0.0.1gigabit Ethernet 0/1forward, where 2.0.0.0/24 is prefix and mask length, 3.0.0.1 is next hop IP, gigabit Ethernet 0/1 is next hop egress, forward is the behavior of routing. When the routing equipment receives an IP message with a destination address of 2.0.0.0-2.0.0.255, a route table is searched for a route with a 2.0.0.0/24 hit by a Longest Prefix Match (LPM for short), and the route is forwarded to a next hop of 3.0.0.1.
The information in the routing table may be manually configured or may be generated by a dynamic routing protocol. A route with a non-direct connection next hop can be generated by manual configuration or by a Border routing Protocol (BGP for short), that is, the next hop IP is a remote device, and a routing table needs to be re-checked according to the next hop IP, and after many recursions are possible, the address of the directly connected next hop IP is finally determined. For the route that the next hop IP is not a direct IP address, it is called recursive route.
Recursive routing may need to search a routing table for many times, and a lookup performance problem of longest prefix matching is considered, actually, a routing device forwards a packet is decided according to a forwarding table (forwarding Information Base, abbreviated as FIB) calculated by the routing table, and a next hop in the forwarding table is directly accessible.
For example, the routing table RIB is:
1.0.0.0/24 next hop IP 2.0.0.1
2.0.0.0/24 Next hop IP 3.0.0.1
Assuming that 3.0.0.1 is a direct next hop and 2.0.0.1 is not a direct next hop, 1.0.0.0/24 is a recursive route. By route calculation: 1.0.0.0/24 route next hop 2.0.0.1, not directly connected, using 2.0.0.1 to look up the route table, matching 2.0.0.0/24 to obtain directly connected next hop 3.0.0.1, so the obtained forwarding table FIB is:
1.0.0.0/24 Next hop IP 3.0.0.1
2.0.0.0/24 Next hop IP 3.0.0.1
If the next hop of the 2.0.0.0/24 route is 4.0.0.1, if 4.0.0.1 is the direct next hop, both routes in the forwarding table need to be updated, that is, the FIB of the forwarding table is updated as follows:
1.0.0.0/24 Next hop IP 4.0.0.1
2.0.0.0/24 Next hop IP 4.0.0.1
If the next hop of 1000 recursive routes is 2.0.0.1, when the next hop of 2.0.0.0/24 recursive routes changes, forwarding tables generated by the 1000 recursive routes change; before the forwarding table is not updated, the packet may be cut off, and the more the associated routes are, the longer the cut-off time is.
Fig. 1 is a schematic diagram of a link failure scenario of a routing device, AS shown in fig. 1, R1, R2, R3, R4, and R5 are routing devices, R1, R2, R3, and R4 are in an Autonomous domain (AS for short), and R5 belongs to another Autonomous domain. R1, R2, R3, R4 run Open Shortest Path First protocol (Open short Path First, OSPF for short); an External Border Gateway Protocol (EBGP) is operated between R4 and R5, and R5 advertises 10K (1K is 1024) for routing to R4; r1 and R4 run an Internal Border Gateway Protocol (IBGP for short); r4 advertises the 10K route issued by R5 to R1.
Assume that the 10K BGP route on R1 is:
6.0.0.0/24 Next hop 5.0.0.2
6.0.1.0/24 Next hop 5.0.0.2
……
The OSPF route is:
5.0.0.0/24 next hop 2.0.0.1 and 3.0.0.1, assuming the link Cost is the same, form Equal Cost MultiPath (ECMP) route.
R1 route calculation generates forwarding table FIB as:
6.0.0.0/24 Next hop 2.0.0.1
3.0.0.1
6.0.1.0/24 Next hop 2.0.0.1
3.0.0.1
……
When the link between R2 and R4 fails, the OSPF route on R1 converges again to obtain:
5.0.0.0/24 Next hop 3.0.0.1
Then the forwarding table generated by the 10K BGP route on R1 also needs to be updated to:
6.0.0.0/24 Next hop 3.0.0.1
6.0.1.0/24 Next hop 3.0.0.1
……
From the beginning of the link failure, R1 receives the traffic destined for the 6.0.0.0/24 network segment, and the traffic break will occur if the next hop of 2.0.0.1 to R2 is still taken, and the traffic break will not be stopped until the forwarding tables of the 10K BGP routes are all updated to only take 3.0.0.1 to R3. The important part of the interruption time is the updating time of the 10K route, and the part of the interruption time is basically linear with the number of routes, and the interruption time is longer when the routes are more. The interruption of the flow may directly affect the user's experience with the network. As the network size becomes larger, the number of routes will be larger, and if the outage time is longer, the user experience will be worse.
Currently, for recursive routing, it is common practice to update the routes one by one, so that the more routes, the longer the update time. In order to solve the problem of message flow interruption caused by long updating time, two routing switching methods exist at present: one is to detect whether a cross-hop network port is reachable through a Bidirectional Forwarding Detection (BFD) protocol, and when it is found that the cross-hop network port is not reachable, a decision is made to switch a direct link. For example, because the link between R2 and R4 is broken, R1 cannot directly sense, and for this scenario configuration, when R1 detects that the network interface connected to R4 in R2 is not reachable, the link between R1 and R2 is directly switched, which may also achieve fast switching. Another method is to configure a special command on R2 to shut down the port connected to R1 when a link failure with R4 is found.
However, for the first route switching method, there may be other links on R2, not all messages going through R2 will be routed to R4, and direct switching is prone to miscut other flows, resulting in unnecessary flow interruption, and this kind of cross-hop detection needs to be specially configured according to actual scenarios. The second route switching method also requires special configuration, there are other traffic misswitches, and the configuration is very complicated if there are many other routing devices between R1 and R2.
Disclosure of Invention
In view of the defects in the prior art, embodiments of the present invention provide a method for switching a recursive route, a router, a switch, and an electronic device.
In a first aspect, an embodiment of the present invention provides a method for switching a recursive route, including:
determining a virtual host route of each recursive route according to a non-direct connection next hop IP address of the recursive route in a routing table;
calculating a direct connection next hop IP address of the virtual host route according to the routing table;
associating the recursive route, the virtual host route, and the direct next hop IP address in a forwarding table;
and if the change of the direct-connection next-hop IP address of the virtual host route is detected, updating the direct-connection next-hop IP address of the virtual host route in the forwarding table.
Optionally, the method for switching the recursive route, where determining the virtual host route of the recursive route according to the non-direct-connection next-hop IP address of each recursive route in the route table includes:
determining all recursive routes in the routing table according to the routing table;
determining a non-direct connection next hop IP address of each recursive route according to the routing table;
and adding a corresponding virtual host route for the recursive route in a forwarding table, wherein the virtual host route is a full-length prefix route, and the prefix IP address of the virtual host route is equal to the non-direct-connection next-hop IP address.
As in the foregoing method for switching recursive routes, optionally, the determining all recursive routes in the routing table according to the routing table includes:
determining the next hop IP address of each route to be tested according to the routing table;
and if judging that the next hop IP address is not directly connected, determining that the route to be detected is a recursive route.
As for the above method for switching recursive routes, optionally, after determining the virtual host route of each recursive route according to the non-direct-connection next-hop IP address of each recursive route in the route table, the method further includes:
determining the type mark of the virtual host route according to the prefix IP address of each virtual host route;
correspondingly, the associating the recursive route, the virtual host route, and the direct next hop IP address in the forwarding table includes:
associating the recursive route, the type label, and the direct next hop IP address in a forwarding table.
As above, optionally, the method for switching the recursive route further includes:
calculating and updating the number of recursive routes associated with each type mark;
and if the recursive routing number is judged to be 0, deleting the type mark in the forwarding table.
In a second aspect, an embodiment of the present invention provides a router, including:
the adding module is used for determining the virtual host route of each recursive route according to the non-direct-connection next hop IP address of the recursive route in the route table;
the calculation module is used for calculating the direct connection next hop IP address of the virtual host route according to the routing table;
a correlation module for correlating the recursive route, the virtual host route, and the direct next hop IP address in a forwarding table;
and the updating module is used for updating the direct connection next hop IP address of the virtual host route in the forwarding table if the change of the direct connection next hop IP address of the virtual host route is detected.
As for the above router, optionally, the adding module includes:
the judging unit is used for determining all recursive routes in the routing table according to the routing table;
the searching unit is used for determining the non-direct connection next hop IP address of each recursive route according to the routing table;
and the adding unit is used for adding a corresponding virtual host route for the recursive route in a forwarding table, wherein the virtual host route is a full-length prefix route, and the prefix IP address of the virtual host route is equal to the non-direct-connection next-hop IP address.
Optionally, the determining unit is specifically configured to:
determining the next hop IP address of each route to be tested according to the routing table;
and if judging that the next hop IP address is not directly connected, determining that the route to be detected is a recursive route.
As for the above router, optionally, the adding module is further configured to:
determining the type mark of the virtual host route according to the prefix IP address of each virtual host route;
correspondingly, the association module is specifically configured to:
associating the recursive route, the type label, and the direct next hop IP address in a forwarding table.
As above, optionally, the router further includes:
the calculation module is used for calculating and updating the number of recursive routes associated with each type mark;
and the deleting module is used for deleting the type mark in the forwarding table if the recursive routing number is judged to be 0. In a third aspect, an embodiment of the present invention provides a switch, including:
a hardware route, configured to store each recursive route in a routing table and a virtual host route corresponding to the recursive route, where the virtual host route is determined according to a non-direct-connection next-hop IP address of the recursive route;
a filter processor FP for storing each of the virtual host routes and a direct next hop IP address of the virtual host route, wherein the direct next hop IP address is determined according to the routing table;
the filter processor FP is further configured to update the direct-connection next-hop IP address of the virtual host route if it is detected that the direct-connection next-hop IP address of the virtual host route changes.
Optionally, as for the switch described above, the virtual host route is a full-length prefix route, and a prefix IP address of the virtual host route is equal to the non-direct-connection next-hop IP address.
As for the switch described above, optionally, the hardware route is specifically configured to:
storing a type tag for each recursive route and its corresponding virtual host route in a routing table, wherein the type tag is determined by a prefix IP address of each of the virtual host routes;
accordingly, the filter processor FP is specifically configured to:
and storing each type mark and the corresponding direct connection next hop IP address, and if detecting that the direct connection next hop IP address of the type mark is changed, updating the direct connection next hop IP address of the type mark.
As with the switch described above, optionally, the filter processor FP is further configured to:
calculating and updating the number of recursive routes associated with each type mark;
and if the recursive route number is judged to be 0, deleting the type mark in the filter processor FP.
In a fourth aspect, an embodiment of the present invention provides an electronic device, including:
the processor and the memory are communicated with each other through a bus; the memory stores program instructions executable by the processor, the processor invoking the program instructions to perform a method comprising: determining a virtual host route of each recursive route according to a non-direct connection next hop IP address of the recursive route in a routing table; calculating a direct connection next hop IP address of the virtual host route according to the routing table; associating the recursive route, the virtual host route, and the direct next hop IP address in a forwarding table; and if the change of the direct-connection next-hop IP address of the virtual host route is detected, updating the direct-connection next-hop IP address of the virtual host route in the forwarding table.
In a fifth aspect, an embodiment of the present invention provides a storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the following method: determining a virtual host route of each recursive route according to a non-direct connection next hop IP address of the recursive route in a routing table; calculating a direct connection next hop IP address of the virtual host route according to the routing table; associating the recursive route, the virtual host route, and the direct next hop IP address in a forwarding table; and if the change of the direct-connection next-hop IP address of the virtual host route is detected, updating the direct-connection next-hop IP address of the virtual host route in the forwarding table.
The method for switching the recursive routes, provided by the embodiment of the invention, comprises the steps of determining the virtual host routes of the recursive routes according to the non-direct-connection next-hop IP addresses of each recursive route in a routing table, calculating the direct-connection next-hop IP addresses of the virtual host routes, associating the recursive routes, the virtual host routes and the direct-connection next-hop IP addresses in a forwarding table, and switching all the recursive routes associated with the recursive routes only by updating the direct-connection next-hop IP addresses of the virtual host routes in the forwarding table when the direct-connection next-hop IP addresses of the virtual host routes are detected to be changed. The recursive route switching time of the embodiment of the invention is irrelevant to the quantity of the recursive routes, the network cutoff time is reduced, the configuration according to the actual scene is not needed, the operation is flexible and effective, the switching granularity is a single route level, the mistaken cutting of other routes is not caused, the unnecessary cutoff is avoided, and the network availability is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 is a schematic diagram of a routing device link failure scenario;
fig. 2 is a schematic flow chart of a method for switching recursive routing according to an embodiment of the present invention;
fig. 3 is a schematic flow chart of a method for switching recursive routing according to another embodiment of the present invention;
fig. 4 is a schematic diagram of a forwarding table according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a router according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a switch according to an embodiment of the present invention;
fig. 7 is a schematic diagram of an input processing flow of a switch chip according to an embodiment of the present invention;
FIG. 8 is a schematic diagram of the recursive routing on the switch chip according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, 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, but 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.
Fig. 2 is a schematic flow chart of a switching method of recursive routing according to an embodiment of the present invention, and as shown in fig. 2, the switching method includes:
step S21, determining the virtual host route of each recursive route according to the non-direct connection next hop IP address of the recursive route in the route table;
specifically, for the performance problem that a forwarding table generated by a large number of recursive routes needs to be updated due to a small number of direct-connected routes, the existing known solutions have the problems of non-universality, complex configuration, coarse switching granularity (port or link level), easiness in mistaken deletion of other routes, and the like, so that a recursive route switching method that can switch all recursive routes by updating only a small amount of information and the switching time is independent of the number of the recursive routes needs to be implemented. Firstly, screening all recursive routes in a routing table, and then determining a non-direct connection next hop IP address of each recursive route according to the routing table, wherein the next hop IP address without an exit is the non-direct connection next hop IP address, for example, 2.0.0.0/24 next hop IP 3.0.0.1gigabit Ethernet 0/1forward in the routing table; 1.0.0.0/23 next hop IP 5.0.0.1, since the next hop IP 3.0.0 takes the exit, the next hop IP 3.0.0.1 is the direct connection next hop IP, and the next hop IP 5.0.0.1 is the non-direct connection next hop IP address. And then, adding a corresponding virtual host route for each recursive route, wherein the IP address of the virtual host route is determined according to the non-direct-connection next-hop IP address of the recursive route, and the step is that the recursive route can directly point to or search for the virtual host route through accurate matching, so that the virtual host route of each recursive route can be obtained.
In practical applications, the recursive route may match multiple non-direct-connection next-hop IP addresses, for example, if the direct-connection next-hop IP address of the recursive route is an ECMP group, adding a virtual host route to the recursive route, where the virtual host route is the same as the number of IP addresses in the ECMP group, that is, adding multiple virtual host routes to the recursive route.
Step S22, calculating the direct connection next hop IP address of the virtual host route according to the routing table;
specifically, after the virtual host route is determined, the direct connection next hop IP address of the virtual host route is calculated according to the routing table, for example, after the virtual host route is determined, the corresponding next hop IP address is searched from the routing table according to the longest prefix matching principle, and if the IP address is direct connection, the IP address is used as the direct connection next hop IP address of the virtual host route.
In practical application, the virtual host route may also match multiple directly connected next hop IP addresses, and at this time, the directly connected next hop IP address of the virtual host route may be set as an IP address group, for example, an ECMP group, that is, the virtual host route has multiple directly connected next hop IP addresses.
In practical application, multiple levels of recursive routes may exist in the routing table, a first level of virtual host route may be added to the first level of recursive route, a next hop IP address of the first level of virtual host route is a recursive route IP address, and the recursive route IP address is set as a second level of virtual host route, that is, a next hop of the first virtual host route is the second level of virtual host route, so that recursion is performed until the next hop IP address of the virtual host route is a direct connection next hop IP address. Considering that a dynamic routing Protocol in a real network is only divided into an External Gateway Protocol (EGP) and an Internal Gateway Protocol (IGP), a route generated by the EGP recurses to an IGP route, and a next hop of the IGP route is directly connected, so that only a new layer of virtual host route needs to be considered, the virtual host route calculates a next hop IP address through a routing table, if the next hop IP address is not directly connected, the next hop IP address of the non-directly connected next hop IP address is continuously calculated according to the routing table until the next hop IP address is the directly connected next hop IP address, and the directly connected next hop IP address is added as the directly connected next hop IP address of the virtual host route.
Step S23, associating the recursive route, the virtual host route and the direct connection next hop IP address in a forwarding table;
specifically, a forwarding table is established according to a routing table, a recursive route, a virtual host route and a direct next hop IP address are established in the forwarding table, and the recursive route, the virtual host route of the recursive route and the direct next hop IP address of the virtual host route are associated.
For example, the routing table is:
recursive route A, Next hop IP Address B1(B1 not straight)
IP address B1, next hop IP address B2(B2 direct connection)
The forwarding table according to the prior art scheme is as follows:
recursive route A, next hop IP address B2
The forwarding table generated according to the embodiment of the invention is as follows:
recursive route A, Next hop virtual host route C
Virtual host route C, next hop IP address B2
Compared with the prior art, a layer of virtual host routing is added in the forwarding table.
Step S24, if it is detected that the direct next hop IP address of the virtual host route changes, updating the direct next hop IP address of the virtual host route in the forwarding table.
Specifically, after the forwarding table is determined, it is further required to detect whether the direct next-hop IP address of the vm route changes in real time, for example, if the next-hop IP address of the vm route C changes from B2 to B3 and B4, the next-hop IP address of the vm route C is updated to { B3, B4} in the forwarding table.
For example, the routing table is:
recursive route A1, next hop IP address B1(B1 not directly connected)
Recursive route A2, next hop IP address B1
IP address B1, next hop IP address B2(B2 direct connection)
The forwarding table according to the prior art scheme is as follows:
recursive route A1, next hop IP address B2
Recursive route A2, next hop IP address B2
The forwarding table generated according to the embodiment of the invention is as follows:
recursive route A1, next hop virtual host route C
Recursive route A2, next hop virtual host route C
Virtual host route C, next hop IP address B2
If the next hop IP address of the virtual host route C changes from B2 to B3 and B4, then according to the prior art scheme, the forwarding table is updated as:
recursive route A1, next hop IP address { B3, B4}
Recursive route A2, next hop IP address { B3, B4}
According to the embodiment of the invention, only the next hop IP address of the virtual host route needs to be updated in the forwarding table, namely the forwarding table is updated as follows:
recursive route A1, next hop virtual host route C
Recursive route A2, next hop virtual host route C
Virtual host route C, Next hop IP Address { B3, B4}
Therefore, if the virtual host route C is the next hop of the plurality of recursive routes, compared with the prior art, the embodiment of the invention can switch all the recursive routes associated with the virtual host route C only by updating the next hop IP address of the virtual host route C, and does not need to update the next hop of the recursive route associated with the virtual host route C, so that the updating speed of the forwarding table is high, the switching time of the recursive route is irrelevant to the number of the recursive routes, the switching granularity is a single route level, and other routes cannot be mistakenly switched.
The method for switching the recursive routes, provided by the embodiment of the invention, comprises the steps of determining the virtual host routes of the recursive routes according to the non-direct-connection next-hop IP addresses of each recursive route in a routing table, calculating the direct-connection next-hop IP addresses of the virtual host routes, associating the recursive routes, the virtual host routes and the direct-connection next-hop IP addresses in a forwarding table, and switching all the recursive routes associated with the recursive routes only by updating the direct-connection next-hop IP addresses of the virtual host routes in the forwarding table when the direct-connection next-hop IP addresses of the virtual host routes are detected to be changed. The recursive route switching time of the embodiment of the invention is irrelevant to the quantity of the recursive routes, the network cutoff time is reduced, the configuration according to the actual scene is not needed, the operation is flexible and effective, the switching granularity is a single route level, the mistaken cutting of other routes is not caused, the unnecessary cutoff is avoided, and the network availability is improved.
On the basis of the foregoing embodiment, further, the determining, according to the non-direct-connection next-hop IP address of each recursive route in the routing table, a virtual host route of the recursive route includes:
determining all recursive routes in the routing table according to the routing table;
determining a non-direct connection next hop IP address of each recursive route according to the routing table;
and adding a corresponding virtual host route for the recursive route in a forwarding table, wherein the virtual host route is a full-length prefix route, and the prefix IP address of the virtual host route is equal to the non-direct-connection next-hop IP address.
Specifically, firstly, determining all recursive routes in a routing table according to the routing table, then searching for a non-direct-connection next-hop IP address of each recursive route according to the routing table, and adding a virtual host route for a next hop of each recursive route, wherein the virtual host route is characterized in that: the prefix length is full length, the embodiment of the invention supports IPv4 recursive routing and IPv6 recursive routing, if the recursive routing is IPv4 routing, the prefix length of the virtual host routing is set to be 32, if the recursive routing is IPv6 routing, the prefix length of the virtual host routing is set to be 128, and the prefix IP address is the same as the next hop IP address of the recursive routing. And then calculating the direct connection next hop of the virtual host route according to the routing table. Thus, the recursive route can directly point to or find out the virtual host route through precise matching, and then the direct connection next hop is obtained.
For example, there are 1000 recursive routes in the routing table:
66.0.0.0/24 Next hop 5.0.0.2
66.0.1.0/24 Next hop 5.0.0.2
……
And a direct route exists, and two next hops form an ECMP route:
5.0.0.0/24 Next hop 2.0.0.1
Next hop 3.0.0.1
Adding a virtual host route 5.0.0.2/32 in the forwarding table which is the same as the recursive route next hop IP 5.0.0.2:
5.0.0.2/32 Next hop 2.0.0.1
Next hop 3.0.0.1
When a message needs to be forwarded, firstly, longest prefix matching is carried out in a routing table according to the destination IP of the message, if recursive routing is hit, the virtual host routing pointed by the recursive routing is directly found, and direct connection of next hop is found according to the virtual host routing and is sent out.
For example, the destination IP is 66.0.0.6IP message, the route 66.0.0.0/24 is found to obtain the virtual host route 5.0.0.2/32, and the direct connection next hop {2.0.0.1, 3.0.0.1} is obtained according to 5.0.0.2/32.
When the direct route changes, only the corresponding virtual host route needs to be updated, and all the recursive route forwarding related to the virtual host route changes accordingly. For example, if a 2.0.0.0.1 link failure for a next hop of 5.0.0.0/24 and only 3.0.0.1 links remain for the next hop, the corresponding virtual host route is updated:
5.0.0.2/32 Next hop 3.0.0.1
At the moment, the IP message with the destination IP of 66.0.0.6 is received, the route 66.0.0.0/24 is searched, the virtual host route 5.0.0.2/32 is obtained, and the direct connection next hop of 3.0.0.1 is obtained according to 5.0.0.2/32.
The method for switching the recursive route provided by the embodiment of the invention has the advantages that the virtual host route is made to be the full-length prefix route by adding the virtual host route, the prefix IP address is the same as the non-direct-connection next-hop IP address of the recursive route, and the performance problem that a large amount of recursive routes need to be switched due to the change of individual direct-connection routes is solved. The embodiment of the invention can realize the quick switching of the forwarding of all the recursive routes on the virtual host only by updating a small amount of routes of the virtual host, and the switching time is irrelevant to the number of the recursive routes, thereby reducing the possible flow break time.
On the basis of the foregoing embodiments, further, the determining all recursive routes in the routing table according to the routing table includes:
determining the next hop IP address of each route to be tested according to the routing table;
and if judging that the next hop IP address is not directly connected, determining that the route to be detected is a recursive route.
Specifically, fig. 3 is a schematic flow chart of a method for switching a recursive route according to another embodiment of the present invention, as shown in fig. 3, the method includes:
step S31, determining the next hop IP address of each route to be tested according to the route table;
step S32, judging whether the next hop IP address is directly connected, specifically, if the next hop IP address has a forwarding outlet, the next hop IP address is directly connected, executing step S33, otherwise, the next hop IP address is not directly connected, and jumping to step S35;
step S33, determining the route to be tested as a direct route;
step S34, adding the direct connection route and the next hop corresponding to the direct connection route into the forwarding table, and jumping to step S39;
step S35, determining the route to be tested as a recursive route;
step S36, adding virtual host route with the same IP address as the next hop of recursive route;
step S37, calculating the direct connection next hop IP address of the virtual host route according to the routing table;
step S38, associating virtual host routing and recursive routing, and adding to the forwarding table;
and step S39, when the change of the next hop of the direct route is detected, updating the virtual host route and/or the next hop of the direct route.
The method for switching the recursive route, provided by the embodiment of the invention, has the advantages that after the recursive route is judged and obtained, the virtual host route is added to the recursive route, the virtual host route is made to be the full-length prefix route, the prefix IP address is the same as the non-direct-connection next-hop IP address of the recursive route, and the performance problem that a large number of recursive routes need to be switched due to the change of individual direct-connection routes is solved. The embodiment of the invention can realize the quick switching of the forwarding of all the recursive routes on the virtual host only by updating a small amount of routes of the virtual host, and the switching time is irrelevant to the number of the recursive routes, thereby reducing the possible flow break time.
On the basis of the foregoing embodiments, further, after determining, according to the non-direct-connection next-hop IP address of each recursive route in the routing table, a virtual host route of the recursive route, the method further includes:
determining the type mark of the virtual host route according to the prefix IP address of each virtual host route;
correspondingly, the associating the recursive route, the virtual host route, and the direct next hop IP address in the forwarding table includes:
associating the recursive route, the type label, and the direct next hop IP address in a forwarding table.
Specifically, in order to simplify management of the virtual host routes, a type flag is assigned to each virtual host route and is marked as class _ id, where the class _ id is the same for the virtual host routes with the same prefix IP address, and fig. 4 is a schematic diagram of a forwarding table provided in the embodiment of the present invention, and as shown in fig. 4, a recursive route, a class _ id, and a direct next hop IP address are directly associated in the forwarding table. In practical application, a certain amount of class _ id, for example, 1000 class _ ids, may be saved according to the capability of the routing device and the scene where the routing device is located, and if the capacity is exceeded, the class _ id may be forwarded and updated according to the original FIB. For example, in a router device, a forwarding table may be set by a program, a recursive route, a class _ id, and a direct next hop IP address are associated in the forwarding table, and in a switch device, by using hardware resources thereof, the recursive route and the class _ id associated therewith may be stored in a three-layer route, and the class _ id and the direct next hop IP address associated therewith may be stored in an input filter, so that, when a packet needs to be forwarded, the recursive route is found first according to a destination IP address, then the class _ id is determined by a hardware routing table, and finally the direct next hop IP address corresponding to the class _ id is determined by inputting and filtering the same, and the packet is forwarded.
For example, mapping next hop IP address 5.0.0.2 to class _ id1, the recursive route is represented as follows:
66.0.0.0/24 Next hop class _ id1(5.0.0.2/32)
class _ id1(5.0.0.2/32) next hop 2.0.0.1
Next hop 3.0.0.1
In addition, the embodiment of the invention supports the ECMP recursive routing and can be used for expanding the number of the actual directly-connected next hops which can be forwarded by the recursive routing. If the recursive route has a plurality of next hops, a class _ id is allocated to the virtual host route corresponding to each non-direct-connection next hop, the processing is the same as that of a single next hop, and if a recursive route has 10 next hops and the virtual route corresponding to each next hop has 32 different direct-connection next hops, the number of the direct-connection next hops of the recursive route can reach 320.
For example, original routing table:
66.0.0.0/24 Next hop 5.0.0.2
Next hop 6.0.0.2
5.0.0.0/24 Next hop 2.0.0.1
Next hop 3.0.0.1
6.0.0.0/24 Next hop 2.0.0.2
Next hop 3.0.0.2
If VMs 5.0.0.2/32 maps class _ id1, and 6.0.0.2/32 maps to class _ id2, the forwarding table is:
66.0.0.0/24 Next hop 5.0.0.2class _ id1
Next hop 6.0.0.2class _ id2
class _ id1(5.0.0.2/32) next hop 2.0.0.1
Next hop 3.0.0.1
class _ id 2(6.0.0.2/32) Next hop 2.0.0.2
Next hop 3.0.0.2
When an IP message with the destination IP being 66.0.0.6 is received, a route 66.0.0.0/24 is found to obtain { class _ id1 and class _ id2}, one of the routes is selected in a balanced mode, for example, class _ id2 is selected, then a direct next hop {2.0.0.2 and 3.0.0.2} is obtained according to class _ id2, and one of the routes is selected for forwarding.
The switching method of the recursive route provided by the embodiment of the invention adds the virtual host route for the recursive route, allocates a special class mark for each virtual host route to facilitate the storage and search of the virtual host route, and solves the performance problem that a large number of recursive routes need to be switched due to the change of individual direct connection routes. The embodiment of the invention can realize the quick switching of the forwarding of all the recursive routes on the virtual host only by updating a small amount of virtual host routes, and the switching time is irrelevant to the number of the recursive routes, thereby reducing the flow interruption time.
On the basis of the foregoing embodiments, further, the handover method further includes:
calculating and updating the number of recursive routes associated with each type mark;
and if the recursive routing number is judged to be 0, deleting the type mark in the forwarding table.
Specifically, in practical applications, the next hop of the recursive route points to the virtual host route, and multiple recursive routes may point to the same virtual host route. In order to avoid wasting memory space and hardware table entry resources, the virtual host route needs to maintain a reference relationship, when no recursive route is referenced, the virtual host route is deleted, specifically, the number of recursive routes associated with each class _ id is calculated and updated in real time, and when the number of recursive routes is 0, the type mark is deleted in a forwarding table.
For example, 1000 recursive routes of 66.0.0.0 segments all point to VMR route class _ id1(5.0.0.2/32), the reference count on the VMR route is 1000, and every time a recursive route is deleted, the reference count on the VMR route is decremented by 1, and when the reference count is decremented to 0, the VMR route is deleted.
The recursive route switching method provided by the embodiment of the invention adds a virtual host route for the recursive route, calculates and updates the recursive route number associated with the virtual host route, deletes the virtual host route when the recursive route number is 0, avoids wasting memory space and hardware table entry resources, and solves the performance problem that a large number of recursive routes need to be switched due to the change of individual direct routes. The embodiment of the invention can realize the quick switching of the forwarding of all the recursive routes on the virtual host only by updating a small amount of virtual host routes, and the switching time is irrelevant to the number of the recursive routes, thereby reducing the flow interruption time.
Fig. 5 is a schematic structural diagram of a router according to an embodiment of the present invention, and as shown in fig. 5, the router includes: an adding module 51, a calculating module 52, an associating module 53 and an updating module 54, wherein:
the adding module 51 is configured to determine a virtual host route of each recursive route according to a non-direct-connection next-hop IP address of the recursive route in a routing table; the calculation module 52 is configured to calculate a direct connection next hop IP address of the virtual host route according to the routing table; the associating module 53 is configured to associate the recursive route, the virtual host route, and the direct next hop IP address in a forwarding table; the updating module 54 is configured to update the direct next hop IP address of the virtual host route in the forwarding table if it is detected that the direct next hop IP address of the virtual host route changes.
Specifically, the adding module 51 screens out all recursive routes from the routing table, then determines a non-direct-connection next-hop IP address of each recursive route according to the routing table, and adds a corresponding virtual host route to each recursive route, where the IP address of the virtual host route is determined according to the non-direct-connection next-hop IP address of the recursive route, so that the virtual host route of each recursive route can be obtained. The calculating module 52 calculates the direct connection next hop IP address of the virtual host route according to the routing table, for example, the calculating module 52 searches the corresponding next hop IP address from the routing table according to the longest prefix matching principle, and if the IP address is direct connection, the IP address is used as the direct connection next hop IP address of the virtual host route. The association module 53 establishes a forwarding table according to the routing table, establishes a recursive route, a virtual host route and a direct next hop IP address in the forwarding table, and associates the recursive route, the virtual host route of the recursive route and the direct next hop IP address of the virtual host route. The update module 54 detects in real time whether the direct next-hop IP address of the vm route changes, for example, the next-hop IP address of the vm route C changes from B2 to B3 and B4, and updates the next-hop IP address of the vm route C to { B3, B4} in the forwarding table. The router provided in the embodiment of the present invention is configured to implement the method, and its functions specifically refer to the method embodiment, which is not described herein again.
The router provided by the embodiment of the invention determines the virtual host route of the recursive route according to the non-direct-connection next-hop IP address of each recursive route in the routing table, calculates the direct-connection next-hop IP address of the virtual host route, associates the recursive route, the virtual host route and the direct-connection next-hop IP address in the forwarding table, and when the change of the direct-connection next-hop IP address of the virtual host route is detected, all the recursive routes associated with the forwarding table can be switched by only updating the direct-connection next-hop IP address of the virtual host route in the forwarding table, so that the network cutoff time is reduced, the router is not required to be configured according to an actual scene and is flexible and effective, the switching granularity is a single route level, other routes cannot be mistakenly switched, unnecessary cutoff is avoided, and the network availability is improved.
On the basis of the above embodiment, further, the adding module includes:
the judging unit is used for determining all recursive routes in the routing table according to the routing table;
the searching unit is used for determining the non-direct connection next hop IP address of each recursive route according to the routing table;
and the adding unit is used for adding a corresponding virtual host route for the recursive route in a forwarding table, wherein the virtual host route is a full-length prefix route, and the prefix IP address of the virtual host route is equal to the non-direct-connection next-hop IP address.
Specifically, the determining unit determines all recursive routes in the routing table according to the routing table, the searching unit searches the non-direct-connection next-hop IP address of each recursive route according to the routing table, and the adding unit adds a virtual host route to the next hop of each recursive route, where the virtual host route is characterized in that: the prefix length is full length, the embodiment of the invention supports IPv4 recursive routing and IPv6 recursive routing, if the recursive routing is IPv4 routing, the virtual host routing prefix length is set to be 32, if the recursive routing is Ipv6 routing, the virtual host routing prefix length is set to be 128, and the prefix IP address is the same as the next hop IP address of the recursive routing. And then the adding unit calculates the direct connection next hop of the virtual host route according to the routing table. Thus, the recursive route can directly point to or find out the virtual host route through precise matching, and then the direct connection next hop is obtained. The router provided in the embodiment of the present invention is configured to implement the method, and its functions specifically refer to the method embodiment, which is not described herein again.
The router provided by the embodiment of the invention has the advantages that the virtual host route is enabled to be the full-length prefix route by adding the virtual host route, the prefix IP address is the same as the non-direct-connection next-hop IP address of the recursive route, and the performance problem that a large number of recursive routes need to be switched due to the change of individual direct-connection routes is solved. The embodiment of the invention can realize the quick switching of the forwarding of all the recursive routes on the virtual host only by updating a small amount of routes of the virtual host, and the switching time is irrelevant to the number of the recursive routes, thereby reducing the possible flow break time.
On the basis of the foregoing embodiments, further, the determining unit is specifically configured to:
determining the next hop IP address of each route to be tested according to the routing table;
and if judging that the next hop IP address is not directly connected, determining that the route to be detected is a recursive route.
Specifically, the next hop IP address of each route to be tested is determined according to the routing table, and then whether the next hop IP address is directly connected is determined, specifically, if the next hop IP address has a forwarding outlet, the next hop IP address is directly connected, otherwise, the next hop IP address is not directly connected. If the next hop IP address of the route to be tested is not directly connected, the route to be tested is a recursive route, otherwise, the route to be tested is a direct route, and the direct route and the next hop information thereof can be directly added into a forwarding table. The router provided in the embodiment of the present invention is configured to implement the method, and its functions specifically refer to the method embodiment, which is not described herein again.
The router provided by the embodiment of the invention has the advantages that after the router is judged to be the recursive router, the virtual host router is added to the recursive router, the virtual host router is made to be the full-length prefix router, the prefix IP address is the same as the non-direct-connection next-hop IP address of the recursive router, and the performance problem that a large amount of recursive routers need to be switched due to the change of individual direct-connection routers is solved. The embodiment of the invention can realize the quick switching of the forwarding of all the recursive routes on the virtual host only by updating a small amount of routes of the virtual host, and the switching time is irrelevant to the number of the recursive routes, thereby reducing the possible flow break time.
On the basis of the foregoing embodiments, further, the adding module is further configured to:
determining the type mark of the virtual host route according to the prefix IP address of each virtual host route;
correspondingly, the association module is specifically configured to:
associating the recursive route, the type label, and the direct next hop IP address in a forwarding table.
Specifically, in order to simplify management of the virtual host routes, the adding module may further allocate a type flag, which is denoted as class _ id, to each virtual host route, where the class _ id is the same for virtual host routes with the same prefix IP address, and in practical applications, the adding module may save a certain amount of class _ id, for example, 1000 class _ ids, according to the routing device capability and the located scene, and if the capacity is exceeded, forward and update the class _ id according to the original FIB. In addition, the embodiment of the invention supports the ECMP recursive routing and can be used for expanding the number of the actual directly-connected next hops which can be forwarded by the recursive routing. If the recursive route has a plurality of next hops, the adding module allocates a class _ id to the virtual host route corresponding to each non-direct-connection next hop, the processing is the same as that of a single next hop, and if a recursive route has 10 next hops and the virtual route corresponding to each next hop has 32 different direct-connection next hops, the number of the direct-connection next hops of the recursive route can reach 320. The router provided in the embodiment of the present invention is configured to implement the method, and its functions specifically refer to the method embodiment, which is not described herein again.
The router provided by the embodiment of the invention adds the virtual host routes for the recursive routes, allocates a special class mark for each virtual host route to facilitate the storage and search of the virtual host routes, and solves the performance problem that a large number of recursive routes need to be switched due to the change of individual direct routes. The embodiment of the invention can realize the quick switching of the forwarding of all the recursive routes on the virtual host only by updating a small amount of virtual host routes, and the switching time is irrelevant to the number of the recursive routes, thereby reducing the flow interruption time.
On the basis of the foregoing embodiments, further, the router further includes:
the calculation module is used for calculating and updating the number of recursive routes associated with each type mark;
and the deleting module is used for deleting the type mark in the forwarding table if the recursive routing number is judged to be 0.
Specifically, in practical applications, the next hop of the recursive route points to the virtual host route, and multiple recursive routes may point to the same virtual host route. In order to avoid wasting memory space, the virtual host route needs to maintain a reference relationship, when no recursive route is referenced, the virtual host route is deleted, specifically, the calculation module calculates and updates the number of recursive routes associated with each class _ id in real time, and when the number of recursive routes is 0, the deletion module deletes the type mark in the forwarding table. The router provided in the embodiment of the present invention is configured to implement the method, and its functions specifically refer to the method embodiment, which is not described herein again.
The router provided by the embodiment of the invention adds the virtual host route for the recursive route, calculates and updates the recursive route number associated with the virtual host route, deletes the virtual host route when the recursive route number is 0, avoids wasting memory space and hardware table entry resources, and solves the performance problem that a large number of recursive routes need to be switched due to the change of individual direct routes. The embodiment of the invention can realize the quick switching of the forwarding of all the recursive routes on the virtual host only by updating a small amount of virtual host routes, and the switching time is irrelevant to the number of the recursive routes, thereby reducing the flow interruption time.
Fig. 6 is a schematic structural diagram of a switch according to an embodiment of the present invention, and as shown in fig. 6, the switch includes: hardware routing 61 and filtering processor FP 62, where:
the hardware route 61 is used for storing each recursive route in a routing table and a virtual host route corresponding to the recursive route, wherein the virtual host route is determined according to a non-direct-connection next-hop IP address of the recursive route; the filter processor FP 62 is configured to store each of the virtual host routes and a direct next hop IP address of the virtual host route, where the direct next hop IP address is determined according to the routing table; the filter processor FP 62 is further configured to, if it is detected that the direct-connection next-hop IP address of the virtual host route changes, update the direct-connection next-hop IP address of the virtual host route.
Specifically, a special switch chip is usually used in a switch, a hardware routing table resource and a Filter Processor (FP) resource are used to implement recursive routing, a packet is directly forwarded on hardware, a chip flow is relatively fixed, fig. 7 is a schematic diagram of an input processing flow of the switch chip provided in the embodiment of the present invention, as shown in fig. 7, route lookup is usually performed in a three-layer route, the three-layer route includes a prefix resource which can be used to install prefix information, the prefix resource can point to a single next-hop resource or point to an ECMP resource, the input Filter Processor FP can match a packet or a special field inside the chip to determine a forwarding behavior, for example, the normal route forwards the packet according to a destination IP of the packet, and the FP can match a source IP information of the packet and forward to a specific next hop.
When the recursive route is determined by the routing table, the hardware route adds the virtual host route for each recursive route, the IP address of the virtual host route is determined according to the non-direct-connection next-hop IP address of the recursive route, and the step is that the recursive route can directly point to or search the virtual host route through precise matching, so that the virtual host route of each recursive route can be obtained. The hardware route stores the recursive route and its corresponding virtual host route. And then, determining a direct connection next hop IP address of the virtual host route according to the routing table, storing the virtual host route and the corresponding direct connection next hop IP address in the filter processor FP, detecting whether the direct connection next hop IP address of the virtual host route changes in real time, and if the direct connection next hop IP address of the virtual host route changes, updating the stored direct connection next hop IP address of the virtual host route by the filter processor FP. Therefore, when the direct next hop is changed, the IP address of the direct next hop of the virtual host route is only needed to be updated, and the switching of all the recursive routes associated with the direct next hop can be realized. The switch provided in the embodiment of the present invention is configured to implement the method, and its functions specifically refer to the method embodiment, which is not described herein again.
On the basis of the foregoing embodiment, further, the virtual host route is a full-length prefix route, and a prefix IP address of the virtual host route is equal to the non-direct-connection next-hop IP address.
Specifically, the hardware route determines all recursive routes in the routing table according to the routing table, then searches for the non-direct-connection next-hop IP address of each recursive route according to the routing table, and adds a virtual host route to the next hop of each recursive route, wherein the virtual host route is characterized in that: the prefix length is full length, the embodiment of the invention supports IPv4 recursive routing and IPv6 recursive routing, if the recursive routing is IPv4 routing, the prefix length of the virtual host routing is set to be 32, if the recursive routing is IPv6 routing, the prefix length of the virtual host routing is set to be 128, and the prefix IP address is the same as the next hop IP address of the recursive routing. And then calculating the direct connection next hop of the virtual host route according to the routing table. Thus, the recursive route in the hardware route can directly point to or find out the virtual host route through precise matching, so that the direct connection next hop is obtained. The switch provided in the embodiment of the present invention is configured to implement the method, and its functions specifically refer to the method embodiment, which is not described herein again.
The switch provided by the embodiment of the invention has the advantages that the virtual host route is made to be the full-length prefix route by adding the virtual host route, the prefix IP address is the same as the non-direct-connection next-hop IP address of the recursive route, and the performance problem that a large number of recursive routes need to be switched due to the change of individual direct-connection routes is solved. The embodiment of the invention can realize the quick switching of the forwarding of all the recursive routes on the virtual host only by updating a small amount of routes of the virtual host, and the switching time is irrelevant to the number of the recursive routes, thereby reducing the possible flow break time.
On the basis of the foregoing embodiments, further, the hardware route is specifically configured to:
storing a type tag for each recursive route and its corresponding virtual host route in a routing table, wherein the type tag is determined by a prefix IP address of each of the virtual host routes;
accordingly, the filter processor FP is specifically configured to:
and storing each type mark and the corresponding direct connection next hop IP address, and if detecting that the direct connection next hop IP address of the type mark is changed, updating the direct connection next hop IP address of the type mark.
Specifically, to simplify management of the virtual host routes, each virtual host route is assigned a type tag, denoted as class _ id, where the class _ id is the same for virtual host routes with the same prefix IP address, and then the recursive route is associated with the class tag class _ id and stored in the hardware route. And searching a direct connection next hop IP address corresponding to the class _ id in a routing table, and storing the direct connection next hop IP address in the filter processor FP after the direct connection next hop IP address is associated. The on-chip fields that the FP may match include a classmark (class id) in the prefix resource or the next hop resource. When a message searches and hits a certain prefix in the three-layer route, and a next hop is obtained, the corresponding class _ id information is brought, and the class _ id can be matched at the FP stage, and a decision is made to be forwarded to a new next hop or an ECMP group. Therefore, after the message searches a routing prefix table, class _ id in the next hop is obtained, and the message is matched with the class _ id through FP and is actually sent out by directly connecting the next hop.
In the switch, when the direct route (non-recursive route) changes, all the recursive routes associated with the switch can be switched to a new direct next hop by only updating the next hop information of the class _ id table entry in the FP. The switching time is independent of the number of recursive routes, and even 10000 recursive routes only need to be updated once.
For example, the forwarding table obtained by calculation is:
66.0.0.0/24 Next hop 5.0.0.2class _ id1
class _ id1(5.0.0.2/32) next hop 2.0.0.1
Next hop 3.0.0.1
Then set up in the switch's chip hardware routing table:
66.0.0.0/24 Next hop class _ id 1;
set up in the FP table:
matching next hop class _ id1, the behavior is directed to ECMP group {2.0.0.1, 3.0.0.1 }.
If the next hop of the virtual host route (class _ id1) needs to be updated, e.g., 2.0.0.1 fails, only the behavior of one FP entry (class _ id1) needs to be updated. For example, the virtual host routing can be automatically updated according to the IGP routing protocol, and the method does not need to be manually configured specially for special scenes, and is suitable for complex network scenes.
In practical applications, ECMP recursive routing is also supported in the switches:
for example, the forwarding table is:
66.0.0.0/24 Next hop 5.0.0.2class _ id1
Next hop 6.0.0.2class _ id2
class _ id1(5.0.0.2/32) next hop 2.0.0.1
Next hop 3.0.0.1
class _ id 2(6.0.0.2/32) Next hop 2.0.0.2
Next hop 3.0.0.2
Setting a hardware routing table as follows:
66.0.0.0/24 set of next hop ECMP { class _ id1, class _ id2 }.
The FP table is set as:
match next hop class _ id1, action ECMP set {2.0.0.1, 3.0.0.1}
Match next hop class _ id2, action ECMP set {2.0.0.2, 3.0.0.2}
Fig. 8 is a schematic diagram illustrating the installation of recursive routing on a switch chip according to an embodiment of the present invention, and as shown in fig. 8, Next Hop (NH for short) 2001 to 2006 are assigned hardware Next Hop resource indexes; ECMP1, 2, 3 is an assigned hardware ECMP group resource index.
The two-stage recursive routing is realized by the hardware routing and the FP resource in the switching chip, and the hardware routing and the FP resource can also be used for expanding the number of the direct connection next hop actually forwarded by the ECMP recursive routing. Usually, the maximum number of next hops supported by an ECMP group on a switch chip is limited, and assuming that the maximum number of next hops is 32, a recursive route is implemented by using a hardware route and an FP, a first-stage route may point to an ECMP group having 32 next hops, each next hop applies for a class _ id, the FP matches the class _ id, and may still point to another ECMP group having 32 directly connected next hops, which is equivalent to that the recursive route supports 32 × 32 directly connected next hops for forwarding.
Since the FP only needs to exactly match the next hop class _ id, class _ id1 and class _ id2 for installation without order requirement, the software management will be simpler and the update performance will be good. In practical application, considering that the next hop of recursive routing is not too many, the number of class _ ids, such as 512, can be limited according to practical scenarios, so as to reduce unnecessary FP resource consumption. Because the switch uses hardware to forward the message, the FP operation after routing is an inherent flow, and the forwarding performance is not influenced. The switch provided in the embodiment of the present invention is configured to implement the method, and its functions specifically refer to the method embodiment, which is not described herein again.
The switch provided by the embodiment of the invention adds the virtual host routes for the recursive routes, allocates a special class mark for each virtual host route to facilitate the storage and search of the virtual host routes, and solves the performance problem that a large number of recursive routes need to be switched due to the change of individual direct connection routes. The embodiment of the invention can realize the quick switching of the forwarding of all the recursive routes on the virtual host only by updating a small amount of virtual host routes, and the switching time is irrelevant to the number of the recursive routes, thereby reducing the flow interruption time.
On the basis of the foregoing embodiments, further, the filtering processor FP is further configured to:
calculating and updating the number of recursive routes associated with each type mark;
and if the recursive route number is judged to be 0, deleting the type mark in the filter processor FP.
Specifically, in practical applications, the next hop of the recursive route points to the virtual host route, and multiple recursive routes may point to the same virtual host route. In order to avoid wasting the hardware resources of the filter processor FP, the virtual host route needs to maintain a reference relationship, and when there is no recursive route reference, the virtual host route is deleted, specifically, the filter processor FP calculates and updates the number of recursive routes associated with each class _ id in real time, and when the number of recursive routes is 0, the type flag is deleted in the filter processor FP.
For example, 1000 recursive routes of 66.0.0.0 segments all point to VMR route class _ id1(5.0.0.2/32), the reference count on the VMR route is 1000, and every time a recursive route is deleted, the reference count on the VMR route is decremented by 1, and when the reference count is decremented to 0, the VMR route is deleted. The switch provided in the embodiment of the present invention is configured to implement the method, and its functions specifically refer to the method embodiment, which is not described herein again.
The switch provided by the embodiment of the invention adds the virtual host route for the recursive route, calculates and updates the recursive route number associated with the virtual host route, deletes the virtual host route when the recursive route number is 0, avoids wasting memory space and hardware table entry resources, and solves the performance problem that a large number of recursive routes need to be switched due to the change of individual direct-connected routes. The embodiment of the invention can realize the quick switching of the forwarding of all the recursive routes on the virtual host only by updating a small amount of virtual host routes, and the switching time is irrelevant to the number of the recursive routes, thereby reducing the flow interruption time.
Fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 9, the electronic device includes: a processor (processor)91, a memory (memory)92, and a bus 93;
wherein, the processor 91 and the memory 92 complete the communication with each other through the bus 93;
the processor 91 is configured to call program instructions in the memory 92 to perform the methods provided by the above-described method embodiments, including, for example: determining a virtual host route of each recursive route according to a non-direct connection next hop IP address of the recursive route in a routing table; calculating a direct connection next hop IP address of the virtual host route according to the routing table; associating the recursive route, the virtual host route, and the direct next hop IP address in a forwarding table; and if the change of the direct-connection next-hop IP address of the virtual host route is detected, updating the direct-connection next-hop IP address of the virtual host route in the forwarding table.
An embodiment of the present invention discloses a computer program product, which includes a computer program stored on a non-transitory computer readable storage medium, the computer program including program instructions, when the program instructions are executed by a computer, the computer can execute the methods provided by the above method embodiments, for example, the method includes: determining a virtual host route of each recursive route according to a non-direct connection next hop IP address of the recursive route in a routing table; calculating a direct connection next hop IP address of the virtual host route according to the routing table; associating the recursive route, the virtual host route, and the direct next hop IP address in a forwarding table; and if the change of the direct-connection next-hop IP address of the virtual host route is detected, updating the direct-connection next-hop IP address of the virtual host route in the forwarding table.
Embodiments of the present invention provide a non-transitory computer-readable storage medium, which stores computer instructions, where the computer instructions cause the computer to perform the methods provided by the above method embodiments, for example, the methods include: determining a virtual host route of each recursive route according to a non-direct connection next hop IP address of the recursive route in a routing table; calculating a direct connection next hop IP address of the virtual host route according to the routing table; associating the recursive route, the virtual host route, and the direct next hop IP address in a forwarding table; and if the change of the direct-connection next-hop IP address of the virtual host route is detected, updating the direct-connection next-hop IP address of the virtual host route in the forwarding table.
Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
The above-described embodiments of the apparatuses and the like are merely illustrative, wherein the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the embodiments of the present invention, and are not limited thereto; although embodiments of the present invention have been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (16)

1. A method for switching a recursive route, comprising:
determining a virtual host route of each recursive route according to a non-direct connection next hop IP address of the recursive route in a routing table;
calculating a direct connection next hop IP address of the virtual host route according to the routing table;
associating the recursive route, the virtual host route, and the direct next hop IP address in a forwarding table;
if the change of the direct next hop IP address of the virtual host route is detected, updating the direct next hop IP address of the virtual host route in the forwarding table;
and the prefix IP address of the virtual host route is equal to the non-direct connection next hop IP address.
2. The method of claim 1, wherein determining the virtual host route of each recursive route according to the non-direct next hop IP address of the recursive route in the routing table comprises:
determining all recursive routes in the routing table according to the routing table;
determining a non-direct connection next hop IP address of each recursive route according to the routing table;
and adding a corresponding virtual host route for the recursive route in a forwarding table, wherein the virtual host route is a full-length prefix route.
3. The method of claim 2, wherein said determining all recursive routes in the routing table from the routing table comprises:
determining the next hop IP address of each route to be tested according to the routing table;
and if judging that the next hop IP address is not directly connected, determining that the route to be detected is a recursive route.
4. The method according to claim 2 or 3, wherein after determining the virtual host route of each recursive route according to the non-direct-connection next-hop IP address of the recursive route in the routing table, the method further comprises:
determining the type mark of the virtual host route according to the prefix IP address of each virtual host route;
correspondingly, the associating the recursive route, the virtual host route, and the direct next hop IP address in the forwarding table includes:
associating the recursive route, the type label, and the direct next hop IP address in a forwarding table.
5. The method of claim 4, further comprising:
calculating and updating the number of recursive routes associated with each type mark;
and if the recursive routing number is judged to be 0, deleting the type mark in the forwarding table.
6. A router, comprising:
the adding module is used for determining the virtual host route of each recursive route according to the non-direct-connection next hop IP address of the recursive route in the route table;
the calculation module is used for calculating the direct connection next hop IP address of the virtual host route according to the routing table;
a correlation module for correlating the recursive route, the virtual host route, and the direct next hop IP address in a forwarding table;
the updating module is used for updating the direct connection next hop IP address of the virtual host route in the forwarding table if the change of the direct connection next hop IP address of the virtual host route is detected;
and the prefix IP address of the virtual host route is equal to the non-direct connection next hop IP address.
7. The router of claim 6, wherein the adding module comprises:
the judging unit is used for determining all recursive routes in the routing table according to the routing table;
the searching unit is used for determining the non-direct connection next hop IP address of each recursive route according to the routing table;
and the adding unit is used for adding a corresponding virtual host route for the recursive route in a forwarding table, wherein the virtual host route is a full-length prefix route.
8. The router according to claim 7, wherein the determining unit is specifically configured to:
determining the next hop IP address of each route to be tested according to the routing table;
and if judging that the next hop IP address is not directly connected, determining that the route to be detected is a recursive route.
9. The router according to claim 7 or 8, wherein the adding module is further configured to:
determining the type mark of the virtual host route according to the prefix IP address of each virtual host route;
correspondingly, the association module is specifically configured to:
associating the recursive route, the type label, and the direct next hop IP address in a forwarding table.
10. The router of claim 9, further comprising:
the calculation module is used for calculating and updating the number of recursive routes associated with each type mark;
and the deleting module is used for deleting the type mark in the forwarding table if the recursive routing number is judged to be 0.
11. A switch, comprising:
a hardware route, configured to store each recursive route in a routing table and a virtual host route corresponding to the recursive route, where the virtual host route is determined according to a non-direct-connection next-hop IP address of the recursive route;
a filter processor FP for storing each of the virtual host routes and a direct next hop IP address of the virtual host route, wherein the direct next hop IP address is determined according to the routing table;
the filter processor FP is further configured to update the direct-connection next-hop IP address of the virtual host route if it is detected that the direct-connection next-hop IP address of the virtual host route changes;
and the prefix IP address of the virtual host route is equal to the non-direct connection next hop IP address.
12. The switch of claim 11, wherein the virtual host route is a full-length prefix route.
13. The switch of claim 12, wherein the hardware route is specifically configured to:
storing a type tag for each recursive route and its corresponding virtual host route in a routing table, wherein the type tag is determined by a prefix IP address of each of the virtual host routes;
accordingly, the filter processor FP is specifically configured to:
and storing each type mark and the corresponding direct connection next hop IP address, and if detecting that the direct connection next hop IP address of the type mark is changed, updating the direct connection next hop IP address of the type mark.
14. The switch according to claim 13, characterized in that the filtering processor FP is further configured to:
calculating and updating the number of recursive routes associated with each type mark;
and if the recursive route number is judged to be 0, deleting the type mark in the filter processor FP.
15. An electronic device, comprising:
the processor and the memory are communicated with each other through a bus; the memory stores program instructions executable by the processor, the processor invoking the program instructions to perform the method of any of claims 1 to 5.
16. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1 to 5.
CN201810614666.4A 2018-06-14 2018-06-14 Recursive routing switching method, router, switch and electronic equipment Active CN109039908B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810614666.4A CN109039908B (en) 2018-06-14 2018-06-14 Recursive routing switching method, router, switch and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810614666.4A CN109039908B (en) 2018-06-14 2018-06-14 Recursive routing switching method, router, switch and electronic equipment

Publications (2)

Publication Number Publication Date
CN109039908A CN109039908A (en) 2018-12-18
CN109039908B true CN109039908B (en) 2021-04-20

Family

ID=64609613

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810614666.4A Active CN109039908B (en) 2018-06-14 2018-06-14 Recursive routing switching method, router, switch and electronic equipment

Country Status (1)

Country Link
CN (1) CN109039908B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112187636B (en) * 2020-09-22 2022-08-16 锐捷网络股份有限公司 ECMP route storage method and device
CN113014489B (en) * 2020-12-31 2022-02-22 腾讯科技(深圳)有限公司 Data forwarding method and device, server and storage medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100583806C (en) * 2003-09-30 2010-01-20 华为技术有限公司 Route iteration system and method thereof
US7423974B2 (en) * 2004-04-30 2008-09-09 Alcatel Disabling mutually recursive routes
CN101707547A (en) * 2008-07-21 2010-05-12 北京星网锐捷网络技术有限公司 Method and device for generating route information, method and equipment for forwarding recursive route data
CN101674251B (en) * 2009-10-10 2012-07-25 福建星网锐捷网络有限公司 Method for upgrade processing for recursive router, device and router therefor
CN102118371B (en) * 2009-12-30 2013-10-09 华为技术有限公司 Method, device and system for controlling network traffic switch
CN102594656B (en) * 2011-12-20 2016-05-04 杭州华三通信技术有限公司 A kind of route iteration method and route exchange device
CN106059932B (en) * 2016-08-08 2020-12-11 新华三技术有限公司 Method and device for generating routing table item
CN106130790A (en) * 2016-08-10 2016-11-16 杭州华三通信技术有限公司 A kind of fault handling method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Caching Popular BGP Prefixes with Grey Modeling Prediction;Wei Zhang; Jun Bi; Jianping Wu等;《 2011 Proceedings of 20th International Conference on Computer Communications and Networks (ICCCN)》;20110830;全文 *

Also Published As

Publication number Publication date
CN109039908A (en) 2018-12-18

Similar Documents

Publication Publication Date Title
US8576721B1 (en) Local forwarding bias in a multi-chassis router
EP4274182A2 (en) Transmission path fault processing method, device and system
US10412009B2 (en) Next hop groups
US9391886B2 (en) Identification of the paths taken through a network of interconnected devices
US9049131B2 (en) Network system and load balancing method
CN110535769A (en) Reduce or eliminate the routing micro-loop in the network with CLOS topology
RU2612599C1 (en) Control device, communication system, method for controlling switches and program
US11411858B2 (en) Method for updating route in network, network device, and system
US20160050142A1 (en) Transmission path switching
CN108429680B (en) Route configuration method, system, medium and equipment based on virtual private cloud
KR101457317B1 (en) Prioritization of routing information updates
US9350684B2 (en) Packet network routing
US8000327B1 (en) Quality of service (QoS)-aware forwarding in an MPLS network with tactical traffic engineering
US20160211990A1 (en) Method and device for switching tunnels and switch
US11750497B2 (en) BGP route aggregation exception systems and methods
EP3200405B1 (en) Layer-3-forwarding device route table capacity expansion method and forwarding device
EP3813306A1 (en) Message processing method, and gateway device
US20170195181A1 (en) Method and system for selective route download in network devices
US11546252B2 (en) Fast flooding topology protection
US20150146525A1 (en) Transfer apparatus, server, and route changing method
CN109039908B (en) Recursive routing switching method, router, switch and electronic equipment
US8331373B2 (en) Methods, systems, and computer readable media for automatically selecting between internet protocol switching modes on a per-module basis in a packet forwarding device
US20150288595A1 (en) Control apparatus, communication system, control information creation method, and program
CN110022263B (en) Data transmission method and related device
EP3902210A1 (en) Congruent bidirectional segment routing tunnels

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant