ipmon(8)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

✨ ipmon(8) ✨ β€” the System Manager's Manual page, but make it make sense πŸ’…

okay so bestie, gather round, because ipmon is genuinely one of those tools that's lowkey iconic once you get what it's doing 🫢


🌸 NAME 🌸

ipmon β€” monitors /dev/ipl for logged packets. that's it, that's the vibe πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

ipmon [ -abBDFhnpstvxX ] [ -B <binarylogfile> ] [ -C <configfile> ] [ -N
<device> ] [ -L <facility> ] [ -o [NSI] ] [ -O [NSI] ] [ -P <pidfile> ]
[ -S <device> ] [ -f <device> ] [ <filename> ]

πŸ’– DESCRIPTION πŸ’–

so ipmon opens /dev/ipl for reading and just… awaits data to be saved from the packet filter. main character energy, honestly. the binary data it reads from the device gets reprinted in human readable form β€” but heads up: IP#'s are not mapped back to hostnames, and ports are not mapped back to service names (unless you pass -n, iykyk, we'll get there).

the output goes to standard output by default, or to a filename if you gave one on the command line. and if you used the -s option? output is instead sent to syslogd(8). messages sent via syslog have the day, month and year removed from the message, but the time (including microseconds), as recorded in the log, is still included. slay, timestamps stay πŸ•


πŸ¦‹ the fields, bestie (whitespace separated, obviously) πŸ¦‹

messages generated by ipmon consist of whitespace separated fields. the fields common to all messages are:

  1. The date of packet receipt. this one is suppressed when the message is sent to syslog, so don't come for it if it ghosts you πŸ™ˆ
  2. The time of packet receipt. form is HH:MM:SS.F β€” hours, minutes seconds, and fractions of a second (which can be several digits long, no cap).
  3. The name of the interface the packet was processed on, e.g., we1.
  4. The group and rule number of the rule, e.g., @0:17. you can view these with ipfstat -n.
  5. The action: p for passed, b for blocked, the source literally leaves this one blank for a short packet 😭, n did not match any rules, or L for a log rule.
  6. The addresses. this is actually three fields: the source address and port (separated by a comma), the -> symbol, and the destination address and port. E.g.: 209.53.17.22,80 -> 198.73.220.17,1722. it's giving arrow, it's giving flow πŸ’«
  7. PR followed by the protocol name or number, e.g., PR tcp.
  8. len followed by the header length and total length of the packet, e.g., len 20 40.

if the packet is a TCP packet, there will be an additional field starting with a hyphen followed by letters corresponding to any flags that were set. see the ipf.conf manual page for a list of letters and their flags πŸ”₯

if the packet is an ICMP packet, there will be two fields at the end, the first always being icmp, and the next being the ICMP message and submessage type, separated by a slash, e.g., icmp 3/3 for a port unreachable message.


⚠️ okay important one: in order for ipmon to properly work, the kernel option IPFILTER_LOG must be turned on in your kernel. please see options(4) for more details. no kernel option, no logs, no slay πŸ’€

and ✨ fun fact ✨ β€” ipmon reopens its log file(s) and rereads its configuration file when it receives a SIGHUP signal. iconic behaviour, honestly.


🌈 OPTIONS 🌈

  • -a β€” open all of the device logfiles for reading log entries from. all entries are displayed to the same output 'device' (stderr or syslog). one big happy feed 🫢
  • -b β€” for rules which log the body of a packet, generate hex output representing the packet contents after the headers. hex girl summer πŸ”₯
  • -B <binarylogfilename> β€” enable logging of the raw, unformatted binary data to the specified <binarylogfilename> file. this can be read, later, using ipmon with the -f option. time capsule behaviour ⏳
  • -C <configfilename> β€” this option specifies a file to be used to specify optional extra actions when it sees specific log entries from the kernel.
  • -D β€” cause ipmon to turn itself into a daemon. using subshells or backgrounding of ipmon is not required to turn it into an orphan so it can run indefinitely. it just does it. independent queen πŸ‘‘
  • -f <device> β€” specify an alternative device/file from which to read the log information for normal IP Filter log records.
  • -F β€” flush the current packet log buffer. the number of bytes flushed is displayed, even should the result be zero. we love transparency πŸ’–
  • -L <facility> β€” using this option allows you to change the default syslog facility that ipmon uses for syslog messages. the default is local0.
  • -n β€” IP addresses and port numbers will be mapped, where possible, back into hostnames and service names. the "actually readable" option, we stan 🌸
  • -N <device> β€” set the logfile to be opened for reading NAT log records from to <device>.
  • -o β€” specify which log files to actually read data from. N β€” NAT logfile, S β€” State logfile, I β€” normal IP Filter logfile. the -a option is equivalent to using -o NSI. pick your faves ✨
  • -O β€” specify which log files you do not wish to read from. this is most sensibly used with the -a. letters available as parameters to this are the same as for -o. it's the blocklist to -o's allowlist, we love a duo 🫢
  • -p β€” cause the port number in log messages to always be printed as a number and never attempt to look it up as from /etc/services, etc. no detective work, just numbers πŸ”’
  • -P <pidfile> β€” write the pid of the ipmon process to a file. by default this is //etc/opt/ipf/ipmon.pid (Solaris), /var/run/ipmon.pid (44BSD or later) or /etc/ipmon.pid for all others. (yes, 44BSD, that's how it's written, don't @ me 😭)
  • -s β€” packet information read in will be sent through syslogd rather than saved to a file. the default facility when compiled and installed is security. the following levels are used:
    • LOG_INFO β€” packets logged using the "log" keyword as the action rather than pass or block.
    • LOG_NOTICE β€” packets logged which are also passed.
    • LOG_WARNING β€” packets logged which are also blocked.
    • LOG_ERR β€” packets which have been logged and which can be considered "short".
  • -S <device> β€” set the logfile to be opened for reading state log records from to <device>.
  • -t β€” read the input file/device in a manner akin to tail(1). the way that it just follows along… obsessed πŸ‘€
  • -v β€” show tcp window, ack and sequence fields. verbose queen πŸ’…
  • -x β€” show the packet data in hex.
  • -X β€” show the log header record data in hex.

πŸ’€ DIAGNOSTICS πŸ’€

ipmon expects data that it reads to be consistent with how it should be saved and will abort if it fails an assertion which detects an anomaly in the recorded data. so like… keep your data consistent or it's not gonna be chill about it, fr fr 😭


πŸ“ FILES πŸ“

  • /dev/ipl
  • /dev/ipnat
  • /dev/ipstate
  • /etc/ipmon.conf
  • /etc/services

🧚 SEE ALSO 🧚

ipl(4), ipmon(5), ipf(8), ipfstat(8), ipnat(8)

the whole friend group, honestly 🌈


πŸ™ˆ BUGS πŸ™ˆ

if you find any, please send email to me at darrenr@pobox.com. be nice about it, bestie πŸ’Œ


and that's the page!! πŸŽ€ this was ipmon(8) from the System Manager's Manual β€” literally the whole thing, no crumbs left. go forth and monitor those packets, you gorgeous genius πŸ’–βœ¨πŸ‘‘
πŸ“¦ where this page comes from