Вы находитесь на странице: 1из 10

BGP Best Path Algorithm

0. Initial configuration IP addresses are already configured on all routers

G0/0 G1/0 G2/0 G3/0 Se2/0 Loopback0


R1 10.0.13.1 /24 12.12.12.1 /24 - - 10.0.14.1 /24
21.21.21.1 /24
R2 10.0.23.2 /24 12.12.12.2 /24 - - 10.0.26.2 /24
21.21.21.2 /24
R3 10.0.13.3 /24 10.0.23.3 /24 10.0.36.3 /24 10.0.34.3 /24 -
R4 10.0.34.4 /24 10.0.45.4 /24 - 10.0.54.4 /24 10.0.14.4 /24 4.4.4.4 /32
R5 10.0.45.5 /24 10.0.54.5 /24 10.0.56.5 /24 - - 5.5.5.5 /32
R6 10.0.36.6 /24 10.0.56.6 /24 - - 10.0.26.6 /24 6.6.6.6 /32

Page 1 of 10
eBGP and iBGP sessions

R1(config)# router bgp 12


R1(config-router)# bgp router-id 1.1.1.1
R1(config-router)# neighbor 10.0.14.4 remote-as 456
R1(config-router)# neighbor 10.0.34.4 remote-as 456
R1(config-router)# neighbor 10.0.34.4 ttl-security hops 2
R1(config-router)# neighbor 10.0.36.6 remote-as 456
R1(config-router)# neighbor 10.0.36.6 ttl-security hops 2

R2(config)# router bgp 12


R2(config-router)# bgp router-id 2.2.2.2
R2(config-router)# neighbor 10.0.26.6 remote-as 456
R2(config-router)# neighbor 10.0.34.4 remote-as 456
R2(config-router)# neighbor 10.0.34.4 ttl-security hops 2
R2(config-router)# neighbor 10.0.36.6 remote-as 456
R2(config-router)# neighbor 10.0.36.6 ttl-security hops 2

R4(config)# router bgp 456


R4(config-router)# neighbor 6.6.6.6 remote-as 456
R4(config-router)# neighbor 6.6.6.6 update-source Loopback0
R4(config-router)# neighbor 6.6.6.6 next-hop-self
R4(config-router)# neighbor 10.0.13.1 remote-as 12
R4(config-router)# neighbor 10.0.13.1 ttl-security hops 2
R4(config-router)# neighbor 10.0.14.1 remote-as 12
R4(config-router)# neighbor 10.0.23.2 remote-as 12
R4(config-router)# neighbor 10.0.23.2 ttl-security hops 2
R4(config-router)# neighbor 10.0.45.5 remote-as 456
R4(config-router)# neighbor 10.0.45.5 next-hop-self
R4(config-router)# neighbor 10.0.54.5 remote-as 456
R4(config-router)# neighbor 10.0.54.5 next-hop-self

R5(config)# router bgp 456


R5(config-router)# neighbor 10.0.56.6 remote-as 456
R5(config-router)# neighbor 10.0.45.4 remote-as 456
R5(config-router)# neighbor 10.0.54.4 remote-as 456

Page 2 of 10
R6(config)# router bgp 456
R6(config-router)# neighbor 4.4.4.4 remote-as 456
R6(config-router)# neighbor 4.4.4.4 update-source Loopback0
R6(config-router)# neighbor 4.4.4.4 next-hop-self
R6(config-router)# neighbor 10.0.56.5 remote-as 456
R6(config-router)# neighbor 10.0.56.5 next-hop-self
R6(config-router)# neighbor 10.0.13.1 remote-as 12
R6(config-router)# neighbor 10.0.13.1 ttl-security hops 2
R6(config-router)# neighbor 10.0.23.2 remote-as 12
R6(config-router)# neighbor 10.0.23.2 ttl-security hops 2
R6(config-router)# neighbor 10.0.26.2 remote-as 12
R6(config-router)# neighbor 10.0.56.5 remote-as 456
R6(config-router)# neighbor 10.0.56.5 next-hop-self

Please configure R1 and R2 to advertise networks 12.12.12.0/24 and 21.21.21.0/24.

Rx(config)# route-map c2b permit 10


Rx(config-route-map)# match interface G1/0
Rx(config)# router bgp 12
Rx(config-router)# redistribute connected route-map c2b

1. Weight

Please configure R4 to assign different weights to each of its external peers.


R4(config)# router bgp 456
R4(config-router)# neighbor 10.0.13.1 weight 100
R4(config-router)# neighbor 10.0.14.1 weight 101
R4(config-router)# neighbor 10.0.23.2 weight 102

Please force R4 to send BGP Route-Refresh request to all its external peers.
R4# clear ip bgp 12 soft

Please verify the BGP table in R4


R4# show ip bgp

Q1: Which is the best route to network 12.12.12.0 and 21.21.21.0?


A: 12.12.12.0 to 10.0.23.2; 21.21.21.21.0 to 10.0.23.2

Please verify how is learnt network 12.12.12.0 by R4.


