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

firewalliptables

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

iptables -A INPUT -s 192.168.1.0/24 -j ACCEPT
iptables -A INPUT -s 192.168.1.0/24 -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.