You are here

Useful IPTABLES commands

Save rules: service iptables save
Restart iptables: service iptables restart
Delete a rule 1:
iptables -D INPUT 1

ACCEPT PORT 80 CONNECTIONS
iptables -A INPUT -p tcp --dport 80 -j ACCEPT

REJECT PORT 80 CONNECTIONS
iptables -A INPUT -p tcp --dport 80 -j REJECT

REJECT CONNECTIONS FROM A SPECIFIC IP
iptables -A INPUT -s x.x.x.x -j DROP