Routing

Expand all | Collapse all

Setting local preference for BGP routes

Jump to Best Answer
  • 1.  Setting local preference for BGP routes

    Posted 06-23-2020 08:30

    Hello Guys,

     

    I hope someone can help me. I have got a Cisco background and having to do some work on Juniper.I am trying to setup local preference on selected routes which I am receiveng from an external neighbour. So on Cisco my cnfiguration is like this

     

    router bgp 65000
    
    neighbor 192.168.12.2 remote-as 65001
    neighbor 192.168.12.2 route-map LOCALPREF in
    
    ip access-list standard LOC_PREF_SUBNETS
    permit 10.38.0.0 0.0.255.255 log
    permit 10.39.0.0 0.0.255.255 log
    permit 10.22.254.0 0.0.0.255 log
    
    route-map LOCALPREF permit 10
    match ip address LOC_PREF_SUBNETS
    set local-preference 120
    route-map LOCALPREF permit 20
    
    

    Does anyone know how I can convert these set of commands to Juniper.

     

    Thanks



  • 2.  RE: Setting local preference for BGP routes
    Best Answer

     
    Posted 06-23-2020 08:44

    Hello jam,

     

    you can use this config:

     

    [edit]
    policy-options {
      policy-statement SET-HIGHER-LOCALPREF {
        term 1 {
              from {
                 route-filter 10.38.0.0/16 exact;
                 route-filter 10.39.0.0/16 exact;
                 route-filter 10.22.254.0/24 exact;
                   }
            then {
                local-preference 120;
                accept;
            }
       }
       term 2 {
         then accept;
        }
      }
    }
    
    [edit protocols bgp]
    group EBGP-NEIGHBOR {
        type external;
        neighbor 192.168.12.2 {
            import SET-HIGHER-LOCALPREF;
            peer-as 65001;
     }
    }


  • 3.  RE: Setting local preference for BGP routes

     
    Posted 06-23-2020 09:09

    Fighter rightly converted the config in a jiffy, I am pasting the 'set' format of the same config:
    Please note that you should be in the configuration mode to make these changes, you can enter "configure" from JunOS cli to enter this mode:

     

    set policy-options policy-statement SET-HIGHER-LOCALPREF term 1 from route-filter 10.38.0.0/16 exact
    set policy-options policy-statement SET-HIGHER-LOCALPREF term 1 from route-filter 10.39.0.0/16 exact
    set policy-options policy-statement SET-HIGHER-LOCALPREF term 1 from route-filter 10.22.254.0/24 exact
    set policy-options policy-statement SET-HIGHER-LOCALPREF term 1 then local-preference 120
    set policy-options policy-statement SET-HIGHER-LOCALPREF term 1 then accept
    set policy-options policy-statement SET-HIGHER-LOCALPREF term 2 then accept
    set protocols bgp group EBGP-NEIGHBOR type external
    set protocols bgp group EBGP-NEIGHBOR neighbor 192.168.12.2 import SET-HIGHER-LOCALPREF
    set protocols bgp group EBGP-NEIGHBOR neighbor 192.168.12.2 peer-as 65001

     

     hit Kudos if you think its cool, accept as a solution if it works for you.

     

    //Nex



  • 4.  RE: Setting local preference for BGP routes

    Posted 06-23-2020 09:36

    Hello   and