Iptables

From FoppaWiki

Jump to: navigation, search

Block on ip:

iptables -I INPUT -s 4.2.2.2 -j DROP

Block on ip and port:

iptables -I INPUT -s 4.2.2.2 -p udp --destination-port 53 -j DROP

Remove block:

iptables -D INPUT -s 4.2.2.2 -j DROP

Flush rules:

iptables -F

Portforwarding - this will forward ports 1024->65536 to 80 on the same host:

iptables -t nat -A PREROUTING -p tcp -d 10.0.0.10 --dport 1024:65535 -j DNAT --to 10.0.0.10:80
iptables -A INPUT -p tcp 10.0.0.10 -s 0/0 --dport 1024:65535 -j ACCEPT
Personal tools
menu