Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / ipfilter / man / ipmon.8
1 .\" $FreeBSD: src/contrib/ipfilter/man/ipmon.8,v 1.6.2.5 2003/03/01 03:55:53 darrenr Exp $
2 .TH ipmon 8
3 .SH NAME
4 ipmon \- monitors /dev/ipl for logged packets
5 .SH SYNOPSIS
6 .B ipmon
7 [
8 .B \-abDFhnpstvxX
9 ] [
10 .B "\-N <device>"
11 ] [
12 .B "\-o [NSI]"
13 ] [
14 .B "\-O [NSI]"
15 ] [
16 .B "\-P <pidfile>"
17 ] [
18 .B "\-S <device>"
19 ] [
20 .B "\-f <device>"
21 ] [
22 .B <filename>
23 ]
24 .SH DESCRIPTION
25 .LP
26 \fBipmon\fP opens \fB/dev/ipl\fP for reading and awaits data to be saved from
27 the packet filter.  The binary data read from the device is reprinted in
28 human readable for, however, IP#'s are not mapped back to hostnames, nor are
29 ports mapped back to service names.  The output goes to standard output by
30 default or a filename, if given on the command line.  Should the \fB\-s\fP
31 option be used, output is instead sent to \fBsyslogd(8)\fP.  Messages sent
32 via syslog have the day, month and year removed from the message, but the
33 time (including microseconds), as recorded in the log, is still included.
34 .LP
35 Messages generated by ipmon consist of whitespace separated fields.
36 Fields common to all messages are:
37 .LP
38 1. The date of packet receipt. This is suppressed when the message is
39 sent to syslog.
40 .LP
41 2. The time of packet receipt. This is in the form HH:MM:SS.F, for hours,
42 minutes seconds, and fractions of a second (which can be several digits
43 long).
44 .LP
45 3. The name of the interface the packet was processed on, e.g., \fBwe1\fP.
46 .LP
47 4. The group and rule number of the rule, e.g., \fB@0:17\fP. These can be
48 viewed with \fBipfstat -n\fP.
49 .LP
50 5. The action: \fBp\fP for passed, \fBb\fP for blocked, \fBS\fP for a short
51 packet, \fBn\fP did not match any rules, \fBL\fP for a log rule.  The order
52 of precedence in showing flags is: S, p, b, n, L.  A capital \fBP\fP or
53 \fBB\fP means that the packet has been logged due to a global logging
54 setting, not a particular rule.
55 .LP
56 6. The addresses.
57 This is actually three fields: the source address and port
58 (separated by a comma), the \fB->\fP symbol, and the destination address
59 and port. E.g.: \fB209.53.17.22,80 -> 198.73.220.17,1722\fP.
60 .LP
61 7. \fBPR\fP followed by the protocol name or number, e.g., \fBPR tcp\fP.
62 .LP
63 8. \fBlen\fP followed by the header length and total length of the packet,
64 e.g., \fBlen 20 40\fP.
65 .LP
66 If the packet is a TCP packet, there will be an additional field starting
67 with a hyphen followed by letters corresponding to any flags that were set.
68 See the ipf.conf manual page for a list of letters and their flags.
69 .LP
70 If the packet is an ICMP packet, there will be two fields at the end,
71 the first always being `icmp', and the next being the ICMP message and
72 submessage type, separated by a slash, e.g., \fBicmp 3/3\fP for a port
73 unreachable message.
74 .LP
75 In order for \fBipmon\fP to properly work, the kernel option
76 \fBIPFILTER_LOG\fP must be turned on in your kernel.  Please see
77 \fBoptions(4)\fP for more details.
78 .SH OPTIONS
79 .TP
80 .B \-a
81 Open all of the device logfiles for reading log entries from.  All entries
82 are displayed to the same output 'device' (stderr or syslog).
83 .TP
84 .B \-b
85 For rules which log the body of a packet, generate hex output representing
86 the packet contents afte the headers.
87 .TP
88 .B \-D
89 Cause ipmon to turn itself into a daemon.  Using subshells or backgrounding
90 of ipmon is not required to turn it into an orphan so it can run indefinately.
91 .TP
92 .B "\-f <device>"
93 specify an alternative device/file from which to read the log information
94 for normal IP Filter log records.
95 .TP
96 .B \-F
97 Flush the current packet log buffer.  The number of bytes flushed is displayed,
98 even should the result be zero.
99 .TP
100 .B \-n
101 IP addresses and port numbers will be mapped, where possible, back into
102 hostnames and service names.
103 .TP
104 .B "\-N <device>"
105 Set the logfile to be opened for reading NAT log records from to <device>.
106 .TP
107 .B \-o
108 Specify which log files to actually read data from.  N - NAT logfile,
109 S - State logfile, I - normal IP Filter logfile.  The \fB-a\fP option is
110 equivalent to using \fB-o NSI\fP.
111 .TP
112 .B \-O
113 Specify which log files you do not wish to read from.  This is most sensibly
114 used with the \fB-a\fP.  Letters available as parameters to this are the same
115 as for \fB-o\fP.
116 .TP
117 .B \-p
118 Cause the port number in log messages to always be printed as a number and
119 never attempt to look it up as from \fI/etc/services\fP, etc.
120 .TP
121 .B \-P <pidfile>
122 Write the pid of the ipmon process to a file.  By default this is
123 \fI//etc/opt/ipf/ipmon.pid\fP (Solaris), \fI/var/run/ipmon.pid\fP (44BSD
124 or later) or \fI/etc/ipmon.pid\fP for all others.
125 .TP
126 .B \-s
127 Packet information read in will be sent through syslogd rather than
128 saved to a file.  The default facility when compiled and installed is
129 \fBlocal0\fP.  The following levels are used:
130 .IP
131 .B LOG_INFO
132 \- packets logged using the "log" keyword as the action rather
133 than pass or block.
134 .IP
135 .B LOG_NOTICE
136 \- packets logged which are also passed
137 .IP
138 .B LOG_WARNING
139 \- packets logged which are also blocked
140 .IP
141 .B LOG_ERR
142 \- packets which have been logged and which can be considered
143 "short".
144 .TP
145 .B "\-S <device>"
146 Set the logfile to be opened for reading state log records from to <device>.
147 .TP
148 .B \-t
149 read the input file/device in a manner akin to tail(1).
150 .TP
151 .B \-v
152 show tcp window, ack and sequence fields.
153 .TP
154 .B \-x
155 show the packet data in hex.
156 .TP
157 .B \-X
158 show the log header record data in hex.
159 .SH DIAGNOSTICS
160 \fBipmon\fP expects data that it reads to be consistent with how it should be
161 saved and will abort if it fails an assertion which detects an anomaly in the
162 recorded data.
163 .SH FILES
164 /dev/ipl
165 .br
166 /dev/ipnat
167 .br
168 /dev/ipstate
169 .br
170 /etc/services
171 .SH SEE ALSO
172 ipl(4), ipf(8), ipfstat(8), ipnat(8)
173 .\".SH BUGS