BGP Route Selection in Junos

22 02 2012

When routers have more than one route to the same destination, they need to go through a route selection process to determine which to use.  Working out why a particular path is being used is sometimes difficult, so knowing how the end result is achieved is useful.  The steps below follow in a top-down way, ending with a final tie-breaker just in case the two routes are equal in all other respects:

1. Route Preference – if there is an OSPF route and a BGP route for the same destination, OSPF is selected since it has a lower preference (10 versus 170). Cisco IOS calls this “Administrative Distance”. You can change these defaults if you want – they are local to the router so will not affect other routers.

2. Local Preference – this is a value received in BGP routes. It defaults to 100, but can be modified. A higher preference wins here, but if the two routes are the same, we move on to step 3.

3. AS Path – The AS path is built up as routes are advertised between autonomous systems.  A shorter path is better because it indicates fewer AS “hops” – i.e. the destination is theoretically closer over a shorter path.

4. Origin – the route’s origin code says whether it originated from an IGP (flagged as I), from an EGP (E) or is unknown (?).  Origin I is most preferred and ? is least preferred.  The thinking behind this is that a route that originated from an IGP is most likely to be accurate whereas ? is less reliable information.

5. MED – Multi-Exit Descriminator is a route attribute that ISP A sends to ISP B to get B to send traffic to A over one particular link (assuming there are two running between them and one is more preferable).  ISP B may ignore this hint and just send traffic down whichever it prefers, of course.  A lower MED is preferred.

6. EBGP over IBGP – if the route is learned via EBGP as well as IBGP, the EBGP one is chosen. The object is to choose the most efficient path to the destination, so if the route is coming from outside, that is probably the best path to choose. EBGP wins here.

7. Lowest IGP cost – if the routes are both learned via IBGP, the one that gets selected is the one with the lowest IGP cost to the destination.

8. Shortest Route Reflection Cluster List – if the routes were received via reflection, the one with the shorted cluster list is picked.  If the route wasn’t received from a route reflector, this step is skipped.

9. Lowest Router ID – the advertising peer with the lowest router-ID wins.  Router ID is normally derived from the loopback address of the router.

10. Lowest peer address – the route received via the lowest peer IP address wins. This step is the final tie-breaker.

If you are receiving two routes for a destination network, you can do a “show route <network> detail” to get more information about those routes.  The “detail” flag will tell you which one is being used, what the origin code is, AS path etc.

Advertisements

Actions

Information

3 responses

17 04 2012
BGP Route Selection in Junos « khurramkhalid

[…] https://dataplumber.wordpress.com/2012/02/22/bgp-route-selection-in-junos/ Share this:TwitterFacebookLike this:LikeBe the first to like this post. Leave a Comment by Khurram Khalid on April 17, 2012  •  Permalink Posted in Uncategorized […]

23 01 2013
Adel

Sorry for disturbance, But the first step is Route Preference this means that
always iBGP is preferred than eBGP.
i cant get it , plz help me
Thanks.

2 04 2014
Rittam Bhattacharya

nope, it is the selection among BGP and any other routing protocol.
IBGP and EBGP altogather considered in a single domain of BGP. the selection among them comes at the 6th step.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: