The PF firewall is much easier to configure than other alternatives. Still, it's hard to get it right on the first try. Luckily, PF makes it very easy to debug things.
How I built the router I use at home, from hardware to configuration.
I took a fun course on Software-Defined Networking (with P4), and later also wrote my Master thesis about SDN. Here is what I did and learned.