Define route policies with specific community and local preference settings, then apply these policies to a BGP neighbor to control routing behavior, including route retention and inbound policy processing.
Use this task when you need to define route policies with specific community and local preference settings and apply them to a BGP neighbor, including route retention and inbound policies.
Procedure
|
1. |
Create route policies.
Example:
Create the route policy RRP_comm_no_export_local_pref_2500.
Router(config)# route-policy RRP_comm_no_export_local_pref_2500
Router(config-rpl)# set community RRP_comm_no_export additive
Router(config-rpl)# set local-preference 2500
Router(config-rpl)# end-policy
Router(config-rpl)# exit
Create the route policy comm_number_local_pref.
Router(config)# route-policy comm_number_local_pref
Router(config-rpl)# set community comm_number
Router(config-rpl)# set local-preference 10000
Router(config-rpl)# end-policy
Router(config-rpl)# exit
|
|
2. |
Apply the route policies to a BGP neighbor.
Example:
Enter BGP router configuration mode for AS 140:
Router(config)# router bgp 140
Configure the neighbor with IP address 10.1.1.1.
Router(config-bgp)# neighbor 10.1.1.1
Router(config-bgp-nbr)# remote-as 1
Router(config-bgp-nbr)# update-source Loopback 0
Enter the IPv4 unicast address family.
Router(config-bgp-nbr)# address-family ipv4 unicast
Apply the inbound route policy.
Router(config-bgp-nbr-af)# route-policy RRP_comm_no_export_local_pref_2500 retention retention-time 2340
Enable soft reconfiguration to view the peer's adj-rib-in table.
Router(config-bgp-nbr-af)# soft-reconfiguration inbound always
The route policies are now successfully configured and applied to the BGP neighbor. This setup controls community attributes, local preference values, route retention duration, and inbound policy processing.
|
|
3. |
Use the show bgp neighbor command to verify the configured route-retention policy using show bgp neighbor.
Example:
Router# show bgp neighbor 10.1.1.1
Fri Oct 22 04:52:44.972 PDT
BGP neighbor is 10.1.1.1
Remote AS 1, local AS 1, internal link
Remote router ID 10.1.1.1
BGP state = Established, up for 00:03:03
…
For Address Family: IPv4 Unicast
BGP neighbor version 16172
Policy for incoming advertisements is comm_number_local_pref
Policy for Retention is RRP_comm_no_export_local_pref_2500
Configured route retention policy stale timer for routes is 2340 seconds
….
The show bgp neighbor 10.1.1.1 output confirms:
-
BGP neighbor 10.1.1.1 is established and up for 3 minutes.
-
Remote AS is 1; local AS is 1 (internal link).
Inbound policy: comm_number_local_pref .
Route-retention policy: RRP_comm_no_export_local_pref_2500 .
-
Stale timer set to 2340 seconds.
This verifies the route policies and retention timer are correctly applied and active.
|
|
4. |
Use the show bgp ipv4 unicast command to verify the presence and status of stale routes using show bgp ipv4 unicast.
Example:
Router# show bgp ipv4 unicast 181.1.1.0/24
Fri Oct 22 04:56:15.906 PDT
….
Path #1: Received by speaker 0
Advertised IPv4 Unicast paths to peers (in unique update groups):
3.3.3.3
100, (Received from a RR-client), (long-lived/route-retention policy stale)
192.1.2.1 (metric 10) from 192.1.2.1 (10.1.1.1)
Origin IGP, metric 1221, localpref 2500, valid, internal, best, group-best, multipath
Received Path ID 0, Local Path ID 1, version 16243
Community: 1:100 no-export
This output confirms that the route is marked as stale due to the route-retention policy. It verifeies that the route’s attributes such as origin, metric, local preference, and community, and shows the route is valid, internal, and selected as the best path. The output also confirms the route is advertised to peers and includes path identifiers for tracking. This demonstrates the route-retention policy is effectively maintaining stale routes for network stability.
|
Route policies with specific attributes are successfully applied to the BGP neighbor, providing route retention and policy enforcement.