How to block an IP using iptables


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

specific port:
 
iptables -A INPUT -p tcp -s xx.xx.xx.xx --dport PORT -j DROP

allow access to an IP?
 
iptables -A INPUT -s xx.xx.xx.xx -j ACCEPT

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.

block a scanner on your server for example “w00tw00t.at.ISC.SANS” using iptables?
iptables -I INPUT -p tcp --dport 80 -m string --algo bm  \
--string 'GET /w00tw00t.at.ISC.SANS.' -j DROP
 
Source: http://safesrv.net/quick-how-to-denyallow-ip-using-iptables/ 

Comments

Popular posts from this blog

Black screen after logging in on Windows 2012 R2 using domain credentials on remote desktop connection

Client denied by server configuration error

Water Wonder Resort