- Table of Contents
-
- 05-Network Connectivity Command Reference
- 00-Preface
- 01-MAC address table commands
- 02-Ethernet link aggregation commands
- 03-VLAN commands
- 04-Spanning tree commands
- 05-LLDP commands
- 06-Layer 2 forwarding commands
- 07-PPP commands
- 08-L2TP commands
- 09-ARP commands
- 10-IP addressing commands
- 11-DHCP commands
- 12-DHCPv6 commands
- 13-DNS commands
- 14-NAT commands
- 15-IP performance optimization commands
- 16-IPv6 basics commands
- 17-Tunneling commands
- 18-GRE commands
- 19-ADVPN commands
- 20-Basic IP routing commands
- 21-IP forwarding basics commands
- 22-Static routing commands
- 23-IPv6 static routing commands
- 24-RIP commands
- 25-Policy-based routing commands
- 26-IPv6 policy-based routing commands
- 27-OSPF commands
- 28-RIPng commands
- 29-BGP commands
- 30-IGMP snooping commands
- 31-MLD snooping commands
- Related Documents
-
Title | Size | Download |
---|---|---|
22-Static routing commands | 134.42 KB |
display route-static routing-table
ip route-static default-preference
ip route-static fast-reroute auto
Static routing commands
delete static-routes all
Use delete static-routes all to delete all static routes.
Syntax
delete static-routes all
Views
System view
Predefined user roles
network-admin
Usage guidelines
CAUTION: This command might interrupt network communication and cause packet forwarding failure. Before executing the command, make sure you fully understand the potential impact on the network. |
When you use this command, the system will prompt you to confirm the operation before deleting all the static routes.
To delete one static route, use the undo ip route-static command. To delete all static routes, including the default route, use the delete static-routes all command.
Examples
# Delete all static routes.
<Sysname> system-view
[Sysname] delete static-routes all
This will erase all IPv4 static routes and their configurations, you must reconfigure all static routes.
Are you sure?[Y/N]:y
Related commands
ip route-static
display route-static nib
Use display route-static nib to display static route next hop information.
Syntax
display route-static nib [ nib-id ] [ verbose ]
Views
Any view
Predefined user roles
network-admin
network-operator
Parameters
nib-id: Specifies a NIB by its ID, a hexadecimal string of 1 to ffffffff. If you do not specify this argument, the command displays all static route next hop information.
verbose: Displays detailed static route next hop information. If you do not specify this keyword, the command displays brief static route next hop information.
Examples
# Displays brief static route next hop information.
<Sysname> display route-static nib
Total number of nexthop(s): 44
NibID: 0x11000000 Sequence: 0
Type: 0x21 Flushed: Yes
UserKey0: 0x111 VrfNthp: 0
UserKey1: 0x0 Nexthop: 0.0.0.0
IFIndex: 0x111 LocalAddr: 0.0.0.0
NewUK0: 0x0 NewUK1: 0x0
NewUK2: 0x0 NewUK3: 0x0
NewUK4: 0x0 NewUK5: 0x0
NewUK6: 0x0 NewUK7: 0x0
TopoNthp: 0 ExtType: 0x0
Color: 0 COFlag: 0x0
LinkID: 0x0
SIDIndex: 0x0 SRPName:
OriNexthop: 0.0.0.0
NibID: 0x11000001 Sequence: 1
Type: 0x41 Flushed: Yes
UserKey0: 0x0 VrfNthp: 5
UserKey1: 0x0 Nexthop: 2.2.2.2
IFIndex: 0x0 LocalAddr: 0.0.0.0
NewUK0: 0x0 NewUK1: 0x0
NewUK2: 0x0 NewUK3: 0x0
NewUK4: 0x0 NewUK5: 0x0
NewUK6: 0x0 NewUK7: 0x0
TopoNthp: 0 ExtType: 0x0
Color: 0 COFlag: 0x0
LinkID: 0x0
SIDIndex: 0x0 SRPName:
OriNexthop: 0.0.0.0
Table 1 Command output
Field |
Description |
NibID |
ID of the NIB. |
Sequence |
Sequence number of the NIB. |
Type |
Type of the NIB. |
Flushed |
Indicates whether the route with the NIB has been flushed to the FIB. |
UserKey0 |
Reserved data 1. |
UserKey1 |
Reserved data 2. |
VrfNthp |
This field is not supported in the current software version. Index of the VPN instance that the next hop belongs to. This field displays 0 if the next hop is on the public network. |
Nexthop |
Next hop address. |
IFIndex |
Interface index |
LocalAddr |
Local interface address. |
NewUK0 |
New reserved data 1. |
NewUK1 |
New reserved data 2. |
NewUK2 |
New reserved data 3. |
NewUK3 |
New reserved data 4. |
NewUK4 |
New reserved data 5. |
NewUK5 |
New reserved data 6. |
NewUK6 |
New reserved data 7. |
NewUK7 |
New reserved data 8. |
TopoNthp |
This field is not supported in the current software version. Index of the topology that contains the next hop. This field displays 0 if the next hop is on the public network. |
ExtType |
NIB extension type. |
Color |
This field is not supported in the current software version. Color extended community attribute. |
COFlag |
This field is not supported in the current software version. Flag of the color extended community attribute. |
LinkID |
This field is not supported in the current software version. Link ID of the SDWAN TTE connection. |
SIDIndex |
This field is not supported in the current software version. SID index value. |
SRPName |
This field is not supported in the current software version. SR-MPLS TE policy name. |
OriNexthop |
Original next hop address of the route. |
# Displays detailed static route next hop information.
<Sysname> display route-static nib verbose
Total number of nexthop(s): 44
NibID: 0x11000000 Sequence: 0
Type: 0x21 Flushed: Yes
UserKey0: 0x111 VrfNthp: 0
UserKey1: 0x0 Nexthop: 0.0.0.0
IFIndex: 0x111 LocalAddr: 0.0.0.0
NewUK0: 0x0 NewUK1: 0x0
NewUK2: 0x0 NewUK3: 0x0
NewUK4: 0x0 NewUK5: 0x0
NewUK6: 0x0 NewUK7: 0x0
TopoNthp: 0 ExtType: 0x0
Color: 0 COFlag: 0x0
LinkID: 0x0
SIDIndex: 0x0 SRPName:
OriNexthop: 0.0.0.0
RefCnt: 2 FlushRefCnt: 0
Flag: 0x2 Version: 1
1 nexthop(s):
PrefixIndex: 0 OrigNexthop: 0.0.0.0
RelyDepth: 0 RealNexthop: 0.0.0.0
Interface: NULL0 LocalAddr: 0.0.0.0
TunnelCnt: 0 Vrf: default-vrf
TunnelID: N/A Topology: base
Weight: 1000000 Flags: 0x0
SRPolicyNID: 4294967295 SRInterface:
ColorWeight: 0 Locator: N/A
OrigLinkID: 0x0 RealLinkID: 0x0
NibID: 0x11000001 Sequence: 1
Type: 0x41 Flushed: Yes
UserKey0: 0x0 VrfNthp: 5
UserKey1: 0x0 Nexthop: 2.2.2.2
IFIndex: 0x0 LocalAddr: 0.0.0.0
NewUK0: 0x0 NewUK1: 0x0
NewUK2: 0x0 NewUK3: 0x0
NewUK4: 0x0 NewUK5: 0x0
NewUK6: 0x0 NewUK7: 0x0
TopoNthp: 0 ExtType: 0x0
Color: 0 COFlag: 0x0
LinkID: 0x0
SIDIndex: 0x0 SRPName:
OriNexthop: 0.0.0.0
RefCnt: 1 FlushRefCnt: 0
Flag: 0x12 Version: 1
2 nexthop(s):
PrefixIndex: 0 OrigNexthop: 2.2.2.2
RelyDepth: 7 RealNexthop: 8.8.8.8
Interface: Vlan11 LocalAddr: 12.12.12.12
TunnelCnt: 0 Vrf: default-vrf
TunnelID: N/A Topology: base
Weight: 1000000 Flags: 0x0
SRPolicyNID: 4294967295 SRInterface:
ColorWeight: 0 Locator: N/A
OrigLinkID: 0x0 RealLinkID: 0x0
PrefixIndex: 0 OrigNexthop: 2.2.2.2
RelyDepth: 9 RealNexthop: 0.0.0.0
Interface: NULL0 LocalAddr: 0.0.0.0
TunnelCnt: 0 Vrf: default-vrf
TunnelID: N/A Topology: base
Weight: 1000000 Flags: 0x0
SRPolicyNID: 4294967295 SRInterface:
ColorWeight: 0 Locator: N/A
OrigLinkID: 0x0 RealLinkID: 0x0
...
Table 2 Command output
Field |
Description |
NibID |
ID of the NIB. |
Sequence |
Sequence number of the NIB. |
Type |
Type of the NIB. |
Flushed |
Indicates whether the route with the NIB has been flushed to the FIB. |
UserKey0 |
Reserved data 1. |
VrfNthp |
This field is not supported in the current software version. Index of the VPN instance that the next hop belongs to. This field displays 0 if the next hop is on the public network. |
UserKey1 |
Reserved data 2. |
Nexthop |
Next hop address. |
IFIndex |
Interface index |
LocalAddr |
Local interface address. |
TopoNthp |
Index of the topology that contains the next hop. This field displays 0 if the next hop is on the public network. |
RefCnt |
Reference count of the next hop. |
FlushRefCnt |
Reference count of the next hop that is flushed to the FIB. |
Flag |
Flag of the next hop. |
Version |
Version of the next hop. |
x nexthop(s) |
Number of next hops. |
PrefixIndex |
Prefix index of the next hop for an ECMP route. |
OrigNexthop |
Original next hop. |
RelyDepth |
Recursion depth. |
RealNexthop |
Real next hop. |
Interface |
Output interface. |
localAddr |
Local interface address. |
TunnelCnt |
Number of tunnels after route recursion. |
Vrf |
This field is not supported in the current software version. VPN instance name. For the public network, this field displays default-vrf. |
TunnelID |
ID of the tunnel after route recursion. |
Topology |
This field is not supported in the current software version. Topology name. The topology name for the public network is base. |
Weight |
ECMP route weight. This field displays 0 for non-ECMP routes. |
Flags |
Flags of the detailed next hop. |
SRPolicyNID |
This field is not supported in the current software version. NIB ID of the route obtained from an SR-MPLS TE policy through route recursion. |
SRInterface |
This field is not supported in the current software version. Output interface of the route obtained from the SR-MPLS TE policy through route recursion. |
ColorWeight |
This field is not supported in the current software version. Weight value of the color attribute in the SR-MPLS TE policy. |
Locator |
This field is not supported in the current software version. IPv6 prefix of the locator to which the SID belongs. If no locator is available, this field displays N/A. |
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. |
display route-static routing-table
Use display route-static routing-table to display static routing table information.
Syntax
display route-static routing-table [ ip-address { mask-length | mask } ]
Views
Any view
Predefined user roles
network-admin
network-operator
Parameters
ip-address: Specifies the destination IP address in dotted decimal notation. If you do not specify this argument, the command displays all static routing table information.
mask-length: Specifies the mask length, an integer in the range of 0 to 32.
mask: Specifies the subnet mask in dotted decimal notation.
Examples
# Display static routing table information.
<Sysname> display route-static routing-table
Total number of routes: 24
Status: * - valid
*Destination: 0.0.0.0/0
NibID: 0x1100000a NextHop: 2.2.2.10
MainNibID: N/A BkNextHop: N/A
BkNibID: N/A Interface: Vlan-interface11
TableID: 0x2 BkInterface: Vlan-interface12
Flag: 0x82d01 BfdSrcIp: N/A
DbIndex: 0xd BfdIfIndex: 0x0
Type: Normal BfdVrfIndex: 0
TrackIndex: 0xffffffff Label: NULL
Preference: 60 vrfIndexDst: 0
BfdMode: N/A vrfIndexNH: 0
Permanent: 0 RecurseMaskLen: N/A
Tag: 0
Destination: 0.0.0.0/0
NibID: 0x1100000b NextHop: 2.2.2.11
MainNibID: N/A BkNextHop: N/A
BkNibID: N/A Interface: Vlan-interface13
TableID: 0x2 BkInterface: Vlan-interface14
Flag: 0x82d01 BfdSrcIp: N/A
DbIndex: 0xd BfdIfIndex: 0x0
Type: Normal BfdVrfIndex: 0
TrackIndex: 0xffffffff Label: NULL
Preference: 60 vrfIndexDst: 0
BfdMode: N/A vrfIndexNH: 0
Permanent: 0 RecurseMaskLen: N/A
Tag: 0
...
Table 3 Command output
Field |
Description |
destination |
Destination address/prefix. |
NibID |
ID of the NIB. |
MainNibID |
ID of the primary next hop for static route FRR. |
BkNibID |
ID of the backup next hop for static route FRR. |
NextHop |
Next hop address. |
BkNextHop |
Backup next hop address. |
Interface |
Output interface of the route. |
BkInterface |
Backup output interface. |
TableID |
ID of the table to which the route belongs. |
Flag |
Flag of the route. |
DbIndex |
Index of the database to which the route belongs. |
Type |
Route type: · Normal. · DHCP. · NAT. · IPsec. · IPSGT. |
BfdSrcIp |
This field is not supported in the current software version. Source IP address of the indirect BFD session. |
BfdIfIndex |
This field is not supported in the current software version. Index of the interface where BFD is enabled. |
BfdVrfIndex |
This field is not supported in the current software version. Index of the VPN instance where BFD is enabled. This field displays 0 if BFD is enabled for the public network. |
BfdMode |
This field is not supported in the current software version. BFD session mode: · N/A—No BFD session is configured. · Ctrl—Control packet mode · Echo—Echo packet mode. |
TrackIndex |
NQA Track index. |
Label |
Label of the route. |
vrfIndexDst |
This field is not supported in the current software version. Index of VPN instance that the destination belongs to. For the public network, this field displays 0. |
vrfIndexNH |
This field is not supported in the current software version. Index of the VPN instance that the next hop belongs to. For the public network, this field displays 0. |
Permanent |
Permanent static route flag. 1 indicates a permanent static route. |
RecurseMaskLen |
Exact mask length for route recursion. If the device uses the longest match principle for route recursion, this field displays N/A. |
BfdStatic |
Name of the static BFD session associated with the route. If no static BFD session is associated with the route, this field is not available. |
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 } | group group-name } interface-type interface-number [ dhcp | next-hop-address ] [ backup-interface interface-type interface-number [ backup-nexthop backup-nexthop-address ] [ permanent ] | permanent | track track-entry-number ] [ preference preference ] [ tag tag-value ] [ description text ]
ip route-static { dest-address { mask-length | mask } | group group-name } next-hop-address [ permanent | track track-entry-number ] [ preference preference ] [ tag tag-value ] [ description text ]
undo ip route-static { dest-address { mask-length | mask } | group group-name } [ interface-type interface-number [ dhcp | next-hop-address ] | next-hop-address ] [ preference preference ]
Configuration profile view:
ip route-static dest-address { mask-length | mask } next-hop-address
undo ip route-static dest-address { mask-length | mask } [ next-hop-address ]
Default
No static route is configured.
Views
System view
Configuration profile view
Predefined user roles
network-admin
Parameters
dest-address: Specifies the destination IP address of the static route, in dotted decimal notation. 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.
mask-length: Specifies the mask length, an integer in the range of 0 to 32.
mask: Specifies the subnet mask in dotted decimal notation.
group group-name: Specifies a static route group by its name, a case-sensitive string of 1 to 31 characters. If you specify a static route group, all prefixes in the static route group will be assigned the next hop and output interface. If the static route group does not exist or does not contain any prefixes, no static routes will be created.
interface-type interface-number: Specifies an output interface by its type and number. For more information, see Layer 3—IP Routing Configuration Guide.
dhcp: Specifies the default router designated by the DHCP server for the output interface as the next hop of the static route.
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.
backup-interface interface-type interface-number: Specifies a backup output interface by its type and number. If the backup output interface is an NBMA interface or broadcast interface and not a P2P interface, you must specify the backup next hop address.
backup-nexthop backup-nexthop-address: Specifies a backup next hop address.
permanent: Specifies the route as a permanent static route. After you specify this keyword, the static route will always be active, even if the output interface is down.
track track-entry-number: Associates the static route with a track entry specified by its number in the range of 1 to 1024. For more information about Track, see High Availability Configuration Guide.
preference preference: Specifies a preference for the static route, in the range of 1 to 255. The default is 60. 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.
tag tag-value: Sets a tag value for marking the static route, in the range of 1 to 4294967295. The default is 0.
description text: Configures a description of 1 to 60 characters for the static route. The description can include special characters, such as the space, except the question mark (?).
Usage guidelines
Application scenarios
Use this command to configure static routes in the public network.
If a network's topology is simple, you only need to configure static routes for the network to work correctly. You can also configure static routes when the device cannot use dynamic routing protocols or cannot establish routes to the destination network.
Restrictions and guidelines
Follow these guidelines when you specify the output interface or the next hop address of the static route:
· If the output interface is a Null 0 interface, no next hop address is required.
· If the output interface is a point-to-point interface, you can specify only the output interface. You do not need to change the configuration of the route even if the peer address is changed.
· Multiple next hops might exist if the output interface is a broadcast interface (for example, a VLAN interface) . You must specify both the output interface and next hop IP address for the static route.
If you specify a static route group, all prefixes in the static route group will be assigned the next hop and output interface specified by using this command.
After an interface obtains an IP address and gateway address through DHCP, the device automatically generates a static route with the interface as the output interface. The destination address of the static route is 0.0.0.0/0 and the next hop of the static route is the default router (the gateway address designated by the DHCP server). This static route cannot form ECMP routes with manually configured static routes. The device uses this static route to guide traffic forwarding only after the manually configured static routes become invalid.
Specify the dhcp keyword to use both the automatically generated static route and the manually configured static routes to guide traffic forwarding. This keyword is applicable when the device has dual egress WAN links.
The dhcp keyword enables the device to automatically generate a static route destined for the specified network with the DHCP-designated default router of the output interface as the next hop. This static route takes effect only after the output interface obtains an IP address and gateway address through DHCP, and becomes invalid upon the DHCP lease expiration. The next hop of this static route changes as the gateway address of the output interface changes. In addition, this static route can form ECMP routes with manually configured static routes.
To specify the dhcp keyword, make sure the output interface of the static route is a broadcast interface.
You can create a configuration profile on the AC, configure the static routes to be deployed to APs in configuration profile view, and then associate APs with this configuration profile. When APs come online through the AC, the AC can deploy the static routes to all APs associated with the configuration profile. For more information about configuration profiles, see configuration file management in Fundamentals Configuration Guide.
Examples
# Configure a static route, whose destination address is 1.1.1.1/24, next hop address is 2.2.2.2, tag value is 45, and description information is for internet.
<Sysname> system-view
[Sysname] ip route-static 1.1.1.1 24 2.2.2.2 tag 45 description for internet
# Create configuration profile ap1, and configure a static route in the configuration profile. In the static route, the destination address is 1.1.1.0/24 and the next hop address is 2.2.2.2.
<Sysname> system-view
[Sysname] configuration profile ap1 model WA6320
[Sysname-config-profile-ap1] ip route-static 1.1.1.0 24 2.2.2.2
Related commands
display ip routing-table protocol (Network Connectivity Command Reference)
ip route-static-group
prefix
ip route-static default-preference
Use ip route-static default-preference to configure a default preference for static routes.
Use undo ip route-static default-preference to restore the default.
Syntax
ip route-static default-preference default-preference
undo ip route-static default-preference
Default
The default preference of static routes is 60.
Views
System view
Predefined user roles
network-admin
Parameters
default-preference: Specifies a default preference for static routes, in the range of 1 to 255.
Usage guidelines
If no preference is specified for a static route, the default preference applies.
When the default preference is reconfigured, it applies only to newly added static routes.
Examples
# Set a default preference of 120 for static routes.
<Sysname> system-view
[Sysname] ip route-static default-preference 120
Related commands
display ip routing-table protocol
ip route-static fast-reroute auto
Use ip route-static fast-reroute auto to configure static route FRR to automatically select a backup next hop.
Use undo ip route-static fast-reroute auto to disable static route FRR from automatically selecting a backup next hop.
Syntax
ip route-static fast-reroute auto
undo ip route-static fast-reroute auto
Default
Static route FRR is disabled from automatically selecting a backup next hop.
Views
System view
Predefined user roles
network-admin
Examples
# Configure static route FRR to automatically select a backup next hop.
<Sysname> system-view
[Sysname] ip route-static fast-reroute auto
ip route-static-group
Use ip route-static-group to create a static route group and enter its view, or enter the view of an existing static route group.
Use undo ip route-static-group to delete a static route group.
Syntax
ip route-static-group group-name
undo ip route-static-group group-name
Default
No static route groups exist.
Views
System view
Predefined user roles
network-admin
Parameters
group-name: Specifies the static route group name, a case-sensitive string of 1 to 31 characters.
Examples
# Create static route group test and enter its view.
<Sysname> system-view
[Sysname] ip route-static-group test
[Sysname-route-static-group-test]
Related commands
ip route-static
prefix
prefix
Use prefix to add a static route prefix to a static route group.
Use undo prefix to delete a static route prefix from a static route group.
Syntax
prefix dest-address { mask-length | mask }
undo prefix dest-address { mask-length | mask }
Default
No static route prefix is added to a static route group.
Views
Static route group 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.
Usage guidelines
Application scenarios
Using a static route group to bulk configure static routes can reduce your configuration workload. You can execute this command multiple times to add multiple prefixes to a static route group. Executing the ip route-static group command can bulk create static routes based on these prefixes.
Restrictions and guidelines
If you have executed the ip route-static group command to bulk create static routes, deleting or adding prefixes in static route group view will delete or add the prefix-associated static routes.
Examples
# Add static route prefix 1.1.1.1/32 to static route group test.
<Sysname> system-view
[Sysname] ip route-static-group test
[Sysname-route-static-group-test] prefix 1.1.1.1 32
Related commands
ip route-static
ip route-static-group