Howto: deny/allow IP using iptables

by Manoj 2012-04-21 12:22:55

How to block an IP using iptables?


iptables -A INPUT -s xx.xx.xx.xx -j DROP

How to block an IP for a specific port:

iptables -A INPUT -p tcp -s xx.xx.xx.xx âАУdport PORT -j DROP

How to allow access to an IP?

iptables -A INPUT -s xx.xx.xx.xx -j ACCEPT

How to allow access to an IP to a specific port using iptables?

iptables -A INPUT -p tcp -s xx.xx.xx.xx âАУdport PORT -j ACCEPT

where, xx.xx.xx.xx is the remote IP address and PORT is the port number you wish to allow/deny access to.

How to block a scanner on your server for example w00tw00t.at.ISC.SANS using iptables?

iptables -I INPUT -p tcp âАУdport 80 -m string âАУstring GET /w00tw00t.at.ISC.SANS. -j DROP

Tagged in:

857
like
0
dislike
0
mail
flag

You must LOGIN to add comments