Home > Article > System Tutorial > Explain the command to use iptables to block IP in CentOS
ViewLogin on the dayUnsuccessful IP
One command to block all these IPs:
for i in `grep "$(date "%b %d")" /var/log/secure | grep "Failed password" | awk '{print $(NF-3)}' | sort | uniq - c | sort -nr| awk '{print $2}'` ;do iptables -A INPUT -s $i -j DROP; done
Effect:
The above is the detailed content of Explain the command to use iptables to block IP in CentOS. For more information, please follow other related articles on the PHP Chinese website!