- Table of Contents
-
- H3C S9500 Command Manual-Release2132[V2.03]-03 IP Routing Volume
- 00-1Cover
- 01-IP Routing Table Display Commands
- 02-BGP Commands
- 03-IS-IS Commands
- 04-OSPF Commands
- 05-RIP Commands
- 06-Routing Policy Commands
- 07-Static Routing Commands
- 08-IPv6 BGP Commands
- 09-IPv6 IS-IS Commands
- 10-IPv6 OSPFv3 commands
- 11-IPv6 RIPng Commands
- 12-IPv6 Static Routing Commands
- Related Documents
-
Title | Size | Download |
---|---|---|
07-Static Routing Commands | 32.63 KB |
Table of Contents
Chapter 1 Static Routing Configuration Commands
1.1 Static Routing Configuration Commands
1.1.1 delete static-routes all
1.1.3 ip route-static default-preference
Chapter 1 Static Routing Configuration Commands
1.1 Static Routing Configuration Commands
1.1.1 delete static-routes all
Syntax
delete [ vpn-instance vpn-instance-name ] static-routes all
View
System view
Default Level
2: System level
Parameters
vpn-instance-name: Name of a VPN instance.
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 and 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 reconfigure all static routes
Are you sure?[Y/N]:Y
1.1.2 ip route-static
Syntax
ip route-static dest-address { mask | mask-length } { gateway-address | interface-type interface-number [ gateway-address ] | vpn-instance d-vpn-instance-name gateway-address } [ preference preference-value ] [ tag tag-value ] [ description description-text ]
undo ip route-static dest-address { mask | mask-length } [ gateway-address | interface-type interface-number [ gateway-address ] | vpn-instance d-vpn-instance-name gateway-address ] [ preference preference-value ]
ip route-static vpn-instance s-vpn-instance-name&<1-6> dest-address { mask | mask-length } { gateway-address [ public ] | interface-type interface-number [ gateway-address ] | vpn-instance d-vpn-instance-name gateway-address } [ preference preference-value ] [ tag tag-value ] [ description description-text ]
undo ip route-static vpn-instance s-vpn-instance-name&<1-6> dest-address { mask | mask-length } [ gateway-address [ public ] | interface-type interface-number [ gateway-address ] | vpn-instance d-vpn-instance-name gateway-address ] [ preference preference-value ]
View
System view
Default Level
2: System level
Parameters
vpn-instance s-vpn-instance-name&<1-6>: Specifies the VPN instance name. &<1-6> indicates the argument before it can be entered up to 6 times. Each VPN instance has its own routing table, and the configured static route is installed in the routing tables of the specified VPN instances.
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.
gateway-address: IP address of the next hop, in dotted decimal notation.
vpn-instance d-vpn-instance-name: Name of the destination VPN instance. If a destination VPN instance name is specified, the router will search the output interface in the destination VPN instance based on the configured gateway-address.
gateway-address public: Indicates that the specified gateway-address is a public network address, rather than a VPN instance address.
preference preference-value : Specifies the preference of the static route. The default is 60.
tag tag-value: Sets a tag value for the static route from 1 to 4294967295. The default is 0. Tags of routes are used in routing policies to control routing.
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 NULL0 interface, if the output interface has already been configured, there is no need to configure the next hop address.
l For point-to-point interfaces, you can specify the output interface if you do not know the peer address. Thus, there is no need to change the router’s configuration even if the peer address is changed. A PPP interface obtains the peer’s IP address through PPP negotiation. In this case, you need only specify the output interface.
l For NBMA and P2MP interfaces, which support point-to-multipoint networks, the IP address to link layer address mapping must be established in addition to IP route configuration. In general, it is recommended to configure the next hop IP address when you configure the output interface.
l It is not recommended to specify a broadcast interface as the output interface for a static route, because a broadcast interface may have multiple next hops. If you have to do so, you must specify the corresponding next hop at the same time.
Related commands: display ip routing-table, ip route-static default-preference.
& Note:
If you specify the next hop of a static route and then configure the next hop as the IP address of a local interface such as a VLAN interface, the static route cannot take effect.
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 & intranet.
<Sysname> system-view
[Sysname] ip route-static 1.1.1.1 24 2.2.2.2 tag 45 description for internet & intranet
# Configure a static route for a VPN instance named vpn1: the destination address is 1.1.1.1/16 and the next hop address is 1.1.1.2, which is the address of this VPN instance.
<Sysname> system-view
[Sysname] ip route-static vpn-instance vpn1 1.1.1.1 16 vpn-instance vpn1 1.1.1.2
1.1.3 ip route-static default-preference
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.
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 if no preference is specified when configuring a static route, the default preference is used.
Related commands: display ip routing-table, ip route-static.
Examples
# Set the default preference of static routes to 120.
<Sysname> system-view