Junos Routing Policy and Firewall Filter Practice

Free Junos practice for the JNCIA-Junos, JNCIS-SP, JNCIP-SP and JNCIP-ENT exams: find the route-filter line that matches, follow a route through a policy chain, and say what a firewall filter does with a packet. Check my answer names the slip, such as trusting a shorter prefix or forgetting the implicit discard.

Check your answer to see the working.

Route filters follow default Junos behavior, without the walkup feature. Policy names, prefixes and packets are made up for practice.

Practise the exams

Routing policy and firewall filters are an exam objective of JNCIA-Junos (JN0-106), and the JNCIS-SP, JNCIP-SP and JNCIP-ENT objectives each list routing policy for OSPF, IS-IS or BGP. Start with the free real exam questions, then get the full pack.

JNCIA-Junos JN0-10698 real exam questions · US$39
Free: 24 questionsGet the full pack
JNCIS-SP JN0-36469 real exam questions · US$39
Free: 18 questionsGet the full pack
JNCIP-SP JN0-66496 real exam questions · US$39
Free: 24 questionsGet the full pack
JNCIP-ENT JN0-650106 real exam questions · US$39
Free: 25 questionsGet the full pack

Junos policy FAQ

How does Junos pick which route-filter line to evaluate?

In two steps. First it does a longest-match lookup that looks only at the prefix and prefix length of each line, not the match type. Then it checks the match type of that one line, and the route filter stops there even if the match type fails. Juniper's example: with 192.168.0.0/16 orlonger and 192.168.254.0/23 exact in one term, the route 192.168.254.0/24 does not match. The /23 is the longest prefix, a /24 is not an exact /23, and the /16 line is never tried.

What is the difference between exact, longer and orlonger?

All three need the route to share the leading bits of the prefix. exact also needs the same prefix length, longer needs a greater prefix length, and orlonger takes an equal or greater one. In Juniper's table for 192.168/16, the route 192.168.0.0/16 matches exact and orlonger but not longer, and 192.168.4.0/24 matches longer and orlonger but not exact.

What do upto and prefix-length-range match?

Both take a range of prefix lengths under the prefix. upto sets only the upper limit, so 192.168/16 upto /24 matches prefix lengths from /16 through /24. prefix-length-range sets both limits, so 192.168/16 prefix-length-range /18-/20 matches /18, /19 and /20 only. In Juniper's table 192.168.0.0/17 matches the upto line but not the range, and 192.168.5.4/30 matches neither.

Does the order of route-filter lines matter?

Usually not, because Junos looks for the longest prefix wherever it sits in the list. The exception is the same prefix listed more than once: those lines are scanned from top to bottom and the first match type that matches applies. Juniper's example lists 0.0.0.0/0 upto /7, then upto /24, then orlonger, so 0.0.0.0/0 takes the first line, 0.0.0.0/8 the second and 0.0.0.0/25 the third.

What if a route-filter line has its own action?

An action written on the route-filter line is taken immediately after the match, and the then statement is not evaluated. If the matching line has no action, the action in the then statement is taken. If the route filter does not match, Junos evaluates the next term or the next policy, and finally takes the default policy's action.

What is the difference between next term and next policy?

next term skips to the next term in the same policy. next policy skips all remaining terms of the current policy and goes to the first term of the next one. In both cases any accept or reject in the same then statement is skipped. When a term matches and has no flow control action, the default is next term, or next policy if it was the last term.

When does the default routing policy apply?

Only when the route reaches the end of the last policy without an accept or reject. Then the protocol's default policy decides. In Juniper's table the default export policy for RIP, OSPF and IS-IS is to reject everything, while the default import policy for BGP and RIP accepts the routes learned from configured neighbors.

In what order does a firewall filter evaluate its terms?

In the order they are configured, starting with the first term. A packet matches a term only when it matches all the conditions in that term, and a term with no match conditions matches every packet. When a matching term has no next term action, evaluation ends at that term and no later term is examined.

What is the implicit discard in a firewall filter?

If a packet does not match any term, the device discards it. Juniper describes this as an implicit discard action at the end of every firewall filter, equal to a final term with then discard. To accept everything the filter does not discard, add a last term with then accept.

What happens when a term only counts the packet?

The packet is accepted. Every nonterminating action, such as count, includes an implicit accept that is carried out when the term has no terminating action. A matching term with no actions at all also accepts the packet. accept, discard and reject are terminating actions: discard drops the packet silently and reject returns an ICMP message.

Which exams cover this?

JNCIA-Junos (JN0-106) has an exam objective named Routing Policy and Firewall Filters, which lists default routing policies, routing policy flow, policy match types and actions, and filter terms, match criteria and actions. JNCIS-SP (JN0-364) lists routing policy application under OSPF, IS-IS and BGP. JNCIP-SP (JN0-664) asks you to implement OSPF, IS-IS and BGP routing policy, and JNCIP-ENT (JN0-650) to implement BGP routing policy.

Sources

Checked 20 November 2026 against Juniper's Junos OS routing policy and firewall filter documentation and the current exam objectives.

More free tools

All free tools