@mer said in How to best test/verify firewall rules?:
@furom said in How to best test/verify firewall rules?:
This surprises me a bit, and is in fact what made me want to test the rules. I have been told rules act according to "quick", that first match wins, but experienced otherwise when testing a bit with a simple raspberry pi,
Well, that's what the GUI hides a little from you, hence me saying "pfctl".
Under the hood, pfSense uses pf (originally from OpenBSD) to implement firewalling and NAT. pf has always been last match wins, but other keywords change that behavior. Think of an old HP calculator using RPN and you're thinking "correctly" ;)
If you look closely at the rules you'll see how the "as applied" order matches with the "floating", "per interface", etc ordering in the GUI.
Basically, rules you define in the GUI always have the "quick" added, which makes them effectively "first match wins" because "quick" aborts processing of the rules (there are a few exceptions, but for the most part this applies; I think floating rules you may have to actually check something to get quick applied).
Ah... That clears the woe around that, makes sense now. :)
This is a handy bookmark:
https://docs.netgate.com/pfsense/en/latest/
Definitively! Thanks, had found it already, but a great resource - almost a bit daunting... But what I have seen so far, really good and comprehensive!
If you have other packages enabled, it may affect what rules are evaluated and when, so I'm just talking about base install, nothing else enabled.
Got it, I haven't come to addons or anything like that yet, but will have that in mind when time comes.
The pf book by Peter Hansteen is a little old but the concepts and fundamentals still apply to "how pf works".
Disclaimer: take anything I write here as my opinion, not an official "pfSense position" and like any thing else engineering/networking more than one way to get your result.
For sure. I read a lot and try to compute what I can from it... :) Good thing there is a great backup feature, so there's most often a way back to where I started if messing things up too much :)