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