Default Routing Policy Match Actions in Junos

By Walter J. Goralski, Cathy Gadecki, Michael Bushong

What happens if the incoming route does not match any of the terms in a match condition? As you might imagine, a default action is taken. Thus, it is necessary to be familiar with the default actions.

Examine this policy:

[edit policy-options]
policy-statement my-sample-policy {
  term my-first-term {
   from protocol bgp;
   then accept;

In this example, if the route was learned via BGP, it’s accepted. However, if you assume the route is rejected if it’s not learned via BGP . . . well, you’d be wrong.

If a route doesn’t match any of the configured terms, a default action is taken. The default action depends on where the routing policy is applied and what protocol is involved in the routing information.

Each routing protocol has its own default policy, so the default action depends on which protocol (or protocols) the policy is applied to. The default action also depends on whether the policy is applied to routes being imported (brought into the routing table) or exported (advertised from the routing table). Table 14-3 summarizes the default actions tied to some routing protocols.

Protocol Default Action
RIP Import: Accept all routes received on RIP-enabled interfaces.
Export: Do not export any RIP routes.
OSPF Import: Policies can’t be used for imported routes.
Export: Export all routes learned via OSPF and all direct routes
associated with the OSPF-enabled interfaces.
BGP Import: Accept all routes learned from BGP neighbors. Export:
Export all active routes learned via BGP to all BGP neighbors.

Notice that the default action can only be accept (allow/advertise) or reject (disallow/suppress). The default action must be a terminating action to ensure that all routes reach some definitive conclusion. That is, all routes are eventually either accepted or rejected (this is a good thing).