- Table of Contents
-
- 04-Layer 3 Command Reference
- 00-Preface
- 01-ARP Commands
- 02-IP Addressing Commands
- 03-DHCP Commands
- 04-DHCPv6 Commands
- 05-DNS Commands
- 06-IPv6 DNS Commands
- 07-NAT Commands
- 08-Adjacency Table Commands
- 09-Flow Classification Commands
- 10-IPv6 Basics Commands
- 11-IP Performance Optimization Commands
- 12-Basic IP Routing Commands
- 13-Static Routing Commands
- 14-IPv6 Static Routing Commands
- 15-GRE Commands
- 16-RIP Commands
- 17-RIPng Commands
- 18-Policy-Based Routing Commands
- Related Documents
-
Title | Size | Download |
---|---|---|
13-Static Routing Commands | 45.47 KB |
Static routing configuration commands
delete static-routes all
Use delete static-routes all to delete all static routes.
Syntax
delete static-routes all
Views
System view
Default command level
2: System level
Usage guidelines
When you use this command, the system prompts 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
· display ip routing-table
· ip route-static
ip route-static
Use ip route-static to configure a unicast static route.
Use undo ip route-static to delete a unicast static route.
Syntax
ip route-static dest-address { mask | mask-length } { next-hop-address [ track track-entry-number ] | interface-type interface-number [ next-hop-address ] } [ preference preference-value ] [ permanent ] [ 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 ]
Default
No unicast static route is configured.
Views
System view
Default command level
2: System level
Parameters
dest-address: Specifies a destination IP address of the static route, in dotted decimal notation.
mask: Specifies mask of the IP address, in dotted decimal notation.
mask-length: Specifies mask length in the range of 0 to 32.
next-hop-address: Specifies IP address of the next hop, in dotted decimal notation.
preference preference-value : Specifies a preference for the static route, in the range of 1 to 255. The default is 60. If no preference is specified, the default preference is used. When the default preference is reconfigured, it applies only to newly added static routes.
permanent: Specifies the route as a permanent static route. If the output interface is down, the permanent static route is still active.
description description-text: Configures a description for the static route, which can have 1 to 60 characters, including special characters like space, but excluding question marks (?).
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.
Usage guidelines
When you configure a unicast static route, follow these 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 packets that do not match a specific 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 route backup for these routes, assign different preferences to them.
· Follow these guidelines to 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 (such as a PPP serial 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 an NBMA interface or point-to-multipoint (P2MP) interface (such as an X.25 or Frame Relay interface) that needs IP address-to-link layer address mappings for successful packet delivery, H3C recommends that you specify both the output interface and the next hop address for the route.
¡ If the output interface is a broadcast interface (such as an Ethernet interface or a VLAN interface) that might have multiple next hops, you must specify both the output interface and the next hop address at the same time.
· The next hop address of a static route cannot be the IP address of a local interface. Otherwise, the static route does not take effect.
· If the track module uses NQA to detect the reachability of the private network static route's next hop, the VPN instance number of the static route's next hop must be identical to the VPN instance number configured in the NQA test group.
· If a static route needs route recursion, the associated track entry must monitor the next hop of the recursive route instead of the next hop of the static route. Otherwise, a valid route might be mistakenly considered invalid.
· Do not specify the permanent keyword together with the track keyword.
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
Related commands
· display ip routing-table
· ip route-static default-preference
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
Default command level
2: System level
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 to only 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
· ip route-static