{"id":7920,"date":"2022-02-25T06:52:00","date_gmt":"2022-02-24T22:52:00","guid":{"rendered":"https:\/\/www.ldhost.cn\/jc\/?p=7920"},"modified":"2021-12-08T15:31:59","modified_gmt":"2021-12-08T07:31:59","slug":"%e6%ad%a3%e7%a1%ae%e5%b0%86-cloudflare%e6%9c%8d%e5%8a%a1%e5%99%a8ip%e5%88%97%e5%85%a5%e7%99%bd%e5%90%8d%e5%8d%95","status":"publish","type":"post","link":"https:\/\/www.ldhost.cn\/jc\/weberror\/7920.html","title":{"rendered":"\u6b63\u786e\u5c06 Cloudflare\u670d\u52a1\u5668IP\u5217\u5165\u767d\u540d\u5355"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"643\" height=\"383\" src=\"https:\/\/www.ldhost.cn\/jc\/wp-content\/uploads\/2021\/11\/20191227153419.jpg\" alt=\"\" class=\"wp-image-7921\" srcset=\"https:\/\/www.ldhost.cn\/jc\/wp-content\/uploads\/2021\/11\/20191227153419.jpg 643w, https:\/\/www.ldhost.cn\/jc\/wp-content\/uploads\/2021\/11\/20191227153419-300x179.jpg 300w, https:\/\/www.ldhost.cn\/jc\/wp-content\/uploads\/2021\/11\/20191227153419-150x89.jpg 150w\" sizes=\"auto, (max-width: 643px) 100vw, 643px\" \/><\/figure>\n\n\n\n<p>\u5982\u679c\u60a8\u5728 <a href=\"https:\/\/www.ldhost.cn\/jc\/wp\/wordpress-security\/7350.html\" data-type=\"post\" data-id=\"7350\">Cloudflare<\/a> \u540e\u9762\u6258\u7ba1 Web \u670d\u52a1\uff0c\u5219\u6b63\u786e\u9690\u85cf\u60a8\u7684\u670d\u52a1\u5668\u6e90 IP \u5730\u5740\u9700\u8981\u963b\u6b62\u6240\u6709\u4e0d\u662f\u6765\u81ea Cloudflare \u7684 HTTP\/HTTPS \u6d41\u91cf\u3002\u767d\u540d\u5355\u5bf9\u4e8e\u9632\u6b62\u653b\u51fb\u8005\u626b\u63cf Internet \u5e76\u627e\u5230\u60a8\u7684\u6e90 IP \u5f88\u91cd\u8981\u3002<\/p>\n\n\n\n<p>\u9996\u5148\uff0c\u6211\u4eec\u901a\u8fc7\u5c06 TCP \u8bf7\u6c42\u4e22\u5f03\u5230\u7aef\u53e3 80\/443 \u6765\u963b\u6b62\u6240\u6709 http\/https \u8bf7\u6c42\u3002<\/p>\n\n\n\n<p><code># iptables -A INPUT -p tcp --dport http -j REJECT --reject-with tcp-reset<\/code><br><code># iptables -A INPUT -p tcp --dport https -j REJECT --reject-with tcp-reset<\/code><\/p>\n\n\n\n<p>\u6211\u4eec\u5c06\u4f7f\u7528\u5e26\u6709\u62d2\u7edd\u4e0e tcp-reset\u6807\u5fd7\u7684iptables\u00a0\u3002\u6ca1\u6709\u8fd9\u4e2a\u6807\u5fd7\uff0c\u653b\u51fb\u8005\u4ecd\u7136\u53ef\u4ee5\u68c0\u6d4b\u5230\u4e00\u4e2a\u7a0b\u5e8f\u6b63\u5728\u76d1\u542c\u7aef\u53e3\uff0c\u800c\u6709\u4e86\u8fd9\u4e2a\u6807\u5fd7\uff0c\u7aef\u53e3\u770b\u8d77\u6765\u50cf\u662f\u5173\u95ed\u7684\u3002\u8be5<a rel=\"noreferrer noopener\" href=\"https:\/\/nmap.org\/book\/man-port-scanning-basics.html\" target=\"_blank\">\u5dee\u5f02\u53ef\u5728NMAP\u4e2d\u53ef\u4ee5\u770b\u51fa<\/a>\uff0c\u662f\u4e00\u4e2a\u771f\u6b63\u7684\u62d2\u7edd\u663e\u793a\u4e3a\u201c\u8fc7\u6ee4\u201d\u548cTCP\u91cd\u7f6e\u62d2\u7edd\u663e\u793a\u4e3a\u201c\u5173\u95ed\u201d\u3002<\/p>\n\n\n\n<p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u6dfb\u52a0 Cloudflare IP \u8303\u56f4\uff0c\u4ee5\u4fbf\u5b83\u4eec\u53ef\u4ee5\u8fde\u63a5\u5230\u6211\u4eec\u7684\u4e3b\u673a\u3002<\/p>\n\n\n\n<p><code># for i in `curl https:\/\/www.cloudflare.com\/ips-v4`; do iptables -I INPUT -p tcp -s $i --dport http -j ACCEPT; done<\/code><br><code># for i in `curl https:\/\/www.cloudflare.com\/ips-v4`; do iptables -I INPUT -p tcp -s $i --dport https -j ACCEPT; done<\/code><\/p>\n\n\n\n<p>\u73b0\u5728\u6211\u4eec\u786e\u4fdd\u53ea\u6709 Cloudflare <a href=\"https:\/\/www.ldhost.cn\/vps.html\" target=\"_blank\" rel=\"noreferrer noopener\">\u670d\u52a1\u5668<\/a>\u53ef\u4ee5\u8bbf\u95ee\u7aef\u53e3 80\/443\uff01\u5bf9\u4e8e\u5176\u4ed6\u4eba\u6765\u8bf4\uff0c\u670d\u52a1\u5668\u4f3c\u4e4e\u6ca1\u6709\u5728\u8fd9\u4e9b\u7aef\u53e3\u4e0a\u8fd0\u884c\u4efb\u4f55\u4e1c\u897f\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u60a8\u7684\u670d\u52a1\u5668\u5177\u6709 IPv6 \u63a5\u53e3\uff0c\u60a8\u8fd8\u9700\u8981\u4f7f\u7528 ip6tables \u8fd0\u884c\u76f8\u540c\u7684\u547d\u4ee4\uff1a<\/p>\n\n\n\n<p><code># ip6tables -A INPUT -p tcp --dport http -j REJECT --reject-with tcp-reset<\/code><br><code># ip6tables -A INPUT -p tcp --dport https -j REJECT --reject-with tcp-reset<\/code><br><code># for i in `curl https:\/\/www.cloudflare.com\/ips-v6`; do ip6tables -I INPUT -p tcp -s $i --dport http -j ACCEPT; done<\/code><br><code># for i in `curl https:\/\/www.cloudflare.com\/ips-v6`; do ip6tables -I INPUT -p tcp -s $i --dport https -j ACCEPT; done<\/code><\/p>\n<div><img decoding=\"async\" src=\"https:\/\/www.ldhost.cn\/images\/ad-845-3.png\" alt=\"\u56fe\u7247\u63cf\u8ff0\" \/><\/div>","protected":false},"excerpt":{"rendered":"<p>\u5982\u679c\u60a8\u5728 Cloudflare \u540e\u9762\u6258\u7ba1 Web \u670d\u52a1\uff0c\u5219\u6b63\u786e\u9690\u85cf\u60a8\u7684\u670d\u52a1\u5668\u6e90 IP \u5730\u5740\u9700\u8981\u963b\u6b62\u6240\u6709\u4e0d\u662f\u6765\u81ea Cloudflare \u7684 HTTP\/HTTPS \u6d41\u91cf\u3002\u767d\u540d\u5355\u5bf9\u4e8e\u9632\u6b62\u653b\u51fb\u8005\u626b\u63cf Internet \u5e76\u627e\u5230\u60a8\u7684\u6e90 IP \u5f88\u91cd\u8981\u3002 \u9996\u5148\uff0c\u6211\u4eec\u901a\u8fc7\u5c06 TCP \u8bf7\u6c42\u4e22\u5f03\u5230\u7aef\u53e3 80\/443 \u6765\u963b\u6b62\u6240\u6709 http\/https \u8bf7\u6c42\u3002 # iptables -A INPUT -p tcp &#8211;dport http -j REJECT &#8211;reject-with tcp-reset# iptables -A INPUT -p tcp &#8211;dport https -j REJECT &#8211;rejec&#8230; <a href=\"https:\/\/www.ldhost.cn\/jc\/weberror\/7920.html\" class=\"readmore\">\u9605\u8bfb\u5168\u6587<span class=\"screen-reader-text\">\u6b63\u786e\u5c06 Cloudflare\u670d\u52a1\u5668IP\u5217\u5165\u767d\u540d\u5355<\/span><span class=\"fa fa-angle-double-right\" aria-hidden=\"true\"><\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-7920","post","type-post","status-publish","format-standard","hentry","category-weberror","content-layout-excerpt-thumb"],"_links":{"self":[{"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/posts\/7920","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/comments?post=7920"}],"version-history":[{"count":1,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/posts\/7920\/revisions"}],"predecessor-version":[{"id":7922,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/posts\/7920\/revisions\/7922"}],"wp:attachment":[{"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/media?parent=7920"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/categories?post=7920"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/tags?post=7920"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}