1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
|
'\" te
.\" To view license terms, attribution, and copyright for IP Filter, the default path is /usr/lib/ipf/IPFILTER.LICENCE. If the Solaris operating environment has been installed anywhere other than the default, modify the given path to access the file at the installed
.\" location.
.\" Portions Copyright (c) 2008, Sun Microsystems Inc. All Rights Reserved.
.\" Portions Copyright (c) 2012, Joyent, Inc. All Rights Reserved.
.TH IPFSTAT 1M "Nov 26, 2012"
.SH NAME
ipfstat \- reports on packet filter statistics and filter list
.SH SYNOPSIS
.LP
.nf
\fBipfstat\fR [\fB-6aACdfghIilnoRstv\fR]
.fi
.LP
.nf
\fBipfstat\fR [\fB-C\fR] [\fB-D\fR \fIaddrport\fR] [\fB-P\fR \fIprotocol\fR] [\fB-S\fR \fIaddrport\fR]
[\fB-T\fR \fIrefreshtime\fR] [\fB-z\fR \fIzonename\fR]
.fi
.SH DESCRIPTION
.sp
.LP
The \fBipfstat\fR command is part of a suite of commands associated with the
Solaris IP Filter feature. See \fBipfilter\fR(5).
.sp
.LP
The \fBipfstat\fR command examines \fB/dev/kmem\fR using the symbols
\fB_fr_flags\fR, \fB_frstats\fR, \fB_filterin\fR, and \fB_filterout\fR. To run
and work, it needs to be able to read both \fB/dev/kmem\fR and the kernel
itself.
.sp
.LP
The default behavior of \fBipfstat\fR is to retrieve and display the statistics
which have been accumulated over time as the kernel has put packets through the
filter.
.sp
.LP
The role of \fBipfstat\fR is to display current kernel statistics gathered as a
result of applying the filters in place (if any) to packets going in and out of
the kernel. This is the default operation when no command line parameters are
present. When supplied with either \fB-i\fR or \fB-o\fR, \fBipfstat\fR will
retrieve and display the appropriate list of filter rules currently installed
and in use by the kernel.
.sp
.LP
\fBipfstat\fR uses kernel device files to obtain information. The default
permissions of these files require \fBipfstat\fR to be run as root for all
operations.
.sp
.LP
The \fBipfstat\fR command supports the \fBkstat\fR(3KSTAT) kernel facility.
Because of this support, as an alternative to \fBipfstat\fR, you can use
\fBkstat\fR(1M). For example:
.sp
.LP
# kstat \(hym ipf
.sp
.LP
Using the \fBipfstat\fR \fB-t\fR option causes \fBipfstat\fR to enter the state
top mode. In this mode the state table is displayed similarly to the way the
Unix \fBtop\fR utility displays the process table. The \fB-C\fR, \fB-D\fR,
\fB-P\fR, \fB-S\fR and \fB-T\fR command line options can be used to restrict
the state entries that will be shown and to specify the frequency of display
updates.
.sp
.LP
In state top mode, use the following keys to influence the displayed
information:
.sp
.ne 2
.na
\fB\fBd\fR\fR
.ad
.RS 5n
Select information to display.
.RE
.sp
.ne 2
.na
\fB\fBl\fR\fR
.ad
.RS 5n
Redraw the screen.
.RE
.sp
.ne 2
.na
\fB\fBq\fR\fR
.ad
.RS 5n
Quit the program.
.RE
.sp
.ne 2
.na
\fB\fBs\fR\fR
.ad
.RS 5n
Switch between different sorting criteria.
.RE
.sp
.ne 2
.na
\fB\fBr\fR\fR
.ad
.RS 5n
Reverse the sorting criteria.
.RE
.sp
.LP
States can be sorted by protocol number, by number of IP packets, by number of
bytes, and by time-to-live of the state entry. The default is to sort by the
number of bytes. States are sorted in descending order, but you can use the
\fBr\fR key to sort them in ascending order.
.sp
.LP
It is not possible to interactively change the source, destination, and
protocol filters or the refresh frequency. This must be done from the command
line.
.sp
.LP
The screen must have at least 80 columns for correct display. However,
\fBipfstat\fR does not check the screen width.
.sp
.LP
Only the first \fIX\fR-5 entries that match the sort and filter criteria are
displayed (where \fIX\fR is the number of rows on the display). There is no way
to see additional entries.
.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.na
\fB\fB-6\fR\fR
.ad
.RS 18n
Display filter lists and states for IPv6, if available. This option might
change in the future.
.RE
.sp
.ne 2
.na
\fB\fB-a\fR\fR
.ad
.RS 18n
Display the accounting filter list and show bytes counted against each rule.
.RE
.sp
.ne 2
.na
\fB\fB-A\fR\fR
.ad
.RS 18n
Display packet authentication statistics.
.RE
.sp
.ne 2
.na
\fB\fB-C\fR\fR
.ad
.RS 18n
Valid only in combination with \fB-t\fR. Display "closed" states as well in the
top. Normally, a TCP connection is not displayed when it reaches the
\fBCLOSE_WAIT\fR protocol state. With this option enabled, all state entries
are displayed.
.RE
.sp
.ne 2
.na
\fB\fB-d\fR\fR
.ad
.RS 18n
Produce debugging output when displaying data.
.RE
.sp
.ne 2
.na
\fB\fB-D\fR \fIaddrport\fR\fR
.ad
.RS 18n
Valid only in combination with \fB-t\fR. Limit the state top display to show
only state entries whose destination IP address and port match the
\fIaddrport\fR argument. The \fIaddrport\fR specification is of the form
\fIipaddress\fR[,\fIport\fR]. The \fIipaddress\fR and \fIport\fR should be
either numerical or the string \fBany\fR (specifying any IP address and any
port, in that order). If the \fB-D\fR option is not specified, it defaults to
\fB-D\fR \fBany,any\fR.
.RE
.sp
.ne 2
.na
\fB\fB-f\fR\fR
.ad
.RS 18n
Show fragment state information (statistics) and held state information (in the
kernel) if any is present.
.RE
.sp
.ne 2
.na
\fB\fB-g\fR\fR
.ad
.RS 18n
Show groups currently configured (both active and inactive).
.RE
.sp
.ne 2
.na
\fB\fB-h\fR\fR
.ad
.RS 18n
Show per-rule the number of times each one scores a "hit". For use in
combination with \fB-i\fR.
.RE
.sp
.ne 2
.na
\fB\fB-i\fR\fR
.ad
.RS 18n
Display the filter list used for the input side of the kernel IP processing.
.RE
.sp
.ne 2
.na
\fB\fB-I\fR\fR
.ad
.RS 18n
Swap between retrieving \fBinactive\fR/\fBactive\fR filter list details. For
use in combination with \fB-i\fR.
.RE
.sp
.ne 2
.na
\fB\fB-l\fR\fR
.ad
.RS 18n
When used with \fB-s\fR, show a list of active state entries (no statistics).
.RE
.sp
.ne 2
.na
\fB\fB-n\fR\fR
.ad
.RS 18n
Show the rule number for each rule as it is printed.
.RE
.sp
.ne 2
.na
\fB\fB-o\fR\fR
.ad
.RS 18n
Display the filter list used for the output side of the kernel IP processing.
.RE
.sp
.ne 2
.na
\fB\fB-P\fR \fIprotocol\fR\fR
.ad
.RS 18n
Valid only in combination with \fB-t\fR. Limit the state top display to show
only state entries that match a specific protocol. The argument can be a
protocol name (as defined in \fB/etc/protocols\fR) or a protocol number. If
this option is not specified, state entries for any protocol are specified.
.RE
.sp
.ne 2
.na
\fB\fB-R\fR\fR
.ad
.RS 18n
Disable both IP address-to-hostname resolution and port number-to-service name
resolution.
.RE
.sp
.ne 2
.na
\fB\fB-S\fR \fIaddrport\fR\fR
.ad
.RS 18n
Valid only in combination with \fB-t\fR. Limit the state top display to show
only state entries whose source IP address and port match the \fIaddrport\fR
argument. The \fIaddrport\fR specification is of the form
\fIipaddress\fR[,\fIport\fR]. The \fIipaddress\fR and \fIport\fR should be
either numerical or the string \fBany\fR (specifying any IP address and any
port, in that order). If the \fB-S\fR option is not specified, it defaults to
\fB-S\fR \fBany,any\fR.
.RE
.sp
.ne 2
.na
\fB\fB-s\fR\fR
.ad
.RS 18n
Show packet/flow state information (statistics only).
.RE
.sp
.ne 2
.na
\fB\fB-T\fR \fIrefreshtime\fR\fR
.ad
.RS 18n
Valid only in combination with \fB-t\fR. Specifies how often the state
\fBtop\fR display should be updated. The refresh time is the number of seconds
between an update. Any positive integer can be used. The default (and minimal
update time) is 1.
.RE
.sp
.ne 2
.na
\fB\fB-t\fR\fR
.ad
.RS 18n
Show the state table in a way similar to the way the Unix utility, \fBtop\fR,
shows the process table. States can be sorted in a number of different ways.
.RE
.sp
.ne 2
.na
\fB\fB-v\fR\fR
.ad
.RS 18n
Turn verbose mode on. Displays additional debugging information.
.RE
.sp
.ne 2
.na
\fB\fB-z\fR\fR
.ad
.RS 18n
Report statistics for the specified zone. If this option is not specified,
the current zone is used. This command is only available in the Global Zone.
.RE
.SH FILES
.RS +4
.TP
.ie t \(bu
.el o
\fB/dev/kmem\fR
.RE
.RS +4
.TP
.ie t \(bu
.el o
\fB/dev/ksyms\fR
.RE
.RS +4
.TP
.ie t \(bu
.el o
\fB/dev/ipl\fR
.RE
.RS +4
.TP
.ie t \(bu
.el o
\fB/dev/ipstate\fR
.RE
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE ATTRIBUTE VALUE
_
Interface Stability Committed
.TE
.SH SEE ALSO
.sp
.LP
\fBipf\fR(1M), \fBkstat\fR(1M), \fBkstat\fR(3KSTAT), \fBattributes\fR(5),
\fBipfilter\fR(5), \fBzones(5)\fR
.sp
.LP
\fI\fR
|