Configure Static Routes
The router uses dynamic routes to learn how to reach network destinations. Dynamic routes are determined from the information exchanged by the routing protocols and, as the name implies, the routes might change as network conditions change and these changes are discovered by the routing protocols. You can configure static (nonchanging) routes to some network destinations. The router uses static routes when it does not have a route to a destination that has a better (lower) preference value, when it cannot determine the route to a destination, or when it is forwarding unroutable packets.
A static route is installed in the routing table only when the route is active; that is, the list of next-hop routers configured for that route contains at least one next hop on an operational interface.
You can add the same routes to more than one routing table.
To configure static routes in the default IPv4 routing table (
inet.0), include thestaticstatement:[edit]routing-options {static {defaults {static-options;}rib-groupgroup-name;routedestination-prefix{lsp-next-hoplsp-name{metricmetric;preferencepreference;}next-hop;qualified-next-hopaddress{metricmetric;preferencepreference;}static-options;}}}For a list of hierarchy levels at which you can configure this statement, see the statement summary section for this statement.
To configure static routes in one of the other routing tables, or to explicitly configure static routes in the default IPv4 route table (
inet.0), include thestaticstatement. To explicitly configure static routes in the primary IPv6 routing table (inet6.0), include thestaticstatement.[edit]routing-options {ribrouting-table-name{static {defaults {static-options;}rib-groupgroup-name;routedestination-prefix{lsp-next-hoplsp-name{metricmetric;preferencepreference;}next-hop;qualified-next-hopaddress{metricmetric;preferencepreference;}static-options;}}}}For a list of hierarchy levels at which you can configure this statement, see the statement summary section for this statement.
The
staticstatement consists of two parts:
defaults—Specify global static route options. These are treated as global defaults and apply to all the static routes you configure in thestaticstatement. This part of thestaticstatement is optional.route—Configure individual static routes. In this part of thestaticstatement, you optionally can configure static route options. These options apply to the individual destination only and override any options you configured in thedefaultspart of thestaticstatement.The following sections explain how to configure static routes:
- Specify the Destination of the Static Route
- Specify the Next Hop of the Static Route
- Specify an Independent Preference for a Static Route
- Specify an LSP as the Next Hop for a Static Route
- Install a Static Route into More than One Routing Table
- Specify Static Route Options
- Configure a Default Route
- Propagate Static Routes into Routing Protocols
- Examples: Configure Static Routes