- Table of Contents
-
- 07-Layer 3 - IP Routing Command Reference
- 00-Preface
- 01-Basic IP Routing Commands
- 02-Static Routing Commands
- 03-RIP Commands
- 04-OSPF Commands
- 05-IS-IS Commands
- 06-BGP Commands
- 07-Policy-Based Routing Commands
- 08-Guard Route Commands
- 09-IPv6 Static Routing Commands
- 10-RIPng Commands
- 11-OSPFv3 Commands
- 12-IPv6 IS-IS Commands
- 13-IPv6 BGP Commands
- 14-IPv6 Policy-Based Routing Commands
- 15-Routing Policy Commands
- Related Documents
-
Title | Size | Download |
---|---|---|
02-Static Routing Commands | 94.44 KB |
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 vpn-instance-name: Specifies an MPLS L3VPN. vpn-instance-name is a case-sensitive string of 1 to 31 characters. If no VPN is specified, all static routes on the public network are deleted.
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.
Use the undo ip route-static command to remove one static route; use the delete static-routes all command to remove all static routes, including the default route.
If no topology is specified, all static routes of the base topology are deleted.
If no VPN is specified, all static routes on the public network are deleted.
If neither topology nor VPN is specified, all static routes of the base topology on the public network are deleted.
Related commands: ip route-static and display ip routing-table.
Examples
# Delete all static routes from the switch.
<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
ip route-static
Syntax
ip route-static dest-address { mask | mask-length } { next-hop-address [ bfd control-packet [ bfd-source ip-address ] | track track-entry-number ] | interface-type interface-number [ next-hop-address ] [ bfd { control-packet [ bfd-source ip-address ] | echo-packet } ] | vpn-instance d-vpn-instance-name next-hop-address [ track track-entry-number ] } [ preference preference-value ] [ tag tag-value ] [ permanent ] [ description description-text ]
undo ip route-static dest-address { mask | mask-length } [ next-hop-address | interface-type interface-number [ next-hop-address ] | vpn-instance d-vpn-instance-name next-hop-address ] [ preference preference-value ]
ip route-static vpn-instance s-vpn-instance-name&<1-6> dest-address { mask | mask-length } { next-hop-address [ public ] [ bfd control-packet [ bfd-source ip-address ] | track track-entry-number ] | interface-type interface-number [ next-hop-address ] [ bfd { control-packet [ bfd-source ip-address ] | echo-packet } ] | vpn-instance d-vpn-instance-name next-hop-address [ track track-entry-number ] } [ preference preference-value ] [ tag tag-value ] [ permanent ] [ description description-text ]
undo ip route-static vpn-instance s-vpn-instance-name&<1-6> dest-address { mask | mask-length } [ next-hop-address [ public ] | interface-type interface-number [ next-hop-address ] | vpn-instance d-vpn-instance-name next-hop-address ] [ preference preference-value ]
View
System view
Default level
2: System level
Parameters
vpn-instance s-vpn-instance-name&<1-6>: Specifies a source MPLS L3VPN. s-vpn-instance-name is a case-sensitive string of 1 to 31 characters. &<1-6> indicates the argument before it can be entered up to 6 times. Each VPN has its own routing table, and the configured static route is installed in the routing tables of the specified VPNs.
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, in the range of 0 to 32.
next-hop-address: IP address of the next hop, in dotted decimal notation.
interface-type interface-number: Specifies the output interface by its type and number. If the output interface is a non-P2P interface (including NBMA interface or broadcast interface, such as an Ethernet interface, a virtual template or a VLAN interface), the next hop address must be specified.
vpn-instance d-vpn-instance-name: Specifies a destination MPLS L3VPN. d-vpn-instance-name is a case-sensitive string of 1 to 31 characters. If a destination VPN is specified, the router will search the outgoing interface in the destination VPN based on the configured next-hop-address.
next-hop-address public: Indicates that the specified next-hop-address is a public network address, rather than a VPN instance address.
preference preference-value: Specifies the preference of the static route, which is in the range of 1 to 255 and defaults to 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. For more information about routing policies, see Layer 3—IP Routing Configuration Guide.
permanent: Specifies the route as a permanent static route. If the outgoing interface is down, the permanent static route is still active.
description description-text: Configures a description for the static route, which consists of 1 to 60 characters, including special characters like space, but excluding ?.
bfd: Enable the bidirectional forwarding detection (BFD) function to detect reachability of the static route’s next hop. Once the next hop is unreachable, the system will switch to a backup route.
bfd-source ip-address: Specifies the source address of BFD packets. H3C recommends you to configure loopback interface address.
control-packet: Implements BFD in the control packet mode.
echo-packet: Implements BFD in the echo packet mode.
track track-entry-number: Associates the static route with a track entry. Use the track-entry-number argument to specify a track entry number, in the range of 1 to 1024. For more information about track, see High Availability Configuration Guide.
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.
By default, no unicast static route is configured.
When you configure a unicast static route, note that:
· 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 by tuning route preference. For example, to enable multiple routes to the same destination address to share load, assign the same preference for the routes; to enable them to back up one another, assign different preferences for them.
· Specify the outgoing interface or the next hop address of the static route as needed. The next hop address cannot be the IP address of a local interface.
¡ If the outgoing interface is a Null 0 interface, no next hop address is required.
¡ If the outgoing interface is a point-to-point interface, a PPP serial interface for example, you can specify only the outgoing interface. You do not need to change the configuration of the route even if the peer address is changed.
¡ If the outgoing interface is an NBMA interface or point-to-multipoint (P2MP) interface, an X.25 or Frame Relay interface for example, H3C recommends specifying both the outgoing interface and the next hop address for the route. This is because such interfaces need IP address-to-link layer address mappings for successful packet delivery.
¡ If the outgoing interface is a broadcast interface, an Ethernet interface or a VLAN interface for example, you must specify the corresponding next hop of the interface at the same time. This is because such interfaces can have multiple next hops.
Related commands: display ip routing-table and ip route-static default-preference.
|
NOTE: · If you specify the next hop address of a static route and configure it as the IP address of a local interface, the static route does not take effect. · If route oscillation occurs, enabling BFD may worsen it. Be cautious when using BFD. For more information about BFD, see High Availability Configuration Guide. · 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 that 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 that of the static route. Otherwise, a valid route may be mistakenly considered invalid. · Do not specify the permanent keyword together with the bfd or track keyword. |
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
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, which is in the range of 1 to 255.
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.
If no preference is specified when configuring a static route, the default preference is used.
When the default preference is re-configured, it applies to newly added static routes only.
Related commands: display ip routing-table and ip route-static.
Examples
# Set the default preference of static routes to 120.
<Sysname> system-view
[Sysname] ip route-static default-preference 120
ip route-static fast-reroute
Syntax
ip route-static [ vpn-instance vpn-instance-name ] fast-reroute route-policy route-policy-name
undo ip route-static [ vpn-instance vpn-instance-name ] fast-reroute
View
System view
Default level
2: System level
Parameters
vpn-instance vpn-instance-name: Specifies an MPLS L3VPN to configure FRR for all matching static routes in it. vpn-instance-name is a case-sensitive string of 1 to 31 characters.
route-policy route-policy-name: References a routing policy. The route-policy-name argument is a case-sensitive string of 1 to 63 characters.
Description
Use the ip route-static fast-reroute command to configure static route fast reroute (FRR).
Use the undo ip route-static fast-reroute command to restore the default.
By default, static route FRR is not configured.
|
NOTE: · Configuring static route FRR needs to reference a routing policy, which specifies a backup next hop with the apply fast-reroute backup-interface command. For more information about the command and routing policy configurations, see Layer 3—IP Routing Configuration Guide. · Static route FRR takes effect only for static routes that have both the outgoing interface and next hop specified. · Do not use static route FRR and BFD (for static route) at the same time. |
Example
# Enable static route FRR to designate a backup next hop using routing policy frr.
<Sysname> system-view
[Sysname] bfd echo-source-ip 1.1.1.1
[Sysname] ip ip-prefix abc index 10 permit 100.1.1.0 24
[Sysname] route-policy frr permit node 10
[Sysname-route-policy] if-match ip-prefix abc
[Sysname-route-policy] apply fast-reroute backup-interface vlan-interface 1 backup-nexthop 193.1.1.8
[Sysname-route-policy] quit
[Sysname] ip route-static fast-reroute route-policy frr