[j-nsp] Changing preference value in generate statement

Julian Cowley julian at lava.net
Wed May 18 03:05:26 EDT 2005


Hi folks,

We are configuring our network to be more resilient in the case
of upstream interface (or BGP) failure.  We are multi-homed to two
providers, each one on its own Juniper.  Both these Junipers announce
default routes to the rest of our network (i.e., there are two default
routes in the normal case).

If an upstream goes down, we want the Juniper it is attached to to
continue to send out a default route.  (The reason for this is so
that a default route still exists even if both providers are down.)
Internally, the next hop for the default route would be the other
Juniper.

The problem we are facing is how to set this up reliably.  From reading
about the generate statement, each active route in the routing table is
run through the configured policy (if any) for the generate statement,
and one route is chosen from the accepted routes as the primary or
preferred contributor route.  This is all well and good.  However,
we want the BGP routes from our upstreams to take precedence over
the default route seen from the peer Juniper, which is over OSPF.

The docs say that the primary contributor route is chosen from the
contributor routes first by route preference, which means that OSPF
(10 or 150) is chosen over BGP (170).  The docs also say that you
can modify the preference: "if the contributor is accepted, the
policy can modify the default preferences".  What we will be doing
is setting the OSPF with a preference that is higher than BGP (say,
to a value of 200).

The question is, does this actually do what we are expecting?  That is,
can we change the preference of the OSPF routes to be higher than
the BGP routes, and then the BGP routes will be preferred?  Also,
changing the preference in the policy would not change the preference
for the route in the routing table, right?

Here is a snippet of the configuration that we're considering using.
We tried running this through a "test policy" statement, but the routes
don't show the effect of any preference we put on them (it appears
to show the regular routing table instead).  Furthermore, we can't
test the default route since the OSPF default route is not active.

routing-options {
     generate {
         route 0.0.0.0/0 policy if-upstream-routes-exist;
     }
}
policy-options {
     policy-statement if-upstream-routes-exist {
         term provider-routes {
             /* This is the address of one of our upstream BGP peers.
                Our other Juniper has a similar configuration. */
             from next-hop AAA.BBB.CCC.DDD;
             then accept;
         }
         term from-juniper-peer {
             from {
                 protocol ospf;
                 route-filter 0.0.0.0/0 exact;
             }
             then {
                 preference 200;
                 accept;
             }
         }
         term all-other-routes {
             then reject;
         }
     }
}

-- 
The question is, "What is the question?"  That is the question of what the
question is, isn't it?


More information about the juniper-nsp mailing list