O'Reilly logo

JUNOS Cookbook by Aviva Garrett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

9.1. Creating a Simple Routing Policy

Problem

You want to advertise configured static routes to adjacent OSPF neighbors, going beyond the OSPF default of advertising only the routes learned from an OSPF neighbor.

Solution

To modify the route advertisement behavior, create and apply a routing policy. First, create the policy:

	[edit]
	aviva@router1# set policy-options policy-statement send-statics term 1 from protocol
	static
	aviva@router1# set policy-options policy-statement send-statics term 1 then accept

Then, apply it to OSPF:

	[edit]
	aviva@router1# set protocols ospf export send-statics

Here's what the policy looks like in the configuration:

	[edit]
	aviva@router1# show
	policy-options {
	    policy-statement send-statics {
	         term 1 {
	              from protocol static;
	              then accept;
	         }
	    }
	}
	protocols {
	     
ospf {
	         export send-statics;
	    }
	}

Discussion

From a structural point of view, this routing policy is very straightforward and illustrates the basic components of how to configure a policy. The JUNOS policy language is similar to standard programming languages or pseudocode, so you can read through the show output in this recipe to get the gist of the policy. If you are not a programmer, you can read the policy language as if it were a paragraph written in an outline format. Looking through the show output in this recipe, you see it creates a policy named send-statics that looks for static routes and accepts them. OSPF applies the policy to routes it advertises to its OSPF neighbors. Rephrased, this recipe allows ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required