Having the same initial configurations from the previous lab (Lab 10), we can influence the BGP routes using LOCAL_PREF.
R2 is not shutdown anymore and has the below configuration.
The serial link between R1 and R2 is shutdown.
Also, the Fa0/0 links on R1 and R2 will be shutdown, so that R1 connects only to R101 and R2 only to R102.
R1(config)#int fa 0/0
R1(config-if)#shut
R1(config-if)#int se 0/1
R1(config-if)#shut
R2(config)#int fa 0/0
R2(config-if)#shut
R2(config-if)#int se 0/1
R2(config-if)#shut
R1(config)#router bgp 100
R1(config-router)#no neighbor 102.102.102.102 remote-as 102
R1(config-router)#no neighbor 102.102.102.102 ebgp-multihop 2
R1(config-router)#no neighbor 102.102.102.102 update-source Loopback1
R2:
!
interface Loopback2
ip address 2.2.2.2 255.255.255.255
!
router bgp 100
no synchronization
bgp log-neighbor-changes
neighbor 102.102.102.102 remote-as 102
neighbor 102.102.102.102 ebgp-multihop 2
neighbor 102.102.102.102 update-source Loopback2
no auto-summary
!
ip route 102.102.102.102 255.255.255.255 202.2.2.6
!
R102:
!
interface Loopback102
ip address 102.102.102.102 255.255.255.255
!
router bgp 102
no synchronization
bgp log-neighbor-changes
neighbor 1.1.1.1 remote-as 100
neighbor 1.1.1.1 ebgp-multihop 2
neighbor 1.1.1.1 update-source Loopback102
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 ebgp-multihop 2
neighbor 2.2.2.2 update-source Loopback102
neighbor 103.103.103.103 remote-as 103
neighbor 103.103.103.103 ebgp-multihop 2
neighbor 103.103.103.103 update-source Loopback102
no auto-summary
!
ip forward-protocol nd
ip route 2.2.2.2 255.255.255.255 202.2.2.5
ip route 103.103.103.103 255.255.255.255 123.1.1.2
!
R1#show ip bgp summary
...
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
101.101.101.101 4 101 23 23 6 0 0 00:18:03 5
R2#show ip bgp summary
...
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
102.102.102.102 4 102 5 4 6 0 0 00:00:36 5
R1#show ip bgp
BGP table version is 6, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 192.168.40.40/32 101.101.101.101 0 101 104 i
*> 192.168.41.41/32 101.101.101.101 0 101 104 i
*> 192.168.42.42/32 101.101.101.101 0 101 104 i
*> 192.168.43.43/32 101.101.101.101 0 101 104 i
*> 192.168.44.44/32 101.101.101.101 0 101 104 i
R2#show ip bgp
BGP table version is 6, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 192.168.40.40/32 102.102.102.102 0 102 103 104 i
*> 192.168.41.41/32 102.102.102.102 0 102 103 104 i
*> 192.168.42.42/32 102.102.102.102 0 102 103 104 i
*> 192.168.43.43/32 102.102.102.102 0 102 103 104 i
*> 192.168.44.44/32 102.102.102.102 0 102 103 104 i
The BGP Local Preference (Local_Pref) PA gives the routers inside a single AS a value that they can set per-route, advertise to all iBGP routers inside the AS, so that all routers in the AS agree about which router is the best exit point for packets destined for that prefix.
By design, the Local_Pref can be set by routers as they receive eBGP routes by using an inbound route map. The routers then advertise the Local_Pref in iBGP updates. It is not advertised to eBGP peers.
As a result, all the routers in the same AS can then make the same choice of which route is best, agreeing as to which router to use to exit the AS for each prefix.
Default value is 100. Higher values are preferred.
Note: Because Updates received from eBGP peers do not include the Local_Pref PA, IOS lists a null value for Local_Pref for eBGP-learned routes by default. However, Updates from iBGP peers do include the Local_Pref.
Next, we should configure the iBGP mesh in the Enterprise so we can tune the LOCAL_PREF later. Let's configure iBGP peering between R1 and R3, then R2 and R4.
R1---R3:
R1(config)#router ospf 1
R1(config-router)#network 1.1.1.1 0.0.0.0 area 0
R3(config)#router ospf 1
R3(config-router)#network 3.3.3.3 0.0.0.0 area 0
R1(config)#router bgp 100
R1(config-router)#neighbor 3.3.3.3 remote-as 100
R1(config-router)#neighbor 3.3.3.3 update-source loopback 1
R3(config)#router bgp 100
R3(config-router)#neighbor 1.1.1.1 remote-as 100
R3(config-router)#neighbor 1.1.1.1 update-source loopback 3
R3(config)#interface loopback 3
R3(config-if)#ip address 3.3.3.3 255.255.255.255
R2---R4:
R2(config)#router ospf 1
R2(config-router)#network 2.2.2.2 0.0.0.0 area 0
R4(config)#router ospf 1
R4(config-router)#network 4.4.4.4 0.0.0.0 area 0
R2(config)#router bgp 100
R2(config-router)#neighbor 4.4.4.4 remote-as 100
R2(config-router)#neighbor 4.4.4.4 update-source loopback 2
R4(config)#router bgp 100
R4(config-router)#neighbor 2.2.2.2 remote-as 100
R4(config-router)#neighbor 2.2.2.2 update-source loopback 4
R4(config)#interface loopback 4
R4(config-if)#ip address 4.4.4.4 255.255.255.255
R2---R3:
R2(config)#router bgp 100
R2(config-router)#neighbor 3.3.3.3 remote-as 100
R2(config-router)#neighbor 3.3.3.3 update-source loopback 2
R3(config)#router bgp 100
R3(config-router)#neighbor 2.2.2.2 remote-as 100
R3(config-router)#neighbor 2.2.2.2 update-source loopback 3
R1---R4:
R1(config)#router bgp 100
R1(config-router)#neighbor 4.4.4.4 remote-as 100
R1(config-router)#neighbor 4.4.4.4 update-source loopback 1
R4(config)#router bgp 100
R4(config-router)#neighbor 1.1.1.1 remote-as 100
R4(config-router)#neighbor 1.1.1.1 update-source loopback 4
Next-hop-self setting:
R1(config)#router bgp 100
R1(config-router)#neighbor 3.3.3.3 next-hop-self
R1(config-router)#neighbor 4.4.4.4 next-hop-self
R4(config)#router bgp 100
R2(config-router)#neighbor 3.3.3.3 next-hop-self
R2(config-router)#neighbor 4.4.4.4 next-hop-self
As a result of the iBGP neighborships formed, R3 and R4 learn about the 192.168.x.x routes from their iBGP peers.
R3#show ip bgp
BGP table version is 11, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*>i192.168.40.40/32 1.1.1.1 0 100 0 101 104 i
* i 2.2.2.2 0 100 0 102 103 104 i
*>i192.168.41.41/32 1.1.1.1 0 100 0 101 104 i
* i 2.2.2.2 0 100 0 102 103 104 i
*>i192.168.42.42/32 1.1.1.1 0 100 0 101 104 i
* i 2.2.2.2 0 100 0 102 103 104 i
*>i192.168.43.43/32 1.1.1.1 0 100 0 101 104 i
* i 2.2.2.2 0 100 0 102 103 104 i
*>i192.168.44.44/32 1.1.1.1 0 100 0 101 104 i
* i 2.2.2.2 0 100 0 102 103 104 i
R4#show ip bgp
BGP table version is 11, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*>i192.168.40.40/32 1.1.1.1 0 100 0 101 104 i
* i 2.2.2.2 0 100 0 102 103 104 i
*>i192.168.41.41/32 1.1.1.1 0 100 0 101 104 i
* i 2.2.2.2 0 100 0 102 103 104 i
*>i192.168.42.42/32 1.1.1.1 0 100 0 101 104 i
* i 2.2.2.2 0 100 0 102 103 104 i
*>i192.168.43.43/32 1.1.1.1 0 100 0 101 104 i
* i 2.2.2.2 0 100 0 102 103 104 i
*>i192.168.44.44/32 1.1.1.1 0 100 0 101 104 i
* i 2.2.2.2 0 100 0 102 103 104 i
Both interior enterprise routers prefer the path through R1 due to the shorter AS_PATH (Next-hop is reachable, equal Weights, equal LOCAL_PREF, injected by BGP).
Setting the BGP Local_Pref Using a Route Map
To set the Local_Pref, a router can use the neighbor neighbor-ip route-map in BGP subcommand.
Typically, a router uses this command with the inbound direction for routes received from eBGP peers.
Then, with no additional configuration required, the router advertises the Local_Pref to any iBGP peers.
Let's influence both enterprise routers to use R2 as the exit point for reaching the 192.168.44.44/32 subnet, using Local Preference.
R1(config)#ip prefix-list pref44 permit 192.168.44.44/24 le 32
R1(config)#route-map set-pref-200 permit 10
R1(config-route-map)#match ip address prefix-list pref44
R1(config-route-map)#set local-preference 200
R1(config)#route-map set-pref-200 permit 20
The above route map sets the Local Preference of 200 for the specified route and leaves all the other routes with their default values.
Now, we should apply the route-map to the routes coming inbound from the eBGP neighbor. R2 will then advertise the route having the new Local Preference value to its iBGP peers.
R2(config)#router bgp 100
R2(config-router)#neighbor 102.102.102.102 route-map set-pref-200 in
R2#clear ip bgp 102.102.102.102 soft
As a result:
R2#show ip bgp
BGP table version is 7, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 192.168.40.40/32 102.102.102.102 0 102 103 104 i
*> 192.168.41.41/32 102.102.102.102 0 102 103 104 i
*> 192.168.42.42/32 102.102.102.102 0 102 103 104 i
*> 192.168.43.43/32 102.102.102.102 0 102 103 104 i
*> 192.168.44.44/32 102.102.102.102 200 0 102 103 104 i
Having R3 and R4 as iBGP peers, R2 will advertise the 192.168.44.44 route with the new Local Preference value, thus enabling them to choose R2 as the next-hop for that destination, as seen below:
R2#show ip bgp summary
...
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
3.3.3.3 4 100 280 285 7 0 0 04:24:18 0
4.4.4.4 4 100 286 290 7 0 0 04:25:25 0
102.102.102.102 4 102 343 344 7 0 0 05:39:10 5
R3#show ip bgp
BGP table version is 32, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*>i192.168.40.40/32 1.1.1.1 0 100 0 101 104 i
* i 2.2.2.2 0 100 0 102 103 104 i
*>i192.168.41.41/32 1.1.1.1 0 100 0 101 104 i
* i 2.2.2.2 0 100 0 102 103 104 i
*>i192.168.42.42/32 1.1.1.1 0 100 0 101 104 i
* i 2.2.2.2 0 100 0 102 103 104 i
*>i192.168.43.43/32 1.1.1.1 0 100 0 101 104 i
* i 2.2.2.2 0 100 0 102 103 104 i
* i192.168.44.44/32 1.1.1.1 0 100 0 101 104 i
*>i 2.2.2.2 0 200 0 102 103 104 i
R4#show ip bgp
BGP table version is 32, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*>i192.168.40.40/32 1.1.1.1 0 100 0 101 104 i
* i 2.2.2.2 0 100 0 102 103 104 i
*>i192.168.41.41/32 1.1.1.1 0 100 0 101 104 i
* i 2.2.2.2 0 100 0 102 103 104 i
*>i192.168.42.42/32 1.1.1.1 0 100 0 101 104 i
* i 2.2.2.2 0 100 0 102 103 104 i
*>i192.168.43.43/32 1.1.1.1 0 100 0 101 104 i
* i 2.2.2.2 0 100 0 102 103 104 i
* i192.168.44.44/32 1.1.1.1 0 100 0 101 104 i
*>i 2.2.2.2 0 200 0 102 103 104 i
Wednesday, May 7, 2014
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment