OpenBSD's stateful packet filter, PF, is the heart of the OpenBSD firewall. With more and more services placing high demands on bandwidth and an increasingly hostile Internet environment, no sysadmin can afford to be without PF expertise. The third edition of The Book of PF covers the most up-to-date developments in PF, including new content on IPv6, dual stack configurations, the “queues and priorities” traffic-shaping system, NAT and redirection, wireless networking, spam fighting, failover provision ing, logging, and more.
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
【One-Line Pitch】
A practical, example-driven guide to building real networks with OpenBSD's PF packet filter—from a single machine to gateways, DMZs, wireless, and failover—for sysadmins who want secure, well-shaped traffic without hand-waving.
【Book Arc】
- **Opening (~0%–10%)**: Frames PF as the kernel-level heart of the OpenBSD firewall and sets expectations—firewalling, NAT, traffic control, and bandwidth management in one system—while orienting newcomers to the BSD way of working.
- **Early (~10%–32%)**: Builds the foundation: enabling PF with `pfctl`, writing a minimal single-machine rule set (`block in all` / `pass out all keep state`), and understanding that filtering is only one of several uses for packet criteria.
- **Middle (~32%–48%)**: Extends the single-machine setup into a gateway for a home or small office, introducing macros like `$localnet` for readable rule sets and handling awkward services such as FTP via `ftp-proxy`.
- **Late (~48%–70%)**: Moves into trickier territory—wireless with authpf access control, DMZs and multiple subnets, redirection and relayd load balancing, and proactive defense against brute-force and spam (spamd).
- **Ending (~70%–100%)**: Covers traffic shaping with the queues-and-priorities system (replacing ALTQ), plus monitoring/visualization and failover provisioning with CARP—rounding out operations beyond basic filtering. (Excerpts do not detail the final chapters' internals.)
【Key Takeaways】
- **PF is more than a blocker** (Early): Filtering criteria can redirect traffic to hosts, assign it to queues, shape bandwidth, or hand it to other software—so treat the rule set as a traffic policy, not just a deny list.
- **Start minimal, then grow** (Early): The book deliberately begins with the simplest possible rule set on a standalone machine, because every later configuration builds on that baseline; skipping ahead makes later chapters harder.
- **Macros make rule sets maintainable** (Middle): Defining `$localnet`, `$ports`, and similar macros shrinks rule sets and makes logic legible—crucial for long-term upkeep and auditing.
- **Document policy before converting** (Early): Hansteen urges resisting automated conversion from other firewall products; instead re-specify your network's goals in prose (or config comments) and implement those policies in PF.
- **Awkward protocols need special handling** (Middle): FTP and similar services require helpers like `ftp-proxy` and careful pass rules—an early lesson that "just open the port" often isn't enough.
- **Defense can be proactive** (Late): Tools like spamd and rate-limiting against brute-force attempts turn the firewall into an active defender, making the network friendlier to legitimate users.
- **Traffic shaping is a first-class concern** (Late): The queues-and-priorities system (post-ALTQ) keeps networks responsive under load—bandwidth management belongs in your PF design, not as an afterthought.
- **Availability and visibility matter** (Late): CARP, relayd, and monitoring/NetFlow-style tooling extend PF from a perimeter device into a resilient, observable network component.
【Reading Tips】
- **Deep-read Chapters 2–3**: the single-machine and gateway configurations are the load-bearing foundation; type out and test each rule set rather than skimming.
- **Skim the BSD-orientation material** if you already run OpenBSD/FreeBSD/NetBSD, but don't skip the `pfctl` enable/load workflow—it recurs throughout.
- **Treat FTP, wireless, and spamd sections as pattern libraries**: read them when your network actually needs them, and consult the referenced man pages for edge cases.
- **Watch version drift**: the book targets OpenBSD 5.6, FreeBSD 10.x, and NetBSD 6.x; verify syntax against current man pages, especially for queues/priorities and ALTQ migration.
- **Keep a written policy alongside your config**: follow the author's advice and comment your rules—future-you will thank present-you.
【Coverage Limits】
This guide is synthesized from stratified excerpts covering roughly the first half of the book plus front matter; later chapters on queues, monitoring, and failover are represented only by their stated themes, so specifics there are not covered.
Excerpt 1
, and more. be well prepared to unlock PF’s full potential. You’ll also learn how to: A B O U T T H E A U T H O R • Create rule sets for all kinds of network...
orities and queues systems introduced in OpenBSD 5.5. This chapter also contains tips on how to convert earlier ALTQ-based setups to the new system, as well...
ou’re ready to move on to creating a complete configuration. The supplied /etc/pf.conf file contains no active settings; it has only comment lines starting w...
pass rule that is useful to those who want the ability to administer machines from elsewhere: pass in proto tcp to port ssh Or use this form, if you prefer:...
ce-specific programs, such as wicontrol and ancontrol, are still around, but for the most part, they are deprecated and have long been replaced with ifconfig...
eds to surf the Web and have access to a service that runs on a high port on a specific machine could get what he needs with a /etc/ authpf/users/peter/authp...
s on a machine that’s primarily a firewall isn’t desirable. This means we’re back to the situation where we do our NAT at the gateway. Fortunately, the redir...
ey are, it’s confirmation that the bridge has been enabled. If they’re not, go back and see what went wrong and why. n o T e These values apply to filtering...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
The Book of PF, 3rd Edition A No-Nonsense Guide to the OpenBSD Firewall (Peter N. M. Hansteen)(Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share to WeChat Moments
The Book of PF, 3rd Edition A No-Nonsense Guide to the OpenBSD Firewall (Peter N. M. Hansteen)(Z-Library)
Scan the QR code with WeChat to open this book
Tap the ··· menu in the top-right corner
Choose Share to Moments
You are already in WeChat. Tap ··· in the top-right corner and choose Share to Moments.
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
The Book of PF, 3rd Edition A No-Nonsense Guide to the OpenBSD Firewall (Peter N. M. Hansteen)(Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
Loading comments...
Reply to Comment
Edit Comment