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 the static statement:
-
static {
-
- defaults {
-
static-options;
- }
-
rib-group group-name;
-
- route destination-prefix {
-
-
bfd-liveness-detection {
-
- detection-time {
- threshold milliseconds;
- }
- <local-address ip-address>;
- minimum-interval milliseconds;
- minimum-receive-interval milliseconds;
- multiplier number;
- neighbor address;
- minimum-receive-ttl number;
- no-adaptation;
-
- transmit-interval {
- threshold milliseconds;
- minimum-interval milliseconds;
- }
- version (1 | automatic);
- }
-
-
lsp-next-hop lsp-name {
-
metric metric;
-
preference preference;
- }
- next-hop address;
-
next-hop options;
-
-
p2mp-lsp-next-hop {
-
metric metric;
-
preference preference;
- }
-
-
qualified-next-hop address {
-
metric metric;
-
preference preference;
- }
-
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 the static statement:
-
rib routing-table-name {
-
-
static {
-
- defaults {
-
static-options;
- }
-
rib-group group-name;
-
- route destination-prefix {
-
-
bfd-liveness-detection {
-
- detection-time {
- threshold milliseconds;
- }
- <local-address ip-address>;
- minimum-interval milliseconds;
- minimum-receive-interval milliseconds;
- minimum-receive-ttl number;
- multiplier number;
- neighbor address;
- no-adaptation;
-
- transmit-interval {
- threshold milliseconds;
- minimum-interval milliseconds;
- }
- version (1 | automatic);
- }
-
-
lsp-next-hop lsp-name {
-
metric metric;
-
preference preference;
- }
- next-hop address;
-
next-hop options;
-
-
p2mp-lsp-next-hop {
-
metric metric;
-
preference preference;
- }
-
-
qualified-next-hop address {
-
metric metric;
-
preference preference;
- }
-
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 static statement consists of two parts:
![]() |
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. |
The following sections explain how to configure static routes: