- Table of Contents
-
- 07-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-Guard Route Configuration
- 09-IPv6 Static Routing Configuration
- 10-RIPng Configuration
- 11-OSPFv3 Configuration
- 12-IPv6 IS-IS Configuration
- 13-IPv6 BGP Configuration
- 14-IPv6 Policy-Based Routing Configuration
- 15-Routing Policy Configuration
- 16-Tunnel End Packets Policy Routing Configuration
- Related Documents
-
Title | Size | Download |
---|---|---|
01-Basic IP Routing Configuration | 106.84 KB |
IP routing basics
IP routing directs IP packet forwarding on routers based on a routing table. This book focuses on unicast routing protocols. For more information about multicast routing protocols, see IP Multicast Configuration Guide.
Routing table
A router maintains at least two routing tables: one global routing table and one forwarding information base (FIB). The FIB table contains only the optimal routes, and the global routing table contains all routes. The router uses the FIB table to forward packets. For more information about the FIB table, see the Layer 3—IP Services Configuration Guide.
Table 1 categorizes routes by different criteria.
Criterion |
Categories |
Destination |
· Network route—Destination is a network. The subnet mask is less than 32 bits. · Host route—Destination is a host. The subnet mask is 32 bits. |
Whether the destination is directly connected |
· Direct route—Destination is directly connected. · Indirect route—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
Routing Tables: Public
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.0/24 Direct 0 0 1.1.1.1 GE3/0/1
2.2.2.0/24 Static 60 0 12.2.2.2 GE3/0/2
80.1.1.0/24 OSPF 10 2 80.1.1.1 GE3/0/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 one with the highest preference is optimal.
· Cost—When multiple routes to a destination have the same preference, the one with the smallest cost becomes 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 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 based on different criteria, as shown in Table 2:
Table 2 Dynamic routing protocols
Criterion |
Categories |
Optional scope |
· IGPs—Work within an autonomous system (AS). Examples include RIP, OSPF, and IS-IS. · EGPs—Work between ASs. The most popular one is BGP. |
Routing algorithm |
· Distance-vector protocols—RIP and BGP. BGP is also considered a path-vector protocol. · Link-state protocols—OSPF and IS-IS. |
Destination address type |
· Unicast routing protocols—RIP, OSPF, BGP, and IS-IS. · Multicast routing protocols—PIM-SM and PIM-DM. |
IP version |
· IPv4 routing protocols—RIP, OSPF, BGP, and IS-IS. · IPv6 routing protocols—RIPng, OSPFv3, IPv6 BGP, and IPv6 IS-IS. |
|
NOTE: An AS refers to a group of routers that share 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 as required. 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
Routing type |
Preference |
Direct route |
0 |
OSPF |
10 |
IS-IS |
15 |
Static route |
60 |
RIP |
100 |
OSPF ASE |
150 |
OSPF NSSA |
150 |
IBGP |
255 |
EBGP |
255 |
Unknown (route from an untrusted source) |
256 |
Configuring the maximum number of ECMP routes
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.
To configure the maximum number of ECMP routes:
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Configure the maximum number of ECMP routes. |
By default, the maximum number of ECMP routes is 16. |
Route backup
Route backup can help improve network availability. Among routes to the same destination, the route with the highest preference 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 BGP, static, or RIP route that has an indirectly connected next hop, a router must perform route recursion to find the output interface to reach the next hop.
Link-state routing protocols, such as OSPF and IS-IS, do not need route recursion, because they obtain directly connected next hops through route calculation.
Route redistribution
Route redistribution enables routing protocols to learn route 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.
Displaying and maintaining a routing table
Task |
Command |
Remarks |
Display information about the routing table. |
display ip routing-table [ vpn-instance vpn-instance-name ] [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display information about routes permitted by an IPv4 basic ACL. |
display ip routing-table [ vpn-instance vpn-instance-name ] acl acl-number [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display information about routes to the specified destination. |
display ip routing-table [ vpn-instance vpn-instance-name ] ip-address [ mask | mask-length ] [ longer-match ] [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display information about routes with destination addresses in the specified range. |
display ip routing-table [ vpn-instance vpn-instance-name ] ip-address1 { mask | mask-length } ip-address2 { mask | mask-length } [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display routing information permitted by an IPv4 prefix list. |
display ip routing-table [ vpn-instance vpn-instance-name ] ip-prefix ip-prefix-name [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display routes of a routing protocol. |
display ip routing-table [ vpn-instance vpn-instance-name ] protocol protocol [ inactive | verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display statistics about the routing table. |
display ip routing-table [ vpn-instance vpn-instance-name ] statistics [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Clear statistics for the routing table. |
reset ip routing-table statistics protocol [ vpn-instance vpn-instance-name ] { all | protocol } |
Available in user view. |
Display IPv6 routing table information. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display routing information permitted by an IPv6 ACL. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] acl acl6-number [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display routing information for a specified destination IPv6 address. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] ipv6-address prefix-length [ longer-match ] [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display IPv6 routing information for an IPv6 address range. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] ipv6-address1 prefix-length1 ipv6-address2 prefix-length2 [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display routing information permitted by an IPv6 prefix list. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] ipv6-prefix ipv6-prefix-name [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display IPv6 routing information of a routing protocol. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] protocol protocol [ inactive | verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display IPv6 routing statistics. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] statistics [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Clear specified IPv6 routing statistics. |
reset ipv6 routing-table statistics protocol [ vpn-instance vpn-instance-name ] { protocol | all } |
Available in user view. |