Home > Articles > Cisco Network Technology > General Networking > Effective BGP Policy Control

Effective BGP Policy Control

Chapter Description

Micah Bartell and Randy Zhang explore the various aspects of BGP policy control, including Policy control techniques, Conditional advertisement, Aggregation and deaggregation, Local AS, QoS policy propagation, and BGP policy accounting.

Case Study: AS Integration via the Local AS

This case study shows you how to integrate two existing autonomous systems (AS 100 and AS 2) into one AS (AS 2) using the Local AS feature. A simple topology is shown in Figure 4-11. AS 100 is multihomed to three different autonomous systems: 200, 300, and 2. The prefix 172.15.0.0/16 is generated and advertised to neighboring autonomous systems. AS 100 also receives the prefix 172.16.0.0/16 generated by AS 400.

Figure 11Figure 4-11 Network Topology for the Case Study

For the purposes of this case study, the last octet of an IP address indicates the router number. Basic BGP configurations for R1 and R2 are shown in Examples 4-40 and 4-41, respectively.

Example 4-40 BGP Configuration on R1

router bgp 100
 no synchronization
 bgp log-neighbor-changes
 network 172.15.0.0
 neighbor 192.168.12.2 remote-as 100
 neighbor 192.168.14.4 remote-as 200
 no auto-summary

Example 4-41 BGP Configuration on R2

router bgp 100
 no synchronization
 bgp log-neighbor-changes
 network 172.15.0.0
 neighbor 192.168.12.1 remote-as 100
 neighbor 192.168.23.3 remote-as 2
 neighbor 192.168.25.5 remote-as 300
 no auto-summary

Examples 4-42 and 4-43 show the BGP RIB.

Example 4-42 BGP RIB on R1

R1#show ip bgp
BGP table version is 3, local router ID is 192.168.14.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
       r RIB-failure
Origin codes: i - IGP, e - EGP, ? - incomplete

  Network     Next Hop      Metric LocPrf Weight Path
* i172.15.0.0    192.168.12.2       0  100   0 i
*>         0.0.0.0         0     32768 i
* i172.16.0.0    192.168.25.5         100   0 300 400 i
*>         192.168.14.4              0 200 400 i

Example 4-43 BGP RIB on R2

R2#show ip bgp
BGP table version is 3, local router ID is 192.168.25.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
       r RIB-failure
Origin codes: i - IGP, e - EGP, ? - incomplete

  Network     Next Hop      Metric LocPrf Weight Path
* i172.15.0.0    192.168.12.1       0  100   0 i
*>         0.0.0.0         0     32768 i
* 172.16.0.0    192.168.23.3              0 2 300 400 i
* i         192.168.14.4         100   0 200 400 i
*>         192.168.25.5              0 300 400 i

