User Tools

Site Tools


networking:firewall:block_host

This is an old revision of the document!


Block Traffic From a Particular Host

:!: You can use DROP or REJECT depending on what you want the blocked host to know.

iptables -I INPUT -s 66.184.141.132 -j DROP
iptables -I INPUT -s 64.139.76.21 -j DROP

iptables -I INPUT -s 85.25.176.237 -j DROP

Delete the rules:

iptables -D INPUT -s 66.184.141.132 -j DROP
iptables -D INPUT -s 64.139.76.21 -j DROP

Show the rules:

iptables -L INPUT

One-liner to block evil hosts grep'd from Apache error logs:

for ip in `grep Itau.com.br /var/log/httpd/error_log|egrep -o "client [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+"|sort |uniq|cut -f 2 -d " "`; do iptables -I INPUT -s $ip -j DROP; done
networking/firewall/block_host.1372719244.txt.gz · Last modified: 2013/07/01 16:54 by gcooper