Configuring 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;p2mp-lsp-next-hop {metricmetric;preferencepreference;}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, to explicitly configure static routes in the default IPv4 route table (
inet.0), or 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;p2mp-lsp-next-hop {metricmetric;preferencepreference;}qualified-next-hopaddress{metricmetric;preferencepreference;}static-options;}}}}
NOTE: You cannot configure static routes for the IPv4 multicast routing table (
inet.1) or the IPv6 multicast routing table (inet6.1).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 options only set default attributes inherited by all newly created static routes. These are treated as global defaults and apply to all the static routes you configure in thestaticstatement. This part of thestaticstatement is optional.
NOTE: Specifying the global static route options does not create default routes. These options only set default attributes inherited by all newly created static routes.
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:
- Specifying the Destination of the Static Route
- Specifying the Next Hop of the Static Route
- Specifying an Independent Preference for a Static Route
- Specifying an LSP as the Next Hop for a Static Route
- Installing a Static Route into More than One Routing Table
- Specifying Static Route Options
- Configuring a Default Route
- Propagating Static Routes into Routing Protocols
- Examples: Configuring Static Routes