Why are tables built into ipchains? What was the benefit of adding tables to ipchains? Is there a simple scenario that would illustrate how tables are used to increase performance or offer some other benefit?
|
|
||||
migrated from serverfault.com Dec 21 '11 at 19:35
|
"tables" were included because the concept carried over to ipchains from when Linux used BSD's IPFW firewall. They make it easy to apply one or more rules to a set of IPs that should administratively be treated the same. The most common place I see them is when using black or white lists. You might be using fail2ban to automatically block IPs that are "attacking" your server, adding them to a naughty table instead of creating a rule for each IP keeps things clean. Similarly you might have a set of "administrative" machines on your network with diverse IPs, you could add those to a table then write a single rule that allows them to SSH into your server. |
|||
|
|
So, in the above example, you don't have to write rules for the same set of allowed UDP/TCP ports over and over again for the allowed networks. So, you have 9 lines instead of 15. There should be some performance improvement since each incoming packet doesn't have to try matching on 15 rules. Instead, a packet will be matched those 3 INPUT rules, and if there's a match on the source IP, it will try matching on the 4 rules in the dmzrules table. I think if you're using iptables for a single box, it may be less useful to use tables. You can probably just enumerate the allowed ports in one swoop, though Chris's point about black/white lists is something to keep in mind, i.e., you can update this list without mucking with the main set of rules. |
|||
|
|

iptablesis meant to control. – Gilles Dec 22 '11 at 0:34mangle) would have to come first, then all in the next one, and so on. - It seems to be all about chains; tables seem to serve no clear purpose. Are they an implementation detail leaked to user docs? Is that because the predecessor was calledipchainsand there had to be a difference? – Lumi Nov 29 '12 at 9:13