Iptables Tutorial 1.2.2
frozentux.net
frozentux.net
Here's an alternate url
https://web.archive.org/web/20170921014253/https://www.froze...
Up to that point, setting up a router/firewall had been exceedingly painful, using Linux and iptables.
The syntax of pf.conf is beautiful. Somebody (I forgot who) once said that in order to write a rule set one needs to consult the (excellent) man page constantly, but once it is done, reading and understanding it takes no effort at all. As far as the "UI" goes, PF is so far ahead of anything I know of that most other metrics to judge a firewall / packet filter by seem to disappear.
Just to be clear: I have nothing against Linux, in fact most of my computers run Linux. But the syntax of pf.conf is just so sweet, once I tasted it, it spoiled me forever. And now iptables scripts look like something out of a Lovecraftian nightmare.
I do wish they'd just adopted the PF syntax tho. It really is the gold standard for stateful firewall definition
Was anyone involved in the discussions around the creation of nftables that can comment on whether this was considered?
https://wiki.nftables.org/wiki-nftables/index.php/Main_Page#...
None of these is anything like a tutorial or introduction. "Quick reference, nftables in 10 minutes" claims to be a ten-minute guide but it's actually just an information dump without any guidance.
Some highlights: "matches are clues used to access to certain packet information and create filters according to them." My translation: "Matches are conditions for rules to apply. They match certain properties (hyperlink) of packets."
"position is an internal number that is used to insert a rule before a certain handle." My translation: "position is an index into the list of rules. It can be used to insert rules at a given position in the list."
I don't know if my translations are correct due to the absurdly bad originals. It is like the authors explain verbs without explaining the nouns they act on. For the nouns, there are mostly just tables of them without any explanation at all. In other places, the few most important nouns are explained.
This alien logic is not only in the documentation, it is also in the syntax. Nobody I know thinks like that.
For reference: https://wiki.nftables.org/wiki-nftables/index.php/Multiple_N...
It does look nicer when properly formatted as part of a rule file, however.
The docs needs some work.
It is a bit hit and miss with kernel/nftables versions on release distributions. I probably would not use it with any kernels older than 4.10 for example. So any current LTS kernel is out.
https://wiki.nftables.org/wiki-nftables/index.php/Main_diffe...
I found 'nft', along with other commands such as 'ip' and 'tc' are pretty hard to use. I hope someone can create all possible auto-completion to guide the users, it is so hard to memorize those abbrev tags/options for those commands.
OTOH, it’s really long for a tutorial and starts with a dissection of IP headers, the audience who needs it most have probably tuned out after the first dozen, and certainly by STCP.
That said, I love the effort in this documentation.
It's also an overly complex pain in the ass, IMO (but I've already dealt with ipfwadm -> ipchains -> iptables and not excited about having to learn yet another way to do it).
I think that can potentially be expressed very simply and consistently with a basic grammar. You could still keep the concept of zones, which are a useful abstraction. Learning and applying something like that would be much quicker for me personally, because I don't normally work with it, and when I do, I just need something that gets the job done so I can move on.
UFW comes close, but it's use cases are limited and the syntax is not consistent - it changes based on what attributes you are matching.
I tried using firewalld (on RHEL/CentOS) since that's now the "official way" but I just had too many issues, said "f--k it", and gave up on it. Mostly I didn't like that it tried to be helpful and auto-create certain rules (that I didn't need nor want) but I also had issues with it not respecting the ordering of my rules. Creating a "raw" iptables ruleset (one that can be loaded with iptables-restore) gives me complete control over my firewall rules -- and that's what I want.