Monday, August 20, 2012

BGP choosing longer AS_Path as preferred route...

The following network might look familiar if you’re going through the 642-902 book; and, if you are following the reading by configuring the examples in GNS3, you will find an omission which isn’t discussed until several sections later (that discussion does not clarify the problem as there is no mention of a problem with the example… but there is problem!)
 


Note: no influence (PA values, weight, etc) has been made on any routers for best path selection.
The focus is on E1, E2, I3_1 (ISP3), and a route advertised by R5, namely 192.135.250.0/28.

E1 and E2 are iBGP neighbors (using loopback E1: 10.100.1.1/32 and E2: 10.100.1.2/32 as their peering neighbor commands and update-source).


 








 
E1 is getting an eBGP route for 192.135.250.0/28 from I1_1 (ISP1) and an iBGP route from E2. E1 is choosing the eBGP route over the iBGP even though the iBGP has the shortest AS_PATH.

note: next hop 3.3.3.3 is to ISP1; you can also see that the iBGP route has a LocPrf of 100 so that should make it the best no matter what!...wait, wha-what?


Problem:
Now, E1 should choose the route through E2 as the AS_Path is shorter. This path is learned from E2 as an iBGP route (3rd char space is “i") and its next hop is ISP3 or 192.168.1.6. Instead, E1 is choosing 3.3.3.3 as the valid and best route / next hop.

Solution:
The reason why E1 is not choosing the route through E2 is because E1 does not have a route to 192.168.1.6:
 


 
 
 
 
 
 
 
There are several solutions to this; first you could advertise the 192.168.1.4/30 network through your IGP in ASN 11 (Enterprise). Second you could configure BGP on E2 to advertise the route:









 
Or configure E2 to let E1 know that the next-hop is itself (tis my solution):




Now, looking at the bgp table on E1 we can see the new path to 192.135.250.0/28 is through E2 and the next hop to this route is now E2.










The BGP Algorithm chooses the best path in the following order:
1.    Next hop reachability (our problem)
2.    Weight (Cisco proprietary)
3.    LOCAL_PREF
4.    Locally injected (originated path)
5.    AS_PATH length (shortest – as long as the router has a route to the next hop!)
6.    Origin (lowest)
7.    MED (lowest)
8.    Neighbor Type (prefer eBGP over iBGP)
9.    Path w/lowest IGP metric to BGP next hop
10. Oldest path first
11. Route from router w/lowest RID
12.  Path with minimum cluster list length
13. Path from lowest neighbor address


I know, exhausting! Prost!

2 comments:

  1. Thanks, very helpful. I was labbing this up myself and came across same result as yours.

    ReplyDelete
    Replies
    1. Awesome, thanks for taking the time to leave a comment. Cheers!

      Delete