Routing

Expand all | Collapse all

Local preference atribute

  • 1.  Local preference atribute

    Posted 12 days ago
    Given this article:

    Example: Configuring BGP Local Preference

    If the local preference is modified on R3 and iBGP send local preference to all iBGP neighbours, does this mean that under default condition with only local preference altered to 300, if R2 will want to send traffic to R4, does this mean it will follow the following path to R4 : R2 -> R1 -> R3 -> R4?

    Thanks you.


    ------------------------------
    ALEXANDRU MINZAT
    ------------------------------


  • 2.  RE: Local preference atribute

     
    Posted 12 days ago
    The key to understanding here is the first word LOCAL preference.

    The node and the node alone sets and uses local preference.  This is NOT part of what is advertised to neighbors either iBGP or eBGP.  

    Local preference is used only by the local host to influence how it selects egress route choice.

    ------------------------------
    Steve Puluka BSEET - Juniper Ambassador
    IP Architect - DQE Communications Pittsburgh, PA (Metro Ethernet & ISP)
    http://puluka.com/home
    ------------------------------



  • 3.  RE: Local preference atribute

    Posted 10 days ago
    Hello,

    We know that local preference is local to the AS, and it wont leave the AS, so it is specific to iBGP peers.
    Since R3 have iBGP sessions with R1 and R2, it will advertise the routes received from R4 to both R1 and R2 since it is full mesh.
    If I check the best route selection algorithm:

    1. Verify that the next hop can be resolved.
    2. Choose the path with the lowest preference value (routing protocol process preference).

      Routes that are not eligible to be used for forwarding (for example, because they were rejected by routing policy or because a next hop is inaccessible) have a preference of –1 and are never chosen.

    3. Prefer the path with higher local preference.

    Since both iBGP and eBGP have the same route preference value of 170 and it is the same it will move to the 3rd tiebreaker which is local preference, where R3 have the highest one = 300, and it should be chosen as the best path.
    So R2 will see as the best path R2 -> R1 -> R3 -> R4.

    Am i missing something?

    ------------------------------
    ALEXANDRU MINZAT
    ------------------------------



  • 4.  RE: Local preference atribute

    Posted 12 days ago

    I understand local preference is local to the AS in which it is configured.... and so is advertised to all local i-bgp peers...

    https://www.juniper.net/documentation/us/en/software/junos/bgp/topics/ref/statement/local-preference-edit-protocols-bgp.html
    "The LOCAL_PREF path attribute always is advertised to internal BGP peers and to neighboring confederations. It is never advertised to external BGP peers."

    Also, a router will chose ebgp learned paths over ibgp learned paths.

    So it seems that if R2 is learning about reachability to R4 via ebgp between AS 123 and AS 4... and R2 is also learning about R4 reachability via it's local ibgp sessions.... R2 will choose its ebgp learned path, and so the local pref you mention is not regarded at all

    https://www.juniper.net/documentation/en_US/junos/topics/topic-map/bgp-route-preference.html#jd0e506
    "...Junos OS always prefers EBGP routes over IBGP routes"




    ------------------------------
    Aaron Gould
    Senior Network Engineer
    aaron@gvtc.com
    https://www.linkedin.com/in/agould123/
    ------------------------------



  • 5.  RE: Local preference atribute

    Posted 10 days ago
    Hello,

    We know that local preference is local to the AS, and it wont leave the AS, so it is specific to iBGP peers.
    Since R3 have iBGP sessions with R1 and R2, it will advertise the routes received from R4 to both R1 and R2 since it is full mesh.
    If I check the best route selection algorithm:

    1. Verify that the next hop can be resolved.
    2. Choose the path with the lowest preference value (routing protocol process preference).

      Routes that are not eligible to be used for forwarding (for example, because they were rejected by routing policy or because a next hop is inaccessible) have a preference of –1 and are never chosen.

    3. Prefer the path with higher local preference.

    Since both iBGP and eBGP have the same route preference value of 170 and it is the same it will move to the 3rd tiebreaker which is local preference, where R3 have the highest one = 300, and it should be chosen as the best path.
    So R2 will see as the best path R2 -> R1 -> R3 -> R4.

    Am i missing something?

    ------------------------------
    ALEXANDRU MINZAT
    ------------------------------



  • 6.  RE: Local preference atribute

    Posted 10 days ago
    Alexandru...You are correct in your understanding.  Since R4 is peered to R2 and R3, they each receive the same routes that R4 is sending.  But you may want to favor the path via R3 to R4(for whatever reason), so how you force traffic to forward accordingly is to set the local preference higher via an import policy on R3 for routes from R4, and then when R3 announces those routes to the iBGP peers, they will receive the routes w/ the modified LP (300 in your example above).  When R2 looks in it's routing table, it'll see a path via R4 directly or via R3.  B/c the path via R3 has a higher LP, R2 will choose that path.


  • 7.  RE: Local preference atribute

    Posted 9 days ago
    Hi,

    Thank you for the answer, I was looking at that setup and was wandering what will happen in the rest of the network (not necessarily a real life example)

    ------------------------------
    ALEXANDRU MINZAT
    ------------------------------