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.

counterintuitive. However, understanding this behavior is critical in designing filters<br />

and tracing problems if the router stops receiving certain types of traffic. Be especially<br />

careful when implementing filters that limit access to the router to ensure that you don’t<br />

lock yourself out of the router. A common mistake is to block Telnet access to the<br />

router. One way to protect against lockout is to use the commit confirmed command.<br />

The default time to revert to the previous configuration is 10 minutes. Choose a rollback<br />

time of one minute to minimize how long you have to wait to reconnect to the<br />

router if you lock yourself out:<br />

[edit firewall]<br />

aviva@RouterF# commit confirmed 1<br />

commit confirmed will be automatically rolled back in 1 minutes unless confirmed<br />

commit complete<br />

When using the commit confirmed command, especially with firewall filters, another<br />

good practice is to include a comment, which is saved to the router’s commit logfile:<br />

[edit firewall]<br />

aviva@RouterF# commit confirmed 1 comment "added filter to discard remaining packets"<br />

commit confirmed will be automatically rolled back in 1 minutes unless confirmed<br />

commit complete<br />

Use the show system commit command to see the comments:<br />

aviva@RouterF> show system commit<br />

0 2005-11-07 20:31:03 UTC by aviva via cli<br />

added filter to discard remaining packets<br />

1 2005-11-02 23:42:38 UTC by root via cli<br />

2 2005-11-02 23:35:11 UTC by root via cli<br />

Adding a comment is a handy way to keep track of reasons for commits if for some<br />

reason you lock yourself out of the router.<br />

Another counterintuitive behavior of JUNOS firewalls is that filters do not have a<br />

then clause to accept packets that match the from conditions. To verify this, create a<br />

one-term filter with no action:<br />

[edit firewall]<br />

aviva@RouterF# set filter one-term-filter term bgp-peers from destination-address 10.<br />

0.31.1/24<br />

Look in the file /var/etc/filters/dfwc.out to see the actions taken by the term:<br />

aviva@RouterF> file show /var/etc/filters/dfwc.out<br />

rule "bgp-peers" matches 3<br />

match destination-port unreferenced type range<br />

ranges 1<br />

179<br />

match source-address unreferenced type addrmask<br />

number of address-masks: 1<br />

10.0.8/24<br />

match action unreferenced type action<br />

accept<br />

The output shows the filter (or rule) bgp-peers matched and accepted three packets.<br />

Creating a Simple Firewall Filter that Matches Packet Contents | 307<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!