{"id":18212,"date":"2024-11-18T10:43:53","date_gmt":"2024-11-18T02:43:53","guid":{"rendered":"https:\/\/fwq.ai\/blog\/18212\/"},"modified":"2024-11-18T10:43:53","modified_gmt":"2024-11-18T02:43:53","slug":"linux%e6%80%8e%e4%b9%88%e5%90%af%e5%8a%a8%e7%ab%af%e5%8f%a3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/18212\/","title":{"rendered":"linux\u600e\u4e48\u542f\u52a8\u7aef\u53e3"},"content":{"rendered":"<blockquote><p>\n  \u56de\u7b54\uff1a\u8981\u542f\u52a8 linux \u7aef\u53e3\uff0c\u9700\u8981\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u786e\u5b9a\u8981\u542f\u52a8\u7684\u7aef\u53e3\u3002\u4f7f\u7528 netstat \u547d\u4ee4\u67e5\u627e\u5df2\u5173\u95ed\u7684\u7aef\u53e3\u3002\u4f7f\u7528 iptables \u89c4\u5219\u6253\u5f00\u7aef\u53e3\u3002\u4fdd\u5b58\u66f4\u6539\u3002\u91cd\u542f iptables\u3002\u4ec5\u6253\u5f00\u5fc5\u8981\u7684\u7aef\u53e3\uff0c\u5e76\u786e\u4fdd\u91c7\u53d6\u9002\u5f53\u7684\u5b89\u5168\u63aa\u65bd\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/04\/2024060414092016910.jpg\" class=\"aligncenter\" title=\"linux\u600e\u4e48\u542f\u52a8\u7aef\u53e3\u63d2\u56fe\" alt=\"linux\u600e\u4e48\u542f\u52a8\u7aef\u53e3\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u542f\u52a8 Linux \u7aef\u53e3<\/strong><\/p>\n<p><strong>\u542f\u52a8\u7aef\u53e3\u7684\u6b65\u9aa4\uff1a<\/strong><\/p>\n<p>\u8981\u542f\u52a8 Linux \u4e2d\u7684\u7aef\u53e3\uff0c\u9700\u8981\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li> <strong>\u786e\u5b9a\u8981\u542f\u52a8\u7684\u7aef\u53e3\uff1a<\/strong>\u4e86\u89e3\u60a8\u8981\u6253\u5f00\u54ea\u4e2a\u7aef\u53e3\uff0c\u4ee5\u53ca\u5b83\u4e0e\u54ea\u4e2a\u670d\u52a1\u6216\u5e94\u7528\u7a0b\u5e8f\u76f8\u5173\u3002<\/li>\n<li> <strong>\u4f7f\u7528 netstat \u547d\u4ee4\u67e5\u627e\u5df2\u5173\u95ed\u7684\u7aef\u53e3\uff1a<\/strong>\u8fd0\u884c netstat -an | grep \u547d\u4ee4\uff0c\u5176\u4e2d \u662f\u8981\u542f\u52a8\u7684\u7aef\u53e3\u53f7\u3002\u5982\u679c\u6ca1\u6709\u663e\u793a\u8be5\u7aef\u53e3\uff0c\u5219\u8bf4\u660e\u5b83\u5df2\u5173\u95ed\u3002 <\/li>\n<li>\n<p><strong>\u4f7f\u7528 iptables \u89c4\u5219\u6253\u5f00\u7aef\u53e3\uff1a<\/strong>\u8981\u6253\u5f00\u7aef\u53e3\uff0c\u53ef\u4ee5\u4f7f\u7528 iptables \u547d\u4ee4\u3002\u8bed\u6cd5\u4e3a iptables -I INPUT -p &#8211;dport -j ACCEPT\uff0c\u5176\u4e2d\uff1a <\/p>\n<ul>\n<li> \u662f\u8981\u6253\u5f00\u7aef\u53e3\u7684\u534f\u8bae\uff0c\u5982 tcp \u6216 udp <\/li>\n<li> \u662f\u8981\u542f\u52a8\u7684\u7aef\u53e3\u53f7 <\/li>\n<\/ul>\n<\/li>\n<li> <strong>\u4fdd\u5b58\u66f4\u6539\uff1a<\/strong>\u4f7f\u7528 service iptables save \u547d\u4ee4\u4fdd\u5b58 iptables \u66f4\u6539\u3002<\/li>\n<li> <strong>\u91cd\u542f iptables\uff1a<\/strong>\u4f7f\u7528 service iptables restart \u547d\u4ee4\u91cd\u542f iptables \u4ee5\u5e94\u7528\u66f4\u6539\u3002<\/li>\n<\/ol>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<p>\u8981\u542f\u52a8\u7aef\u53e3 80 \u4ee5\u5141\u8bb8 HTTP \u6d41\u91cf\uff0c\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>iptables -I INPUT -p tcp --dport 80 -j ACCEPT\nservice iptables save\nservice iptables restart<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u73b0\u5728\uff0c\u7aef\u53e3 80 \u5c06\u88ab\u6253\u5f00\uff0c\u5141\u8bb8 HTTP \u6d41\u91cf\u901a\u8fc7\u3002<\/p>\n<p><strong>\u6ce8\u610f\u4e8b\u9879\uff1a<\/strong><\/p>\n<ul>\n<li>\u5982\u679c\u7aef\u53e3\u88ab\u9632\u706b\u5899\u6216\u5176\u4ed6\u5b89\u5168\u63aa\u65bd\u963b\u6b62\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u7981\u7528\u5b83\u4eec\u624d\u80fd\u542f\u52a8\u7aef\u53e3\u3002<\/li>\n<li>\u4ec5\u6253\u5f00\u5fc5\u8981\u7684\u7aef\u53e3\uff0c\u5e76\u786e\u4fdd\u91c7\u53d6\u9002\u5f53\u7684\u5b89\u5168\u63aa\u65bd\u6765\u4fdd\u62a4\u60a8\u7684\u7cfb\u7edf\u3002<\/li>\n<li>\u4e0d\u540c\u7684 Linux \u53d1\u884c\u7248\u53ef\u80fd\u4f1a\u4f7f\u7528\u4e0d\u540c\u7684 iptables \u8bed\u6cd5\uff0c\u56e0\u6b64\u8bf7\u6839\u636e\u60a8\u7684\u53d1\u884c\u7248\u8fdb\u884c\u8c03\u6574\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u542f\u52a8\u7aef\u53e3\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u56de\u7b54\uff1a\u8981\u542f\u52a8 linux \u7aef\u53e3\uff0c\u9700\u8981\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u786e\u5b9a\u8981\u542f\u52a8\u7684\u7aef\u53e3\u3002\u4f7f\u7528 netstat \u547d\u4ee4\u67e5\u627e\u5df2\u5173\u95ed\u7684\u7aef\u53e3\u3002\u4f7f\u7528 iptables \u89c4\u5219\u6253\u5f00\u7aef\u53e3\u3002\u4fdd\u5b58\u66f4\u6539\u3002\u91cd\u542f iptables\u3002\u4ec5\u6253\u5f00\u5fc5\u8981\u7684\u7aef\u53e3\uff0c\u5e76\u786e\u4fdd\u91c7\u53d6\u9002\u5f53\u7684\u5b89\u5168\u63aa\u65bd\u3002 \u5982\u4f55\u542f\u52a8 Linux \u7aef\u53e3 \u542f\u52a8\u7aef\u53e3\u7684\u6b65\u9aa4\uff1a \u8981\u542f\u52a8 Linux \u4e2d\u7684\u7aef\u53e3\uff0c\u9700\u8981\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a \u786e\u5b9a\u8981\u542f\u52a8\u7684\u7aef\u53e3\uff1a\u4e86\u89e3\u60a8\u8981\u6253\u5f00\u54ea\u4e2a\u7aef\u53e3\uff0c\u4ee5\u53ca\u5b83\u4e0e\u54ea\u4e2a\u670d\u52a1\u6216\u5e94\u7528\u7a0b\u5e8f\u76f8\u5173\u3002 \u4f7f\u7528 netstat \u547d\u4ee4\u67e5\u627e\u5df2\u5173\u95ed\u7684\u7aef\u53e3\uff1a\u8fd0\u884c netstat -an | grep \u547d\u4ee4\uff0c\u5176\u4e2d \u662f\u8981\u542f\u52a8\u7684\u7aef\u53e3\u53f7\u3002\u5982\u679c\u6ca1\u6709\u663e\u793a\u8be5\u7aef\u53e3\uff0c\u5219\u8bf4\u660e\u5b83\u5df2\u5173\u95ed\u3002 \u4f7f\u7528 iptables \u89c4\u5219\u6253\u5f00\u7aef\u53e3\uff1a\u8981\u6253\u5f00\u7aef\u53e3\uff0c\u53ef\u4ee5\u4f7f\u7528 iptables \u547d\u4ee4\u3002\u8bed\u6cd5\u4e3a iptables -I INPUT -p &#8211;dport -j ACCEPT\uff0c\u5176\u4e2d\uff1a \u662f\u8981\u6253\u5f00\u7aef\u53e3\u7684\u534f\u8bae\uff0c\u5982 tcp \u6216 udp \u662f\u8981\u542f\u52a8\u7684\u7aef\u53e3\u53f7 \u4fdd\u5b58\u66f4\u6539\uff1a\u4f7f\u7528 service iptables save \u547d\u4ee4\u4fdd\u5b58 iptables \u66f4\u6539\u3002 \u91cd\u542f iptables\uff1a\u4f7f\u7528 service iptables restart \u547d\u4ee4\u91cd\u542f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-18212","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18212","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=18212"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18212\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=18212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=18212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=18212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}