我需要一些处理ddos的帮助.我在我的服务器上遇到1gb ddos攻击,我不知道如何阻止它.
(1gbs是服务器的最大速度.)
我有以下iptables规则:
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A INPUT -p tcp --dport 22 -j ACCEPT iptables -A INPUT -p tcp --dport 80 -j ACCEPT iptables -A INPUT -p tcp --dport 8080 -j ACCEPT iptables -A INPUT -i lo -j ACCEPT iptables -A INPUT -j DROP
但是使用tcpdump,我可以看到来自端口53的数据包
12:14:40.341410 IP 195.137.162.149 > x.x.x.x: ip-proto-17 12:14:40.341411 IP 193.169.188.52.53 > x.x.x.x.23495: 23454- 0/4/6 (234) 12:14:40.341414 IP 195.248.88.120 > x.x.x.x: ip-proto-17 12:14:40.341416 IP 193.19.184.42.53 > x.x.x.x.50529: 26701| 6/0/1 TXT[|domain] 12:14:40.341418 IP 192.41.13.71.53 > x.x.x.x.10634: 23454| 6/0/1 TXT[|domain] 12:14:40.341418 IP 50.97.53.214.53 > x.x.x.x.65437: 23454| 6/0/1 TXT[|domain] 12:14:40.341419 IP 192.3.130.149.53 > x.x.x.x.57519: 24820| 6/0/1 TXT[|domain] 12:14:40.341438 IP 195.182.58.136 > x.x.x.x: ip-proto-17 12:14:40.341441 IP 193.234.216.12 > x.x.x.x: ip-proto-17 12:14:40.341442 IP 195.228.85.145.53 > x.x.x.x.7903: 37969| 6/0/1 TXT[|domain] 12:14:40.341512 IP 192.195.177.60.53 > x.x.x.x.42871: 57501- 0/13/23 (718) 12:14:40.341552 IP 192.210.150.10.53 > x.x.x.x.41447: 25994| 6/0/1 TXT[|domain] 12:14:40.341556 IP 193.28.177.41 > x.x.x.x: ip-proto-17
iptables -xnvL
Chain INPUT (policy ACCEPT 0 packets,0 bytes) pkts bytes target prot opt in out source destination 415575 293176304 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state ESTABLISHED 24101 1323153 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 19725 1182436 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080 2 104 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0 13101233 35329988490 DROP all -- * * 0.0.0.0/0 0.0.0.0/0 Chain FORWARD (policy ACCEPT 0 packets,0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 488686 packets,518540789 bytes) pkts bytes target prot opt in out source destination
在Nginx我
limit_req_zone $binary_remote_addr zone=one:10m rate=5r/s;
在此屏幕截图中,您可以看到实际的数字.我的正常使用率不超过5mb / sec.
netstat -ntu | awk'{print $5}’| cut -d:-f1 |排序| uniq -c | sort -n |尾巴| grep -v“127.0.0”
13 87.149.x.x 14 95.68.x.x 15 109.186.x.x 15 84.108.x.x 15 91.231.x.x 17 162.17.x.x 18 82.212.x.x 82 151.248.x.x 94 79.180.x.x