Firewalling with PF

Lately I’ve been setting up a couple of firewalls on Linux hosts using PF, and find myself looking up the same things over and over.  So here is a post with a couple of resources and the commands I need to remember.

First, the simple PF documentation from within the FreeBSD documentation:

https://www.freebsd.org/doc/handbook/firewalls-pf.html

Second, a really interesting looking manuscript that is more of a tutorial, and dedicated to the PF project:

https://home.nuug.no/~peter/pf/

Lastly, the commands for restarting PF or causing it to reload the rules set due to my changes:

pfctl -F all -f /etc/pf.conf  Flush all NAT, filter, state, and table rules and reload

pfctl -s [ rules | nat | states ]  Report on the filter rules, NAT rules, or state table.

pfctl -vnf /etc/pf.conf  Check /etc/pf.conf for errors, but do not load ruleset.

Leave a Comment.