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

Explain the command to use iptables to block IP in CentOS

王林
Release: 2023-12-30 19:32:28
forward
896 people have browsed it

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!

Related labels:
source:jb51.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template