Routing
Highlighted
Routing

OSPF external routes - changing the preference with import policy

‎09-21-2017 07:56 AM

I am trying to change the preference of an OSPF external route so that the BGP route is prefered. I do not want to change the preference of all external routes.

 

[edit policy-options policy-statement ospf-import]
lab@r2-srx210# set then preference 200

[edit policy-options policy-statement ospf-import]
lab@r2-srx210# show
from {
route-filter 172.16.1.1/32 exact;
}
then {
preference 200;
accept;
}

 

[edit]
lab@r2-srx210# show protocols ospf
import ospf-import;
area 0.0.0.0 {
interface fe-0/0/2.0 {
interface-type p2p;
}
interface lo0.0 {
passive;
}
}

 

 

[edit]
lab@r2-srx210# run show route 172.16.1.1

inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

172.16.1.1/32 *[OSPF/150] 00:08:54, metric 0, tag 0
> to 10.0.0.1 via fe-0/0/2.0

 

Does this action have no affect?

JNCIE-ENT #552, JNCSP-ENT, JNCIP-SEC, JNCIP-SP, JNCIP-DC, JNCDS-DC, JNCDS-SEC, JNCDS-SP, CCNP, CCDA
2 REPLIES 2
Highlighted
Routing

Re: OSPF external routes - changing the preference with import policy

‎09-21-2017 09:54 AM

Hi,

 

I don't think you can change specific external route preference in OSPF. You can change overall by external-preference under protocol ospf hierarchy.

However i will check if we can do some trick.

 

HTH

Highlighted
Routing

Re: OSPF external routes - changing the preference with import policy

‎09-22-2017 01:23 PM

Hi,

 

The other option is to lower down the BGP preference for this particular prefix.

 

set policy-options policy-statement xyz from protocol bgp
set policy-options policy-statement xyz from route-filter 172.16.1.1/32 exact
set policy-options policy-statement xyz then preference 100
set policy-options policy-statement xyz then accept

 

 

[KUDOS PLEASE! If you think I earned it!

If this solution worked for you please flag my post as an "Accepted Solution" so others can benefit..]

Feedback