R4# show ip bgp 12.12.12.0

Q2: Why is 10.0.23.2 the best next-hop?


A: weight 102

Please redo the configuration on R4 and force it to send BGP Route-Refresh request to all its external peers.

Page 3 of 10
Please configure R6 to associate different weights to each of its external peers.
R6(config)# route-map setWeights_100
R6(config-route-map)# set weight 100
R6(config)# route-map setWeights_101
R6(config-route-map)# set weight 101
R6(config)# route-map setWeights_102
R6(config-route-map)# set weight 102

R6(config)# router bgp 456


R6(config-router)# neighbor 10.0.13.1 route-map setWeights_100 in
R6(config-router)# neighbor 10.0.23.2 route-map setWeights_102 in
R6(config-router)# neighbor 10.0.26.2 route-map setWeights_101 in

Please force R6 to send BGP Route-Refresh request to all its external peers.
R6# clear ip bgp 12 soft

Q3: Which is the best route to network 12.12.12.0 and 21.21.21.0?


A:
12.12.12.0 and 21.21.21.0 to 10.0.23.2
Please verify how is learnt network 12.12.12.0 by R6.
R6# show ip bgp 12.12.12.0

Q4: Why is 10.0.23.2 the best next-hop?


A: weight 102

Please redo the configuration on R6 and force it to send BGP Route-Refresh request to all its external peers.

Local-Preference

Please configure R6 to assign Local-Preference 199 when advertises prefixes to each of its internal peers.
R6(config)# route-map LocalPref_199
R6(config-route-map)# set local-preference 199

R6(config)# router bgp 456


R6(config-router)# neighbor 4.4.4.4 route-map LocalPref_199 out
R6(config-router)# neighbor 10.0.56.5 route-map LocalPref_199 out

Please force R6 to send BGP Route-Refresh request to all its external peers.
R6# clear ip bgp 456 soft

Q1: Does R6 and R5 receive prefixes from R4 (BGP router-id 4.4.4.4)?


A:
no

Q2: Which is the best path for networks 12.12.12.0 and 21.21.21.0 on R5 and R4?
A:

Page 4 of 10
6.6.6.6 for R4 and for R5 10.0.56.5

Q3: Why R4 prefers R6 (BGP router-id 6.6.6.6) for destination networks 12.12.12.0 and 21.21.21.0?
A: local pref 199

Please redo the configuration on R6 and force it to send BGP Route-Refresh request to all its external peers.

AS-Path

Please configure R2 to prepend its AS_Path attribute.


R2(config)# route-map aspath_prepend
R2(config-route-map)# set as-path prepend 12

R2(config)# router bgp 12


R2(config-router)# neighbor 10.0.26.6 route-map aspath_prepend out
R2(config-router)# neighbor 10.0.36.6 route-map aspath_prepend out
R2(config-router)# neighbor 10.0.34.4 route-map aspath_prepend out

Please force R2 to send BGP Route-Refresh request to all its external peers.
R2# clear ip bgp 456 soft

Please verify BGP table in R4 and R6.


Rx# show ip bgp

Q1: Which is the best path to networks 12.12.12.0 and 21.21.21.0?


A:

R4 -10.0.14.1
R6 - 10.0.23.2

Q2. Why R6 prefers R1?


A:
Because of lowest AS path

Redo the configuration on R2 and force R2 to send BGP Route-Refresh request to all its external peers.
R2# clear ip bgp 456 soft

Origin

Please configure R2 to set Origin IGP for its advertised networks.


R2(config)# route-map c2b permit 10
R2(config-route-map)# set origin igp

Please force R2 to send BGP Route-Refresh request to all its peers.


R2# clear ip bgp * soft

Page 5 of 10
Please verify BGP table in R4 and R6.
Rx# show ip bgp

Q1: Which is the best path to networks 12.12.12.0 and 21.21.21.0?


A:
12.12.12.0 to 10.0.23.2

R6 10.0.23.2
R4- 10.0.23.2

Q2. Why R4 prefers R2?


A:

Redo the configuration on R2 and force R2 to send BGP Route-Refresh request to all its peers.
R2# clear ip bgp * soft

MED

Please configure R2 to set MED (a.k.a. metric) 199 for its advertised networks.
R2(config)# route-map c2b permit 10
R2(config-route-map)# set metric 199

Please force R2 to send BGP Route-Refresh request to all its peers.


R2# clear ip bgp * soft

Please configure R1 to set MED 299 for its advertised networks.


R1(config)# route-map c2b permit 10
R1(config-route-map)# set metric 299

Please force R1 to send BGP Route-Refresh request to all its peers.


R1# clear ip bgp * soft

Please wait for 30-60 seconds and then verify BGP table in R4 and R6.
Rx# show ip bgp

Q1: Which is the best path to networks 12.12.12.0 and 21.21.21.0?


A:
82
Q2. Why R4 prefers R2?
A:
Low BGP metric, internal

