The AS_Path prepend tool gives engineers a means to increase the length of an AS_Path by adding ASNs to the AS_Path, while not impacting the loop prevention role of the AS_Path PA.
By increasing the length of an AS_Path, a route is less likely to become the best route.
For this lab we will use the following configurations, having the R1-R2 serial link disabled.
R1(config)#int fa 0/0
R1(config-if)#shut
R1(config)#int se 0/1
R1(config-if)#shut
R2(config)#int fa 0/0
R2(config-if)#shut
R2(config)#int se 0/1
R2(config-if)#shut
R1:
!
interface Loopback1
ip address 1.1.1.1 255.255.255.255
!
router bgp 100
no synchronization
bgp log-neighbor-changes
neighbor 101.101.101.101 remote-as 101
neighbor 101.101.101.101 password ccnp
neighbor 101.101.101.101 ebgp-multihop 2
neighbor 101.101.101.101 update-source Loopback1
no auto-summary
!
ip route 101.101.101.101 255.255.255.255 201.1.1.2
!
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
!
R101:
!
interface Loopback101
ip address 101.101.101.101 255.255.255.255
!
router bgp 101
no synchronization
bgp log-neighbor-changes
neighbor 1.1.1.1 remote-as 100
neighbor 1.1.1.1 password ccnp
neighbor 1.1.1.1 ebgp-multihop 2
neighbor 1.1.1.1 update-source Loopback101
neighbor 104.104.104.104 remote-as 104
neighbor 104.104.104.104 password ccnp
neighbor 104.104.104.104 ebgp-multihop 2
neighbor 104.104.104.104 update-source Loopback101
no auto-summary
!
ip route 1.1.1.1 255.255.255.255 201.1.1.1
ip route 104.104.104.104 255.255.255.255 114.1.1.2
!
R102:
!
interface Loopback102
ip address 102.102.102.102 255.255.255.255
!
router bgp 102
no synchronization
bgp log-neighbor-changes
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
!
R103:
!
interface Loopback103
ip address 103.103.103.103 255.255.255.255
!
router bgp 103
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 Loopback103
neighbor 104.104.104.104 remote-as 104
neighbor 104.104.104.104 ebgp-multihop 2
neighbor 104.104.104.104 update-source Loopback103
no auto-summary
!
ip route 102.102.102.102 255.255.255.255 123.1.1.1
ip route 104.104.104.104 255.255.255.255 134.1.1.2
!
R104:
!
interface Loopback40
ip address 192.168.40.40 255.255.255.255
!
interface Loopback41
ip address 192.168.41.41 255.255.255.255
!
interface Loopback42
ip address 192.168.42.42 255.255.255.255
!
interface Loopback43
ip address 192.168.43.43 255.255.255.255
!
interface Loopback44
ip address 192.168.44.44 255.255.255.255
!
interface Loopback104
ip address 104.104.104.104 255.255.255.255
!
router bgp 104
no synchronization
bgp log-neighbor-changes
network 192.168.40.40 mask 255.255.255.255
network 192.168.41.41 mask 255.255.255.255
network 192.168.42.42 mask 255.255.255.255
network 192.168.43.43 mask 255.255.255.255
network 192.168.44.44 mask 255.255.255.255
neighbor 101.101.101.101 remote-as 101
neighbor 101.101.101.101 password ccnp
neighbor 101.101.101.101 ebgp-multihop 2
neighbor 101.101.101.101 update-source Loopback104
neighbor 103.103.103.103 remote-as 103
neighbor 103.103.103.103 ebgp-multihop 2
neighbor 103.103.103.103 update-source Loopback104
no auto-summary
!
ip route 101.101.101.101 255.255.255.255 114.1.1.1
ip route 103.103.103.103 255.255.255.255 134.1.1.1
!
Further more, we should configure iBGP peering between R3 and R1 & R3 and R2.
R1(config)#router ospf 1
R1(config-router)#network 1.1.1.1 0.0.0.0 area 0
R2(config)#router ospf 1
R2(config-router)#network 2.2.2.2 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
R1(config-router)#neighbor 3.3.3.3 next-hop-self
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
R2(config-router)#neighbor 3.3.3.3 next-hop-self
R3(config)#interface loopback 3
R3(config-if)#ip address 3.3.3.3 255.255.255.255
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-router)#neighbor 2.2.2.2 remote-as 100
R3(config-router)#neighbor 2.2.2.2 update-source loopback 3
At this point, R3 is choosing R1 as the next-hop for 192.168.44.44/32 due to the shorter AS Path.
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 2.2.2.2 0 100 0 102 103 104 i
*>i 1.1.1.1 0 100 0 101 104 i
* i192.168.41.41/32 2.2.2.2 0 100 0 102 103 104 i
*>i 1.1.1.1 0 100 0 101 104 i
* i192.168.42.42/32 2.2.2.2 0 100 0 102 103 104 i
*>i 1.1.1.1 0 100 0 101 104 i
* i192.168.43.43/32 2.2.2.2 0 100 0 102 103 104 i
*>i 1.1.1.1 0 100 0 101 104 i
* i192.168.44.44/32 2.2.2.2 0 100 0 102 103 104 i
*>i 1.1.1.1 0 100 0 101 104 i
Let's say we want to influence R3 to choose the path via R2 for the 192.168.44.44 route, by worsening the AS Path advertised by R1 (adding two ASs to the '101 104' AS Path).
R1(config)#access-list 101 permit ip host 192.168.44.44 host 255.255.255.255
R1(config)#route-map set-as permit 10
R1(config-route-map)#match ip address 101
R1(config-route-map)#set as-path prepend 101 101
R1(config-route-map)#route-map set-as permit 20
R1(config)#router bgp 100
R1(config-router)#neighbor 101.101.101.101 route-map set-as in
R1#clear ip bgp 101.101.101.101 soft
Now, the AS Path advertised by R1 is two ASs longer:
R1#show ip bgp
BGP table version is 12, 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 101 101 104 i
As a consequence, R3 is choosing R2 as the next-hop for the specified route, due to the new shortest AS Path:
R3#show ip bgp
BGP table version is 12, 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 2.2.2.2 0 100 0 102 103 104 i
*>i 1.1.1.1 0 100 0 101 104 i
* i192.168.41.41/32 2.2.2.2 0 100 0 102 103 104 i
*>i 1.1.1.1 0 100 0 101 104 i
* i192.168.42.42/32 2.2.2.2 0 100 0 102 103 104 i
*>i 1.1.1.1 0 100 0 101 104 i
* i192.168.43.43/32 2.2.2.2 0 100 0 102 103 104 i
*>i 1.1.1.1 0 100 0 101 104 i
*>i192.168.44.44/32 2.2.2.2 0 100 0 102 103 104 i
* i 1.1.1.1 0 100 0 101 101 101 104 i
Thursday, May 8, 2014
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment