pf.conf Generator for OpenBSD and FreeBSD
A pf firewall configurator for a server (host firewall). Set the interface and services, enable normalization, antispoofing, brute-force protection and optionally NAT and port forwarding, and the tool will assemble a complete, readable pf.conf file in the syntax of the system you choose. Everything is computed in your browser, nothing is sent. This is a tool for administrators, so read the rule descriptions and test the configuration before deploying. Related: FreeBSD server administration.
Interface and macros
Global options (set)
Skips filtering on the loopback interface. Recommended by default.
Drops packets silently instead of sending a response. Less information for anyone scanning you.
Collects statistics for the external interface (pfctl -si).
Automatic optimization of the rule set.
Normalization (scrub)
Reassembles fragmented packets and tidies up traffic. OpenBSD: match in all scrub (no-df), FreeBSD: scrub in all.
Default policy and antispoofing
Default-deny policy: block whatever is not explicitly allowed. The foundation of a secure firewall.
Blocks packets with a spoofed source address.
Rejects traffic from private and unallocated addresses (the bogon table) on the public interface.
pass out keep state — the server can initiate outbound connections (updates, DNS).
Brute-force protection
Addresses that exceed the new-connection limit are moved to the table and blocked (overload).
ICMP (ping)
Permits echoreq and the messages needed for the network to work (e.g. unreach, PMTU).
NAT and port forwarding (optional)
Logging
Adds the log keyword to the block rule; traffic is visible via tcpdump -i pflog0.
pfctl -nf pf.conf, deploy from a console or a second session, and make sure you have a pass rule for SSH./etc/pf.conf, check pfctl -nf /etc/pf.conf, then load pfctl -f /etc/pf.conf. Enable pf: on OpenBSD pfctl -e, on FreeBSD service pf enable && service pf start.