Now AS 100 and AS 2 decide to merge into a single AS 2. All BGP speakers in AS 100 are to be migrated to AS 2. Because a common IGP must be used in the same AS, IGP must be migrated first (migrating the IGP is outside the scope of this book and thus isn't covered here). To reduce migration risk and the impact on the peers, migration is to take a gradual approach, with R2 being migrated first.

Local AS is configured on R2 on the session with R5. To maintain the current forwarding architecture, a higher WEIGHT is set on R2 to prefer the path from R5. The outbound AS_PATH is prepended twice on R3 toward R6 and once on R1 toward R4. The no-prepend option on R2 is needed so that R1 accepts the path via R5, because now there is an eBGP session between R1 and R2.

Examples 4-44, 4-45, and 4-46 show the configurations on R1, R2, and R3, respectively.

Example 4-44 BGP Configuration on R1

router bgp 100
 network 172.15.0.0
 neighbor 192.168.12.2 remote-as 2
 neighbor 192.168.14.4 remote-as 200
 neighbor 192.168.14.4 route-map Path-200 out
!
route-map Path-200 permit 10
 set as-path prepend 100

Example 4-45 BGP Configuration on R2

router bgp 2
 network 172.15.0.0
 neighbor 192.168.12.1 remote-as 100
 neighbor 192.168.23.3 remote-as 2
 neighbor 192.168.25.5 remote-as 300
 neighbor 192.168.25.5 local-as 100 no-prepend
 neighbor 192.168.25.5 weight 100

Example 4-46 BGP Configuration on R3

router bgp 2
 neighbor 192.168.23.2 remote-as 2
 neighbor 192.168.36.6 remote-as 300
 neighbor 192.168.36.6 route-map Path-300 out
!
route-map Path-300 permit 10
 set as-path prepend 2 2

The new BGP RIB on R1, R2, and R7 is shown in Examples 4-47, 4-48, and 4-49, respectively.

Example 4-47 BGP RIB on R1

R1#show ip bgp
BGP table version is 3, local router ID is 192.168.14.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
       r RIB-failure
Origin codes: i - IGP, e - EGP, ? - incomplete

  Network     Next Hop      Metric LocPrf Weight Path
* 172.15.0.0    192.168.12.2       0       0 2 i
*>         0.0.0.0         0     32768 i
* 172.16.0.0    192.168.12.2              0 2 300 400 i
*>         192.168.14.4              0 200 400 i

Example 4-48 BGP RIB on R2

R2#show ip bgp
BGP table version is 5, local router ID is 192.168.25.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
       r RIB-failure
Origin codes: i - IGP, e - EGP, ? - incomplete

  Network     Next Hop      Metric LocPrf Weight Path
* 172.15.0.0    192.168.12.1       0       0 100 i
*>         0.0.0.0         0     32768 i
*> 172.16.0.0    192.168.25.5             100 300 400 i
*          192.168.12.1              0 100 200 400 i
* i         192.168.36.6         100   0 300 400 i

Example 4-49 BGP RIB on R7

R7#show ip bgp
BGP table version is 4, local router ID is 192.168.57.7
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
       r RIB-failure
Origin codes: i - IGP, e - EGP, ? - incomplete

  Network     Next Hop      Metric LocPrf Weight Path
* 172.15.0.0    192.168.57.5              0 300 100 2 i
*>         192.168.47.4              0 200 100 100 i
*> 172.16.0.0    0.0.0.0         0     32768 i

The resulting topology is shown in Figure 4-12.

Figure 12Figure 4-12 Topology After R2 Is Migrated to AS 2

The next step is to migrate R1 to the new AS. Local AS is configured on R1 on the session with R4. AS_PATH prepending is now removed on R1. The LOCAL_PREF is modified to prefer the path via R4. The reason that LOCAL_PREF is used instead of WEIGHT is that R2 would also prefer the path via R1 for 172.16.0.0/16 if the link between R2 and R5 failed. The new BGP configurations on R1 and R2 are shown in Examples 4-50 and 4-51, respectively.

Example 4-50 BGP Configuration on R1

router bgp 2
 network 172.15.0.0
 neighbor 192.168.12.2 remote-as 2
 neighbor 192.168.14.4 remote-as 200
 neighbor 192.168.14.4 local-as 100
neighbor 192.168.14.4 route-map Set-lpref in
!
route-map Set-lpref permit 10
 set local-preference 120

Example 4-51 BGP Configuration on R2

router bgp 2
 network 172.15.0.0
 neighbor 192.168.12.1 remote-as 2
 neighbor 192.168.23.3 remote-as 2
 neighbor 192.168.25.5 remote-as 300
 neighbor 192.168.25.5 local-as 100 no-prepend
 neighbor 192.168.25.5 weight 100

The BGP RIB is shown in Examples 4-52, 4-53, and 4-54 for R1, R2, and R7, respectively.

Example 4-52 BGP RIB on R1

R1#show ip bgp
BGP table version is 3, local router ID is 192.168.14.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
       r RIB-failure
Origin codes: i - IGP, e - EGP, ? - incomplete

  Network     Next Hop      Metric LocPrf Weight Path
* i172.15.0.0    192.168.12.2       0  100   0 i
*>         0.0.0.0         0     32768 i
*> 172.16.0.0    192.168.14.4         120   0 100 200 400 i
* i         192.168.25.5         100   0 300 400 i

Example 4-53 BGP RIB on R2

R2#show ip bgp
BGP table version is 5, local router ID is 192.168.25.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
       r RIB-failure
Origin codes: i - IGP, e - EGP, ? - incomplete

  Network     Next Hop      Metric LocPrf Weight Path
* i172.15.0.0    192.168.12.1       0  100   0 i
*>         0.0.0.0         0     32768 i
* i172.16.0.0    192.168.14.4         120   0 100 200 400 i
*>         192.168.25.5             100 300 400 i
* i         192.168.36.6         100   0 300 400 i

Example 4-54 BGP RIB on R7

R7#show ip bgp
BGP table version is 5, local router ID is 192.168.57.7
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
       r RIB-failure
Origin codes: i - IGP, e - EGP, ? - incomplete

  Network     Next Hop      Metric LocPrf Weight Path
*> 172.15.0.0    192.168.57.5              0 300 100 2 i
*          192.168.47.4              0 200 100 2 i
*> 172.16.0.0    0.0.0.0         0     32768 i

Now AS 2 can convince AS 300 to change its peering and, thus, R5's configuration. Local AS is not needed on R2. However, AS 200 will only honor its previous peering agreement with AS 100. Local AS is still needed between R1 and R4. To maintain the same forwarding policy, R2 now needs to prepend its AS_PATH outbound to R5. The final configuration of R2 is shown in Example 4-55. The BGP RIB on R7 is shown in Example 4-56.

Example 4-55 BGP Configuration on R2

router bgp 2
 network 172.15.0.0
 neighbor 192.168.12.1 remote-as 2
 neighbor 192.168.23.3 remote-as 2
 neighbor 192.168.25.5 remote-as 300
 neighbor 192.168.25.5 weight 100
 neighbor 192.168.25.5 route-map Path-300 out
!
route-map Path-300 permit 10
 set as-path prepend 2

Example 4-56 BGP RIB on R7

R7#show ip bgp
BGP table version is 10, local router ID is 192.168.57.7
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
       r RIB-failure
Origin codes: i - IGP, e - EGP, ? - incomplete

  Network     Next Hop      Metric LocPrf Weight Path
* 172.15.0.0    192.168.47.4              0 200 100 2 i
*>         192.168.57.5              0 300 2 2 i
*> 172.16.0.0    0.0.0.0         0     32768 i

Figure 4-13 shows the final topology.

Figure 13Figure 4-13 Final Topology