{"id":442690,"date":"2026-06-06T15:53:02","date_gmt":"2026-06-06T07:53:02","guid":{"rendered":"https:\/\/idc.net\/help\/?p=442690"},"modified":"2026-06-02T15:54:29","modified_gmt":"2026-06-02T07:54:29","slug":"%e6%9c%8d%e5%8a%a1%e5%99%a8%e9%81%ad%e9%81%87ddos-cc%e6%94%bb%e5%87%bb%e5%85%a8%e5%a5%97%e5%ba%94%e5%af%b9%ef%bc%9a%e4%bb%8e%e6%a3%80%e6%b5%8b%e5%88%b0%e9%98%b2%e5%be%a1%e7%9a%84%e9%9b%b6%e6%88%90","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/442690\/","title":{"rendered":"\u670d\u52a1\u5668\u906d\u9047DDoS\/CC\u653b\u51fb\u5168\u5957\u5e94\u5bf9\uff1a\u4ece\u68c0\u6d4b\u5230\u9632\u5fa1\u7684\u96f6\u6210\u672c\u65b9\u6848"},"content":{"rendered":"<p>\u9999\u6e2f\u670d\u52a1\u5668\u56e0\u514d\u5907\u6848\u3001\u4f4e\u5ef6\u8fdf\u7684\u4f18\u52bf\u88ab\u5927\u91cf\u7ad9\u957f\u4f7f\u7528\uff0c\u4f46\u540c\u65f6\u4e5f\u662f\u6076\u610f\u653b\u51fb\u7684\u9ad8\u53d1\u533a\u3002\u4e00\u65e6\u906d\u53d7DDoS\u6216CC\u653b\u51fb\uff0c\u8f7b\u5219\u7f51\u7ad9\u54cd\u5e94\u53d8\u6162\uff0c\u91cd\u5219\u76f4\u63a5\u5b95\u673a\u3002\u672c\u6587\u7cfb\u7edf\u68b3\u7406\u653b\u51fb\u8bc6\u522b\u65b9\u6cd5\u548c\u9632\u5fa1\u65b9\u6848\uff0c90%\u7684\u63aa\u65bd\u96f6\u6210\u672c\u5373\u53ef\u5b9e\u73b0\u3002<\/p>\n<h2>\u4e00\u3001DDoS\u4e0eCC\u653b\u51fb\u7684\u533a\u522b<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u653b\u51fb\u7c7b\u578b<\/th>\n<th>\u539f\u7406<\/th>\n<th>\u4e3b\u8981\u8868\u73b0<\/th>\n<th>\u9632\u5fa1\u96be\u5ea6<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>DDoS\uff08\u6d41\u91cf\u578b\uff09<\/td>\n<td>\u5927\u91cf\u8089\u9e21\u53d1\u9001SYN\/UDP\/ICMP\u6d2a\u6c34\uff0c\u6253\u6ee1\u5e26\u5bbd<\/td>\n<td>\u5e26\u5bbd\u8dd1\u6ee1\uff0c\u670d\u52a1\u5668\u65e0\u54cd\u5e94<\/td>\n<td>\u9ad8\uff0c\u9700\u786c\u9632<\/td>\n<\/tr>\n<tr>\n<td>CC\u653b\u51fb\uff08HTTP\u5c42\uff09<\/td>\n<td>\u6a21\u62df\u6b63\u5e38HTTP\u8bf7\u6c42\uff0c\u6d88\u8017CPU\u548c\u6570\u636e\u5e93\u8d44\u6e90<\/td>\n<td>CPU 100%\uff0c\u9875\u9762502\/504<\/td>\n<td>\u4e2d\uff0c\u8f6f\u4ef6\u53ef\u9632<\/td>\n<\/tr>\n<tr>\n<td>\u66b4\u529b\u7834\u89e3<\/td>\n<td>\u9ad8\u9891\u5c1d\u8bd5SSH\/\u540e\u53f0\u5bc6\u7801<\/td>\n<td>auth.log\u5f02\u5e38\uff0c\u8d26\u53f7\u9501\u5b9a<\/td>\n<td>\u4f4e\uff0cFail2ban\u5373\u53ef<\/td>\n<\/tr>\n<tr>\n<td>\u6162\u901f\u653b\u51fb<\/td>\n<td>\u6781\u6162\u53d1\u9001\u8bf7\u6c42\uff0c\u5360\u6ee1\u8fde\u63a5\u6570<\/td>\n<td>\u8fde\u63a5\u6570\u6ee1\uff0c\u65b0\u8bf7\u6c42\u8d85\u65f6<\/td>\n<td>\u4e2d\uff0cNginx\u914d\u7f6e\u53ef\u9632<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u4e8c\u3001\u5feb\u901f\u5224\u65ad\u662f\u5426\u6b63\u5728\u88ab\u653b\u51fb<\/h2>\n<h3>\u68c0\u67e5\u670d\u52a1\u5668\u8d1f\u8f7d<\/h3>\n<pre><code># \u67e5\u770b\u5b9e\u65f6\u8d1f\u8f7d\r\ntop\r\n# \u6216\u4f7f\u7528htop\uff08\u9700\u5b89\u88c5\uff09\r\nhtop\r\n\r\n# \u67e5\u770b\u8fde\u63a5\u6570\uff08\u6309IP\u7edf\u8ba1\uff09\r\nnetstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -rn | head -20<\/code><\/pre>\n<h3>\u68c0\u67e5\u7f51\u7edc\u6d41\u91cf<\/h3>\n<pre><code># \u5b89\u88c5nethogs\u67e5\u770b\u5b9e\u65f6\u6d41\u91cf\r\napt install nethogs -y\r\nnethogs eth0\r\n\r\n# \u67e5\u770b\u5f53\u524d\u8fde\u63a5\u72b6\u6001\u7edf\u8ba1\r\nss -s<\/code><\/pre>\n<h3>\u5224\u65ad\u6807\u51c6<\/h3>\n<ul>\n<li>\u67d0\u4e2aIP\u7684\u5e76\u53d1\u8fde\u63a5\u6570\u8d85\u8fc7100\uff1a\u7591\u4f3cCC\u653b\u51fb\u6765\u6e90<\/li>\n<li>\u7f51\u7edc\u5165\u7ad9\u6d41\u91cf\u7a81\u7136\u8d85\u8fc7\u6b63\u5e38\u503c\u768410\u500d\u4ee5\u4e0a\uff1a\u7591\u4f3cDDoS<\/li>\n<li>CPU\u6301\u7eed100%\u4f46\u6b63\u5e38\u6d41\u91cf\u4e0d\u9ad8\uff1a\u7591\u4f3cCC\u6216\u6076\u610f\u722c\u866b<\/li>\n<\/ul>\n<h2>\u4e09\u3001\u96f6\u6210\u672c\u9632\u5fa1\u65b9\u6848\uff08\u7acb\u5373\u53ef\u7528\uff09<\/h2>\n<h3>1. Nginx\u9650\u6d41\u914d\u7f6e\uff08\u9632CC\uff09<\/h3>\n<pre><code># nginx.conf http\u5757\u4e2d\u6dfb\u52a0\uff1a\r\nlimit_req_zone $binary_remote_addr zone=req_limit:10m rate=20r\/s;\r\nlimit_conn_zone $binary_remote_addr zone=conn_limit:10m;\r\n\r\n# server\u5757\u4e2d\u5e94\u7528\uff1a\r\nserver {\r\n    limit_conn conn_limit 50;      # \u5355IP\u6700\u591a50\u4e2a\u5e76\u53d1\u8fde\u63a5\r\n\r\n    location \/ {\r\n        limit_req zone=req_limit burst=50 nodelay;\r\n    }\r\n\r\n    location \/wp-login.php {\r\n        limit_req zone=req_limit burst=5 nodelay;   # \u767b\u5f55\u9875\u4e25\u683c\u9650\u5236\r\n    }\r\n}<\/code><\/pre>\n<h3>2. UFW\u9632\u706b\u5899\u5c01\u7981\u653b\u51fbIP<\/h3>\n<pre><code># \u5c01\u7981\u5355\u4e2aIP\r\nufw deny from \u653b\u51fb\u8005IP to any\r\n\r\n# \u5c01\u7981IP\u6bb5\uff08CIDR\uff09\r\nufw deny from 192.168.1.0\/24 to any\r\n\r\n# \u67e5\u770b\u5c01\u7981\u5217\u8868\r\nufw status numbered<\/code><\/pre>\n<h3>3. iptables\u9650\u5236\u8fde\u63a5\u9891\u7387<\/h3>\n<pre><code># \u6bcf\u79d2\u5141\u8bb8\u540c\u4e00IP\u65b0\u5efa\u8fde\u63a5\u4e0d\u8d85\u8fc720\u4e2a\r\niptables -A INPUT -p tcp --dport 80 -m conntrack --ctstate NEW -m limit --limit 20\/s --limit-burst 100 -j ACCEPT\r\niptables -A INPUT -p tcp --dport 80 -m conntrack --ctstate NEW -j DROP\r\n\r\n# \u4fdd\u5b58\u89c4\u5219\r\niptables-save &gt; \/etc\/iptables\/rules.v4<\/code><\/pre>\n<h3>4. \u4f7f\u7528Cloudflare\u514d\u8d39\u7248\uff08\u5f3a\u70c8\u63a8\u8350\uff09<\/h3>\n<p>Cloudflare\u514d\u8d39\u7248\u662f\u9632\u5fa1CC\u653b\u51fb\u6027\u4ef7\u6bd4\u6700\u9ad8\u7684\u65b9\u6848\uff1a<\/p>\n<ol>\n<li>\u5c06\u57df\u540dNS\u670d\u52a1\u5668\u6539\u4e3aCloudflare\u63d0\u4f9b\u7684\u5730\u5740<\/li>\n<li>\u5f00\u542f\"\u6a59\u4e91\u4ee3\u7406\"\uff0c\u9690\u85cf\u771f\u5b9e\u670d\u52a1\u5668IP<\/li>\n<li>\u5f00\u542f\"Under Attack Mode\"\uff08\u53d7\u653b\u51fb\u6a21\u5f0f\uff09\uff0c\u81ea\u52a8\u5bf9\u6240\u6709\u8bbf\u95ee\u8005\u8fdb\u884cJS\u9a8c\u8bc1<\/li>\n<li>\u5728\u9632\u706b\u5899\u89c4\u5219\u4e2d\u5c4f\u853d\u53ef\u7591\u56fd\u5bb6\/\u5730\u533a\u6216\u5f02\u5e38UA<\/li>\n<\/ol>\n<h2>\u56db\u3001\u4e2d\u7ea7\u9632\u5fa1\u65b9\u6848\uff08\u4f4e\u6210\u672c\uff09<\/h2>\n<h3>5. \u5b89\u88c5ModSecurity WAF<\/h3>\n<pre><code>apt install libmodsecurity3 libnginx-mod-http-modsecurity -y\r\n\r\n# \u542f\u7528OWASP\u89c4\u5219\u96c6\r\ngit clone https:\/\/github.com\/coreruleset\/coreruleset \/etc\/nginx\/modsecurity\/crs<\/code><\/pre>\n<h3>6. \u5b9d\u5854\u9762\u677f\u5185\u7f6e\u9632CC<\/h3>\n<p>\u82e5\u4f7f\u7528\u5b9d\u5854\u9762\u677f\uff1a\u5b89\u5168 \u2192 \u7f51\u7ad9\u9632\u706b\u5899 \u2192 \u9632CC\u653b\u51fb\uff0c\u8bbe\u7f6e30\u79d2\u5185\u540cIP\u8bf7\u6c42\u8d85\u8fc760\u6b21\u81ea\u52a8\u5c01\u7981\uff0c\u5c01\u7981\u65f6\u95f4600\u79d2\u3002<\/p>\n<h3>7. \u914d\u7f6efail2ban\u9488\u5bf9Web\u8bf7\u6c42<\/h3>\n<pre><code># \/etc\/fail2ban\/jail.local \u6dfb\u52a0\uff1a\r\n[nginx-cc]\r\nenabled = true\r\nport = http,https\r\nfilter = nginx-cc\r\nlogpath = \/var\/log\/nginx\/access.log\r\nmaxretry = 60\r\nfindtime = 30\r\nbantime = 3600<\/code><\/pre>\n<h2>\u4e94\u3001\u4e13\u4e1a\u7ea7\u9632\u5fa1\uff08\u4ed8\u8d39\u65b9\u6848\uff09<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u65b9\u6848<\/th>\n<th>\u9632\u62a4\u80fd\u529b<\/th>\n<th>\u9002\u7528\u573a\u666f<\/th>\n<th>\u53c2\u8003\u8d39\u7528<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Cloudflare Pro\/Business<\/td>\n<td>\u65e0\u9650DDoS\u9632\u62a4 + WAF<\/td>\n<td>\u4e2d\u5927\u578b\u7f51\u7ad9<\/td>\n<td>$20~$200\/\u6708<\/td>\n<\/tr>\n<tr>\n<td>\u9999\u6e2f\u9ad8\u9632\u670d\u52a1\u5668<\/td>\n<td>10G~100G\u786c\u9632<\/td>\n<td>\u6e38\u620f\u3001\u91d1\u878d\u7c7b\u9ad8\u98ce\u9669\u4e1a\u52a1<\/td>\n<td>500\u5143~2000\u5143\/\u6708<\/td>\n<\/tr>\n<tr>\n<td>\u963f\u91cc\u4e91\/\u817e\u8baf\u4e91\u9ad8\u9632IP<\/td>\n<td>T\u7ea7\u9632\u62a4\uff0c\u5f39\u6027\u4ed8\u8d39<\/td>\n<td>\u8d85\u5927\u6d41\u91cf\u4e1a\u52a1<\/td>\n<td>\u6309\u653b\u51fb\u91cf\u8ba1\u8d39<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u516d\u3001\u88ab\u653b\u51fb\u65f6\u7684\u5e94\u6025\u5904\u7f6e\u6b65\u9aa4<\/h2>\n<ol>\n<li><strong>\u7acb\u5373\u5f00\u542fCloudflare\u53d7\u653b\u51fb\u6a21\u5f0f<\/strong>\uff08\u82e5\u5df2\u914d\u7f6e\uff09<\/li>\n<li>\u68c0\u67e5\u653b\u51fb\u6765\u6e90IP\u6bb5\uff0c\u6279\u91cf\u5c01\u7981<\/li>\n<li>\u4e34\u65f6\u5173\u95ed\u9ad8\u6d88\u8017\u8def\u5f84\uff08\u5982\u641c\u7d22\u63a5\u53e3\u3001\u767b\u5f55\u9875\uff09<\/li>\n<li>\u8054\u7cfb\u670d\u52a1\u5546\u5f00\u542f\u6d41\u91cf\u6e05\u6d17\u6216\u66f4\u6362IP<\/li>\n<li>\u653b\u51fb\u7ed3\u675f\u540e\u5206\u6790\u65e5\u5fd7\uff0c\u52a0\u56fa\u9632\u62a4\u89c4\u5219<\/li>\n<\/ol>\n<h2>\u4e03\u3001\u603b\u7ed3<\/h2>\n<p>\u5927\u591a\u6570\u4e2d\u5c0f\u578b\u7f51\u7ad9\u906d\u9047\u7684CC\u653b\u51fb\uff0c\u901a\u8fc7Nginx\u9650\u6d41 + Cloudflare\u514d\u8d39\u7248\u5373\u53ef\u6709\u6548\u9632\u5fa1\uff0c\u65e0\u9700\u989d\u5916\u82b1\u8d39\u3002IDC.Net\u7684<a href=\"https:\/\/idc.net\/\">\u9999\u6e2f\u670d\u52a1\u5668<\/a>\u4ea4\u4ed8\u65f6\u63d0\u4f9b\u514d\u8d39\u57fa\u7840\u5b89\u5168\u52a0\u56fa\uff0c\u4e14\u5728\u975e\u5ba2\u6237\u539f\u56e0\u5bfc\u81f4IP\u88ab\u5c01\u65f6\u63d0\u4f9b24\u5c0f\u65f6\u5185\u514d\u8d39\u6362IP\u4fdd\u969c\u3002\u5982\u9700\u66f4\u9ad8\u9632\u62a4\uff0c\u53ef\u5347\u7ea7\u81f3<a href=\"https:\/\/idc.net\/\">\u9999\u6e2f\u9ad8\u9632\u670d\u52a1\u5668<\/a>\u65b9\u6848\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9999\u6e2f\u670d\u52a1\u5668\u56e0\u514d\u5907\u6848\u3001\u4f4e\u5ef6\u8fdf\u7684\u4f18\u52bf\u88ab\u5927\u91cf\u7ad9\u957f\u4f7f\u7528\uff0c\u4f46\u540c\u65f6\u4e5f\u662f\u6076\u610f\u653b\u51fb\u7684\u9ad8\u53d1\u533a\u3002\u4e00\u65e6\u906d\u53d7DDoS\u6216CC\u653b\u51fb\uff0c\u8f7b\u5219\u7f51 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[],"class_list":["post-442690","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/442690","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=442690"}],"version-history":[{"count":1,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/442690\/revisions"}],"predecessor-version":[{"id":442691,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/442690\/revisions\/442691"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=442690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=442690"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=442690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}