Question: how do iptables rules work?
Answer: The iptables firewall operates by comparing network traffic against a set of rules. The rules define the characteristics that a packet must have to match the rule, and the action that should be taken for matching packets. ... It can also be move the packet to a different chain for processing, or simply log the encounter.