- Table of Contents
-
- 05-Layer 3-IP Routing Configuration Guide
- 00-Preface
- 01-Basic IP routing configuration
- 02-Static routing configuration
- 03-RIP configuration
- 04-OSPF configuration
- 05-IS-IS configuration
- 06-BGP configuration
- 07-Policy-based routing configuration
- 08-IPv6 static routing configuration
- 09-RIPng configuration
- 10-OSPFv3 configuration
- 11-IPv6 IS-IS configuration
- 12-IPv6 policy-based routing configuration
- 13-Routing policy configuration
- Related Documents
-
Title | Size | Download |
---|---|---|
01-Basic IP routing configuration | 132.83 KB |
Extension attribute redistribution
Setting the maximum lifetime for routes and labels in the RIB
Setting the maximum lifetime for routes in the FIB
Enabling the enhanced ECMP mode
Configuring basic IP routing
The term "interface" in the routing features collectively refers to Layer 3 interfaces, including VLAN interfaces and Layer 3 Ethernet interfaces. You can set an Ethernet port as a Layer 3 interface by using the port link-mode route command (see Layer 2—LAN Switching Configuration Guide).
IP routing directs IP packet forwarding on routers based on a routing table. This chapter focuses on unicast routing protocols. For more information about multicast routing protocols, see IP Multicast Configuration Guide.
Routing table
A RIB contains the global routing information and related information, including route recursion, route redistribution, and route extension information. The router selects optimal routes from the routing table and puts them into the FIB table, and it uses the FIB table to forward packets. For more information about the FIB table, see Layer 3—IP Services Configuration Guide.
Table 1 categorizes routes by different criteria.
Criterion |
Categories |
Destination |
· Network route—The destination is a network. The subnet mask is less than 32 bits. · Host route—The destination is a host. The subnet mask is 32 bits. |
Whether the destination is directly connected |
· Direct route—The destination is directly connected. · Indirect route—The destination is indirectly connected. |
Origin |
· Direct route—A direct route is discovered by the data link protocol on an interface, and is also called an "interface route." · Static route—A static route is manually configured by an administrator. · Dynamic route—A dynamic route is dynamically discovered by a routing protocol. |
To view brief information about a routing table, use the display ip routing-table command:
<Sysname> display ip routing-table
Destinations : 19 Routes : 19
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
1.1.1.0/24 Direct 0 0 1.1.1.1 Eth1/1
1.1.1.0/32 Direct 0 0 1.1.1.1 Eth1/1
1.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
1.1.1.255/32 Direct 0 0 1.1.1.1 Eth1/1
2.2.2.0/24 Static 60 0 12.2.2.2 Eth1/2
80.1.1.0/24 OSPF 10 2 80.1.1.1 Eth1/3
...
A route entry includes the following key items:
· Destination—IP address of the destination host or network.
· Mask—Mask length of the IP address.
· Pre—Preference of the route. Among routes to the same destination, the route with the highest preference is optimal.
· Cost—If multiple routes to a destination have the same preference, the one with the smallest cost is the optimal route.
· NextHop—Next hop.
· Interface—Output interface.
Dynamic routing protocols
Static routes work well in small, stable networks. They are easy to configure and require fewer system resources. However, in networks where topology changes occur frequently, a typical practice is to configure a dynamic routing protocol. Compared with static routing, a dynamic routing protocol is complicated to configure, requires more routers resources, and consumes more network resources.
Dynamic routing protocols dynamically collect and report reachability information to adapt to topology changes. They are suitable for large networks.
Dynamic routing protocols can be classified by different criteria, as shown in Table 2.
Table 2 Categories of dynamic routing protocols
Criterion |
Categories |
Operation scope |
· IGPs—Work within an AS. Examples include RIP, OSPF, and IS-IS. · EGPs—Work between ASs. The most popular EGP is BGP. |
Routing algorithm |
· Distance-vector protocols—Examples include RIP and BGP. BGP is also considered a path-vector protocol. · Link-state protocols—Examples include OSPF and IS-IS. |
Destination address type |
· Unicast routing protocols—Examples include RIP, OSPF, BGP, and IS-IS. · Multicast routing protocols—Examples include PIM-SM and PIM-DM. |
IP version |
· IPv4 routing protocols—Examples include RIP, OSPF, BGP, and IS-IS. · IPv6 routing protocols—Examples include RIPng, OSPFv3, IPv6 BGP, and IPv6 IS-IS. |
An AS refers to a group of routers that use the same routing policy and work under the same administration.
Route preference
Routing protocols, including static and direct routing, each by default have a preference. If they find multiple routes to the same destination, the router selects the route with the highest preference as the optimal route.
The preference of a direct route is always 0 and cannot be changed. You can configure a preference for each static route and each dynamic routing protocol. The following table lists the route types and default preferences. The smaller the value, the higher the preference.
Table 3 Route types and default route preferences
Route type |
Preference |
Direct route |
0 |
Multicast static route |
1 |
OSPF |
10 |
IS-IS |
15 |
Unicast static route |
60 |
RIP |
100 |
OSPF ASE |
150 |
OSPF NSSA |
150 |
IBGP |
255 |
EBGP |
255 |
Unknown (route from an untrusted source) |
256 |
Load sharing
A routing protocol might find multiple optimal equal-cost routes to the same destination. You can use these routes to implement equal-cost multi-path (ECMP) load sharing.
Static routing, IPv6 static routing, RIP, RIPng, OSPF, OSPFv3, BGP, IPv6 BGP, IS-IS, and IPv6 IS-IS support ECMP load sharing.
You can configure per-flow load sharing by executing the ip load-sharing mode per-flow command in system view. For more information about per-flow load sharing, see Layer 3—IP Services Configuration Guide.
Route backup
Route backup can improve network availability. Among multiple routes to the same destination, the route with the highest priority is the primary route and others are secondary routes.
The router forwards matching packets through the primary route. When the primary route fails, the route with the highest preference among the secondary routes is selected to forward packets. When the primary route recovers, the router uses it to forward packets.
Route recursion
To use a route that has an indirectly connected next hop, a router must perform route recursion to find the outgoing interface to reach the next hop.
The RIB records and saves route recursion information, including brief information about related routes, recursive paths, and recursion depth.
Route redistribution
Route redistribution enables routing protocols to learn routing information from each other. A dynamic routing protocol can redistribute routes from other routing protocols, including direct and static routing. For more information, see the respective chapters on those routing protocols in this configuration guide.
The RIB records redistribution relationships of routing protocols.
Extension attribute redistribution
Extension attribute redistribution enables routing protocols to learn route extension attributes from each other, including BGP extended community attributes, OSPF area IDs, route types, and router IDs.
The RIB records extended attributes of each routing protocol and redistribution relationships of different routing protocol extended attributes.
Setting the maximum lifetime for routes and labels in the RIB
Perform this task to prevent routes of a certain protocol from being aged out due to slow protocol convergence resulting from a large number of route entries or long GR period.
The configuration takes effect at the next protocol or RIB process switchover.
To set the maximum lifetime for routes and labels in the RIB (IPv4):
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Enter RIB view. |
rib |
N/A |
3. Create a RIB IPv4 address family and enter its view. |
address-family ipv4 |
By default, no RIB IPv4 address family exists. |
4. Set the maximum lifetime for IPv4 routes and labels in the RIB. |
protocol protocol lifetime seconds |
By default, the maximum lifetime for routes and labels in the RIB is 480 seconds. |
To set the maximum lifetime for routes and labels in the RIB (IPv6):
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Enter RIB view. |
rib |
N/A |
3. Create a RIB IPv6 address family and enter its view. |
address-family ipv6 |
By default, no RIB IPv6 address family exists. |
4. Set the maximum lifetime for IPv6 routes and labels in the RIB. |
protocol protocol lifetime seconds |
By default, the maximum lifetime for routes and labels in the RIB is 480 seconds. |
Setting the maximum lifetime for routes in the FIB
When GR or NSR is disabled, FIB entries must be retained for some time after a protocol process switchover or RIB process switchover. When GR or NSR is enabled, FIB entries must be removed immediately after a protocol or RIB process switchover to avoid routing issues. Perform this task to meet such requirements.
To set the maximum lifetime for routes in the FIB (IPv4):
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Enter RIB view. |
rib |
N/A |
3. Create a RIB IPv4 address family and enter its view. |
address-family ipv4 |
By default, no RIB IPv4 address family exists. |
4. Set the maximum lifetime for IPv4 routes in the FIB. |
fib lifetime seconds |
By default, the maximum lifetime for routes in the FIB is 600 seconds. |
To set the maximum lifetime for routes in the FIB (IPv6):
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Enter RIB view. |
rib |
N/A |
3. Create a RIB IPv6 address family and enter its view. |
address-family ipv6 |
By default, no RIB IPv6 address family exists. |
4. Set the maximum lifetime for IPv6 routes in the FIB. |
fib lifetime seconds |
By default, the maximum lifetime for routes in the FIB is 600 seconds. |
Enabling the enhanced ECMP mode
When one or multiple ECMP routes fail, the default ECMP mode enables the device to reallocate all traffic to the remaining routes.
The enhanced ECMP mode enables the device to reallocate only the traffic of the failed routes to the remaining routes.
This configuration takes effect at reboot. Make sure the reboot does not impact your network.
To enable the enhanced ECMP mode:
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Enable the enhanced ECMP mode. |
ecmp mode enhanced |
By default, the enhanced ECMP mode is disabled. |
Configuring routing policy-based recursive lookup
|
IMPORTANT: This feature is available in Release 1152 and later versions. |
When a route changes, the routing protocol has to perform a route recursion if the next hop is indirectly connected. The routing protocol might select an incorrect path, which can cause traffic loss. To prevent this problem, you can use a routing policy to verify the recursive route. If the recursive route fails to match the routing policy, the routing protocol invalidates the route and marks it as unreachable.
For the device to use exact routes to forward the traffic, make sure all desired routes can match the routing policy.
To configure routing policy-based recursive lookup:
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Enter RIB view. |
rib |
N/A |
3. Create the RIB IPv4 address family and enter its view. |
address-family ipv4 |
By default, no RIB IPv4 address family exists. |
4. Configure routing policy-based recursive lookup. |
protocol protocol nexthop recursive-lookup route-policy route-policy-name |
By default, routing policy-based recursive lookup is not configured. |
Displaying and maintaining a routing table
Execute display commands in any view and reset commands in user view.
Task |
Command |
Display the ECMP mode. |
display ecmp mode |
Display routing table information (in standalone mode). |
display ip routing-table [ vpn-instance vpn-instance-name ] [ verbose ] [ standby slot slot-number ] |
Display routing table information (in IRF mode). |
display ip routing-table [ vpn-instance vpn-instance-name ] [ verbose ] [ standby chassis chassis-number slot slot-number ] |
Display information about routes permitted by a basic ACL (in standalone mode). |
display ip routing-table [ vpn-instance vpn-instance-name ] acl acl-number [ verbose ] [ standby slot slot-number ] |
Display information about routes permitted by a basic ACL (in IRF mode). |
display ip routing-table [ vpn-instance vpn-instance-name ] acl acl-number [ verbose ] [ standby chassis chassis-number slot slot-number ] |
Display information about routes to a specific destination address (in standalone mode). |
display ip routing-table [ vpn-instance vpn-instance-name ] ip-address [ mask | mask-length ] [ longer-match ] [ verbose ] [ standby slot slot-number ] |
Display information about routes to a specific destination address (in IRF mode). |
display ip routing-table [ vpn-instance vpn-instance-name ] ip-address [ mask | mask-length ] [ longer-match ] [ verbose ] [ standby chassis chassis-number slot slot-number ] |
Display information about routes to a range of destination addresses (in standalone mode). |
display ip routing-table [ vpn-instance vpn-instance-name ] ip-address1 to ip-address2 [ verbose ] [ standby slot slot-number ] |
Display information about routes to a range of destination addresses (in IRF mode). |
display ip routing-table [ vpn-instance vpn-instance-name ] ip-address1 to ip-address2 [ verbose ] [ standby chassis chassis-number slot slot-number ] |
Display information about routes permitted by an IP prefix list (in standalone mode). |
|
Display information about routes permitted by an IP prefix list (in IRF mode). |
display ip routing-table [ vpn-instance vpn-instance-name ] prefix-list prefix-list-name [ verbose ] [ standby chassis chassis-number slot slot-number ] |
Display information about routes installed by a protocol (in standalone mode). |
display ip routing-table [ vpn-instance vpn-instance-name ] protocol protocol [ inactive | verbose ] [ standby slot slot-number ] |
Display information about routes installed by a protocol (in IRF mode). |
|
Display route statistics (in standalone mode). |
display ip routing-table [ vpn-instance vpn-instance-name ] statistics[ standby slot slot-number ] |
Display route statistics (in IRF mode). |
|
Display route attribute information in the RIB (in standalone mode). |
display rib attribute [ attribute-id ] [ standby slot slot-number ] |
Display route attribute information in the RIB (in IRF mode). |
display rib attribute [ attribute-id ] [ standby chassis chassis-number slot slot-number ] |
Display RIB GR state information. |
|
Display next hop information in the RIB (in standalone mode). |
display rib nib [ self-originated ] [ nib-id ] [ verbose ] [ standby slot slot-number ] display rib nib protocol protocol-name [ verbose ] [ standby slot slot-number ] |
Display next hop information in the RIB (in IRF mode). |
|
Display next hop information for direct routes. |
|
Clear route statistics (in standalone mode). |
|
Clear route statistics (in IRF mode). |
|
Display IPv6 routing table information (in standalone mode). |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] [ verbose ] [ standby slot slot-number ] |
Display IPv6 routing table information (in IRF mode). |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] [ verbose ] [ standby chassis chassis-number slot slot-number ] |
Display information about routes permitted by an IPv6 basic ACL (in standalone mode). |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] acl ipv6-acl-number [ verbose ] [ standby slot slot-number ] |
Display information about routes permitted by an IPv6 basic ACL (in IRF mode). |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] acl ipv6-acl-number [ verbose ] [ standby chassis chassis-number slot slot-number ] |
Display information about routes to an IPv6 destination address (in standalone mode). |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] ipv6-address [ prefix-length ] [ longer-match ] [ verbose ] [ standby slot slot-number ] |
Display information about routes to an IPv6 destination address (in IRF mode). |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] ipv6-address [ prefix-length ] [ longer-match ] [ verbose ] [ standby chassis chassis-number slot slot-number ] |
Display information about routes to a range of IPv6 destination addresses (in standalone mode). |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] ipv6-address1 to ipv6-address2 [ verbose ] [ standby slot slot-number ] |
Display information about routes to a range of IPv6 destination addresses (in IRF mode). |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] ipv6-address1 to ipv6-address2 [ verbose ] [ standby chassis chassis-number slot slot-number ] |
Display information about routes permitted by an IPv6 prefix list (in standalone mode). |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] prefix-list prefix-list-name [ verbose ] [ standby slot slot-number ] |
Display information about routes permitted by an IPv6 prefix list (in IRF mode). |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] prefix-list prefix-list-name [ verbose ] [ standby chassis chassis-number slot slot-number ] |
Display information about routes installed by an IPv6 protocol (in standalone mode). |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] protocol protocol [ inactive | verbose ] [ standby slot slot-number ] |
Display information about routes installed by an IPv6 protocol (in IRF mode). |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] protocol protocol [ inactive | verbose ] [ standby chassis chassis-number slot slot-number ] |
Display IPv6 route statistics (in standalone mode). |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] statistics [ standby slot slot-number ] |
Display IPv6 route statistics (in IRF mode). |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] statistics[ standby chassis chassis-number slot slot-number ] |
Clear IPv6 route statistics (in standalone mode). |
reset ipv6 routing-table statistics protocol [ vpn-instance vpn-instance-name ] { protocol | all } [ standby slot slot-number ] |
Clear IPv6 route statistics (in IRF mode). |
reset ipv6 routing-table statistics protocol [ vpn-instance vpn-instance-name ] { protocol | all } [ standby chassis chassis-number slot slot-number ] |