BGP BESTPATH SELECTION
-----------------------
Chooses which routes can be
- installed in the rib/fib
- advertised to other IBGP Peers
(best path is the only one to be advertised)
- In general path selection is standard
- Decision Process RFC 4271
Best Path Selection Prerequisites
----------------------------------
There are few prerequsites that need to be met before we will even start looking at the
path selection
* Next-hop value must be in the routing table - this prevents route recursion failures
*synchronisation rule must be met or disabled- synch was legacy blackhole prevention technique
*AS-Path must not contain local-as - normal EBGP loop prevention
*First ASN in path must be neighbor ASN- bgp enforce-first-as - on by default
How the Best Path Algorithm works
--------------------------------
Checks in prerequisites are met. Then it works in top down fashion once it matches it leaves the algorithm not processing
through the other steps
1. Prefer path with highest weight (locally significant)
2. Prefer path with highest local pref
3. Prefer locally Originated (via network or redistribution or aggregate. Locally sourced redisribution / network are
prefered over aggregation
4.Prefer the path with the shortest AS path
- step can be skipped if you configure bgp bestpath-aspath-ignore
- An as-set counts as 1 no matter how AS are in the set
- AS-confed squence + confed set are not included in the AS path lenght
5.Prefer IGP Path lowest origin- IGP is lower than EGP (legacy pre bgp) which is lower than incomplete (?) redistributed routes
6.Prefer the path with the lowest med
7.Prefer EBGP over IBGP
8.Prefer the path with the lowest metric to next hop
9.then we move into the tie breakers one thing to note if 2 routes have the same aspath and
the same 1-8 on the best path algorithm they can utilise load balancing with bgp multipath
10. When both paths are external prefer the path that we recieved first- if you have bgp bestpath compare-routerid enabled
this step is skipped
11.Prefer the route that comes from the BGP with the lowest router-id
12.Prefer the shortest cluster-list - min no of route reflectors the route has gone through
13.Prefer Lowest neighbor address
multipath can be done with the command
router bgp 100
maximum-paths ibgp 2
When editing attribute like the weight local preference etc
remeber that
OUtbound routing policy affect inbound traffic
Inbound routing policy affects outbound traffic
weight & local pref
- Set INBOUND
- Affects outbound traffic
AS-PATH & MED
- set outbound
-affects inbound traffic
WEIGHT
---------
is locally significant highest weight is best. Although it locally significant it can affect AS decision as if particular router
change it > best route in bgp it will start advertising this route to peers. BGP we only advertise our best routes
LAB
----
bb1
---
we will advertise a route
bb1(config)#router bgp 54
bb1(config-router)#network 11.1.1.1 mask 255.255.255.255
r1#sh ip bgp
BGP table version is 8, 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
* i11.1.1.1/32 10.229.254.1 0 100 0 54 i
*>i 172.25.13.3 0 100 0 54 i
r1#
BB1 advertises the route to r6 and to bb3. Then bb3 adverises the route to r4
OK r1 is receving this from r6 and r4 then
has selected the next hop of 172.25.13.3 which is the segement between r4 and bb3
r1#sh ip bgp
BGP table version is 8, 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
* i11.1.1.1/32 10.229.254.1 0 100 0 54 i
*>i 172.25.13.3 0 100 0 54 i
r1#
r1#sh ip bgp 11.1.1.1 255.255.255.255
BGP routing table entry for 11.1.1.1/32, version 8
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Advertised to update-groups:
2
54
10.229.254.1 (metric 2172416) from 6.6.6.6 (6.6.6.6)
Origin IGP, metric 0, localpref 100, valid, internal
54
172.25.13.3 (metric 30720) from 4.4.4.4 (4.4.4.4)
Origin IGP, metric 0, localpref 100, valid, internal, best
r1#
if we look at this in more detail to figure why it choose the next hop route of 172.25.13.3
FOr the prereq both have valid next hop
r1#ping 10.229.254.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.229.254.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 68/68/68 ms
r1#
r1#ping 172.25.13.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.25.13.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/4 ms
r1#
we meet all prerequisites
1)the weight both are 0 so moves on
2)the local preference both are 100 some moves on
3)the networks are coming from another as so not locally originated so onto next
4)both have as path of 1 so goes onto next
5)both origin type are igp (i) so next
6)both metric are 0 so next
7)Both paths are learnt via igp so onto next
8) THis is where it is decided
r1#sh ip route 172.25.13.3
Routing entry for 172.25.13.0/24
Known via "eigrp 1", distance 170, metric 30720, type external
Redistributing via eigrp 1
Last update from 155.0.146.4 on FastEthernet0/0, 01:10:30 ago
Routing Descriptor Blocks:
* 155.0.146.4, from 155.0.146.4, 01:10:30 ago, via FastEthernet0/0
Route metric is 30720, traffic share count is 1
Total delay is 200 microseconds, minimum bandwidth is 100000 Kbit
Reliability 255/255, minimum MTU 1500 bytes
Loading 1/255, Hops 1
r1#sh ip route 10.229.254.1
Routing entry for 10.229.254.0/24
Known via "eigrp 1", distance 90, metric 2172416, type internal
Redistributing via eigrp 1
Last update from 155.0.146.6 on FastEthernet0/0, 00:58:36 ago
Routing Descriptor Blocks:
* 155.0.146.6, from 155.0.146.6, 00:58:36 ago, via FastEthernet0/0
Route metric is 2172416, traffic share count is 1
Total delay is 20100 microseconds, minimum bandwidth is 1544 Kbit
Reliability 255/255, minimum MTU 1500 bytes
Loading 1/255, Hops 1
we have a lower metric to 172.25.13.3 30720 vs 2172416
if we had got passed we could used multipath but since we havent it will not work
r1(config)#router bgp 100
r1(config-router)#maximum-path 2
r1(config-router)#exit
it will not work as the metric are different to next hop
r1#sh 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
*>i11.1.1.1/32 172.25.13.3 0 100 0 54 i
* i 10.229.254.1 0 100 0 54 i
r1#sh ip route 11.1.1.1
Routing entry for 11.1.1.1/32
Known via "bgp 100", distance 200, metric 0
Tag 54, type internal
Last update from 172.25.13.3 00:09:13 ago
Routing Descriptor Blocks:
* 172.25.13.3, from 4.4.4.4, 00:09:13 ago
Route metric is 0, traffic share count is 1
AS Hops 1
Route tag 54
Ok Lets have a look at weight
say we want r4 not to go it directly connected network BB3 instead we want it to go r6 >> BB1
r4(config)#router bgp 100
r4(config-router)#neighbor 6.6.6.6 weight 100
r4(config-router)#exit
r4(config)#exit
r4#sh ip bgp
BGP table version is 2, 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
* 11.1.1.1/32 172.25.13.3 0 54 i
*>i 10.229.254.1 0 100 100 54 i
now r4 is choosing 10.229.254.1 as it next hop
r4#traceroute 11.1.1.1
Type escape sequence to abort.
Tracing the route to 11.1.1.1
1 155.0.146.6 4 msec 0 msec 0 msec
2 10.229.254.1 36 msec * 32 msec
r4#
it is going out r6 then bb1
r4#sh ip route bgp
11.0.0.0/32 is subnetted, 1 subnets
B 11.1.1.1 [200/0] via 10.229.254.1, 00:03:01
r4#
now lets look at the affect on r1
r1#sh ip bgp
BGP table version is 15, 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
*>i11.1.1.1/32 10.229.254.1 0 100 0 54 i
r1#
r1 is now select the route via r6 as it never recieves the route via r4 as
r4 has now choosen the route via R6 it no longer advertise the other route as in BGP we only advertise our best routes
No comments:
Post a Comment