首頁  >  文章  >  系統教程  >  講解CentOS中使用iptables封鎖IP的指令

講解CentOS中使用iptables封鎖IP的指令

王林
王林轉載
2023-12-30 19:32:28799瀏覽

查看當天登陸未成功的IP

講解CentOS中使用iptables封鎖IP的指令

#一條指令把這些IP全部封掉:

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

效果:

講解CentOS中使用iptables封鎖IP的指令

#

以上是講解CentOS中使用iptables封鎖IP的指令的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:jb51.net。如有侵權,請聯絡admin@php.cn刪除