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.

Because the policy and filter conditions are referenced, you don’t have to repeat the<br />

same information in many places throughout a configuration but can instead modify<br />

the conditions in a single place and reuse them as needed. This modularity is useful,<br />

especially when you consider that for larger ISPs, the routing policy and firewall filter<br />

sections of the JUNOS configuration file make up a very large percentage of the<br />

router’s configuration, sometimes 50 percent or more.<br />

Defining Policies and Filters<br />

In the JUNOS configuration, routing policies and firewall filters have the same basic<br />

structure:<br />

Name<br />

Identifies each policy and filter. You specify and use this name to reference the<br />

policy or filter when configuring a routing protocol or interface. You set the<br />

name like this:<br />

[edit policy-options]<br />

aviva@router1# edit policy-statement add-community<br />

[edit firewall]<br />

aviva@router1# edit filter incoming-to-me<br />

Here, the edit policy-statement command creates a routing policy named addcommunity,<br />

and the edit filter command creates a filter called incoming-to-me.<br />

Term<br />

Groups match conditions with corresponding actions. Policies and filters can<br />

have one or more terms, which are evaluated in order. Terms are also identified<br />

by name, such as:<br />

[edit policy-options filter incoming-to-me]<br />

aviva@router1# edit term allow-snmp-from-nms-systems<br />

The edit term command creates a term called allow-snmp-from-nms-system.<br />

Match conditions<br />

For policies, the match conditions apply to routes; for firewall filters, they apply<br />

to packets. Match conditions are generally identified by a from clause to indicate<br />

information in the received route or packet. Here, the from clause matches UDP<br />

packets:<br />

[edit policy-options filter incoming-to-me term allow-snmp-from-nms-systems]<br />

aviva@router1# set from protocol udp<br />

Match conditions sometimes have a to clause to match information about the<br />

route or packet destination.<br />

Action<br />

Specifies what to do when a match occurs. The action is identified by a then<br />

clause:<br />

[edit policy-options filter incoming-to-me term allow-snmp-from-nms-systems]<br />

aviva@router1# set then accept<br />

Here, the action is to accept the packet.<br />

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

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

Introduction | 283

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

Saved successfully!

Ooh no, something went wrong!