Home  >  Article  >  System Tutorial  >  Explain the command to use iptables to block IP in CentOS

Explain the command to use iptables to block IP in CentOS

王林
王林forward
2023-12-30 19:32:28848browse

ViewLogin on the dayUnsuccessful IP

Explain the command to use iptables to block IP in CentOS

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:

Explain the command to use iptables to block IP in CentOS

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!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete