]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - man/ipfilter.4
Import IP-Filter 5.1.2 into vendor branches using the existing license that
[FreeBSD/FreeBSD.git] / man / ipfilter.4
1 .TH IP\ FILTER 4
2 .SH NAME
3 ipfilter \- Introduction to IP packet filtering
4 .SH DESCRIPTION
5 IP Filter is a TCP/IP packet filter, suitable for use in a firewall
6 environment. To use, it can either be used as a loadable kernel module or
7 incorporated into your UNIX kernel; use as a loadable kernel module where
8 possible is highly recommended. Scripts are provided to install and patch
9 system files, as required.
10 .SH FEATURES
11 The IP packet filter can:
12 .IP
13 explicitly deny/permit any packet from passing through
14 .IP
15 distinguish between various interfaces
16 .IP
17 filter by IP networks or hosts
18 .IP
19 selectively filter any IP protocol
20 .IP
21 selectively filter fragmented IP packets
22 .IP
23 selectively filter packets with IP options
24 .IP
25 send back an ICMP error/TCP reset for blocked packets
26 .IP
27 keep packet state information for TCP, UDP and ICMP packet flows
28 .IP
29 keep fragment state information for any IP packet, applying the same rule
30 to all fragments.
31 .IP
32 act as a Network Address Translator (NAT)
33 .IP
34 use redirection to setup true transparent proxy connections
35 .IP
36 provide packet header details to a user program for authentication
37 .IP
38 in addition, supports temporary storage of pre-authenticated rules for passing packets through
39 .PP
40 Special provision is made for the three most common Internet protocols, TCP,
41 UDP and ICMP. The IP Packet filter allows filtering of:
42 .IP
43 Inverted host/net matchingTCP/UDP packets by port number or a port number
44 range
45 .IP
46 ICMP packets by type/code
47 .IP
48 "established" TCP packets
49 .IP
50 On any arbitrary combination of TCP flags
51 .IP
52 "short" (fragmented) IP packets with incomplete headers can be filtered
53 .IP
54 any of the 19 IP options or 8 registered IP security classes TOS (Type of
55 Service) field in packets
56 .PP
57 To keep track of the performance of the IP packet filter, a logging device
58 is used which supports logging of:
59 .IP
60 the TCP/UDP/ICMP and IP packet headers
61 .IP
62 the first 128 bytes of the packet (including headers)
63 .PP
64 A packet can be logged when:
65 .IP
66 it is successfully passed through
67 .IP
68 it is blocked from passing through
69 .IP
70 it matches a rule setup to look for suspicious packets
71 .PP
72 IP Filter keeps its own set of statistics on:
73 .IP
74 packets blocked
75 .IP
76 packets (and bytes!) used for accounting
77 .IP
78 packets passed
79 .IP
80 packets logged
81 .IP
82 attempts to log which failed (buffer full)
83 .IP
84 and much more, for packets going both in and out.
85
86 .SH Tools
87 The current implementation provides a small set of tools, which can easily
88 be used and integrated with regular unix shells and tools. A brief description
89 of the tools provided:
90 .PP
91 ipf(8)
92 reads in a set of rules, from either stdin or a file, and adds them to
93 the kernels current list (appending them). It can also be used to flush the
94 current filter set or delete individual filter rules. The file format is
95 described in ipf(5).
96 .PP
97 ipfs(8)
98 is a utility to temporarily lock the IP Filter kernel tables (state tables
99 and NAT mappings) and write them to disk. After that the system can be
100 rebooted, and ipfs can be used to read these tables from disk and restore
101 them into the kernel. This way the system can be rebooted without the
102 connections being terminated.
103 .PP
104 ipfstat(8)
105 interrogates the kernel for statistics on packet filtering, so
106 far, and retrieves the list of filters in operation for inbound and outbound
107 packets.
108 .PP
109 ipftest(1)
110 reads in a filter rule file and then applies sample IP packets to
111 the rule file. This allows for testing of filter list and examination of how
112 a packet is passed along through it.
113 .PP
114 ipmon(8)
115 reads buffered data from the logging device (default is /dev/ipl)
116 for output to either:
117 .IP
118 screen (standard output)
119 .IP
120 file
121 .IP
122 syslog
123 .PP
124 ipsend(1)
125 generates arbitary IP packets for ethernet connected machines.
126 .PP
127 ipresend(1)
128 reads in a data file of saved IP packets (ie
129 snoop/tcpdump/etherfind output) and sends it back across the network.
130 .PP
131 iptest(1)
132 contains a set of test "programs" which send out a series of IP
133 packets, aimed at testing the strength of the TCP/IP stack at which it is
134 aimed at. WARNING: this may crash machine(s) targeted!
135 .PP
136 ipnat(8)
137 reads in a set of rules, from either stdin or a file and adds them
138 to the kernels current list of active NAT rules. NAT rules can also be
139 deleted using ipnat. The format of the configuration file to be used
140 with ipnat is described in ipnat(5).
141 .PP
142 For use in your own programs (e.g. for writing of transparent application
143 proxies), the programming interface and the associated ioctl's are
144 documented in ipf(4).
145
146 Documentation on ioctl's and the format of data saved
147 to the logging character device is provided in ipl(4)
148 so that you may develop your own applications to work with or in place of any
149 of the above.
150
151 Similar, the interface to the NAT code is documented in ipnat(4).
152
153 .SH PACKET PROCESSING FLOW
154 The following diagram illustrates the flow of TCP/IP packets through the
155 various stages introduced by IP Filter.
156 .PP
157 .nf
158                                    IN
159                                     |
160                                     V
161           +-------------------------+--------------------------+
162           |                         |                          |
163           |                         V                          |
164           |            Network Address Translation             |
165           |                         |                          |
166           |         authenticated   |                          |
167           |       +-------<---------+                          |
168           |       |                 |                          |
169           |       |                 V                          |
170           |       V           IP Accounting                    |
171           |       |                 |                          |
172           |       |                 V                          |
173           |       |        Fragment Cache Check--+             |
174           |       |                 |            |             |
175           |       V                 V            V             |
176           |       |         Packet State Check-->+             |
177           |       |                 |            |             |
178           |       |       +->--+    |            |             |
179           |       |       |    |    V            |             |
180           |       V   groups   IP Filtering      V             |
181           |       |       |    |    |            |             |
182           |       |       +--<-+    |            |             |
183           |       |                 |            |             |
184           |       +---------------->|<-----------+             |
185           |                         |                          |
186           |                         V                          |
187           |                +---<----+                          |
188           |                |        |                          |
189           |            function     |                          |
190           |                |        V                          |
191           |                +--->----+                          |
192           |                         |                          |
193           |                         V                          |
194        +--|---<--- fast-route ---<--+                          |
195        |  |                         |                          |
196        |  |                         V                          |
197        |  +-------------------------+--------------------------+
198        |                            |
199        |                        pass only
200        |                            |
201        |                            V
202        V               [KERNEL TCP/IP Processing]
203        |                            |
204        |  +-------------------------+--------------------------+
205        |  |                         |                          |
206        |  |                         V                          |
207        |  |                Fragment Cache Check--+             |
208        |  |                         |            |             |
209        |  |                         V            V             |
210        |  |                 Packet State Check-->+             |
211        |  |                         |            |             |
212        |  |                         V            |             |
213        V  |                    IP Filtering      |             |
214        |  |                         |            V             |
215        |  |                         |<-----------+             |
216        |  |                         V                          |
217        |  |                   IP Accounting                    |
218        |  |                         |                          |
219        |  |                         V                          |
220        |  |            Network Address Translation             |
221        |  |                         |                          |
222        |  |                         V                          |
223        |  +-------------------------+--------------------------+
224        |                            |
225        |                        pass only
226        V                            |
227        +--------------------------->|
228                                     V
229                                    OUT
230 .fi
231
232 .SH MORE INFORMATION
233 More information (including pointers to the FAQ and the mailing list) can be
234 obtained from the sofware's official homepage: www.ipfilter.org
235
236 .SH SEE ALSO
237 ipf(4), ipf(5), ipf(8), ipfilter(5), ipfs(8), ipfstat(8), ipftest(1),
238 ipl(4), ipmon(8), ipnat(8), ipnat(4),
239