IPF(8)

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

πŸŽ€ NAME πŸŽ€

okay so bestie, this is the ipf page from the System Manager's Manual β€” page IPF(8) β€” and it's literally the tool that alters packet filtering lists for IP packet input and output. it's giving β€œrule-loader main character energy,” no cap. πŸ’…


✨ SYNOPSIS ✨

ipf [ -6AcdDEInoPrsvVyzZ ] [ -l <block|pass|nomatch> ] [ -T <optionlist>
] [ -F <i|o|a|s|S> ] -f <filename> [ -f <filename> [...]]

πŸ¦‹ DESCRIPTION πŸ¦‹

so ipf opens the filenames listed β€” and yes, it treats - as stdin β€” then parses the file for a set of rules that are gonna be added or removed from the packet filter rule set. iconic behavior honestly.

each rule processed by ipf gets added to the kernel's internal lists if there are no parsing problems. rules are added to the end of the internal lists, matching the order in which they appear when given to ipf. order matters, bestie. periodt.


πŸ’… OPTIONS πŸ’…

  • -6 β€” IPv4 and IPv6 rules are stored in a single table and can be read from a single file. this option is no longer required to load IPv6 rules. it's ignored when specified with the -F option, and the -F option will flush IPv4 rules even if this option is specified. okayyy, noted. πŸ’–
  • -A β€” set the list to make changes to the active list (default).
  • -c <language> β€” causes ipf to generate output files for a compiler that supports language. at present, the only target language supported is C (-cc), for which two files β€” ip_rules.c and ip_rules.h β€” are generated in the CURRENT DIRECTORY when ipf is being run. these files can be used with the IPFILTER_COMPILED kernel option to build filter rules statically into the kernel. compiler girlies rise. πŸŽ€
  • -d β€” turn debug mode on. causes a hexdump of filter rules to be generated as it processes each one.
  • -D β€” disable the filter (if enabled). not effective for loadable kernel versions.
  • -E β€” enable the filter (if disabled). not effective for loadable kernel versions.
  • -F <i|o|a> β€” specifies which filter list to flush. the parameter should either be i (input), o (output) or a (remove all filter rules). either a single letter or an entire word starting with the appropriate letter maybe used. this option maybe before, or after, any other, with the order on the command line being that used to execute options. lowkey flexible. πŸ’…
  • -F <s|S> β€” to flush entries from the state table, the -F option is used in conjunction with either s (removes state information about any non-fully established connections) or S (deletes the entire state table). only one of the two options may be given. a fully established connection will show up in ipfstat -s output as 5/5, with deviations either way indicating it is not fully established any more.
  • -F<5|6|7|8|9|10|11> β€” for the TCP states that represent the closing of a connection has begun β€” be it only one side or the complete connection β€” it is possible to flush those states directly using the number corresponding to that state. the numbers relate to the states as follows: 5 = close-wait, 6 = fin-wait-1, 7 = closing, 8 = last-ack, 9 = fin-wait-2, 10 = time-wait, 11 = closed. state-table cleanup slay. 🧚
  • -F<number> β€” if the argument supplied to -F is greater than 30, then state table entries that have been idle for more than this many seconds will be flushed.
  • -f <filename> β€” this option specifies which files ipf should use to get input from for modifying the packet filter rule lists.
  • -I β€” set the list to make changes to the inactive list.
  • -l <pass|block|nomatch> β€” use of the -l flag toggles default logging of packets. valid arguments to this option are pass, block and nomatch. when an option is set, any packet which exits filtering and matches the set category is logged. this is most useful for causing all packets which don't match any of the loaded rules to be logged. logging bestie activated. πŸ”₯
  • -n β€” this flag (no-change) prevents ipf from actually making any ioctl calls or doing anything which would alter the currently running kernel. look don't touch vibes.
  • -o β€” force rules by default to be added/deleted to/from the output list, rather than the (default) input list.
  • -P β€” add rules as temporary entries in the authentication rule table.
  • -r β€” remove matching filter rules rather than add them to the internal lists.
  • -s β€” swap the active filter list in use to be the "other" one. switcheroo. πŸ¦‹
  • -T <optionlist> β€” this option allows run-time changing of IPFilter kernel variables. some variables require IPFilter to be in a disabled state (-D) for changing, others do not. the optionlist parameter is a comma separated list of tuning commands. a tuning command is either list (retrieve a list of all variables in the kernel, their maximum, minimum and current value), a single variable name (retrieve its current value), and a variable name with a following assignment to set a new value. some examples follow.
# Print out all IPFilter kernel tunable parameters
ipf -T list
# Display the current TCP idle timeout and then set it to 3600
ipf -D -T fr_tcpidletimeout,fr_tcpidletimeout=3600 -E
# Display current values for fr_pass and fr_chksrc, then set fr_chksrc to 1.
ipf -T fr_pass,fr_chksrc,fr_chksrc=1
  • -v β€” turn verbose mode on. displays information relating to rule processing. she's chatty and we love that. πŸ’–
  • -V β€” show version information. this will display the version information compiled into the ipf binary and retrieve it from the kernel code (if running/present). if it is present in the kernel, information about its current state will be displayed (whether logging is active, default filtering, etc). version-check queen. πŸ‘‘
  • -y β€” manually resync the in-kernel interface list maintained by IP Filter with the current interface status list.
  • -z β€” for each rule in the input file, reset the statistics for it to zero and display the statistics prior to them being zeroed. cute little stats reset moment.
  • -Z β€” zero global statistics held in the kernel for filtering only (this doesn't affect fragment or state statistics). important distinction, bestie. πŸ’€

🌸 ENVIRONMENT 🌸

ipf utilizes the following environment variable.

  • IPF_PREDEFINED β€” ipfilter variables, see VARIABLES in ipf(5), can be specified in this environment variable providing shell access to ipfilter and ipnat variables. for example:
IPF_PREDEFINED='my_server="10.1.1.1"; my_client="10.1.1.2";'

πŸŽ€ FILES πŸŽ€

  • /dev/ipauth
  • /dev/ipl
  • /dev/ipstate

🌈 SEE ALSO 🌈


🫢 DIAGNOSTICS 🫢

needs to be run as root for the packet filtering lists to actually be affected inside the kernel. like, actually actually. no cap.


πŸ™ˆ BUGS πŸ™ˆ

if you find any, please send email to me at darrenr@pobox.com. bug reports are self-care, bestie. πŸ’œ


okay that's a wrap on IPF(8) from the System Manager's Manual β€” that's the source/version footer, and there's no date stamped on this copy, so don't come for me. byeee πŸ’…βœ¨

πŸ“¦ where this page comes from