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.

Table 9-5. Header match conditions used in firewall filters (continued)<br />

Match term<br />

tcp-flags number<br />

first-fragment<br />

is-fragment<br />

tcp-established<br />

tcp-initial<br />

Packet field operators<br />

& or +<br />

Logical AND<br />

| or , Logical OR<br />

! Negation<br />

( ) Grouping<br />

Match description<br />

TCP flag field, specified as a number or name. Use with the protocol match condition<br />

to determine the protocol being used on a port.<br />

Flag names and numbers: ack (0x10), fin (0x01), push (0x08), rst (0x04), syn (0x02),<br />

urgent (0x20)<br />

First fragment of a fragmented packet.<br />

Packet fragment other than the first one.<br />

TCP packets other than the first one in a connection (equivalent to "(ack | rst)").<br />

Use with protocol tcp to match TCP packets.<br />

First packet of a TCP connection (equivalent to "(syn & !ack)"). Use with protocol<br />

tcp to match TCP packets.<br />

The fourth command in the recipe is the then clause, which specifies the action to<br />

take when a route matches the condition (or conditions) in the from clause, which is<br />

to accept the packet (then accept). Table 9-6 lists the actions you can use in a firewall<br />

filter.<br />

Table 9-6. Actions to take on matching packets<br />

Action term<br />

accept<br />

reject<br />

discard<br />

next term<br />

counter name<br />

log<br />

policer name<br />

syslog<br />

Description<br />

Accept the packet and send it to its destination. This is the default action.<br />

Do not accept the packet and send an ICMP unreachable message. Rejected packets can be logged.<br />

Discard a packet silently, without sending an ICMP unreachable message. Discarded packets can be<br />

counted but not logged.<br />

Evaluate the next term in the filter.<br />

Count the packet, keeping track of the count in the named counter.<br />

Log the packet’s header.<br />

Rate-limit traffic on an interface.<br />

Keep a record of the packet in a system logfile.<br />

As with routing policy, the JUNOS software evaluates a firewall filter term by term,<br />

and, when a term matches, the action is taken and evaluation ends. If the packet<br />

matches none of the terms, the default action is to discard the packet, which is equivalent<br />

to the following:<br />

aviva@RouterF# set term last-term then discard<br />

The default firewall action, to discard packets, is the opposite of the default policy<br />

action of accepting routes. You would not be alone in thinking that this behavior is<br />

306 | Chapter 9: Routing Policy and Firewall Filters<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!