Junos OS

Expand all | Collapse all

ROUTE-LIST longest match in routing policy

Jump to Best Answer
  • 1.  ROUTE-LIST longest match in routing policy

    Posted 06-21-2017 09:17

    HI everyone,

     

    I am trying to learn how the " order " does not matter when using Route-list in import routing policy ( assuming different prefix ).

     

    Please consider the following Policy:

     

    MISSY-PIC.PNG

    Our toplogy:

     

    R5 (200.200.200.50)-----200.200.200.4 em0.200 JUN4

     

    R5: Cisco router, running RIP Ver2 with Juniper JUN4, it is advertsining 2.2.2.0/24. 5.5.5.0/24, 50.50.50.0/24

     

     

    We will apply the above policy as IMPUT POLICY TO RIP on JUN4,  but before we apply the policy, routing table on JUN4 is:

    Capture45.PNG

     

    Above we can see all the RIP routes.

     

    Next we apply the policy " MISSY" as  an IMPORT POLICY to RIP on JUN4

    Capture46.PNG

     

    We expect only single RIP route 5.5.5.0/24 based on IMPORT POLICY MISSY, however we do not see any RIP routes:

    Capture47.PNG

     

    If we remove the policy, we see all the rip routes:

     

     

    Capture50.PNG

     

    Based on Juniper doc, longest match term will be evaluated first which is TERM2 here but we do not see this here.

     

    What am i missing?

     

    Thanks and have a nice day!!

     

     

     

     

     

     

     

     

     

     



  • 2.  RE: ROUTE-LIST longest match in routing policy

     
    Posted 06-21-2017 09:33

    Hi, 

     

    Policies are evaluated sequentially, i.e 1st term, 2nd, 3rd and so on if preceeding terms are not matched.

    Whether the next term is evaluated also depends on the action of a matched term. Example for accept and reject actions no further terms are evaluated, but an action of next-term does:

     

    https://www.juniper.net/documentation/en_US/junos/topics/usage-guidelines/policy-configuring-actions-in-routing-policy-terms.html

     

    In this case, once term 1 is matched routes 5.5.0.0/16 are rejected and exits policy, term 2 is not processed.

     

    Hope this helps.

     

    Cheers,

    Ashvin



  • 3.  RE: ROUTE-LIST longest match in routing policy

    Posted 06-21-2017 09:54

    Thanks Ashvino!!

     

    This is excatly I see as well but I am confused when I read following:

    https://www.juniper.net/documentation/en_US/junos/topics/usage-guidelines/policy-configuring-route-lists-for-use-in-routing-policy-match-conditions.html

     

    How Prefix Order Affects Route Filter Evaluation

    The order in which the prefixes are specified (from top to bottom) typically does not matter, because the policy framework software scans the route filter looking for the longest prefix during evaluation. An exception to this rule is when you use the same destination prefix multiple times in a list. In this case, the order of the prefixes is important, because the list of identical prefixes is scanned from top to bottom, and the first match type that matches the route applies.

     

    I am also reading a book " JUNOS ENTERPRISE ROUTING" which says the same thing but my lab does not corroborate that or I am missing something here.

     

    Have a nice day!!

     

     



  • 4.  RE: ROUTE-LIST longest match in routing policy
    Best Answer

    Posted 06-21-2017 10:12

    inside a "from" statement with multiple route-filter the prefix length is evaluated, but not between different terms.

    you interpreted the information wrong

     

    regards

     

    alexander



  • 5.  RE: ROUTE-LIST longest match in routing policy

    Posted 06-21-2017 10:27

    Great, that was my hunch but you made it real clear.

     

    Much appreciated!!



  • 6.  RE: ROUTE-LIST longest match in routing policy

    Posted 06-21-2017 10:16

    I think  I am missing something:

     

    Terms with in a policy are evaluated in sequential orderm if a term contains multiple " route-filter" then longest match from that term will be used for matching criteria .

     

    Policy TEST

    term 1 from route-filter 10.10.0.0/16

                 from route-filter 10.10.10.0/24

                 then accept

     

    term2 from route-filter 10.10.10.10/32

               f then reject

     

    If we apply the above policy as IMPORT, a prefix 10.10.10.0/24 will be first matched against term1 because it is listed first, with in that term, longest match is picked for comparison which route-filter 10.10.10.0/24 which matches the prefix 10.10.10.0/24 so it a match,

     

    I see the above behavior when I labbed it up.

     

    Thanks