- Table of Contents
-
- 06-Layer 3 - IP Routing Configuration Guide
- 00-Preface
- 01-IP routing basics
- 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-IP routing basics | 96.62 KB |
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 router maintains at least two routing tables: a global routing table and a 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 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 GE3/0/1
1.1.1.0/32 Direct 0 0 1.1.1.1 GE3/0/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 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 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 may 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.
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 BGP, static, or RIP route that has an indirectly connected next hop, a router must perform route recursion to find the outgoing 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
Execute display commands in any view and reset commands in user view.
Task |
Command |
Display routing table information. |
display ip routing-table [ vpn-instance vpn-instance-name ] [ verbose ] |
Display information about routes permitted by an IPv4 basic ACL. |
display ip routing-table [ vpn-instance vpn-instance-name ] acl acl-number [ verbose ] |
Display information about routes to a specific destination address. |
display ip routing-table [ vpn-instance vpn-instance-name ] ip-address [ mask | mask-length ] [ longer-match ] [ verbose ] |
Display information about routes to a range of destination addresses. |
display ip routing-table [ vpn-instance vpn-instance-name ] ip-address1 to ip-address2 [ verbose ] |
Display information about routes permitted by an IP prefix list. |
display ip routing-table [ vpn-instance vpn-instance-name ] prefix-list prefix-list-name [ verbose ] |
Display information about routes installed by a protocol. |
display ip routing-table [ vpn-instance vpn-instance-name ] protocol protocol [ inactive | verbose ] |
Display IPv4 route statistics. |
display ip routing-table [ vpn-instance vpn-instance-name ] statistics |
Clear IPv4 route statistics. |
reset ip routing-table statistics protocol [ vpn-instance vpn-instance-name ] { protocol | all } |
Display IPv6 routing table information. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] [ verbose ] |
Display information about routes to an IPv6 destination address. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] ipv6-address [ prefix-length ] [ longer-match ] [ verbose ] |
Display information about routes permitted by an IPv6 basic ACL. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] acl acl6-number [ verbose ] |
Display information about routes to a range of IPv6 destination addresses. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] ipv6-address1 to ipv6-address2 [ verbose ] |
Display information about routes permitted by an IPv6 prefix list. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] prefix-list prefix-list-name [ verbose ] |
Display information about routes installed by an IPv6 protocol. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] protocol protocol [ inactive | verbose ] |
Display IPv6 route statistics. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] statistics |
Clear IPv6 route statistics. |
reset ipv6 routing-table statistics protocol [ vpn-instance vpn-instance-name ] { protocol | all } |