Iptables – DROP and ACCEPT the same IP address in iptables? What will take precedence


I am playing around iptables to filter the packets coming and going. What will be the result of following rules?

iptables -A INPUT -s -j ACCEPT
iptables -A INPUT -s -j DROP

Best Answer

Iptables (and most firewall software) operates on a concept of first match wins, so if the rules are in the order posted above, the ACCEPT will match first and will be the effective policy applied to the packet.