1 .\" $NetBSD: ipfilter.4,v 1.1.1.1 2004/03/28 08:56:21 martti Exp $
5 ipfilter \- Introduction to IP packet filtering
7 IP Filter is a TCP/IP packet filter, suitable for use in a firewall
8 environment. To use, it can either be used as a loadable kernel module or
9 incorporated into your UNIX kernel; use as a loadable kernel module where
10 possible is highly recommended. Scripts are provided to install and patch
11 system files, as required.
13 The IP packet filter can:
15 explicitly deny/permit any packet from passing through
17 distinguish between various interfaces
19 filter by IP networks or hosts
21 selectively filter any IP protocol
23 selectively filter fragmented IP packets
25 selectively filter packets with IP options
27 send back an ICMP error/TCP reset for blocked packets
29 keep packet state information for TCP, UDP and ICMP packet flows
31 keep fragment state information for any IP packet, applying the same rule
34 act as a Network Address Translator (NAT)
36 use redirection to setup true transparent proxy connections
38 provide packet header details to a user program for authentication
40 in addition, supports temporary storage of pre-authenticated rules for passing packets through
42 Special provision is made for the three most common Internet protocols, TCP,
43 UDP and ICMP. The IP Packet filter allows filtering of:
45 Inverted host/net matchingTCP/UDP packets by port number or a port number
48 ICMP packets by type/code
50 "established" TCP packets
52 On any arbitrary combination of TCP flags
54 "short" (fragmented) IP packets with incomplete headers can be filtered
56 any of the 19 IP options or 8 registered IP security classes TOS (Type of
57 Service) field in packets
59 To keep track of the performance of the IP packet filter, a logging device
60 is used which supports logging of:
62 the TCP/UDP/ICMP and IP packet headers
64 the first 128 bytes of the packet (including headers)
66 A packet can be logged when:
68 it is successfully passed through
70 it is blocked from passing through
72 it matches a rule setup to look for suspicious packets
74 IP Filter keeps its own set of statistics on:
78 packets (and bytes!) used for accounting
84 attempts to log which failed (buffer full)
86 and much more, for packets going both in and out.
89 The current implementation provides a small set of tools, which can easily
90 be used and integrated with regular unix shells and tools. A brief description
91 of the tools provided:
94 reads in a set of rules, from either stdin or a file, and adds them to
95 the kernels current list (appending them). It can also be used to flush the
96 current filter set or delete individual filter rules. The file format is
100 is a utility to temporarily lock the IP Filter kernel tables (state tables
101 and NAT mappings) and write them to disk. After that the system can be
102 rebooted, and ipfs can be used to read these tables from disk and restore
103 them into the kernel. This way the system can be rebooted without the
104 connections being terminated.
107 interrogates the kernel for statistics on packet filtering, so
108 far, and retrieves the list of filters in operation for inbound and outbound
112 reads in a filter rule file and then applies sample IP packets to
113 the rule file. This allows for testing of filter list and examination of how
114 a packet is passed along through it.
117 reads buffered data from the logging device (default is /dev/ipl)
118 for output to either:
120 screen (standard output)
127 generates arbitary IP packets for ethernet connected machines.
130 reads in a data file of saved IP packets (ie
131 snoop/tcpdump/etherfind output) and sends it back across the network.
134 contains a set of test "programs" which send out a series of IP
135 packets, aimed at testing the strength of the TCP/IP stack at which it is
136 aimed at. WARNING: this may crash machine(s) targeted!
139 reads in a set of rules, from either stdin or a file and adds them
140 to the kernels current list of active NAT rules. NAT rules can also be
141 deleted using ipnat. The format of the configuration file to be used
142 with ipnat is described in ipnat(5).
144 For use in your own programs (e.g. for writing of transparent application
145 proxies), the programming interface and the associated ioctl's are
146 documented in ipf(4).
148 Documentation on ioctl's and the format of data saved
149 to the logging character device is provided in ipl(4)
150 so that you may develop your own applications to work with or in place of any
153 Similar, the interface to the NAT code is documented in ipnat(4).
155 .SH PACKET PROCESSING FLOW
156 The following diagram illustrates the flow of TCP/IP packets through the
157 various stages introduced by IP Filter.
163 +-------------------------+--------------------------+
166 | Network Address Translation |
169 | +-------<---------+ |
175 | | Fragment Cache Check--+ |
178 | | Packet State Check-->+ |
182 | V groups IP Filtering V |
186 | +---------------->|<-----------+ |
196 +--|---<--- fast-route ---<--+ |
199 | +-------------------------+--------------------------+
204 V [KERNEL TCP/IP Processing]
206 | +-------------------------+--------------------------+
209 | | Fragment Cache Check--+ |
212 | | Packet State Check-->+ |
222 | | Network Address Translation |
225 | +-------------------------+--------------------------+
229 +--------------------------->|
235 More information (including pointers to the FAQ and the mailing list) can be
236 obtained from the sofware's official homepage: www.ipfilter.org
239 ipf(4), ipf(5), ipf(8), ipfilter(5), ipfs(8), ipfstat(8), ipftest(1),
240 ipl(4), ipmon(8), ipnat(8), ipnat(4),