Linux CentOS,Debian用iptables屏蔽IP和刪除IP
#添加屏蔽IP
#禁止此IP訪問服務器
iptables -I INPUT -s 1.2.3.4 -j DROP
或 宇塵網(wǎng)絡幫助中心域名知識|虛擬主機知識|VPS主機知識|服務器知識|網(wǎng)站建設知識|網(wǎng)絡推廣
iptables -A INPUT -s 1.2.3.4 -j DROP
#禁止服務器訪問此IP
iptables -A OUTPUT -d 1.2.3.4 -j DROP
如果要封某個網(wǎng)段:
iptables -I INPUT -s 1.2.3.0/24 -j DROP
仿牌空間、香港月付空間、韓國月付空間、日本月付空間、荷蘭VPS、香港VPS
#清空屏蔽IP
iptables -t filter -D INPUT -s 1.2.3.4 -j DROP
iptables -t filter -D OUTPUT -d 1.2.3.4 -j DROP
#一鍵清空所有規(guī)則
iptables -F
美國月付空間、月付美國空間、美國VPS、美國服務器租用
#查看
iptables -L INPUT
或
iptables -L
或
iptables-save(此命令將保存規(guī)則,下次開機自動執(zhí)行)
#處理IP碎片數(shù)量,防止攻擊,允許每秒100個
iptables -A FORWARD -f -m limit --limit 100/s --limit-burst 100 -j ACCEPT
#設置ICMP包過濾,允許每秒1個包,限制觸發(fā)條件是10個包
iptables -A FORWARD -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT
更多技術(shù)知識,更多網(wǎng)絡服務,盡在宇塵網(wǎng)絡。我們的成長,離不開你們的支持,宇塵網(wǎng)絡,歡迎您的訪問。