Security

A firewall must block traffic from 20,000 IP addresses on a blocklist that changes daily. Which iptables approach keeps the rule set small and fast?

Show the answer

Correct answerD. Load the addresses into an ipset set and match it with one rule

AWhy not this: 20,000 rules are checked one by one, which is slow and hard to update daily.

BWhy not this: iptables expands a comma-separated -s list into one rule per address, so the rule set stays large.

CWhy not this: hosts.deny is read by TCP Wrappers-aware programs, not by iptables.

DWhy this is right: One rule with -m set --match-set tests packets against the whole set, which can be updated without editing rules.

ipset stores addresses in kernel sets, and one iptables rule using -m set --match-set can test a packet against the whole set. Listing each address as its own rule is the slower approach that ipset was built to replace.