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.

}<br />

}<br />

<strong>Discussion</strong><br />

}<br />

}<br />

Placing firewall filters on the router’s interfaces is one of the most critical actions you<br />

can take to protect the security of the router and the integrity of traffic received and<br />

sent by the router. Firewall filters also provide a mechanism for counting different<br />

types of packets received or sent over an interface. What happens if you don’t configure<br />

a firewall filter? By default, interfaces accept all incoming traffic and transmit all<br />

outgoing traffic.<br />

Unlike routing policy, which is part of RPD running on the Routing Engine and<br />

which looks at routing-protocol traffic, firewall filters look at all traffic on router<br />

interfaces, working as part of the PFE.<br />

The firewall filter in this recipe has the same basic structure and components as a<br />

routing policy. It uses the same JUNOS policy language, and you can read through<br />

the show command output to understand what the firewall filter does.<br />

The configuration creates a filter named incoming-to-me that has one term named<br />

restrict-telnet-ssh. This term accepts TCP packets if the IP packet header has a<br />

destination port or either Telnet (port 23) or SSH (port 22) and a source address that<br />

falls in the subnetwork 10.0.0.0/8. By default, this filter rejects all other packets.<br />

This recipe applies the filter to all IPv4 traffic on one of the router’s physical interfaces,<br />

fe-0/0/0.<br />

It’s important to remember that this recipe shows only one term in a longer firewall<br />

filter as a way of illustrating how to configure a firewall filter. (Recipe 9.15 shows a<br />

complete filter.) If you were to apply only this filter to an interface, you would be<br />

able to use the interface only for Telnet and SSH connections from subnet 10.0.0.0/8,<br />

and all other incoming traffic would be dropped. Although it’s possible that this is<br />

what you might want to do, it’s not likely that you would want to do exactly this.<br />

However, this recipe does illustrate the point that you need to very carefully design<br />

and construct firewall files so that they do what you want and what you expect.<br />

Because firewall filters apply to logical interfaces, not physical interfaces, each<br />

address family on an interface can have one filter for incoming traffic and one for<br />

outgoing traffic. This means you can have different filters for different logical interfaces.<br />

For this recipe, it also means that if this is the only interface on which you<br />

restrict SSH and Telnet access, using them to access the router through any other<br />

interfaces is unrestricted. This might be exactly the action you want. However, if<br />

your intent is to restrict SSH and Telnet access for all interfaces on the router, you<br />

must apply this firewall filter to all the router’s interfaces. Again, you have a design<br />

choice to make here. You can certainly apply the filter to all the interfaces—or to any<br />

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