Jaycee's Networking

November 6, 2009

Decision of BGP Path Selection on IOS and JUNOS

Filed under: BGP, IOS — Tags: , , — Jaycee @ 11:02 am

BGP Path Selection Process Decision Steps



Next-Hop accessible/resolvable (mandatory
By default, the NEXT-HOP is changed for EBGP and is unchanged for iBGP.


The NEXT-HOP identifies the EBGP speaker in the adjoining AS, and IGP will not carry this route, thereby leading to an unreachable next hop.


BGP process expects the IGP to have a copy of each route before that route can be advertised by BGP. This is why disabling synchronization is the 1st step in IOS configuration.


Weight (Influences OUTBOUND traffic, but apply on inbound). This is Cisco proprietary parameter given to a route on a particular router and is used only within that router. The weight is never given to other routers.


*Default weight = 0, except for locally sourced routes which get a default weight = 32,768. The maximum weight is 65,535.

*Weight value => the higher the better.


Local Preference (Influences OUTBOUND traffic,
but apply on inbound).
(discretionary attribute)


Local preferences are shared among iBGP routers, but they are NOT shared with external BGP routers.


*Default Local_PREF = 100.

*Local_PREF value => the higher the better.


BGP routes prefer routes that originate inside their own AS. That is, to choose the route that originated with BGP on this router.
AS Path (Influences INBOUND traffic, but apply on outbound). (mandatory
By default, BGP discards any route advertisement that contains its local AS number in the AS path to prevent routing loop. For routes that originate outside of the AS, BGP will prefer the one with the shortest path.
Origin. (mandatory attribute)


ORIGIN has 3 values:

0 = IGP, 1 = EGP, 2 = Incomplete

BGP selects IGP routes in preference to EGP, and EGP in preference to INCOMPLETE routes. An INCOMPLETE route is one that is injected into BGP via redistribution.

*Origin value => the lower the better.

MED (Influences INBOUND traffic, but apply on outbound). (nontransitive attribute)


Use MED to tell your ISPs which of several entrances to your
network they should use. You should use MED values ONLY IF you are multihomed to a single provider. MED values are ONLY propagated to adjacent ASes, so routers that are further downstream don’t see them at all.

MED is used by the local AS to influence the routing decisions in an adjacent AS for traffic that is inbound to the local AS. BGP selects the route with the lowest MED value. MED actually leaves your AS and tells your neighbor routers which link we want them to talk to.


*Default MED = 0.

*MED value => the lower the better

MED is used ONLY if both routes are received from the same AS, or if the command “bgp always-compare-med” has been enabled.


With “bgp always-compare-med” enabled, BGP will compare MED values even if they come from different ASes, although to reach this step the AS_PATHs must have the same length. You should use this command throughout the AS or you risk creating routing loops.



BGP prefer the paths learned using EBGP over paths learned using iBGP to eliminate loops.

EBGP AD = 20 is lower than other IGP because it should go out of the AS instead of staying in AS.


iBGP AD = 200 is higher than other IGP because if it¡¯s an internal route, it should use internal IGP.

BGP default protocol preference = 170
IGP Cost


BGP prefers paths with the lowest IGP metric.

a. Make sure disabling synchronization.


b. Choose the routes with the lowest IGP administrative distance.

a. Examine route tables inet.0 and inet.3 for the BGP next hop, and then install the physical next hop for the route with the better preference.


b. For preference ties, install the physical next hop found in inet.3.

c. For preference ties within the same route table, install the physical next hop where the greater number of equal-cost paths exists.

Peering/Ages of the routes
BGP will look at the ages of the routes and use the oldest route to particular destination for stability.
Router ID A router’s ID is the IP address assigned to the loopback interface or the highest IP address on an active interface at boot time.


*Router ID => the lower the better


1 Comment »

  1. when you redristribute routes in BGP on Junos; the origin code behaviour is different than Cisco

    Comment by bhuban — September 5, 2013 @ 6:12 am

RSS feed for comments on this post. TrackBack URI

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

Blog at WordPress.com.

%d bloggers like this: