28.06.2014 Views

Discussion

Discussion

Discussion

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

(called longest-match lookup), so the order of the prefixes in the list does not matter.<br />

This is different from how the JUNOS software handles policy evaluation, which is<br />

to look at policy terms and chained policies in order, from beginning to end, and perform<br />

the action immediately when a match occurs.<br />

The then clause in this recipe has a reject action, which rejects the route. When<br />

applying this policy with a set import command, the routes will not be installed into<br />

the routing table. When applying it with a set export command, the routes will not<br />

be advertised to peer routers. The set import command in this recipe applies the policy<br />

to routes received from neighbors in an EBGP peer group, so the routes are not<br />

installed in the inet.0 routing table.<br />

9.4 Filtering Long Prefixes<br />

Problem<br />

You do not want to install IP address prefixes longer than 172.18.20.0/19 in the<br />

routing table.<br />

Solution<br />

Create a filter that identifies the long prefixes:<br />

[edit policy-options policy-statement long-prefixes term 1]<br />

aviva@router1# set from route-filter 172.18.20.0/19 longer<br />

aviva@router1# set then reject<br />

Then apply the policy to an EBGP group:<br />

[edit protocols bgp]<br />

aviva@router1# set group external-group import long-prefixes<br />

<strong>Discussion</strong><br />

A second way to filter routes based on their IP address prefixes is to create a route<br />

list. Unlike prefix lists, route lists are embedded in the routing policy, not maintained<br />

in a separate list, so it can be somewhat harder to maintain them because the<br />

same prefixes may be used in different policies. This recipe creates a simple policy<br />

that an EBGP group uses to reject all incoming prefixes longer than 172.18.20.0/19.<br />

This policy keeps longer prefixes out of the routing table and is somewhat similar to<br />

aggregating routes.<br />

In the recipe, the set from route-filter command defines the prefix (172.18.20.0/19)<br />

and how to match it (longer). The set then command is a simple action clause to<br />

reject matching prefixes. We apply the policy with a set import command to an<br />

EBGP group to prevent BGP from installing the long prefixes into the routing table.<br />

Route lists have two advantages over prefix lists. The first is that route lists match<br />

prefix ranges instead of the exact matching performed by prefix lists. This recipe uses<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.<br />

Filtering Long Prefixes | 293

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!