When running a
routing protocol, the Ethernet switch also functions as a router. The words
“router” and the router icons covered in the following text
represent routers in common sense and Ethernet switches running a routing
protocol. To improve readability, this will not be mentioned again in this
manual.
Syntax
display ip routing-table
View
Any view
Parameter
None
Description
Use the display ip routing-table
command to display the routing table summary.
This command displays the summary of the routing
table. Each line represents one route, containing destination address/mask
length, protocol, preference, cost, next hop, and output interface.
This command displays only the currently
used routes, that is, the optimal routes.
Example
# Display the
summary of the current routing table.
<H3C> display ip routing-table
Routing
Table: public net
Destination/Mask Protocol Pre
Cost Nexthop Interface
1.1.1.0/24 DIRECT 0 0 1.1.1.1 Vlan-interface1
1.1.1.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0
2.2.2.0/24 DIRECT 0 0 2.2.2.1 Vlan-interface2
2.2.2.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0
3.3.3.0/24 DIRECT 0 0 3.3.3.1 Vlan-interface3
3.3.3.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0
4.4.4.0/24 DIRECT 0 0 4.4.4.1 Vlan-interface4
4.4.4.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0
127.0.0.0/8 DIRECT 0 0 127.0.0.1 InLoopBack0
127.0.0.1/32 DIRECT 0 0
127.0.0.1 InLoopBack0
Table 1-1 Description
on the fields of the display ip routing-table command
|
Field
|
Description
|
|
Destination/Mask
|
Destination address/mask length
|
|
Protocol
|
Routing protocol
|
|
Pre
|
Route preference
|
|
Cost
|
Route cost
|
|
Nexthop
|
Next hop address
|
|
Interface
|
Output interface, through which the data
packets destined for the destination network segment are sent
|
Syntax
display ip routing-table ip-address [ mask ] [ longer-match ] [ verbose
]
View
Any view
Parameter
ip-address:
Destination IP address, in dotted decimal notation.
mask: IP
address mask, length in dotted decimal notation or expressed as an integer. It
ranges from 0 to 32 when expressed as an integer.
longer-match:
Specifies all the routes that lead to the destination address and match the
specified mask. If you do not specify the mask argument, those that
match the natural mask are specified.
verbose: With
the verbose argument specified, this command displays the verbose
information of both the active and inactive routes. Without the argument
specified, this command only displays the summary of active routes.
Description
Use the display ip routing-table ip-address
command to display the routing information of the specified destination
address.
With different arguments provided, the
command output is different. The following is the command output with different
arguments provided:
l
display ip routing-table ip-address
If the destination address ip-address
corresponds to a route in the natural mask range, this command displays the
route that is the longest match of the destination address ip-address
and is active.
l
display ip routing-table ip-address mask
This command only displays the routes exactly
matching the specified destination address and mask.
l
display ip routing-table ip-address longer-match
This command displays all destination
address routes matching the specified destination address in the natural mask
range.
l
display ip routing-table ip-address mask longer-match
This command displays all destination
address routes matching the specified destination address in the specified mask
range.
Example
# There is a corresponding
route in the natural mask range. Display the summary.
<H3C> display ip routing-table
169.0.0.0
Destination/Mask Protocol Pre Cost
Nexthop Interface
169.0.0.0/16 Static 60 0 2.1.1.1 LoopBack1
For detailed description of the output
information, see Table 1-1.
# There is no
corresponding route (only the longest matching route is displayed) in the natural
mask range. Display the summary.
<H3C> display ip routing-table
169.253.0.0
Destination/Mask Protocol Pre Cost
Nexthop Interface
169.0.0.0/8 Static 60 0 2.1.1.1 LoopBack1
# There are corresponding routes in the
natural mask range. Display detailed information.
<H3C> display ip routing-table
169.0.0.0 verbose
Routing tables:
+ = Active Route, - = Last Active,
# = Both * = Next hop in use
Summary count: 1
**Destination: 169.0.0.0
Mask: 255.255.255.0
Protocol: #STATIC
Preference: 60
*NextHop: 2.1.1.1
Interface: 2.1.1.1(LoopBack1)
Vlinkindex: 0
State: <Int ActiveU
Gateway Static Unicast>
Age: 4:49 Cost:
0/0 Tag: 0
# There is no corresponding route in the
natural mask range (only the longest matched route is displayed). Display the
detailed information.
<H3C> display ip routing-table
169.253.0.0 verbose
Routing Tables:
+ = Active Route, - = Last Active,
# = Both * = Next hop in use
Summary count:1
**Destination: 169.0.0.0 Mask:
255.0.0.0
Protocol: #Static
Preference: -60
*NextHop: 2.1.1.1
Interface: 2.1.1.1(LoopBack1)
Vlinkindex: 0
State: <Int ActiveU
Static Unicast>
Age: 3:47 Cost:
0/0 Tag: 0
For detailed description of the output
information, see Table 1-2.
Syntax
display ip routing-table ip-address1 mask1 ip-address2 mask2 [ verbose
]
View
Any view
Parameter
ip-address1, ip-address2: Destination IP address in dotted decimal notation. ip-address1,
mask1 and ip-address2, mask2 determine one address range together. ip-address1
ANDed with mask1 specifies the start of the range, while
ip-address2 ANDed with mask2 specifies the end. This command displays
the route in this address range.
mask1, mask2:
IP address mask, length in dotted decimal notation or expressed as an integer.
It ranges from 0 to 32 when expressed as an integer.
verbose: With
the verbose argument provided, this command displays the verbose
information of both active and inactive routes. Without this argument provided,
this command displays the summary of active routes only.
Description
Use the display ip routing-table ip-address1
ip-address2 command to display the route information in the specified destination
address range.
Example
# Display the routing information of
destination addresses ranging from 1.1.1.0 to 2.2.2.0.
<H3C>display ip routing-table
1.1.1.0 24 2.2.2.0 24
Routing tables:
Summary count: 3
Destination/Mask Protocol Pre
Cost Nexthop Interface
1.1.1.0/24 DIRECT 0 0
1.1.1.1 Vlan-interface1
1.1.1.1/32 DIRECT 0 0 127.0.0.1
InLoopBack0
2.2.2.0/24 DIRECT 0 0
2.2.2.1 Vlan-interface2
For detailed description of the output
information, see Table 1-1.
Syntax
display ip routing-table protocol protocol [ inactive | verbose
]
View
Any view
Parameter
protocol: You
can provide one of the following values for this argument.
l
direct: Displays direct-connect route information
l
static: Displays
static route information.
inactive: With
this argument provided, this command displays the inactive route information.
Without this argument provided, this command displays both active and inactive
route information.
verbose:
With this argument provided, this command displays the verbose route
information. Without this argument provided, this command displays route
summary only.
Description
Use the display ip routing-table
protocol command to display the route information of a specific protocol.
Example
# Display the
summary of all direct-connect routes.
<H3C> display ip routing-table
protocol direct
DIRECT Routing tables:
Summary count: 4
DIRECT Routing tables status:<active>:
Summary count: 3
Destination/Mask Protocol Pre
Cost Nexthop Interface
20.1.1.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0
127.0.0.0/8 DIRECT 0 0 127.0.0.1 InLoopBack0
127.0.0.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0
DIRECT Routing tables status:<inactive>:
Summary count: 1
Destination/Mask Protocol Pre Cost
Nexthop Interface
210.0.0.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0
# Display the static routing table.
<H3C> display ip routing-table protocol
static
STATIC Routing tables:
Summary count: 1
STATIC Routing tables status:<active>:
Summary count: 0
STATIC Routing tables status:<inactive>:
Summary count: 1
Destination/Mask Protocol Pre
Cost Nexthop Interface
1.2.3.0/24 STATIC 60
0 1.2.4.5 Vlan-interface10
For detailed description of the output
information, see Table 1-1.
1.1.5 display ip
routing-table radix
Syntax
display ip routing-table radix
View
Any view
Parameter
None
Description
Use the display ip routing-table radix
command to display the route information in a tree structure.
Example
<H3C> display ip routing-table
radix
Radix tree for INET (2) inodes 7
routes 5:
+-32+--{210.0.0.1
+--0+
| | +--8+--{127.0.0.0
| | | +-32+--{127.0.0.1
| +--1+
| +--8+--{20.0.0.0
| +-32+--{20.1.1.1
Table 1-2 Description on the fields of
the display ip routing-table radix command
|
Field
|
Description
|
|
INET
|
Address suite
|
|
inodes
|
Number of nodes
|
|
routes
|
Number of routes
|
Syntax
display ip routing-table statistics
View
Any view
Parameter
None
Description
Use the display ip routing-table
statistics command to display the integrated routing information.
The integrated routing information includes
the total number of routes, the number of active routes, the number of routes
added by protocols, and the number of routes deleted.
Example
# Display the
integrated route information.
<H3C> display ip routing-table
statistics
Routing tables:
Proto route active
added deleted
DIRECT 24 4
25 1
STATIC 4 1
4 0
RIP 0 0 0
0
OSPF 0 0 0
0
O_ASE 0 0 0
0
O_NSSA 0 0 0
0
Total 28 5
29 1
Table 1-3 Description on the fields of the display ip routing-table
statistics command
|
Field
|
Description
|
|
Proto
|
Routing protocol. O_ASE stands for OSPF_ASE routes; O_NSSA stands for OSPF NSSA
routes; AGGRE stands for aggregated routes.
|
|
route
|
Total number of routes
|
|
active
|
Number of active routes
|
|
added
|
Number of routes added after the router
is rebooted or the routing table is cleared last time.
|
|
deleted
|
Number of routes deleted (Such routes
will be freed in a period of time)
|
|
Total
|
Total number of the different kinds of routes
|
Syntax
display ip routing-table verbose
View
Any view
Parameter
None
Description
Use the display ip routing-table verbose
command to display the verbose routing table information.
With the verbose argument provided,
this command displays the verbose routing table information. The descriptor
describing the route state will be displayed first. Then, the statistics of the
entire routing table will be output. Finally, the verbose description of each
route will be output.
The display ip routing-table verbose command
can display all current routes, including inactive routes and invalid routes.
Example
# Display the
verbose routing table information.
<H3C> display ip routing-table
verbose
Routing Tables:
+ = Active Route, - = Last Active,
# = Both * = Next hop in use
Destinations: 3 Routes: 3
Holddown: 0 Delete: 62
Hidden: 0
**Destination: 1.1.1.0
Mask: 255.255.255.0
Protocol: #DIRECT
Preference: 0
*NextHop: 1.1.1.1 Interface:
1.1.1.1(Vlan-interface1)
State: <Int ActiveU
Retain Unicast>
Age: 20:17:41 Cost: 0/0
**Destination: 1.1.1.1
Mask: 255.255.255.255
Protocol: #DIRECT
Preference: 0
*NextHop: 127.0.0.1 Interface:
127.0.0.1(InLoopBack0)
State: <NoAdvise Int ActiveU
Retain Gateway Unicast>
Age: 20:17:42 Cost: 0/0
**Destination: 2.2.2.0
Mask: 255.255.255.0
Protocol: #DIRECT
Preference: 0
*NextHop: 2.2.2.1
Interface: 2.2.2.1(Vlan-interface2)
State: <Int ActiveU
Retain Unicast>
Age: 20:08:05 Cost: 0/0
First, display statistics of the whole
routing table. Then, output detailed information of every route entry in turn. Table 1-2shows the meaning of route status. Table 1-4 shows routing table statistics.
Table
1-4 Description on the fields of the display ip
routing-table verbose command
|
Field
|
Description
|
|
Holddown
|
Number of held-down routes
|
|
Delete
|
Number of deleted routes
|
|
Hidden
|
Number of hidden routes
|
Syntax
delete static-routes all
View
System view
Parameter
None
Description
Use the delete static-routes all
command to delete all static routes.
The system will request your confirmation
before it deletes all the configured static routes.
Related command: ip route-static and
display ip routing-table.
Example
# Delete all the static routes in the
router.
<H3C> system-view
System View: return to User View with
Ctrl+Z.
[H3C] delete static-routes all
Are you sure to delete all the
unicast static routes?[Y/N]y
Syntax
reset ip routing-table statistics
protocol { all | protocol }
View
User view
Parameter
statistics protocol: Clears routing table statistics.
all: All
protocols.
protocol:
Origin of routes.
Description
Use the reset ip routing-table command
to reset routing table statistics for the public network routing table.
Example
# Clear private routing information.
<Sysname> reset ip
routing-table statistics protocol all
Syntax
ip route-static ip-address { mask | mask-length } { interface-type
interface-number | next-hop } [ preference preference-value
] [ reject | blackhole ] [ description text | detect-group
group number ]*
undo ip route-static ip-address { mask | mask-length
} [ interface-type interface-number | next-hop ] [ preference preference-value
] [ reject | blackhole ] [ description text | detect-group
group number ]*
View
System view
Parameter
ip-address:
Destination IP address, in dotted decimal notation.
mask: Mask.
mask-length:
Mask length. Since 1s in a 32-bit mask must be consecutive, a mask in dotted
decimal notation can be replaced by mask-length, which is the number of
the consecutive 1s in the mask.
interface-type interface-number: Next-hop outgoing interface. The packets sent to a null interface, which
is a virtual interface, will be discarded immediately. This can decrease the
system load.
next-hop: Next
hop IP address of the route, in dotted decimal notation.
preference-value: Preference level of the route, in the range from 1 to 255. The
default preference is 60.
reject:
Indicates an unreachable route. If a static route to a destination has the
"reject" attribute, all the IP packets destined for this
destination will be discarded, and the source host will be informed that the
destination is unreachable.
blackhole:
Indicates a blackhole route. If a static route to a destination has the “blackhole”
attribute, the outgoing interface of this route is the Null 0 interface
regardless of the next hop address, and all the IP packet addresses destined
for this destination are dropped without the source host being notified.
description:
Provides a description for the current route.
detect-group:
Specifies a detect group.
Description
Use the ip route-static command to
configure a static route.
Use the undo ip route-static command
to delete a manually configured static route.
By default, the system can obtain the
subnet route directly connected to the router. When you configure a static
route, if no preference is specified for the route, the preference defaults to
60, and if the route is not specified as reject or blackhole, the
route will be reachable by default.
When configuring a static route, note the
following points:
l
If the destination IP address and the mask are
both 0.0.0.0, what you are configuring is a default route. All the packets that
fail to find a routing entry will be forwarded through this default route.
l
You cannot configure an interface address of the
local switch as the next hop address of a static route.
l
You can configure a different preference to
implement flexible route management policy.
Related command: display ip
routing-table.
Example
# Configure the next hop of the default
route as 129.102.0.2.
<H3C> system-view
System View: return to User View with
Ctrl+Z.
[H3C] ip route-static 0.0.0.0 0.0.0.0
129.102.0.2