- Table of Contents
-
- 04-Network Connectivity Command Reference
- 00-Preface
- 01-MAC address table commands
- 02-Ethernet link aggregation commands
- 03-Port isolation commands
- 04-VLAN commands
- 05-Loop detection commands
- 06-Spanning tree commands
- 07-LLDP commands
- 08-Layer 2 forwarding commands
- 09-PPP commands
- 10-ARP commands
- 11-IP addressing commands
- 12-DHCP commands
- 13-DHCPv6 commands
- 14-DNS commands
- 15-NAT commands
- 16-IP performance optimization commands
- 17-IPv6 basics commands
- 18-Static routing commands
- 19-IPv6 static routing commands
- Related Documents
-
Title | Size | Download |
---|---|---|
18-Static routing commands | 89.32 KB |
Static routing commands
display ip routing-table
Use display ip routing-table to display routing table information.
Syntax
display ip routing-table [ verbose ]
Views
Any view
Predefined user roles
network-admin
network-operator
Parameters
verbose: Displays detailed routing table information, including information about both active and inactive routes. If you do not specify this keyword, the command displays only brief information about active routes.
Usage guidelines
If you do not specify any parameters, this command displays routing table information for the public network.
Examples
# Display brief information about active routes in the routing table.
<Sysname> display ip routing-table
Destinations : 15 Routes : 15
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
1.1.1.1/32 Guard 254 0 0.0.0.0 NULL0
1.1.1.0/24 Static 60 0 192.168.47.4 Vlan12
Static 60 0 192.168.47.4 Vlan13
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.0/24 Direct 0 0 192.168.1.40 Vlan11
192.168.1.0/32 Direct 0 0 192.168.1.40 Vlan11
192.168.1.40/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.255/32 Direct 0 0 192.168.1.40 Vlan11
224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
Table 1 Command output
Field |
Description |
Destinations |
Number of destination addresses. |
Routes |
Number of routes. |
Destination/Mask |
Destination address/mask length. |
Proto |
Route type or protocol that installed the route. |
Pre |
Preference of the route. |
Cost |
Cost of the route. |
NextHop |
Next hop address of the route. |
Interface |
Output interface for packets to be forwarded along the route. |
Summary count |
Number of routes. |
# Display detailed information about all routes in the routing table.
<Sysname> display ip routing-table verbose
Destinations : 2 Routes : 2
Destination: 0.0.0.0/32
Protocol: Direct
Process ID: 0
SubProtID: 0x0 Age: 08h34m37s
Cost: 0 Preference: 0
IpPre: N/A QosLocalID: N/A
Tag: 0 State: Active NoAdv
OrigTblID: 0x0 OrigVrf: default-vrf
TableID: 0x2 OrigAs: 0
NibID: 0x10000000 LastAs: 0
AttrID: 0xffffffff Neighbor: 0.0.0.0
Flags: 0x1000c OrigNextHop: 127.0.0.1
Label: NULL RealNextHop: 127.0.0.1
BkLabel: NULL BkNextHop: N/A
SRLabel: NULL Interface: InLoopBack0
BkSRLabel: NULL BkInterface: N/A
SIDIndex: NULL InLabel: NULL
Tunnel ID: Invalid IPInterface: InLoopBack0
BkTunnel ID: Invalid BkIPInterface: N/A
FtnIndex: 0x0 ColorInterface: N/A
TrafficIndex: N/A BkColorInterface: N/A
Connector: N/A VpnPeerId: N/A
Dscp: N/A Exp: N/A
SRTunnelID: Invalid StatFlags: 0x0
SID Type: N/A SID: N/A
BkSID: N/A NID: Invalid
FlushNID: Invalid BkNID: Invalid
BkFlushNID: Invalid PathID: 0x0
CommBlockLen: 0
OrigLinkID: 0x0 RealLinkID: 0x0
Destination: 1.1.1.0/24
Protocol: Static
Process ID: 0
SubProtID: 0x0 Age: 04h20m37s
Cost: 0 Preference: 60
IpPre: N/A QosLocalID: N/A
Tag: 0 State: Active Adv
OrigTblID: 0x0 OrigVrf: default-vrf
TableID: 0x2 OrigAs: 0
NibID: 0x10000003 LastAs: 0
AttrID: 0xffffffff Neighbor: 0.0.0.0
Flags: 0x1008c OrigNextHop: 192.168.47.4
Label: NULL RealNextHop: 192.168.47.4
BkLabel: NULL BkNextHop: N/A
SRLabel: NULL Interface: Vlan-interface11
BkSRLabel: NULL BkInterface: N/A
SIDIndex: NULL InLabel: NULL
Tunnel ID: Invalid IPInterface: Vlan-interface11
BkTunnel ID: Invalid BkIPInterface: N/A
FtnIndex: 0x0 ColorInterface: N/A
TrafficIndex: N/A BkColorInterface: N/A
Connector: N/A VpnPeerId: N/A
Dscp: N/A Exp: N/A
SRTunnelID: Invalid StatFlags: 0x0
SID Type: N/A SID: N/A
BkSID: N/A NID: Invalid
FlushNID: Invalid BkNID: Invalid
BkFlushNID: Invalid PathID: 0x0
CommBlockLen: 0
OrigLinkID: 0x0 RealLinkID: 0x0
Field |
Description |
Destinations |
Number of destination addresses. |
Routes |
Number of routes. |
Destination |
Destination address/mask length. |
Protocol |
Protocol that installed the route. |
Process ID |
Process ID. |
SubProtID |
ID of the subprotocol for routing. |
Age |
Time for which the route has been in the routing table. |
Cost |
Cost of the route. |
Preference |
Preference of the route. |
IpPre |
IP precedence. |
QosLocalID |
Local QoS ID. |
Tag |
Route tag. |
State |
Route status: · Active—Active unicast route. · Adv—Route that can be advertised. · Inactive—Inactive route. · NoAdv—Route that the router is not allowed to advertise. · Vrrp—Routes generated by VRRP (not supported in the current software version). · Nat—Routes generated by NAT (not supported in the current software version). · TunE—Tunnel (not supported in the current software version). · Derived—Derived route. If a route recurses to multiple related routes, all related routes except the first one are derived routes. The number of derived routes is not included in the total number of routes. |
OrigTblID |
Original routing table ID. |
OrigVrf |
This field is not supported in the current software version. Original VPN instance to which the route belongs. This field displays default-vrf if the route is on the public network. |
TableID |
ID of the routing table. |
OrigAs |
This field is not supported in the current software version. Original AS number. |
NibID |
ID of the next hop. |
LastAs |
This field is not supported in the current software version. Last AS number. |
AttrID |
Attribute ID. |
Neighbor |
Address of the neighbor determined by the routing protocol. |
Flags |
Flags of the route. |
OrigNextHop |
Next hop address of the route. |
Label |
This field is not supported in the current software version. Label of the route. |
RealNextHop |
Real next hop of the route. |
BkLabel |
This field is not supported in the current software version. Backup label. |
BkNexthop |
Backup next hop. |
SRLabel |
This field is not supported in the current software version. Segment routing (SR) label. |
Interface |
Output interface for packets to be forwarded along the route. |
BkInterface |
Backup output interface. |
BkSRLabel |
This field is not supported in the current software version. Backup SR label. |
SIDIndex |
This field is not supported in the current software version. SID index value. |
InLabel |
This field is not supported in the current software version. Incoming label of the route. |
Tunnel ID |
This field is not supported in the current software version. Tunnel ID |
IPInterface |
IP output interface. |
BkTunnel ID |
This field is not supported in the current software version. Backup tunnel ID. |
BkIPInterface |
Backup IP output interface. |
FtnIndex |
Index of the FTN entry. |
ColorInterface |
This field is not supported in the current software version. Output interface recursed by an SR-MPLS TE policy or SRv6 TE policy. |
BkColorInterface |
Backup output interface recursed by an SR-MPLS TE policy or SRv6 TE policy. |
TrafficIndex |
Traffic index in the range of 1 to 64. This field displays N/A when the value is invalid. |
Connector |
This field is not supported in the current software version. BGP connector attribute exchanged between BGP peers along with a VPN IPv4 route. The value of the attribute is the IP address of the remote PE device. The BGP connector attribute is used for MD VPN. This field displays N/A if the BGP connector attribute is not supported. |
VpnPeerId |
This field is not supported in the current software version. ID of the VPN peer to which the route belongs, in the range of 1 to 134217727. This field displays N/A when the value is invalid. |
Dscp |
DSCP value of the route, in the range of 0 to 63. This field displays N/A when the value is invalid. |
Exp |
This field is not supported in the current software version. MPLS EXP value of the route, which is supported only by BGP. This field displays N/A when the value is invalid. |
Summary count |
Number of routes. |
SRTunnelID |
This field is not supported in the current software version. SR tunnel ID. |
StatFlags |
This field is not supported in the current software version. Flags for SRv6 traffic statistics. |
SID Type |
SID type. If the route does not have an SID, this field displays N/A. |
SID |
This field is not supported in the current software version. Primary Segment Identifier (SID). If no primary SID is available, this field displays N/A. |
BkSID |
This field is not supported in the current software version. Backup SID. If no backup SID is available, this field displays N/A. |
NID |
Index of the Next Hop Label Forwarding Entry (NHLFE) issued by the routing protocol. |
FlushNID |
Actual NHLFE index issued to the FIB. |
BkNID |
Backup NHLFE index issued by the routing protocol. |
BkFlushNID |
Actual backup NHLFE index issued to the FIB. |
PathID |
This field is not supported in the current software version. Path ID. |
CommBlockLen |
This field is not supported in the current software version. Common prefix length in the locator. |
OrigLinkID |
This field is not supported in the current software version. Original link ID of the SDWAN TTE connection. |
RealLinkID |
This field is not supported in the current software version. Real link ID of the SDWAN TTE connection. |
ip route-static
Use ip route-static to configure a static route.
Use undo ip route-static to delete a static route.
Syntax
ip route-static dest-address { mask-length | mask } interface-type interface-number [ preference preference ]
ip route-static dest-address { mask-length | mask } next-hop-address [ preference preference ]
undo ip route-static dest-address { mask-length | mask } [ interface-type interface-number | next-hop-address ] [ preference preference ]
Default
No static route is configured.
Views
System view
Predefined user roles
network-admin
Parameters
dest-address: Specifies the destination IP address of the static route, in dotted decimal notation.
mask-length: Specifies the mask length, an integer in the range of 0 to 32.
mask: Specifies the subnet mask in dotted decimal notation.
interface-type interface-number: Specifies an output interface by its type and number. You can specify the output interface only as Null 0.
next-hop-address: Specifies the IP address of the next hop, in dotted decimal notation. For more information, see Layer 3—IP Routing Configuration Guide.
preference preference: Specifies a preference for the static route, in the range of 1 to 255. The default is 60.
Usage guidelines
If the destination IP address and the mask are both 0.0.0.0 (or 0), the configured route is a default route. The default route is used for forwarding a packet matching no entry in the routing table.
Implement different routing policies to configure different route preferences. For example, to enable load sharing for multiple routes to the same destination, assign the same preference to the routes. To enable the routes to back up one another, assign different preferences to them.
Examples
# Configure a static route, whose destination address is 1.1.1.1/24 and next hop address is 2.2.2.2.
<Sysname> system-view
[Sysname] ip route-static 1.1.1.1 24 2.2.2.2