SRX

 View Only
  • 1.  Change BGP route preference?

    Posted 04-15-2025 14:47
    Edited by JOHN MUNOZ 04-15-2025 15:10

    I just established BGP with my ISP but I have also had a "direct connect" to AWS.  Testing a route to AWS it looks like it's using my ISPs route instead of my direct connect (it's showing up first in the show route command).   I'm still trying to learn the intricacies of BGP routing.  I always figured that the router would choose the best route.  Do I need to set an administrative distance to force my preferred route?   Could I possibly be missing a configuration that's keeping the SRX from seeing the best paths?   Im seeing in the AS Path, my direct connect has 4 entries and the ISP only has 3.  

    SRX-1> show route 18.232.0.0

    inet.0: 995065 destinations, 1007602 routes (994898 active, 4031 holddown, 0 hidden)

    + = Active Route, - = Last Active, * = Both

    18.232.0.0/14      +[BGP/170] 00:28:32, localpref 100

                          AS path: 14xxx 16509 14618 I, validation-state: unverified

                        >  to x.x.x.x via xe-0/0/17.0

                       -[BGP/170] 1w1d 23:27:48, MED 10, localpref 100

                          AS path: 7224 7224 16509 14618 I, validation-state: unverified

                        >  to y.y.y.y via ge-0/0/15.1



    ------------------------------
    JOHN MUNOZ
    ------------------------------



  • 2.  RE: Change BGP route preference?

    Posted 04-15-2025 18:56
    1. You see that the best route (the first one) is he best because it has the shortest AS-Path (3 AS)
    2. You don't want to change the preference (admin distance) of the BGP route. You want to change the local-pref of the route.
    3. When you create a BGP inbound policy for the routes, you usually make sure that you prefer the routes using the following scheme, from the best to the worst (with localprefs we use here –for reference – enclosed in brackets):
      1. internal platforms [40000]
      2. customers [900]
      3. private peering [300]
      4. public peering [200]
      5. transit [100 / which is the default value]
      6. backup-only links [50]
    4. localpref is 100 by default, update to local-pref 300 the routes received from your private link with AWS.


    ------------------------------
    Olivier Benghozi
    ------------------------------



  • 3.  RE: Change BGP route preference?

    Posted 19 days ago

    As per Olivier feedback you do not change the admin distance, but the local-pref

    this is how you can do it

    define a policy....

    set policy-options policy-statement AWS-DIRECT term AWS-DIRECT-ROUTE from neighbor y.y.y.y

    set policy-options policy-statement AWS-DIRECT term AWS-DIRECT-ROUTE then local-preference 200

    set policy-options policy-statement AWS-DIRECT term AWS-DIRECT-ROUTE then accept

    set policy-options policy-statement AWS-DIRECT term DEFAULT then accept

    apply to your AWS group

    set protocols bgp group AWS-DX import AWS-DIRECT

    -------------------------------------------



  • 4.  RE: Change BGP route preference?

    Posted 19 days ago

    "I always figured that the router would choose the best route."

    That's exactly what the router does, it's just that the selection criteria isn't based on what you think is the best route but a set of "rules":

    https://www.juniper.net/documentation/us/en/software/junos/vpn-l2/bgp/topics/concept/routing-protocols-address-representation.html#id-10119586__d4e365

    This is, by the way, valid for most (if not all) routing platforms, regardless of vendor. Also, the above is only for BGP routes as direct, static, OSPF routes with a lot of other origins will have a more preferred route preference. That means that if you havve an OSPF route to 10.0.0.0/24 and a BGP route to the same prefix, OSPF wins. On the other hand, prefix length always wins, so a BGP route to 10.0.0.0/25 wins over an OSPF route to 10.0.0.0/24. The order is this (well, roughly):

    Prefix lenth

    Route preference (https://www.juniper.net/documentation/us/en/software/junos/routing-overview/bgp/topics/concept/routing-protocols-default-route-preference-values.html)

    Protocol specific selection criteria

    I hope this helps!

    -------------------------------------------