Redo the configuration on R1 and R2 and force both to send BGP Route-Refresh request to all its peers.
Rx# clear ip bgp * soft

Page 6 of 10
eBGP vs iBGP

Please verify BGP table in R4.


R4# show ip bgp

Q1: Which is the best path to networks 12.12.12.0 and 21.21.21.0?


A:
10.0.14.1 for 21.21.21.0
10.0.19.1 for 12.12.12.0

Please deactivate the BGP session with the current best next hop.
R4(config)#router bgp 456
R4(config-router)# neighbor <IP> shutdown

Please verify BGP table in R4.


R4# show ip bgp

Q2: Which is the best path to networks 12.12.12.0 and 21.21.21.0?


A:
10.0.13.1

Please continue to deactivate the BGP session with the current best next hop.
R4(config)#router bgp 456
R4(config-router)# neighbor <IP> shutdown

Please verify BGP table in R4.


R4# show ip bgp

Q3: Which is the best path to networks 12.12.12.0 and 21.21.21.0?


A:
10.0.23.2
Please redo the configuration on R4.

IGP metric

Please verify BGP table in R4.


R4# show ip bgp

Q1: Which is the best path to networks 12.12.12.0 and 21.21.21.0? How is learnt this next hop by R4?
A:
10.0.14.1

Please deactivate the BGP session with 10.0.14.1 on R4.


R4(config)# router bgp 456
R4(config-router)# neighbor 10.0.14.1 shutdown
Page 7 of 10
Q1: Which is the best path to networks 12.12.12.0 and 21.21.21.0? How is learnt this next hop by R4?
A:
10.0.13.1

Please modify the OSPF cost to value 17 of interface G0/0 on R3.


R3(config)# interface G0/0
R3(config-if)# ip ospf cost 17

Please wait for 30-60 seconds and then verify BGP table in R4 and R6 for network 12.12.12.0 or 21.21.21.0.
Rx# show ip bgp <IP>

Q2: Which is the best path to networks 12.12.12.0 and 21.21.21.0? How is learnt this next hop by R4 and what is the
value of the metric?
A: 10.0.13.1 metric 20;

Please modify the OSPF cost to value 27 of interface G1/0 on R3.


R3(config)# interface G1/0
R3(config-if)# ip ospf cost 27

Please wait for 30-60 seconds and then verify BGP table in R4 and R6 for network 12.12.12.0 or 21.21.21.0.
Rx# show ip bgp <IP>

Q3: Which is the best path to networks 12.12.12.0 and 21.21.21.0? How is learnt this next hop by R4 and what is the
value of the metric?
A:

Redo the configuration on R4 and R3.

Stable route (the oldest one)


This is the case when multiple paths exist and are all EXTERNAL.

Please verify BGP table in R4 and R6.


Rx# show ip bgp

Q1: Which is the best path to networks 12.12.12.0 and 21.21.21.0?


A:

Please modify the BGP router-id of this BGP peer (in this case must be R1 or R2).
Rx(config)# router bgp 12
Rx(config-router)# bgp router-id <IP>

Please verify BGP table in R4 and R6.


Rx# show ip bgp

Q2: Which is the best path to networks 12.12.12.0 and 21.21.21.0?

Page 8 of 10
A:

BGP router-id
This is the case when multiple paths exist and are all INTERNAL.

Please verify BGP table in R5 for network 12.12.12.0 or 21.21.21.0.


R5# show ip bgp <IP>

Q1: Which is the best path to networks 12.12.12.0 and 21.21.21.0?


A: R4, 10.0.14.1

Please modify the BGP router-id in R4 to value 44.44.44.44.


R4(config)# router bgp 456
R4(config-router)# bgp router-id 44.44.44.44

Please verify BGP table in R5 for network 12.12.12.0 or 21.21.21.0.


R5# show ip bgp <IP>

Q2: Which is the best path to networks 12.12.12.0 and 21.21.21.0?


A:

Please redo the configuration on R4 using BGP router-id 4.4.4.4.

IP next-hop

Please verify BGP table in R5 for network 12.12.12.0 or 21.21.21.0.


R5# show ip bgp <IP>

Q1: Which is the best path to networks 12.12.12.0 and 21.21.21.0?


A:

Please deactivate the BGP session with 10.0.45.4 on R5.


R5(config)# router bgp 456
R5(config-router)# neighbor 10.0.45.4 shutdown

Q2: Which is the best path to networks 12.12.12.0 and 21.21.21.0?


A:

Please reactivate the BGP session with 10.0.45.4 on R5.


R5(config)# router bgp 456
R5(config-router)# no neighbor 10.0.45.4 shutdown

Q3: Which is the best path to networks 12.12.12.0 and 21.21.21.0?


A:

Conclusions

Page 9 of 10
Please fill in the correct order of BGP attributes used by decision process to choose the best path.

1. weight
2. local pref
3. AS path
4. origin
5. med
6. eBGP iBGP
7. ibgp metric
8. static router for ebgp
9.
10.
11.

Page 10 of 10

Вам также может понравиться