IPTABLES, block IP quick

Very basic IPTables reference

How to block an IP address in Linux from ssh:

DROP anything coming from the IP address 1.2.3.4:

append will put this new rule at the end of your ruleset:
iptables -A INPUT -s 1.2.3.4 -j DROP

with insert you can tell which position you want your rule to be:
iptables -I INPUT 3 -s 1.2.3.4 -j DROP

When you insert the rule will not replace the existing one.

list rules:
iptables -L

list specific INPUT rules:
iptables -L INPUT

find where the rule is in the list, #1 at the top, and delete it:
iptables -D INPUT 3
(removes rule #3 from “INPUT”)

This entry was posted in Uncategorized. Bookmark the permalink.