See also Manually Add and Remove IP Addresses to a Mikrotik Blacklist
You can use
DROP
or REJECT
depending on what you want the blocked host to know.
iptables -I INPUT -s nnn.nnn.nnn.nnn -j DROP
Delete the rules:
iptables -D INPUT -s nnn.nnn.nnn.nnn -j DROP
Show the rules:
iptables -L INPUT
One-liner to block evil hosts grep'd from Apache error logs:
for ip in `grep spammer.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
http://en.linuxreviews.org/HOWTO_stop_automated_spam-bots_using_.htaccess
vim .htaccess
# Block bots by User Agent string SetEnvIfNoCase User-Agent "^Mozilla\/4.0 \(compatible\; MSIE 6.0\; Windows NT 5.1\; SV1\)" bad_bot # Block empty User Agent string SetEnvIfNoCase User-Agent ^$ bad_bot SetEnvIfNoCase User-Agent "^AESOP_com_SpiderMan" bad_bot SetEnvIfNoCase User-Agent "^Alexibot" bad_bot SetEnvIfNoCase User-Agent "^Zyborg" bad_bot <Limit GET POST HEAD> Order Allow,Deny Allow from all Deny from env=bad_bot </Limit>
service httpd restart