- Table of Contents
-
- 04-Layer 3 Configuration Guide
- 00-Preface
- 01-ARP Configuration
- 02-IP Addressing Configuration
- 03-DHCP Configuration
- 04-DHCPv6 Configuration
- 05-DNS Configuration
- 06-IPv6 DNS Configuration
- 07-NAT Configuration
- 08-Adjacency Table Configuration
- 09-Flow Classification Configuration
- 10-IPv6 Basics Configuration
- 11-IP Performance Optimization Configuration
- 12-IP Routing Basics
- 13-Static Routing Configuration
- 14-IPv6 Static Routing Configuration
- 15-GRE Configuration
- 16-RIP Configuration
- 17-RIPng Configuration
- 18-Policy-Based Routing Configuration
- Related Documents
-
Title | Size | Download |
---|---|---|
12-IP Routing Basics | 46.54 KB |
IP routing basics
The term "router" in this document refers to both routers and routing-capable access controllers.
IP routing directs IP packet forwarding on routers based on a routing table.
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.
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. |
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 XGE1/0/2
2.2.2.0/24 Static 60 0 12.2.2.2 XGE1/0/2
…
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. The route with the highest preference is optimal when multiple routes are available to a destination.
· Cost—If multiple routes to a destination have the same preference, the route with the smallest cost becomes the optimal route.
· NextHop—Next hop.
· Interface—Output interface.
Route preference
The preference of a direct route is always 0 and cannot be changed. You can configure a preference for each static route as required. The following table lists the route types and default preferences. The smaller the value, the higher the preference.
Table 2 Route types and default route preferences
Route type |
Preference |
Direct route |
0 |
Static route |
60 |
Unknown (route from an untrusted source) |
256 |
Route backup
Route backup can improve network availability. When multiple routes are available to a 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.
Displaying and maintaining a routing table
Task |
Command |
Remarks |
Display routing table information. |
display ip routing-table [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display information about routes to a specific destination address. |
display ip routing-table ip-address [ mask | mask-length ] [ longer-match ] [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display information about routes to a range of destination addresses. |
display ip routing-table ip-address1 { mask | mask-length } ip-address2 { mask | mask-length } [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display information about routes installed by a routing protocol. |
display ip routing-table protocol protocol [ inactive | verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display IPv4 route statistics. |
display ip routing-table statistics [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Clear IPv4 route statistics. |
reset ip routing-table statistics protocol { protocol | all } |
Available in user view. |
Display IPv6 routing table information. |
display ipv6 routing-table [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display information about routes to a specific IPv6 destination address. |
display ipv6 routing-table ipv6-address [ prefix-length ] [ longer-match ] [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display information about routes to a range of IPv6 destination addresses. |
display ipv6 routing-table ipv6-address1 prefix-length1 ipv6-address2 prefix-length2 [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display routes installed by an IPv6 routing protocol. |
display ipv6 routing-table protocol protocol [ inactive | verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display IPv6 route statistics. |
display ipv6 routing-table statistics [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Clear IPv6 route statistics. |
reset ipv6 routing-table statistics protocol { protocol | all } |
Available in user view. |