The display ip routing-table command displays the information about the public IPv4 routing table.
display ip routing-table [ verbose ]
display ip routing-table ip-address [ mask | mask-length ] [ longer-match ] [ verbose ]
display ip routing-table ip-address { mask | mask-length } nexthop ip-address [ verbose ]
display ip routing-table ip-address1 { mask1 | mask-length1 } ip-address2 { mask2 | mask-length2 } [ verbose ]
display ip routing-table acl acl-number [ verbose ]
display ip routing-table ip-prefix ip-prefix-name [ verbose ]
| Parameter | Description | Value |
|---|---|---|
| verbose | Displays detailed information about active and inactive routes. If the parameter verbose is not specified, only the summary of active routes is displayed. | - |
| ip-address | Specifies the destination IP address. | It is in dotted decimal notation. |
| longer-match | Displays only the routes that match the specified network or mask. | - |
| nexthop ip-address | Specifies the IP address of the next hop. | It is in dotted decimal notation. |
| mask | Specifies the mask. | It is in dotted decimal notation. |
| mask-length | Specifies the length of the mask. | It is an integer ranging from 0 to 32. |
| ip-address1 / ip-address2 | Specifies the destination ip-address1 and ip-address2 together determine an address range. Only the routes in the address range are displayed. | Both ip-address1 and ip-address2 are in dotted decimal notation. |
| mask1 | mask-length1 | Specifies the mask or mask length of the destination address ip-address1. | - |
| mask2 | mask-length2 | Specifies the mask or mask length of the destination address ip-address2. | - |
| acl | Uses ACLs to filter the command output. If the specified ACL does not exist, information about all active routes is displayed. | - |
| acl-number | Specifies the number of a basic ACL. | It is an integer ranging from 2000 to 2999. |
| ip-prefix ip-prefix-name | Specifies the prefix list name. | The name is a string of 1 to 169 case-sensitive characters, with spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string. |
Usage Scenario
In the command output without the verbose parameter, each line indicates a route. The contents include the destination address, mask length, protocol, priority, route cost, route flag, next hop, and outbound interface.
An iterated route is counted as one route no matter how many outbound interfaces and next hops the route finds.
This command without the parameter verbose displays the currently preferred routes only.
Matching rules vary with parameters in the command:
If the display ip routing-table ip-address command is used, the routes that longest match the destination address are displayed.
If the display ip routing-table ip-address mask command is used, the routes that accurately match the destination address and mask are displayed.
If the display ip routing-table ip-address longer-match command is used, all the routes that match the IP address specified by the destination address and the natural mask are displayed.
If the display ip routing-table ip-address mask longer-match command is used, all the routes that match the IP address specified by the destination address and the input mask are displayed.
If the display ip routing-table ip-address1 mask1 ip-address2 mask2 command is used, the routes whose destination address ranges from ip-address1 mask1 to ip-address2 mask2 are displayed.
Precautions
If the specified ip-prefix ip-prefix-name does not exist, the command displays all of the currently preferred routes.
# Display the summary of the current routing table. Route 1.1.1.1/32 is counted as two static routes because there are two next hops to the destination. Therefore, the number of routes in the routing table is 8.
<sysname> display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 7 Routes : 8
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 Static 60 0 D 0.0.0.0 NULL0
Static 60 0 D 100.0.0.1 GigabitEthernet1/0/0
100.0.0.0/24 Direct 0 0 D 100.0.0.1 GigabitEthernet1/0/0
100.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet1/0/0
103.0.0.0/24 Direct 0 0 D 103.0.0.1 GigabitEthernet1/0/1
103.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet1/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
Item |
Description |
|---|---|
Route Flags |
Indicates the route flag:
|
Routing Tables: Public |
Indicates a public routing table. |
Destinations |
Indicates the total number of destination networks or hosts. |
Routes |
Indicates the total number of routes. |
Destination/Mask |
Indicates the address and mask length of the destination network or host. |
Proto |
Indicates the protocol through which routes are learned. |
Pre |
Indicates the preference. |
Cost |
Indicates the route cost. |
Flags |
Indicates the route flag, that is, Route Flags in the heading of the routing table. |
NextHop |
Indicates the next hop. |
Interface |
Indicates the outbound interface through which the next hop is reachable. |
# Display the summary of the current routing table. As a static route with the next hop 1.1.1.1, route 2.2.2.2/32 is an iterated route. Next hop 1.1.1.1 has two outbound interfaces, and therefore route 2.2.2.2/32 has two outbound interfaces, but the number of destinations is still 1. Therefore, the number of routes in the routing table is 9.
<sysname> display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 8 Routes : 9
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 Static 60 0 D 0.0.0.0 NULL0
Static 60 0 D 100.0.0.1 GigabitEthernet1/0/0
2.2.2.2/32 Static 60 0 RD 1.1.1.1 NULL0
Static 60 0 RD 1.1.1.1 GigabitEthernet1/0/0
100.0.0.0/24 Direct 0 0 D 100.0.0.1 GigabitEthernet1/0/0
100.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet1/0/0
103.0.0.0/24 Direct 0 0 D 103.0.0.1 GigabitEthernet1/0/1
103.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet1/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
# Display detailed information about the routing table.
<sysname> display ip routing-table verbose
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Destinations : 3 Routes : 3
Destination: 30.0.0.36/32
Protocol: Direct Process ID: 0
Preference: 0 Cost: 0
NextHop: 127.0.0.1 Neighbour: 0.0.0.0
State: Active Adv Age: 01h03m56s
Tag: 0 Priority: high
Label: NULL QoSInfo: 0x0
IndirectID: 0x0
RelayNextHop: 0.0.0.0 Interface: GigabitEthernet1/0/1
TunnelID: 0x0 Flags: D
Destination: 60.0.0.36/32
Protocol: Direct Process ID: 0
Preference: 0 Cost: 0
NextHop: 127.0.0.1 Neighbour: 0.0.0.0
State: Active Adv Age: 00h26m41s
Tag: 0 Priority: high
Label: NULL QoSInfo: 0x0
IndirectID: 0x0
RelayNextHop: 0.0.0.0 Interface: GigabitEthernet1/0/2
TunnelID: 0x0 Flags: D
Destination: 60.35.36.0/24
Protocol: Direct Process ID: 0
Preference: 0 Cost: 0
NextHop: 60.35.36.2 Neighbour: 0.0.0.0
State: Active Adv Age: 00h26m36s
Tag: 0 Priority: high
Label: NULL QoSInfo: 0x0
IndirectID: 0x0
RelayNextHop: 0.0.0.0 Interface: GigabitEthernet1/0/0
TunnelID: 0x0 Flags: D
Item |
Description |
|---|---|
Route Flags |
Indicates the route flag:
|
Destinations |
Indicates the number of destination networks or hosts. |
Routes |
Indicates the total number of active routes and inactive routes. |
Destination |
Indicates the address and mask length of the destination network or host. |
Protocol |
Indicates the routing protocol. |
Process ID |
Indicates the process ID of the routing protocol. |
Preference |
Indicates the preference of the route. |
Cost |
Indicates the route cost. |
NextHop |
Indicates the next hop. |
Neighbour |
Indicates the neighbor. |
State |
Indicates the status of routes:
|
Age |
Indicates the lifetime of the route. |
Tag |
Indicates the administrative tag for routes. The value is an integer ranging from 0 to 4294967295. |
Priority |
Indicates the convergence priority of a route.
|
Label |
Indicates the allocated MPLS label. |
QoSInfo |
Indicates QoS information. The value 0x0 indicates that no QoS information is displayed. The value is a 32-bit octal number. The last three octal bits of this value indicate the value of the QoS local ID, which can be configured by the apply qos-local-id command. The fourth and seventh bits of this value are reserved and set to 0. The fifth and the sixth bits indicate the value of the BGP traffic index, which can be configured by the apply traffic-index command. The eighth number of this value is the flag bit. |
IndirectID |
Indicates the keyword of indirect next hop, which is generated by the system and cannot be configured by users. If the route is not iterated, the value is 0x0. If the route is iterated, the value is not 0x0. |
RelayNextHop |
Indicates the relay next hop. |
Interface |
Indicates the outbound interface through which the next hop is reachable. |
Tunnel ID |
Indicates the tunnel ID. |
Flags |
Indicates the route flag, that is, Route Flags in the heading of the routing table. |
# Display the summary of the active routes that match ACL 2000.
<sysname> display ip routing-table acl 2000
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routes Matched by Access list 2000:
Destinations : 1 Routes : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
172.16.0.0/16 Static 60 0 D 0.0.0.0 NULL0
# Display the route that matches the destination address 169.0.0.0 in the natural mask range.
<sysname> display ip routing-table 169.0.0.0 Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Summary Count: 1 Destination/Mask Proto Pre Cost Flags Nexthop Interface 169.0.0.0/16 Static 60 0 D 2.1.1.1 LoopBack1
# Display the routes with the destination address 1.1.1.1/32 based on the next hop.
<sysname> display ip routing-table 1.1.1.1 32 nexthop 2.2.2.2
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 Static 60 0 RD 2.2.2.2 NULL0
# Display the routes with the destination address in the range of 1.0.0.0/8 to 4.0.0.0/24.
<sysname> display ip routing-table 1.0.0.0 8 4.0.0.0 24
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.0.0.0/8 Static 60 0 D 10.0.0.1 GigabitEthernet1/0/2
1.1.1.0/24 Static 60 0 D 2.1.1.1 GigabitEthernet1/0/2
1.2.0.0/16 Static 60 0 D 10.0.0.1 GigabitEthernet1/0/2
2.1.1.0/24 Static 40 0 D 10.0.0.1 GigabitEthernet1/0/2
3.1.1.0/24 Static 60 0 D 4.1.1.1 GigabitEthernet1/0/2
# Display the summary of the active routes that match the prefix list named abc2.
<sysname> display ip routing-table ip-prefix abc2
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routes Matched by Prefix-list abc2:
Destinations : 4 Routes : 4
Destination/Mask Proto Pre Cost Flags Nexthop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
169.0.0.0/8 Static 60 0 D 2.1.1.1 LoopBack1
169.0.0.0/15 Static 60 0 D 2.1.1.1 LoopBack1