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 ] [ backup-interface interface-type interface-number [ backup-nexthop backup-nexthop-address ] [ permanent ] | bfd { control-packet | echo-packet } | permanent | track track-entry-number ] | next-hop-address [ recursive-lookup host-route ] [ bfd control-packet bfd-source ip-address | permanent | track track-entry-number ] | vpn-instance d-vpn-instance-name next-hop-address [ recursive-lookup host-route ] [ bfd control-packet bfd-source ip-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 [ next-hop-address ] | next-hop-address | vpn-instance d-vpn-instance-name next-hop-address ] [ preference preference ]
ip route-static vpn-instance s-vpn-instance-name { dest-address { mask-length | mask } | group group-name } { interface-type interface-number [ next-hop-address ] [ backup-interface interface-type interface-number [ backup-nexthop backup-nexthop-address ] [ permanent ] | bfd { control-packet | echo-packet } | permanent | track track-entry-number ] | next-hop-address [ recursive-lookup host-route ] [ public ] [ bfd control-packet bfd-source ip-address | permanent | track track-entry-number ] | vpn-instance d-vpn-instance-name next-hop-address [ recursive-lookup host-route ] [ bfd control-packet bfd-source ip-address | permanent | track track-entry-number ] } [ preference preference ] [ tag tag-value ] [ description text ]
undo ip route-static vpn-instance s-vpn-instance-name { dest-address { mask-length | mask } | group group-name } [ interface-type interface-number [ next-hop-address ] | next-hop-address [ public ] | vpn-instance d-vpn-instance-name next-hop-address ] [ preference preference ]
Default
No static route is configured.
Views
System view
Predefined user roles
network-admin
Parameters
vpn-instance s-vpn-instance-name: Specifies a source MPLS L3VPN instance by its name, a case-sensitive string of 1 to 31 characters. 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: 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.
vpn-instance d-vpn-instance-name: Specifies a destination MPLS L3VPN instance by its name, a case-sensitive string of 1 to 31 characters. If a destination VPN instance is specified, packets will search for the output interface in the destination VPN instance based on the configured next hop address.
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.
recursive-lookup host-route: Specifies only host routes for static route recursion.
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.
bfd: Enables BFD to detect reachability of the static route's next hop. When the next hop is unreachable, the system immediately switches to the backup route.
control-packet: Specifies the BFD control mode.
bfd-source ip-address: Specifies the source IP address of BFD packets. As a best practice, specify the loopback interface address.
echo-packet: Specifies the BFD echo mode.
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.
public: Indicates that the specified next hop address is on the public network.
preference preference: 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 in routing policies. For more information about routing policies, see Layer 3—IP Routing Configuration Guide.
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.
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.
NBMA or P2MP interfaces need IP address-to-link layer address mappings for successful packet delivery. As a best practice, specify the next hop address for the route at the same time if the output interface is an NBMA or P2MP interface.
If the output interface is a broadcast interface, the device uses the next hop IP address to obtain the MAC address of the next hop. Therefore, you must specify both the output interface and next hop IP address.
Follow these guidelines when you configure a static route:
Enabling BFD for a flapping route could worsen the route flapping situation. Therefore, use it with caution. For more information about BFD, see High Availability Configuration Guide.
For static routing-Track-NQA collaboration, you must configure the same VPN instance ID for the next hop to be detected and the NQA operation.
If a static route needs route recursion, the associated track entry must monitor the next hop of the related route instead of that of the recursive static route. Otherwise, a valid route might be mistakenly considered invalid.
Do not specify the permanent keyword together with the bfd or track keyword.
To specify the recursive-lookup host-route keyword, you must configure the arp route-direct advertise command on the output interface corresponding to the next hop. Use the arp route-direct advertise command to advertise 32-bit host routes. For more information about the arp route-direct advertise command, see ARP configuration in Layer 3—IP Services Configuration Guide.
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, and description information is for internet.
<Sysname> system-view [Sysname] ip route-static 1.1.1.1 24 2.2.2.2 description for internet
Related commands
arp route-direct advertise (Layer 3—IP Services Command Reference)
display ip routing-table protocol
ip route-static-group
prefix