Configuring Static Route Options
In the defaults and route parts of the static statement, you can specify static-options, which define additional information about static routes that is included with the route when it is installed in the routing table. All static options are optional. Static options that you specify in the defaults part of the static statement are treated as global defaults and apply to all the static routes you configure in the static statement. Static options that you specify in the route part of the static statement override any global static options and apply to that destination only.
To configure static route options for IPv4 static routes, include one or more options in the defaults or route part of the static statement.
For a list of hierarchy levels at which you can include this statement, see the statement summary section for this statement.
To configure static route options for IPv6 static routes, include one or more options in the defaults or route part of the static statement. Each of these options is explained in the sections that follow.
For a list of hierarchy levels at which you can include this statement, see the statement summary section for this statement.
The following sections explain how to configure static route options:
- Configuring a Metric Value for Static Routes
- Configuring a Preference Value for Static Routes
- Associating BGP Communities with Static Routes
- Associating AS Paths with Static Routes
- Configuring an OSPF Tag String for Static Routes
- Controlling Temporary Installation of Static Routes in the Forwarding Table
- Controlling Retention of Static Routes in the Forwarding Table
- Controlling Retention of Inactive Static Routes in the Routing and Forwarding Tables
- Controlling Readvertisement of Static Routes
- Controlling Resolution of Static Routes to Prefixes That Are Not Directly Connected
Configuring a Metric Value for Static Routes
To associate a metric value with an IPv4 route, include the metric statement:
To associate a metric value with an IPv6 route, include the metric statement:
For a list of hierarchy levels at which you can include these statements, see the statement summary sections for these statements.
In the type option, you can specify the type of route. For OSPF, when routes are exported to OSPF, type 1 routes are advertised in type 1 externals, and routes of any other type are advertised in type 2 externals. Note that if a qualified-next-hop metric value is configured, this value overrides the route metric.
Configuring a Preference Value for Static Routes
By default, static routes have a preference value of 5. To modify the default preference value, specify a primary preference value (preference). You also can specify a secondary preference value (preference2) and colors, which are even finer-grained preference values (color and color2). To do this for IPv4 static routes, include one or more of the following statements:
To do this for IPv6 static routes, include one or more of the following statements:
For a list of hierarchy levels at which you can include these statements, see the statement summary sections for these statements.
The preference value can be a number in the range from 0 through 4,294,967,295 (232 – 1) with a lower number indicating a more preferred route. For more information about preference values, see Route Preferences Overview. Note that if a qualified-next-hop preference value is configured, this value overrides the route preference.
In the type option, you can specify the type of route.
Associating BGP Communities with Static Routes
By default, no BGP community information is associated with static routes. To associate community information with IPv4 routes, include the community statement:
To associate community information with IPv6 routes, include the community statement:
For a list of hierarchy levels at which you can include these statements, see the statement summary sections for these statements.
community-ids is one or more community identifiers for either communities or extended communities.
The format for community identifiers is:
as-number is the autonomous system (AS) number and can be a value in the range from 1 through 65,534. community-value is the community identifier and can be a number in the range from 0 through 65,535.
You also can specify community-ids as one of the following well-known community names, which are defined in RFC 1997:
- no-export—Routes containing this community name are not advertised outside a BGP confederation boundary.
- no-advertise—Routes containing this community name are not advertised to other BGP peers.
- no-export-subconfed—Routes containing this community name are not advertised to external BGP peers, including peers in other members’ ASs inside a BGP confederation.
You can also explicitly exclude BGP community information with a static route using the none option. Include none when configuring an individual route in the route portion of the static statement to override a community option specified in the defaults portion of the statement.
![]() | Note: Extended community attributes are not supported at the [edit routing-options] hierarchy level. You must configure extended communities at the [edit policy-options] hierarchy level. For information about configuring extended communities information, see the “Defining BGP Communities and Extended Communities for Use in Routing Policy Match Conditions” section in the Junos Policy Framework Configuration Guide. For information about configuring 4-byte AS numbers and extended communities, see Configuring 4-Byte AS Numbers and BGP Extended Community Attributes in the Using 4-Byte Autonomous System Numbers in BGP Networks Technology Overview . |
Associating AS Paths with Static Routes
By default, no AS path information is associated with static routes. To associate AS path information with IPv4 routes, include the as-path statement:
To associate AS path information with IPv6 routes, include the as-path statement:
For a list of hierarchy levels at which you can include these statements, see the statement summary sections for these statements.
as-path is the AS path to include with the route. It can include a combination of individual AS path numbers and AS sets. Enclose sets in brackets ( [ ] ). The first AS number in the path represents the AS immediately adjacent to the local AS. Each subsequent number represents an AS that is progressively farther from the local AS, heading toward the origin of the path.
![]() | Note: In Junos OS Release 9.1 and later, the range that you can configure for the AS number has been extended to provide BGP support for 4-byte AS numbers as defined in RFC 4893, BGP Support for Four-octet AS Number Space. You can now configure a number from 1 through 4,294,967,295. All releases of the Junos OS support 2-byte AS numbers. The 2-byte AS number range is 1 through 65,535 (this is a subset of the 4-byte range). In Junos OS Release 9.2 and later, you can also configure a 4-byte AS number using the AS-dot notation format of two integer values joined by a period: <16-bit high-order value in decimal>.<16-bit low-order value in decimal>. For example, the 4-byte AS number of 65,546 in plain-number format is represented as 1.10 in the AS-dot notation format. You can specify a value in the range from 0.0 through 65535.65535 in AS-dot notation format. |
You also can specify the AS path using the BGP origin attribute, which indicates the origin of the AS path information:
- igp—Path information originated within the local AS.
- egp—Path information originated in another AS.
- incomplete—Path information learned by some other means.
To attach the BGP ATOMIC_AGGREGATE path attribute to the static route, specify the atomic-aggregate statement. This path attribute indicates that the local system selected a less specific route rather than a more specific route.
To attach the BGP AGGREGATOR path attribute to the static route, specify the aggregator statement. When using this statement, you must specify the last AS number that formed the static route (encoded as two octets), followed by the IP address of the BGP system that formed the static route.
Configuring an OSPF Tag String for Static Routes
By default, no OSPF tag strings are associated with static routes. You can specify an OSPF tag string by including the tag statement:
For a list of hierarchy levels at which you can include this statement, see the statement summary section for this statement.
Controlling Temporary Installation of Static Routes in the Forwarding Table
By default, the Junos OS installs all active static routes into the forwarding table. To configure the software not to install active IPv4 static routes into the forwarding table, include the no-install statement:
To configure the software not to install active IPv6 static routes into the forwarding table, include the no-install statement:
Even if you configure a route so it is not installed in the forwarding table, the route is still eligible to be exported from the routing table to other protocols. To explicitly install IPv4 routes into the forwarding table, include the install statement. Include this statement when configuring an individual route in the route portion of the static statement to override a no-install option specified in the defaults portion of the statement.
To explicitly install IPv6 routes into the forwarding table, include the install statement. Include this statement when configuring an individual route in the route portion of the static statement to override a no-install statement specified in the defaults portion of the statement.
For a list of hierarchy levels at which you can include these statements, see the statement summary sections for these statements.
Controlling Retention of Static Routes in the Forwarding Table
By default, statically configured routes are deleted from the forwarding table when the routing protocol process shuts down normally. To have an IPv4 static route remain in the forwarding table, include the retain statement. Doing this greatly reduces the time required to restart a system that has a large number of routes in its routing table.
To have an IPv6 static route remain in the forwarding table, include the retain statement. Doing this greatly reduces the time required to restart a system that has a large number of routes in its routing table.
To explicitly specify that IPv4 routes be deleted from the forwarding table, include the no-retain statement. Include this statement when configuring an individual route in the route portion of the static statement to override a retain option specified in the defaults portion of the statement.
To explicitly specify that IPv6 routes be deleted from the forwarding table, include the no-retain statement. Include this statement when configuring an individual route in the route portion of the static statement to override a retain statement specified in the defaults portion of the statement.
For a list of hierarchy levels at which you can include these statements, see the statement summary sections for these statements.
Controlling Retention of Inactive Static Routes in the Routing and Forwarding Tables
Static routes are only removed from the routing table if the next hop becomes unreachable. This can occur if the local or neighbor interface goes down. To have an IPv4 static route remain installed in the routing and forwarding tables, include the passive statement:
To have an IPv6 static route remain installed in the routing and forwarding tables, include the passive statement:
For a list of hierarchy levels at which you can include these statements, see the statement summary sections for these statements.
Routes that have been configured to remain continually installed in the routing and forwarding tables are marked with reject next hops when they are inactive.
To explicitly remove IPv4 static routes when they become inactive, include the active statement. Include this statement when configuring an individual route in the route portion of the static statement to override a passive option specified in the defaults portion of the statement.
To explicitly remove IPv6 static routes when they become inactive, include the active statement. Include this statement when configuring an individual route in the route portion of the static statement to override a passive statement specified in the defaults portion of the statement.
For a list of hierarchy levels at which you can include these statements, see the statement summary sections for these statements.
Controlling Readvertisement of Static Routes
By default, static routes are eligible to be readvertised (that is, exported) by dynamic routing protocols. To mark an IPv4 static route as being ineligible for readvertisement, include the no-readvertise statement:
To mark an IPv6 static route as being ineligible for readvertisement, include the no-readvertise statement:
To explicitly readvertise IPv4 static routes, include the readvertise statement. Include the readvertise statement when configuring an individual route in the route portion of the static statement to override a no-readvertise statement specified in the defaults portion of the statement.
To explicitly readvertise IPv6 static routes, include the readvertise statement. Include the readvertise statement when configuring an individual route in the route portion of the static statement to override a no-readvertise option specified in the defaults portion of the statement.
For a list of hierarchy levels at which you can include these statements, see the statement summary sections for these statements.
Controlling Resolution of Static Routes to Prefixes That Are Not Directly Connected
By default, static routes can point only to a directly connected next hop. You can configure an IPv4 route to a prefix that is not directly connected by resolving the route through the inet.0 and inet.3 routing tables. To configure an IPv4 static route to a prefix that is not a directly connected next hop, include the resolve statement:
You can configure an IPv6 route to a prefix that is not directly connected by resolving the route through the inet6.0 routing table. To configure an IPv6 static route to a prefix that is not a directly connected next hop, include the resolve statement:
For a list of hierarchy levels at which you can include these statements, see the statement summary sections for these statements.
Hide Navigation Pane
Show Navigation Pane
Download
SHA1
