Previous Page TOC Index Next Page

Packet Filtering

Introduction

This chapter describes how to manage TCPware packet filtering.

Using Packet Filtering

Packet filtering is used today in almost all (from basic to sophisticated) security firewalls. Packet filtering firewalls apply filtering rules to each packet received to determine whether to accept or discard it. These filtering rules specify the protocol, source and destination IP addresses, and destination ports (for TCP and UDP) for accepted or discarded packets.

You use packet filtering on routers between an internal network and one or more external networks (such as a connection to the Internet). Packet filter rules restrict what may come in over the interface connected to the external network.

Packet filtering can also be useful on hosts. For example, you can restrict the hosts allowed access to services. In particular, these are UDP-based services and services that the TCPware master server does not activate, and thus cannot use incoming access restrictions.

TCPware's packet filtering support is similar to what many routers provide. Once you create a file containing the packet filter rules and load it for an interface, any IP datagrams received on that interface are filtered before being processed or forwarded. (Packets are only forwarded if you enable forwarding; see the NETCU ENABLE FORWARDING command for details.)

Note that when you use packet filtering, each and every datagram received on the interface is filtered. This increases processing overhead depending on the size of the filter list.

Packet filtering can be an effective and useful security mechanism. However, it cannot solve all of your security problems. To be effective, you must construct the filtering rules carefully.

Cautions

Consider the following cautions when setting up packet filtering on an interface:

This means that for UDP-based applications, it is not possible to add a rule that says to accept replies to requests. This also affects connection-oriented protocols such as FTP that use two connections, one for commands and the other for data.

Suggested reading includes the protocol RFCs (listed elsewhere in the TCPware documentation) and books such as Cheswick, William R. & Steven M. Bellovin, Firewalls and Internet Security: Repelling the Wily Hacker.

Packet Filter File

Packet filtering uses a filter list to determine whether you can receive a datagram. Filter lists are in packet filter files having the .DAT extension by default. Create one of these files first and then edit it. Format each file entry in the manner described in Table 20-1.

Table 20-1 Fields in a Packet Filter File Entry
Field... With valid values... Description
Entry Format: action protocol saddr smask [sport] daddr dmask [dport [doption]]

action

permit

drop

deny

permit permits the datagram; deny denies the datagram and sends the ICMP; drop denies the datagram without sending an ICMP destination unreachable message to the sender.

protocol

ip ip-number

tcp

udp

icmp

Protocol to check: the values indicated or the numeric IP protocol number. The value ip matches any IP protocol.

saddr

Example: 192.168.123.123

Source IP address to check.

smask

Example: 255.255.255.255

Source address mask to check, in standard bit mask format. To match a single address, use 255.255.255.255. To match any address, use 0.0.0.0

sport

operator operand

lt port

le

eq

ge

gt

ne

Optional source port specification to check (for TCP and UDP entries only). Consists of an operator, space, and port name or number. If port name, must be defined in the TCPWARE:SERVICES. file. If omitted, any source port is valid.

Example: gt 1023

daddr

Example: 192.168.123.123

Destination IP address to check.

dmask

Example: 255.255.255.255

Destination address mask to check, in standard bit mask format, as in s-mask above.

dport

operator operand

lt port

le icmp-msg-type

eq

ge

gt

ne

Optional destination port (for TCP and UDP entries) or ICMP message type specification consisting of an operator, space, and operand. If a port name, must be in the TCPWARE:SERVICES. file. If icmp-msg-type, use:

0 Echo Reply3 Destination Unreachable4 Source Quench5 Redirect8 Echo11 Time Exceeded12 Parameter Problem13 Timestamp14 Timestamp Reply15 Information Request16 Information Reply

doption

established

Matches only established connections (TCP segments with ACK or RST bits set).

Each entry specifies a packet filtering condition for a particular protocol type, source or destination address and mask, and destination port and mask specification, with certain additional options. The system looks at each condition in sequence, looks for a match, and takes a permit (accept) or deny (reject) action. The system stops testing conditions after the first match. This means that the order of the entries in the file is important; if the file lists a subsequent condition for an address, the system ignores it.

An implicit deny terminates the list of entries in the packet filter file. This means that if no condition matches, the system rejects the datagram. To use packet filtering:

1

Create address list entries in the packet filter file.

2

Apply the list to interfaces on your system by using packet filtering commands.

To create a packet filter file, edit a file and add address list entries in the format described.

Any number of spaces or tabs can separate each entity. Lines beginning with an exclamation point (!) are comment lines. You can use the dash (–) continuation character at the end of a line that needs to continue onto the next.

To apply the list to a particular network interface or interfaces on your system, use the SET FILTER command, as described in Setting and Showing.

Configuration Recommendations

A packet filtering configuration might look something like Figure 20-1. A packet filter is installed at the ISA-1 interface to prevent unwanted packets from the external networks from entering the internal network. TCPware's packet filters are applied to packets received on a specific interface (no filtering of transmitted packets is done).

Figure 20-1 Tunneling DECnet over IP

Constructing the address filter list requires care in that you only want to let in the packets you need. Here are some recommendations in setting up an address filter list for an interface:

While packet filtering is very useful, it is by no means the only step you should take to secure your network. You must take special care to secure the system to assure that it cannot be compromised. One way to do this is to greatly limit the services it offers.

Setting and Showing

The commands to set and show packet filters are:

SET FILTER

Associates a packet filter list with particular network lines

SET NOFILTER

Removes a previously associated packet filter list from network line(s)

SHOW FILTER

Displays the current packet filter list for network lines

See the NETCU Command Reference manual for details on these commands.

Setting at Startup

When you start TCPware, the STARTNET procedure looks for a TCPWARE:FILTER-line-id.DAT file for each interface it starts. If the file exists, STARTNET issues the following NETCU command to set the filter list for the interface:

SET FILTER line-id TCPWARE:FILTER-line-id.DAT

You can also add the necessary NETCU commands to the TCPWARE:ROUTING.COM file.

Previous Page Page Top TOC Index Next Page