Juniper JNCIA-Junos JN0-104 – Section 7: Routing Policy and Firewall Filters
April 26, 2023

74. Routing Policy Overview

Let’s now focus our attention on routing policies. Let’s understand what a routing policy is. And what are the use cases for configuring a routing policy? By default, all routing protocols running on a Junos device will install their routes into the routing table. Routing protocols also advertise a limited set of routes from the routing table, the active routes that were learned by that protocol are advertised to other routers in the network. A routing policy allows you to control the flow of routing information to and from the routing table. In other words, a routing policy allows you to control which routes the routing protocols will store into and retrieve from the routing table. A routing policy can be applied as information enters the routing table and as information leaves the routing table. A routing policy allows you to choose which routes you accept or reject from neighbors running dynamic routing protocols and also to choose which routes you send to neighbors running dynamic routing protocols.

Routing policy also allows you to modify attributes on routes as they enter or leave the routing table. For example, we can change the preference value. Modifying route attributes allows you to control which route is selected as the active route and placed into the forwarding table. So by using a routing policy, we can influence what routes will be added into the routing table. And ultimately, we can also influence what route will be added into the forwarding table because the forwarding table is populated using information from the routing table. Policies that are applied when the routing protocol places, routes into the routing table are called as import policies. This is because routes are being imported into the routing table. So an import policy can change the routes that are available in the routing table and can affect the local route selection process. Similarly, policies applied when the routing protocol is advertising routes that are in the routing table are called as export policies.

The software applies export policies as it exports routes from the routing table to dynamic routing protocols or to the forwarding table. An important thing to keep in mind is that only active routes are available for export. From the routing table. Juneau supplies export policies as it exports routes from the routing table. So any attribute changes will not affect the local routing table. Rather, the software will apply them to the route while exporting it. This means although an export policy can choose which active routes to export and modify the attributes for, it cannot cause the exportation of inactive routes. So why should we create a routing policy, creating a routing policy allows us to control which routes. A protocol will import into the routing table. It also allows us to control which routes. A protocol will export from the routing table. Using a routing protocol allows us to announce active routes. Learn from another routing protocol, which is also sometimes called as route redistribution. Also, using your routing policy, we can manipulate route characteristics such as preference value.

A routing policy can also be used to perform per packet load balancing, and we can also use a routing policy to enable a class of service. So to summarize, here’s the routing table of our Junos device and our Junos device already has routing associations with its neighbors. When the neighbors share routing information with our device, we can apply import policies to decide what routes we want to install into the routing table. Similarly, our device will also send routing information to other neighbors. And that’s when we can apply export policies to decide what routes are going to be exported to our neighbors.

75. Default Routing Policies

Let’s now talk about default routing policies, default routing policies, or applied on incoming or outgoing routes or packets. If there is no explicitly configured policy related to the route or the interface upon which the packet arrives. Understanding the default routing policy is important because it decides the fate of any route that is not matched against any of the user defined policies. Being familiar with the default routing policies also allows us to know when we need to modify them to suit our requirements. A default policy will determine whether the route is placed in or advertised from the routing table. Every routing protocol has a default import policy and a default export policy. The default import policy will decide if it allows routes to be imported into the routing table and the default export policy will decide whether it allows advertising routes from the routing table. Let’s first talk about the default policy for RIP or routing information protocol, the default import policy for RIP is that it will accept all rip routs learned from configured neighbors and it will imported into the eyen it Doxey or routing table. The default export policy is to reject everything this means by default.

The report call will not advertise the routes that it learned to its neighbors. However, if we wanted to do this, we would have to configure and export policy. Let’s talk about the default policy for SPF or open shortest path. First. The default import policy is to accept all SPF roots and import them into the isLAN, see were routing table. An important thing to keep in mind is that the import policy for SPF only applies to external routes. An external route is a route that is outside the O. SPF autonomous system. We talked about autonomous systems earlier. An autonomous system is a collection of routers under a common administrative domain. So the default import policy for SPF, which is to accept all SPF routs, only applies for external routes or routes that are outside our autonomous system. The default export policy is to reject everything or SBF will not export internally learned routes. These are directly connected routes on interfaces running OSP SPF. Let’s talk about the default policy for ISIS or intermediate system, intermediate system.

The default import policy is to accept all ISIS routes and import them into the net. DOD 0 and I need six starts your routing table. We know that the net Dods you routing table is for IPv4 and I next six start 0 is for IPv6. The default export policy for ISIS is to reject everything. Finally, let’s talk about the default policy for BTP or Border Gateway Protocol, the default import policy is to accept all received BTP IPv4 an IPv6 routes, learn from configured neighbors and import them into AYNA 0 and net six start 0 routing table. The default export policy for BTP is different from what we’ve seen so far. So this is an important thing to keep in mind, that by default BGP will re advertise all active BGP routes.

76. Building blocks of Routing Policy

