- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
02-Static routing commands | 59.63 KB |
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
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 in the range of 1 to FFFFFFFF.
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
TopoNthp: 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
TopoNthp: 0
Table 1 Command output
Field |
Description |
NibID |
ID of the NIB. |
NibSeq |
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 |
VPN instance to which the next hop belongs. The device does not support this field in the current software version. |
Nexthop |
Next hop address. |
IFIndex |
Interface index |
LocalAddr |
Local interface address. |
TopoNthp |
Topology to which the next hop belongs. 0 indicates the base topology. The device does not support this field in the current software version. |
# 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
TopoNthp: 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: 100000
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
TopoNthp: 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: Dia0 LocalAddr: 12.12.12.12
TunnelCnt: 0 Vrf: default-vrf
TunnelID: N/A Topology: base
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: 100000
...
Table 2 Command output
Field |
Description |
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 |
VPN instance name. The device does not support this field in the current software version. |
TunnelID |
ID of the tunnel after route recursion. |
Topology |
Name of the topology. base indicates the base topology. The device does not support this field in the current software version. |
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. |
Weight |
Weight of the ECMP route. A route is not an ECMP route if its weight is 0. |
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.
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: N/A
TableID: 0x2 BkInterface: N/A
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 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: N/A
TableID: 0x2 BkInterface: N/A
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 Tag: 0
...
# Display information about the static route with destination address 1.2.3.4/32.
<Sysname> display route-static routing-table 1.2.3.4 32
*Destination: 1.2.3.4/32
NibID: 0x11000017 NextHop: 4.4.4.4
MainNibID: 0x11000015 BkNextHop: 5.5.5.5
BkNibID: 0x11000016 Interface: GigabitEthernet1/0/1
TableID: 0x2 BkInterface: GigabitEthernet1/0/2
Flag: 0xa8d0b BfdSrcIp: N/A
DbIndex: 0x17 BfdIfIndex: 0x0
Type: Normal BfdVrfIndex: 0
TrackIndex: 0xffffffff Label: NULL
Preference: 60 vrfIndexDst: 0
BfdMode: N/A vrfIndexNH: 0
Permanent: 0 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. |
BfdSrcIp |
Source IP address of the indirect BFD session. The device does not support this field in the current software version. |
BfdIfIndex |
Index of the interface where BFD is enabled. The device does not support this field in the current software version. |
BfdVrfIndex |
Index of the VPN instance where BFD is enabled. The device does not support this field in the current software version. |
BfdMode |
BFD session mode: · N/A—No BFD session is configured. · Ctrl—Control packet mode · Echo—Echo packet mode. The device does not support this field in the current software version. |
TrackIndex |
NQA Track index. |
vrfIndexDst |
Index of the destination VPN. The device does not support this field in the current software version. |
vrfIndexNH |
Index of the VPN to which the next hop belongs. The device does not support this field in the current software version. |
Permanent |
Permanent static route flag. 1 indicates a permanent static route. |
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 [ next-hop-address ] | next-hop-address [ permanent | track track-entry-number ] } [ preference preference-value ] [ tag tag-value ] [ description description-text ]
undo ip route-static { dest-address { mask-length | mask } | group group-name } [ interface-type interface-number [ next-hop-address ] | next-hop-address ] [ preference preference-value ]
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.
group group-name: Specifies a static route group by its name, a case-sensitive string of 1 to 31 characters. If the static route group does not exist or the static route group does not contain a prefix, no static route is configured.
interface-type interface-number: Specifies an output interface by its type and number. For more information, see Layer 3—IP Routing Configuration Guide.
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.
permanent: Specifies the route as a permanent static route. If the output interface is down, the permanent static route is still active.
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-value: Specifies a preference for the static route, in the range of 1 to 255. The default is 60.
tag tag-value: Sets a tag value for marking the static route, in the range of 1 to 4294967295. The default is 0. Tags of routes are used for route control.
description 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
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. Only the WX2540E and WX2540H access controllers support load sharing and route backup.
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.
· If the output interface is a broadcast interface that might have multiple next hops, you must specify the next hop address at the same time. Broadcast interfaces include Ethernet interfaces and VLAN interfaces.
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.
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
Related commands
· display ip routing-table protocol
· 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-value
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-value: 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-group
Use ip route-static-group to create a static route group and enter static route group view.
Use undo ip route-static-group to delete the static route group.
Syntax
ip route-static-group group-name
undo ip route-static-group group-name
Default
No static route group is created.
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.
Parameters
Execute the ip route-static command to configure static routes in batches after you create a static route group with static route prefixes.
Examples
# Create the static route group test.
<Sysname> system-view
[Sysname] ip route-static-group test
[Sysname-route-static-group-test]
Related commands
· ip route-static
· prefix
prefix
Use prefix to configure a static route prefix.
Use undo prefix to delete the static route prefix.
Syntax
prefix dest-address { mask-length | mask }
undo prefix dest-address { mask-length | mask }
Default
No static route prefix is configured.
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
Execute the prefix command repeatedly to add multiple static route prefixes to a static route group.
After you create a static route group with static route prefixes, execute the ip route-static command to configure static routes with the prefixes. To configure more static routes, you only need to add new static route prefixes to the group.
Examples
# Configure the static route prefix 1.1.1.1/32 for the 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