28.06.2014 Views

Discussion

Discussion

Discussion

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

the community string from the route, no action is taken and evaluation automatically<br />

continues with the send-statics policy, which has an accept action to terminate policy<br />

evaluation.<br />

When chaining policies together in this way, make sure that the last policy in the<br />

chain has a terminating action (either then accept or then reject). One trick for<br />

ensuring that there’s always a terminating action is to create a policy that is nothing<br />

more than the action itself and place it at the end of the chain:<br />

[edit policy-options policy-statement final-accept]<br />

aviva@router1# set then accept<br />

[edit protocols bgp group external-group]<br />

aviva@router1# set export [ block-private remove-communities send-statics finalaccept<br />

]<br />

You would no longer need the set then accept command at the end of the sendstatics<br />

policy, so the configured policies would look like this:<br />

[edit]<br />

aviva@router1> show configuration policy-options<br />

policy-statement remove-communities {<br />

term 1 {<br />

then {<br />

community delete all-communities;<br />

}<br />

}<br />

}<br />

policy-statement send-statics {<br />

term 1 {<br />

from protocol [ static direct ];<br />

}<br />

}<br />

policy-statement final-accept {<br />

term 1 {<br />

then accept;<br />

}<br />

}<br />

community all-communities members *:*;<br />

The second configuration in this recipe chains policies using the next policy action<br />

in a then clause. This forces policy evaluation to continue with the next policy after a<br />

match occurs. The next policy action is optional because it is the default action that<br />

the policy evaluation takes when a match occurs; when you do not include an<br />

accept, reject, ornext term action; and when there are no more terms in the routing<br />

policy. However, using it can speed up policy evaluation when a policy contains several<br />

terms and the import or export command references a number of policies.<br />

It is also possible to explicitly jump to the next term in a policy when a match<br />

occurs:<br />

[edit policy-options policy-statement from-my-customers]<br />

aviva@router1# set term 1 from protocol direct<br />

aviva@router1# set term 1 then local-preference 300<br />

aviva@router1# set term 1 then community set 65500:12345<br />

Creating a Chain of Routing Policies | 299<br />

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

Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.

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

Saved successfully!

Ooh no, something went wrong!