]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/ipfilter/man/ipf.8
MFC r363453:
[FreeBSD/stable/10.git] / contrib / ipfilter / man / ipf.8
1 .\" $FreeBSD$
2 .TH IPF 8
3 .SH NAME
4 ipf \- alters packet filtering lists for IP packet input and output
5 .SH SYNOPSIS
6 .B ipf
7 [
8 .B \-6AcdDEInoPrsvVyzZ
9 ] [
10 .B \-l
11 <block|pass|nomatch>
12 ] [
13 .B \-T
14 <optionlist>
15 ] [
16 .B \-F
17 <i|o|a|s|S>
18 ]
19 .B \-f
20 <\fIfilename\fP>
21 [
22 .B \-f
23 <\fIfilename\fP>
24 [...]]
25 .SH DESCRIPTION
26 .PP
27 \fBipf\fP opens the filenames listed (treating "\-" as stdin) and parses the
28 file for a set of rules which are to be added or removed from the packet
29 filter rule set.
30 .PP
31 Each rule processed by \fBipf\fP
32 is added to the kernel's internal lists if there are no parsing problems.
33 Rules are added to the end of the internal lists, matching the order in
34 which they appear when given to \fBipf\fP.
35 .SH OPTIONS
36 .TP
37 .B \-6
38 IPv4 and IPv6 rules are stored in a single table and can be read from a
39 single file. This option is no longer required to load IPv6 rules. This
40 option is ignored when specified with the -F option and the -F option
41 will flush IPv4 rules even if this option is specified.
42 .TP
43 .B \-A
44 Set the list to make changes to the active list (default).
45 .TP
46 .B \-c <language>
47 This option causes \fBipf\fP to generate output files for a compiler that
48 supports \fBlanguage\fI.  At present, the only target language supported is
49 \fBC\fB (-cc) for which two files - \fBip_rules.c\fP
50 and \fBip_rules.h\fP are generated in the \fBCURRENT DIRECTORY\fP when
51 \fBipf\fP is being run.  These files can be used with the
52 \fBIPFILTER_COMPILED\fP kernel option to build filter rules staticlly into
53 the kernel.
54 .TP
55 .B \-d
56 Turn debug mode on.  Causes a hexdump of filter rules to be generated as
57 it processes each one.
58 .TP
59 .B \-D
60 Disable the filter (if enabled).  Not effective for loadable kernel versions.
61 .TP
62 .B \-E
63 Enable the filter (if disabled).  Not effective for loadable kernel versions.
64 .TP
65 .BR \-F \0<i|o|a>
66 This option specifies which filter list to flush.  The parameter should
67 either be "i" (input), "o" (output) or "a" (remove all filter rules).
68 Either a single letter or an entire word starting with the appropriate
69 letter maybe used.  This option maybe before, or after, any other with
70 the order on the command line being that used to execute options.
71 .TP
72 .BR \-F \0<s|S>
73 To flush entries from the state table, the \fB-F\fP option is used in
74 conjunction with either "s" (removes state information about any non-fully
75 established connections) or "S" (deletes the entire state table).  Only
76 one of the two options may be given.  A fully established connection
77 will show up in \fBipfstat -s\fP output as 5/5, with deviations either
78 way indicating it is not fully established any more.
79 .TP
80 .BR \-F <5|6|7|8|9|10|11>
81 For the TCP states that represent the closing of a connection has begun,
82 be it only one side or the complete connection, it is possible to flush
83 those states directly using the number corresponding to that state.
84 The numbers relate to the states as follows: 5 = close-wait, 6 = fin-wait-1,
85 7 = closing, 8 = last-ack, 9 = fin-wait-2, 10 = time-wait, 11 = closed.
86 .TP
87 .BR \-F <number>
88 If the argument supplied to \fB-F\fP is greater than 30, then state table
89 entries that have been idle for more than this many seconds will be flushed.
90 .TP
91 .BR \-f \0<filename>
92 This option specifies which files
93 \fBipf\fP should use to get input from for modifying the packet filter rule
94 lists.
95 .TP
96 .B \-I
97 Set the list to make changes to the inactive list.
98 .TP
99 .B \-l \0<pass|block|nomatch>
100 Use of the \fB-l\fP flag toggles default logging of packets.  Valid
101 arguments to this option are \fBpass\fP, \fBblock\fP and \fBnomatch\fP.
102 When an option is set, any packet which exits filtering and matches the
103 set category is logged.  This is most useful for causing all packets
104 which don't match any of the loaded rules to be logged.
105 .TP
106 .B \-n
107 This flag (no-change) prevents \fBipf\fP from actually making any ioctl
108 calls or doing anything which would alter the currently running kernel.
109 .TP
110 .B \-o
111 Force rules by default to be added/deleted to/from the output list, rather
112 than the (default) input list.
113 .TP
114 .B \-P
115 Add rules as temporary entries in the authentication rule table.
116 .TP
117 .B \-r
118 Remove matching filter rules rather than add them to the internal lists
119 .TP
120 .B \-s
121 Swap the active filter list in use to be the "other" one.
122 .TP
123 .B \-T <optionlist>
124 This option allows run-time changing of IPFilter kernel variables.  Some
125 variables require IPFilter to be in a disabled state (\fB-D\fP) for changing,
126 others do not.  The optionlist parameter is a comma separated list of tuning
127 commands.  A tuning command is either "list" (retrieve a list of all variables
128 in the kernel, their maximum, minimum and current value), a single variable
129 name (retrieve its current value) and a variable name with a following
130 assignment to set a new value.  Some examples follow.
131 .nf
132 # Print out all IPFilter kernel tunable parameters
133 ipf -T list
134 # Display the current TCP idle timeout and then set it to 3600
135 ipf -D -T fr_tcpidletimeout,fr_tcpidletimeout=3600 -E
136 # Display current values for fr_pass and fr_chksrc, then set fr_chksrc to 1.
137 ipf -T fr_pass,fr_chksrc,fr_chksrc=1
138 .fi
139 .TP
140 .B \-v
141 Turn verbose mode on.  Displays information relating to rule processing.
142 .TP
143 .B \-V
144 Show version information.  This will display the version information compiled
145 into the ipf binary and retrieve it from the kernel code (if running/present).
146 If it is present in the kernel, information about its current state will be
147 displayed (whether logging is active, default filtering, etc).
148 .TP
149 .B \-y
150 Manually resync the in-kernel interface list maintained by IP Filter with
151 the current interface status list.
152 .TP
153 .B \-z
154 For each rule in the input file, reset the statistics for it to zero and
155 display the statistics prior to them being zeroed.
156 .TP
157 .B \-Z
158 Zero global statistics held in the kernel for filtering only (this doesn't
159 affect fragment or state statistics).
160 .DT
161 .SH ENVIRONMENT
162 .NM utilizes the following environment variable.
163 .TP
164 .B IPF_PREDEFINED
165 ipfilter variables, see VARIABLES in ipf(5), can be specified in this
166 environment variable providing shell access to ipfilter and ipnat variables.
167 For example,
168 .br
169 IPF_PREDEFINED='my_server="10.1.1.1"; my_client="10.1.1.2";'
170 .SH FILES
171 /dev/ipauth
172 .br
173 /dev/ipl
174 .br
175 /dev/ipstate
176 .SH SEE ALSO
177 ipftest(1), mkfilters(1), ipf(4), ipl(4), ipf(5), ipfstat(8), ipmon(8), ipnat(8)
178 .SH DIAGNOSTICS
179 .PP
180 Needs to be run as root for the packet filtering lists to actually
181 be affected inside the kernel.
182 .SH BUGS
183 .PP
184 If you find any, please send email to me at darrenr@pobox.com