iptables -I INPUT 1 -s 10.0.0.5 -j DROP

Category: Networking

iptables -I INPUT 1 -s 10.0.0.5 -j DROP

Insert a DROP rule at position 1 to block an IP

-I inserts (rather than appends) at a specific position. Putting a DROP rule at position 1 ensures it's evaluated before any ACCEPT rules. Use to immediately block a suspected malicious IP.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.