Topology:
SRX-1 @ Site A ------------------ SRX-2 @ Site B
ISP A is terminated at Site A and ISP B teminated at site B with each ISP being backup of other site during failover. Site A and B are physically connected via fiber.
The OSPF Routing Issue
When ISP A @ site A fails the traffic from Site A is routed via OSPF to site B and out this only works if ISP B @ site B is configured as default next hop. If Site B is configured with OSPF as default next hop and traffic is to be routed via Site A OSPF does not work but if OSPF is configured as qualified next hop at site B and deactivating the next hop syntax routes traffic via OSPF.
Configuration
Site A
set protocols ospf traceoptions flag all
set protocols ospf export OSPF-Export
set protocols ospf area 0.0.0.0 interface reth1.34 interface-type p2p
set protocols ospf area 0.0.0.0 interface reth1.34 neighbor 10.1.40.130
set policy-options policy-statement OSPF-Export term 0 from interface reth1.400
set policy-options policy-statement OSPF-Export term 0 from interface reth1.401
set policy-options policy-statement OSPF-Export term 0 from interface reth1.402
set policy-options policy-statement OSPF-Export term 0 from interface reth1.404
set policy-options policy-statement OSPF-Export term 0 from interface reth1.441
set policy-options policy-statement OSPF-Export term 0 from interface reth1.450
set policy-options policy-statement OSPF-Export term 0 from interface reth1.451
set policy-options policy-statement OSPF-Export term 0 from interface reth1.452
set policy-options policy-statement OSPF-Export term 0 then accept
set policy-options policy-statement OSPF-Export term 1 from route-filter 0.0.0.0/0 exact
set policy-options policy-statement OSPF-Export term 1 then accept
set policy-options policy-statement OSPF-Export term 2 then reject
set routing-options static route 0.0.0.0/0 next-hop ISP A
set routing-options static route 0.0.0.0/0 qualified-next-hop 10.1.40.130 preference 8
Site B
set policy-options prefix-list OSPF-IMPORT 10.1.0.0/16
set policy-options policy-statement Inet-Import term 1 from protocol ospf
set policy-options policy-statement OSPF-Export term 0 from interface reth1.320
set policy-options policy-statement OSPF-Export term 0 from interface reth1.330
set policy-options policy-statement OSPF-Export term 0 from interface reth1.340
set policy-options policy-statement OSPF-Export term 0 from interface reth1.350
set policy-options policy-statement OSPF-Export term 0 then accept
set policy-options policy-statement OSPF-Export term 1 from protocol static
set policy-options policy-statement OSPF-Export term 1 from tag 150
set policy-options policy-statement OSPF-Export term 1 then metric 170
set policy-options policy-statement OSPF-Export term 1 then accept
set policy-options policy-statement OSPF-Export term 2 then reject
set routing-instances O1-O2-Int protocols ospf traceoptions flag all
set routing-instances O1-O2-Int protocols ospf export OSPF-Export
set routing-instances O1-O2-Int protocols ospf area 0.0.0.0 interface reth0.34 interface-type p2p
set routing-instances O1-O2-Int protocols ospf area 0.0.0.0 interface reth0.34 neighbor 10.1.40.129
set routing-options static route 0.0.0.0/0 next-hop ISP B ---- Currently working
set routing-options static route 0.0.0.0/0 qualified-next-hop 10.1.40.129 preference 8 --- failover to OSPF
If the above 2 syntax are interchanged and OSPF route is made as a primary for Site B so as to be able to route all traffic via site A routing fails.