Now that we’ve understood what a routing policy is, let’s talk about the building blocks of routing policies. Let’s understand the components that make up a routing policy. Routing policies are made up of terms. A term is a named structure in which match conditions and actions are defined. Think of it as a configuration in which you would define match conditions and the actions that need to be performed. A routing policy can have one or more terms defined within it. Talking about match conditions. It is criteria against which an incoming or an outgoing route or packet is compared. We can define one or more criteria. If all the criteria match, one or more actions are applied. The terms can also define actions. This defines what will happen when all criteria match and we can configure one or more actions within a term. Let’s talk more about terms, terms are basic building blocks for Junos routing policies. Terms are assigned names. The name has no effect on the evaluation of the term.

 It is only a meaningful identifier. Essentially, a term is an if then statement. If all the match conditions specified in the firm statement are true, all the actions in the then statement are executed. The firm statement is used to match incoming routes. Similarly, we can also define two statements for outgoing routes. That’s like your IF portion. If the if portion is true, meaning if the route has matched the firm statement or to statement, we then move to the then part which defines what actions need to be performed on that route. So structurally it looks like this. We have a routing policy which is made up of four term. The term has a firm statement and event statement. This would apply for an incoming route if it’s an outgoing route. We would have a two statement and event statement if all criteria in the firm statement are matching. Then we execute the actions defined in the then statement. Otherwise, we move to term to. And the same thing applies over here. If all the criteria defined in the first statement have matched, we then evaluate that then statement.

Let’s talk about routing policy evaluation. We start by evaluating the route against the first term in the routing policy, if it matches, the specified action is taken. If they’re configured, action is to accept or reject the route that action is taken. And the evaluation of the route will end. However, evaluation will continue to the next term if the route does not match or if no action has been specified or if the next term action is specified. So let’s see, the route matches the first term in a routing policy. But that term has no action specified. In that case, evaluation will move to the next term. Or let’s say the action specified is next term. In this case, also will move evaluation to the next term. Or let’s say the first term did not match at all. In that case, also will move evaluation to the second term. Following the exact same pattern will evaluate other terms in the routing policy. If the route matches no terms in the routing policy, they accept or reject action specified by the default policy is taken. So this is how evaluation works. So here we have the route and we have the routing policy.

We start with the first term of the routing policy. If it’s a match, it will apply to accept or reject action configured on that term. Now, let’s say this term does not have any action defined or let’s say the action defined is to move to the next term or let’s say term one did not match at all. In all these situations will move evaluation to term. Again, if that is a match will apply to accept or reject action. Let’s say it’s not a match, and let’s say that is the last term in the routing policy. In that case will apply the action defined in the default policy. Now, let’s see what a routing policy looks like. We start with a policy statement in this case, the name of the policy is my policy. Make a note. We have two terms defined over here. The first term is called except direct routes. And the second term is called reject rip routs. Both the terms have from and then statements. This means we will try to match incoming routes using this policy. The firm statement of the first term matches the protocol direct and the interface G. 0 0 0. If that’s true, then the action is to accept. The second term reject rip roots matches only the protocol, which is rip, and the action is to reject.

Note that the policy itself does not define whether it’s going to be an import policy or an export policy. That depends on how we can figure it. Now, let’s talk about routing policy, match conditions. Each term in a routing policy can include two statements from and two to define the conditions that a route must match for the policy to apply. In the firm statement, you defined criteria that an incoming route must match. If you define more than one criteria, they must all match the root for it to be considered as a match. Meaning if you define more than one criteria, like the example we saw earlier, where we wanted to match the protocol and the interface. So when you defined more than one criteria, they must all match for the root to be considered as a match. The firm statement is optional. If you omit the firm statement, all routes will be considered to be a match.

All routes will then take the configured actions of the policy term because they all will be considered as a match. Similarly, in the two statement, you can define criteria that an outgoing route must match. If more than one criteria is matched, they must all match the route for a match to occur. Just like the firm statement, the two statement is also optional. Now, let’s talk about the actions each term in a routing policy can include a then statement which defines the actions to take. If the route matches all the conditions or criteria. The then statement may include one or more actions. There are three types of actions that we can configure flow control actions. These decide whether to accept or reject the route and whether to evaluate the next term or next routing policy. Then we have actions that can be used to manipulate route characteristics, for example, preference value. And then we have trace actions and these are used to log root matches. Like we understood earlier, that then statement is optional. If we admit that the following will occur. The next term in the routing policy, if one present is evaluated. If there are no more terms in the routing policy, the next routing policy, if present, will be evaluated. If there are no more terms or routing policies, the accept or reject action specified by the default policy will be taken.

Leave a Reply

How It Works

img
Step 1. Choose Exam
on ExamLabs
Download IT Exams Questions & Answers
img
Step 2. Open Exam with
Avanset Exam Simulator
Press here to download VCE Exam Simulator that simulates real exam environment
img
Step 3. Study
& Pass
IT Exams Anywhere, Anytime!