20-Static Routing Commands
Chapters Download (90.48 KB)
Table of Contents
display ip routing-table ip-address
display ip routing-table protocol
display ip routing-table statistics
reset ip routing-table statistics protocol
2 Static Routing Configuration Commands
Static Routing Configuration Commands
ip route-static default-preference
The term “router” in this document refers to an S3600 EPON OLT switch configured with Layer 3 interfaces such as VLAN interfaces or Loopback interfaces.
Syntax
display ip routing-table [ verbose | | { begin | exclude | include } regular-expression ]
View
Any view
Default Level
1: Monitor level
Parameters
verbose: Displays detailed routing table information, including that for inactive routes. With this keyword absent, the command displays only brief information about active routes.
|: Uses a regular expression to filter output information. For details about regular expressions, refer to the section CLI Display in System Maintenance and Debugging Configuration.
begin: Displays route entries starting from the one specified by the regular expression.
exclude: Displays route entries not matching the regular expression.
include: Displays route entries matching the regular expression.
regular-expression: Regular expression, a string of 1 to 256 case-sensitive characters used for specifying routing entries.
Description
Use the display ip routing-table command to display brief information about active routes in the routing table.
This command displays brief information about a routing table, with a routing entry contained in one line. The information displayed includes destination IP address/mask length, protocol, priority, cost, next hop and outbound interface. This command only displays the routes currently in use, that is, the optimal routes.
Use the display ip routing-table verbose command to display detailed information about all routes in the routing table.
This command displays detailed information about all active and inactive routes, including the statistics of the entire routing table and information for each route.
Examples
# Display brief information about active routes in the routing table.
<Sysname> display ip routing-table
Routing Tables: Public
Destinations : 4 Routes : 4
Destination/Mask Proto Pre Cost NextHop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.0.0/24 Direct 0 0 192.168.0.140 Vlan1
192.168.0.140/32 Direct 0 0 127.0.0.1 InLoop0
Table 1-1 display ip routing-table command output description
Field |
Description |
Destinations |
Number of destination addresses |
Routes |
Number of routes |
Destination/Mask |
Destination address/mask length |
Proto |
Protocol that presents the route |
Pre |
Priority of the route |
Cost |
Cost of the route |
Nexthop |
Address of the next hop on the route |
Interface |
Outbound interface for packets to be forwarded along the route |
# Display detailed information about all routes in the routing table.
<Sysname> display ip routing-table verbose
Routing Table : Public
Destinations : 4 Routes : 4
Destination: 127.0.0.0/8
Protocol: Direct Process ID: 0
Preference: 0 Cost: 0
NextHop: 127.0.0.1 Interface: InLoopBack0
BkNextHop: 0.0.0.0 BkInterface:
RelyNextHop: 0.0.0.0 Neighbor : 0.0.0.0
Tunnel ID: 0x0 Label: NULL
State: Active NoAdv Age: 01h37m09s
Tag: 0
Destination: 127.0.0.1/32
Protocol: Direct Process ID: 0
Preference: 0 Cost: 0
NextHop: 127.0.0.1 Interface: InLoopBack0
BkNextHop: 0.0.0.0 BkInterface:
RelyNextHop: 0.0.0.0 Neighbor : 0.0.0.0
Tunnel ID: 0x0 Label: NULL
State: Active NoAdv Age: 01h37m09s
Tag: 0
Destination: 192.168.0.0/24
Protocol: Direct Process ID: 0
Preference: 0 Cost: 0
NextHop: 192.168.0.140 Interface: Vlan-interface1
BkNextHop: 0.0.0.0 BkInterface:
RelyNextHop: 0.0.0.0 Neighbor : 0.0.0.0
Tunnel ID: 0x0 Label: NULL
State: Active Adv Age: 01h36m40s
Tag: 0
Destination: 192.168.0.140/32
Protocol: Direct Process ID: 0
Preference: 0 Cost: 0
NextHop: 127.0.0.1 Interface: InLoopBack0
BkNextHop: 0.0.0.0 BkInterface:
RelyNextHop: 0.0.0.0 Neighbor : 0.0.0.0
Tunnel ID: 0x0 Label: NULL
State: Active NoAdv Age: 01h36m41s
Tag: 0
Displayed first are statistics for the whole routing table, followed by detailed description of each route (in sequence).
Table 1-2 display ip routing-table verbose command output description
Field |
Description |
|
Destination |
Destination address/mask length |
|
Protocol |
Protocol that presents the route |
|
Process ID |
Process ID |
|
Preference |
Priority of the route |
|
Cost |
Cost of the route |
|
NextHop |
Address of the next hop on the route |
|
Interface |
Outbound interface for packets to be forwarded along the route |
|
BkNexthop |
Backup next hop |
|
BkInterface |
Backup outbound interface |
|
RelyNextHop |
The next hop address obtained through routing recursion |
|
Neighbour |
Neighboring address determined by Routing Protocol |
|
Tunnel ID |
Tunnel ID |
|
Label |
Label |
|
State |
Route status: |
|
Active |
This is an active unicast route. |
|
Adv |
This route can be advertised. |
|
Delete |
This route is deleted. |
|
Gateway |
This is an indirect route. |
|
Holddown |
Number of holddown routes. Holddown is a route advertisement policy used in some distance vector (D-V) routing protocols, such as RIP, to avoid the propagation of some incorrect routes. It distributes a Holddown route during a period regardless of whether a new route to the same destination is found. For details, refer to corresponding routing protocols. |
|
Int |
The route was discovered by an Interior Gateway Protocol (IGP). |
|
NoAdv |
The route is not advertised when the router advertises routes based on policies. |
|
NotInstall |
Normally, among routes to a destination, the route with the highest priority is installed into the core routing table and advertised, while a NotInstall route cannot be installed into the core routing table but may be advertised. |
|
Reject |
The packets matching a Reject route will be dropped. Besides, the router sends ICMP unreachable messages to the sources of the dropped packets. The Reject routes are usually used for network testing. |
|
Static |
A static route is not lost when you perform the save operation and then restart the router. Routes configured manually are marked as static. |
|
Unicast |
Unicast routes |
|
Inactive |
Inactive routes |
|
Invalid |
Invalid routes |
|
WaitQ |
The route is the WaitQ during route recursion. |
|
TunE |
Tunnel |
|
GotQ |
The route is in the GotQ during route recursion. |
|
Age |
Time for which the route has been in the routing table, in the sequence of hour, minute, and second from left to right. |
|
Tag |
Route tag |
Syntax
display ip routing-table acl acl-number [ verbose ]
View
Any view
Default Level
1: Monitor level
Parameters
acl-number: Basic ACL number, in the range of 2000 to 2999.
verbose: Displays detailed routing table information, including that for inactive routes. With this argument absent, the command displays only brief information about active routes.
Description
Use the display ip routing-table acl command to display information about routes permitted by a specified basic ACL.
This command is intended for the follow-up display of routing policies.
If the specified ACL does not exist or it has no rules configured, the entire routing table is displayed.
Examples
# Define basic ACL 2000 and set the route filtering rules.
<Sysname> system-view
[Sysname] acl number 2000
[Sysname-acl-basic-2000] rule permit source 192.168.0.0 0.0.255.255
[Sysname-acl-basic-2000] rule deny source any
# Display brief information about active routes permitted by basic ACL 2000.
[Sysname-acl-basic-2000] display ip routing-table acl 2000
Routes Matched by Access list : 2000
Summary Count : 2
Destination/Mask Proto Pre Cost NextHop Interface
192.168.0.0/24 Direct 0 0 192.168.0.140 Vlan1
192.168.0.140/32 Direct 0 0 127.0.0.1 InLoop0
For detailed description of the above output, see Table 1-1.
# Display detailed information about both active and inactive routes permitted by basic ACL 2000.
<Sysname> display ip routing-table acl 2000 verbose
Routes Matched by Access list : 2000
Summary Count : 2
Destination: 192.168.0.0/24
Protocol: Direct Process ID: 0
Preference: 0 Cost: 0
NextHop: 192.168.0.140 Interface: Vlan-interface1
BkNextHop: 0.0.0.0 BkInterface:
RelyNextHop: 0.0.0.0 Neighbor : 0.0.0.0
Tunnel ID: 0x0 Label: NULL
State: Active Adv Age: 01h44m12s
Tag: 0
Destination: 192.168.0.140/32
Protocol: Direct Process ID: 0
Preference: 0 Cost: 0
NextHop: 127.0.0.1 Interface: InLoopBack0
BkNextHop: 0.0.0.0 BkInterface:
RelyNextHop: 0.0.0.0 Neighbor : 0.0.0.0
Tunnel ID: 0x0 Label: NULL
State: Active NoAdv Age: 01h44m12s
Tag: 0
For the description of the command output above, see Table 1-2.
Syntax
display ip routing-table ip-address [ mask-length | mask ] [ longer-match ] [ verbose ]
display ip routing-table ip-address1 { mask-length | mask } ip-address2 { mask-length | mask } [ verbose ]
View
Any view
Default Level
1: Monitor level
Parameters
ip-address: Destination IP address, in dotted decimal format.
mask-length: IP address mask length in the range 0 to 32.
mask: IP address mask in dotted decimal format.
longer-match: Displays the route with the longest mask.
verbose: Displays detailed routing table information, including both active and inactive routes. With this argument absent, the command displays only brief information about active routes.
Description
Use the display ip routing-table ip-address command to display information about routes to a specified destination address.
Executing the command with different parameters yields different output:
l display ip routing-table ip-address
The system ANDs the input destination IP address with the subnet mask in each route entry; and ANDs the destination IP address in each route entry with its corresponding subnet mask.
If the two operations yield the same result for an entry and this entry is active, it is displayed.
l display ip routing-table ip-address mask
The system ANDs the input destination IP address with the input subnet mask; and ANDs the destination IP address in each route entry with the input subnet mask.
If the two operations yield the same result for an entry and the entry is active with a subnet mask less than or equal to the input subnet mask, the entry is displayed.
Only route entries that exactly match the input destination address and mask are displayed.
l display ip routing-table ip-address longer-match
The system ANDs the input destination IP address with the subnet mask in each route entry; and ANDs the destination IP address in each route entry with its corresponding subnet mask.
If the two operations yield the same result for multiple entries that are active, the one with longest mask length is displayed.
l display ip routing-table ip-address mask longer-match
The system ANDs the input destination IP address with the input subnet mask; and ANDs the destination IP address in each route entry with the input subnet mask.
If the two operations yield the same result for multiple entries with a mask less than or equal to the input subnet mask, the one that is active with longest mask length is displayed.
Use the display ip routing-table ip-address1 { mask-length | mask } ip-address2 { mask-length | mask } command to display route entries with destination addresses within a specified range.
Examples
# Display route entries for the destination IP address 192.168.0.140.
[Sysname] display ip routing-table 192.168.0.140
Routing Table : Public
Summary Count : 2
Destination/Mask Proto Pre Cost NextHop Interface
192.168.0.0/24 Direct 0 0 192.168.0.140 Vlan1
192.168.0.140/32 Direct 0 0 127.0.0.1 InLoop0
For detailed description about the output, see Table 1-1.
# Display route entries by specifying a destination IP address and the longer-match keyword.
[Sysname] display ip routing-table 11.1.1.1 longer-match
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost NextHop Interface
192.168.0.140/32 Direct 0 0 127.0.0.1 InLoop0
# Display route entries by specifying a destination IP address and mask.
[Sysname] display ip routing-table 192.168.0.140 32
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost NextHop Interface
192.168.0.140/32 Direct 0 0 127.0.0.1 InLoop0
# Display route entries by specifying a destination IP address and mask and the longer-match keyword.
[Sysname] display ip routing-table 192.168.0.140 32 longer-match
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost NextHop Interface
192.168.0.140/32 Direct 0 0 127.0.0.1 InLoop0
For detailed description of the above output, see Table 1-1.
Syntax
display ip routing-table protocol protocol [ inactive | verbose ]
View
Any view
Default Level
1: Monitor level
Parameters
protocol: Routing protocol. It can be direct or static.
inactive: Displays information about only inactive routes. With this argument absent, the command displays information about both active and inactive routes.
verbose: Displays detailed routing table information. With this argument absent, the command displays brief routing table information.
Description
Use the display ip routing-table protocol command to display routing information of a specified routing protocol.
Examples
# Display brief information about direct routes.
<Sysname> display ip routing-table protocol direct
Public Routing Table : Direct
Summary Count : 4
Direct Routing table Status : < Active>
Summary Count : 4
Destination/Mask Proto Pre Cost NextHop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.0.0/24 Direct 0 0 192.168.0.140 Vlan1
192.168.0.140/32 Direct 0 0 127.0.0.1 InLoop0
Direct Routing table Status : < Inactive>
Summary Count : 0
# Display brief information about static routes.
<Sysname> display ip routing-table protocol static
Public Routing Table : Static
Summary Count : 0
Static Routing table Status : < Active>
Summary Count : 0
Static Routing table Status : < Inactive>
Summary Count : 0
For detailed description of the above output, see Table 1-1.
Syntax
display ip routing-table [ vpn-instance vpn-instance-name ] statistics
View
Any view
Default Level
1: Monitor level
Parameters
vpn-instance vpn-instance-name: Displays routing table statistics for a VPN instance. The VPN instance name is a string of 1 to 31 case-sensitive characters.
Description
Use the display ip routing-table statistics command to display the route statistics of the public network routing table or the VPN routing table.
Examples
# Display route statistics in the routing table.
<Sysname> display ip routing-table statistics
Proto route active added deleted freed
DIRECT 4 4 4 0 0
STATIC 0 0 0 0 0
Total 4 4 4 0 0
Table 1-3 display ip routing-table statistics command output description
Field |
Description |
Proto |
Origin of the routes. |
route |
Number of routes from the origin |
active |
Number of active routes from the origin |
added |
Number of routes added into the routing table since the router started up or the routing table was last cleared |
deleted |
Number of routes marked as deleted, which will be freed after a period. |
freed |
Number of routes that got freed, that is, got removed permanently. |
Total |
Total number |
Syntax
reset ip routing-table statistics protocol [ vpn-instance vpn-instance-name ] { protocol | all }
View
User view
Default Level
2: System level
Parameters
vpn-instance-name: VPN instance name, a string of 1 to 31 case-sensitive characters.
protocol: Clears statistics for the IPv4 routing protocol, which can be direct or static.
all: Clears statistics for all routing protocols.
Description
Use the reset ip routing-table statistics protocol command to clear routing statistics for the routing table or VPN routing table.
Examples
# Clear all routing statistics information.
<Sysname> reset ip routing-table statistics protocol all
Syntax
delete static-routes all
View
System view
Default Level
2: System level
Parameters
None
Description
Use the delete static-routes all command to delete all static routes.
When you use this command to delete static routes, the system will prompt you to confirm the operation before deleting all the static routes.
Related commands: display ip routing-table, ip route-static.
Examples
# Delete all static routes on the router.
<Sysname> system-view
[Sysname] delete static-routes all
This will erase all ipv4 static routes and their configurations, you must reconf
igure all static routes
Are you sure?[Y/N]:Y
Syntax
ip route-static dest-address { mask | mask-length } { next-hop-address | interface-type interface-number next-hop-address } [ preference preference-value ] [ description description-text ]
undo ip route-static dest-address { mask | mask-length } [ next-hop-address | interface-type interface-number [ next-hop-address ] ] [ preference preference-value ]
View
System view
Default Level
2: System level
Parameters
dest-address: Destination IP address of the static route, in dotted decimal notation.
mask: Mast of the IP address, in dotted decimal notation.
mask-length: Mask length, in the range 0 to 32.
next-hop-address: IP address of the next hop, in dotted decimal notation.
preference preference-value : Specifies the preference of the static route, which is in the range of 1 to 255 and defaults to 60.
description description-text: Configures a description for the static route, which consists of 1 to 60 characters, including special characters like space, but excluding ?.
Description
Use the ip route-static command to configure a unicast static route.
Use the undo ip route-static command to delete a unicast static route.
When configuring a unicast static route, note that:
1) If the destination IP address and the mask are both 0.0.0.0, the configured route is a default route. If routing table searching fails, the router will use the default route for packet forwarding.
2) Different route management policies can be implemented for different route preference configurations. For example, specifying the same preference for different routes to the same destination address enables load sharing, while specifying different preferences for these routes enables route backup.
3) When configuring a static route, you can specify the output interface or the next hop address based on the actual requirement. Note that the next hop address must not be the IP address of the local interface; otherwise, the route configuration will not take effect. For interfaces that support network address to link layer address resolution or point-to-point interfaces, you can specify the output interface or next hop address. When specifying the output interface, note that:
l For a Null 0 or loopback interface, if the output interface has already been configured, there is no need to configure the next hop address.
l If you specify a broadcast interface (such as a VLAN interface) as the output interface for a static route, you must specify the corresponding next hop of the interface at the same time.
Related commands: display ip routing-table, ip route-static default-preference.
The static route does not take effect if you specify its next hop address first and then configure the address as the IP address of a local interface, such as a VLAN interface.
Examples
# Configure a static route, whose destination address is 1.1.1.1/24, next hop address is 2.2.2.2, and description information is for internet & intranet.
<Sysname> system-view
[Sysname] ip route-static 1.1.1.1 24 2.2.2.2 description for internet & intranet
Syntax
ip route-static default-preference default-preference-value
undo ip route-static default-preference
View
System view
Default Level
2: System level
Parameters
default-preference-value: Default preference for static routes, which is in the range of 1 to 255.
Description
Use the ip route-static default-preference command to configure the default preference for static routes.
Use the undo ip route-static default-preference command to restore the default.
By default, the default preference of static routes is 60.
Note that:
l If no preference is specified when configuring a static route, the default preference is used.
l When the default preference is re-configured, it applies to newly added static routes only.
Related commands: display ip routing-table, ip route-static.
Examples
# Set the default preference of static routes to 120.
<Sysname> system-view