16.03.2014 Views

Policy Framework Configuration Guide - Juniper Networks

Policy Framework Configuration Guide - Juniper Networks

Policy Framework Configuration Guide - Juniper Networks

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Chapter 5: Extended Match Conditions <strong>Configuration</strong><br />

In the following example, locally administered AS 2 is connected to AS 1 (10.2.2.6) and<br />

AS 3. AS 3 advertises its routes to AS 2, but the administrator for AS 2 does not want to<br />

advertise AS 3 routes to AS 1 and thereby allow transit traffic from AS 1 to AS 3 through<br />

AS 2. To prevent transit traffic, the export policy only-my-routes is applied to AS 1. It<br />

permits advertisement of routes from AS 2 to AS 1 but prevents advertisement of routes<br />

for AS 3 (or routes for any other connected AS) to AS 1:<br />

[edit policy-options]<br />

null-as "()";<br />

policy-statement only-my-routes {<br />

term just-my-as {<br />

from {<br />

protocol bgp;<br />

as-path null-as;<br />

}<br />

then accept;<br />

}<br />

term nothing-else {<br />

then reject;<br />

}<br />

}<br />

protocol {<br />

bgp {<br />

neighbor 10.2.2.6 {<br />

export only-my-routes;<br />

}<br />

}<br />

}<br />

How AS Path Regular Expressions Are Evaluated<br />

AS path regular expressions implement the extended (modern) regular expressions as<br />

defined in POSIX 1003.2. They are identical to the UNIX regular expressions with the<br />

following exceptions:<br />

• The basic unit of matching in an AS path regular expression is the AS number and not<br />

an individual character.<br />

• A regular expression matches a route only if the AS path in the route exactly matches<br />

regular-expression. The equivalent UNIX regular expression is ^regular-expression$. For<br />

example, the AS path regular expression 1234 is equivalent to the UNIX regular<br />

expression ^1234$.<br />

• You can specify a regular expression using wildcard operators.<br />

Examples: Configuring AS Path Regular Expressions<br />

Exactly match routes with the AS path 1234 56 78 9 and accept them:<br />

[edit]<br />

policy-options {<br />

wellington "1234 56 78 9";<br />

policy-statement from-wellington {<br />

term term1 {<br />

from as-path wellington;<br />

}<br />

Copyright © 2010, <strong>Juniper</strong> <strong>Networks</strong>, Inc.<br />

101

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

Saved successfully!

Ooh no, something went wrong!