Supported Platforms
Related Documentation
- ACX, M, MX, PTX, QFX, T Series
- Example: Configuring BGP Prefix-Based Outbound Route Filtering
Understanding Route Advertisement
All routing protocols use the Junos OS routing table to store the routes that they learn and to determine which routes they should advertise in their protocol packets. Routing policy allows you to control which routes the routing protocols store in and retrieve from the routing table. For information about routing policy, see the Routing Policy Configuration Guide.
When configuring BGP routing policy, you can perform the following tasks:
Applying Routing Policy
You define routing policy at the [edit policy-options] hierarchy level. To apply policies you have defined for BGP, include the import and export statements within the BGP configuration. For information about defining policy, see the Routing Policy Configuration Guide.
You can apply policies as follows:
- BGP global import and export statements—Include these statements at the [edit protocols bgp] hierarchy level (for routing instances, include these statements at the [edit routing-instances routing-instance-name protocols bgp] hierarchy level).
- Group import and export statements—Include these statements at the [edit protocols bgp group group-name] hierarchy level (for routing instances, include these statements at the [edit routing-instances routing-instance-name protocols bgp group group-name] hierarchy level).
- Peer import and export statements—Include these statements at the [edit protocols bgp group group-name neighbor address] hierarchy level (for routing instances, include these statements at the [edit routing-instances routing-instance-name protocols bgp group group-name neighbor address] hierarchy level).
A peer-level import or export statement overrides a group import or export statement. A group-level import or export statement overrides a global BGP import or export statement.
To apply policies, see the following sections:
- Applying Policies to Routes Being Imported into the Routing Table from BGP
- Applying Policies to Routes Being Exported from the Routing Table into BGP
Applying Policies to Routes Being Imported into the Routing Table from BGP
To apply policy to routes being imported into the routing table from BGP, include the import statement, listing the names of one or more policies to be evaluated:
For a list of hierarchy levels at which you can include this statement, see the statement summary section for this statement.
If you specify more than one policy, they are evaluated in the order specified, from first to last, and the first matching filter is applied to the route. If no match is found, BGP places into the routing table only those routes that were learned from BGP routing devices.
Applying Policies to Routes Being Exported from the Routing Table into BGP
To apply policy to routes being exported from the routing table into BGP, include the export statement, listing the names of one or more policies to be evaluated:
For a list of hierarchy levels at which you can include this statement, see the statement summary section for this statement.
If you specify more than one policy, they are evaluated in the order specified, from first to last, and the first matching filter is applied to the route. If no routes match the filters, the routing table exports into BGP only the routes that it learned from BGP.
Setting BGP to Advertise Inactive Routes
By default, BGP stores the route information it receives from update messages in the Junos OS routing table, and the routing table exports only active routes into BGP, which BGP then advertises to its peers. To have the routing table export to BGP the best route learned by BGP even if Junos OS did not select it to be an active route, include the advertise-inactive statement:
For a list of hierarchy levels at which you can include this statement, see the statement summary section for this statement.
Configuring BGP to Advertise the Best External Route to Internal Peers
In general, deployed BGP implementations do not advertise the external route with the highest local preference value to internal peers unless it is the best route. Although this behavior was required by an earlier version of the BGP version 4 specification, RFC 1771, it was typically not followed in order to minimize the amount of advertised information and to prevent routing loops. However, there are scenarios in which advertising the best external route is beneficial, in particular, situations that can result in IBGP route oscillation.
In Junos OS Release 9.3 and later, you can configure BGP to advertise the best external route into an internal BGP (IBGP) mesh group, a route reflector cluster, or an autonomous system (AS) confederation, even when the best route is an internal route.
![]() | Note: In order to configure the advertise-external statement on a route reflector, you must disable intracluster reflection with the no-client-reflect statement. |
When a routing device is configured as a route reflector for a cluster, a route advertised by the route reflector is considered internal if it is received from an internal peer with the same cluster identifier or if both peers have no cluster identifier configured. A route received from an internal peer that belongs to another cluster, that is, with a different cluster identifier, is considered external.
In a confederation, when advertising a route to a confederation border router, any route from a different confederation sub-AS is considered external.
You can also configure BGP to advertise the external route only if the route selection process reaches the point where the multiple exit discriminator (MED) metric is evaluated. As a result, an external route with an AS path worse (that is, longer) than that of the active path is not advertised.
Junos OS also provides support for configuring a BGP export policy that matches on the state of an advertised route. You can match on either active or inactive routes. For more information, see the Routing Policy Configuration Guide.
To configure BGP to advertise the best external path to internal peers, include the advertise-external statement:
![]() | Note: The advertise-external statement is supported at both the group and neighbor level. If you configure the statement at the neighbor level, you must configure it for all neighbors in a group. Otherwise, the group is automatically split into different groups. For a complete list of hierarchy levels at which you can configure this statement, see the statement summary section for this statement. |
To configure BGP to advertise the best external path only if the route selection process reaches the point where the MED value is evaluated, include the conditional statement:
For a complete list of hierarchy levels at which you can configure this statement, see the statement summary section for this statement.
Configuring How Often BGP Exchanges Routes with the Routing Table
BGP stores the route information it receives from update messages in the routing table, and the routing table exports active routes from the routing table into BGP. BGP then advertises the exported routes to its peers. By default, the exchange of route information between BGP and the routing table occurs immediately after the routes are received. This immediate exchange of route information might cause instabilities in the network reachability information. To guard against this, you can delay the time between when BGP and the routing table exchange route information.
To configure how often BGP and the routing table exchange route information, include the out-delay statement:
By default, the routing table retains some of the route information learned from BGP. To have the routing table retain all or none of this information, include the keep statement:
For a list of hierarchy levels at which you can include these statements, see the statement summary sections for these statements.
The routing table can retain the route information learned from BGP in one of the following ways:
- Default (omit the keep statement)—Keep all route information that was learned from BGP, except for routes whose AS path is looped and whose loop includes the local AS.
- keep all—Keep all route information that was learned from BGP.
- keep none—Discard routes that were received from a peer and that were rejected by import policy or other sanity checking, such as AS path or next hop. When you configure keep none for the BGP session and the inbound policy changes, Junos OS forces readvertisement of the full set of routes advertised by the peer.
In an AS path healing situation, routes with looped paths theoretically could become usable during a soft reconfiguration when the AS path loop limit is changed. However, there is a significant memory usage difference between the default and keep all.
Consider the following scenarios:
- A peer readvertises routes back to the peer from which
it learned them.
This can happen in the following cases:
- Another vendor's routing device advertises the routes back to the sending peer.
- The Junos OS peer’s default behavior of not readvertising routes back to the sending peer is overridden by configuring advertise-peer-as.
- A provider edge (PE) routing device discards any VPN route that does not have any of the expected route targets.
When keep all is configured, the behavior of discarding routes received in the above scenarios is overridden.
Disabling Suppression of Route Advertisements
Junos OS does not advertise the routes learned from one EBGP peer back to the same external BGP (EBGP) peer. In addition, the software does not advertise those routes back to any EBGP peers that are in the same AS as the originating peer, regardless of the routing instance. You can modify this behavior by including the advertise-peer-as statement in the configuration. To disable the default advertisement suppression, include the advertise-peer-as statement:
![]() | Note: The route suppression default behavior is disabled if the as-override statement is included in the configuration. |
If you include the advertise-peer-as statement in the configuration, BGP advertises the route regardless of this check.
To restore the default behavior, include the no-advertise-peer-as statement in the configuration:
If you include both the as-override and no-advertise-peer-as statements in the configuration, the no-advertise-peer-as statement is ignored. You can include these statements at multiple hierarchy levels.
For a list of hierarchy levels at which you can include these statements, see the statement summary section for these statements.
Related Documentation
- ACX, M, MX, PTX, QFX, T Series
- Example: Configuring BGP Prefix-Based Outbound Route Filtering
Published: 2012-12-08
Supported Platforms
Related Documentation
- ACX, M, MX, PTX, QFX, T Series
- Example: Configuring BGP Prefix-Based Outbound Route Filtering