{"id":585,"date":"2024-08-17T12:59:14","date_gmt":"2024-08-17T04:59:14","guid":{"rendered":"https:\/\/thereisno.top:4430\/?p=585"},"modified":"2024-08-17T12:59:15","modified_gmt":"2024-08-17T04:59:15","slug":"centos-7-firewalld-%e9%98%b2%e7%81%ab%e5%a2%99%e8%ae%be%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/thereisno.top\/?p=585","title":{"rendered":"CentOS 7 firewalld \u9632\u706b\u5899\u8bbe\u7f6e"},"content":{"rendered":"\n<p>\/\/ \u67e5\u770b\u9632\u706b\u5899\u72b6\u6001<\/p>\n\n\n\n<p>systemctl status firewalld<\/p>\n\n\n\n<p>\/\/ \u5f00\u542f\u9632\u706b\u5899<\/p>\n\n\n\n<p>systemctl start firewalld<\/p>\n\n\n\n<p>\/\/ \u5f00\u673a\u542f\u52a8<\/p>\n\n\n\n<p>systemctl enable firewalld<\/p>\n\n\n\n<p>\/\/ \u5f00\u673a\u5173\u95ed<\/p>\n\n\n\n<p>systemctl disable firewalld<\/p>\n\n\n\n<p>\/\/ \u67e5\u8be2\u6253\u5f00\u7684\u7aef\u53e3<\/p>\n\n\n\n<p>firewall-cmd &#8211;zone=public &#8211;list-ports<\/p>\n\n\n\n<p>\/\/\u5173\u95ed\u7aef\u53e39002<\/p>\n\n\n\n<p>firewall-cmd &#8211;zone=public &#8211;remove-port=9002\/tcp &#8211;permanent<\/p>\n\n\n\n<p>\/\/\u91cd\u65b0\u8f7d\u5165\u4e00\u4e0b\u9632\u706b\u5899\u8bbe\u7f6e\uff0c\u4f7f\u8bbe\u7f6e\u751f\u6548<\/p>\n\n\n\n<p>firewall-cmd &#8211;reload<\/p>\n\n\n\n<p>\/\/ \u5141\u8bb8ip172.27.0.45\u8bbf\u95ee9002\u7aef\u53e3<\/p>\n\n\n\n<p>firewall-cmd &#8211;permanent &#8211;add-rich-rule=&#8221;rule family=&#8221;ipv4&#8243; source address=&#8221;172.27.0.45&#8243; port protocol=&#8221;tcp&#8221; port=&#8221;9002&#8243; accept&#8221;<\/p>\n\n\n\n<p>\/\/\u91cd\u65b0\u8f7d\u5165\u4e00\u4e0b\u9632\u706b\u5899\u8bbe\u7f6e\uff0c\u4f7f\u8bbe\u7f6e\u751f\u6548<\/p>\n\n\n\n<p>firewall-cmd &#8211;reload<\/p>\n\n\n\n<p>\/\/\u67e5\u770b\u5df2\u8bbe\u7f6e\u89c4\u5219<\/p>\n\n\n\n<p>firewall-cmd &#8211;zone=public &#8211;list-rich-rules<\/p>\n\n\n\n<p>\u67e5\u770b<\/p>\n\n\n\n<p>firewall-cmd &#8211;zone= public &#8211;query-port=80\/tcp<\/p>\n\n\n\n<p>\u5220\u9664<\/p>\n\n\n\n<p>firewall-cmd &#8211;zone= public &#8211;remove-port=80\/tcp &#8211;permanent<\/p>\n\n\n\n<p>\u6279\u91cf\u5f00\u653e\u6216\u9650\u5236\u7aef\u53e3<\/p>\n\n\n\n<p>\u6279\u91cf\u5f00\u653e\u7aef\u53e3\uff0c\u5982\u4ece9002\u52309005\u8fd9\u4e4b\u95f4\u7684\u7aef\u53e3\u6211\u4eec\u5168\u90e8\u8981\u6253\u5f00<\/p>\n\n\n\n<p>firewall-cmd &#8211;zone=public &#8211;add-port=9002-9005\/tcp &#8211;permanent<\/p>\n\n\n\n<p>firewall-cmd &#8211;reload<\/p>\n\n\n\n<p>\u6279\u91cf\u9650\u5236\u7aef\u53e3\u4e3a<\/p>\n\n\n\n<p>firewall-cmd &#8211;zone=public &#8211;remove-port=9002-9005\/tcp &#8211;permanent<\/p>\n\n\n\n<p>firewall-cmd &#8211;reload<\/p>\n\n\n\n<p>\u5f00\u653e\u6216\u9650\u5236ip\uff08\u8bbe\u7f6e\u89c4\u5219\uff09<\/p>\n\n\n\n<p>\u5f00\u653eIP\u4e3a172.27.0.0\u7684\u5730\u5740\u5141\u8bb8\u8bbf\u95ee9002\u7aef\u53e3<\/p>\n\n\n\n<p>firewall-cmd &#8211;permanent &#8211;add-rich-rule=\u201crule family=\u201cipv4\u201d source address=\u201c172.27.0.0\u201d port protocol=\u201ctcp\u201d port=\u201c9002\u201d accept\u201d<\/p>\n\n\n\n<p>\u9650\u5236IP\u4e3a172.27.0.0\u7684\u5730\u5740\u7981\u6b62\u8bbf\u95ee9002\u7aef\u53e3\u5373\u7981\u6b62\u8bbf\u95ee\u673a\u5668<\/p>\n\n\n\n<p>firewall-cmd &#8211;permanent &#8211;add-rich-rule=\u201crule family=\u201cipv4\u201d source address=\u201c172.27.0.0\u201d port protocol=\u201ctcp\u201d port=\u201c9002\u201d reject\u201d<\/p>\n\n\n\n<p>\u5220\u9664\u5df2\u8bbe\u7f6e\u89c4\u5219<\/p>\n\n\n\n<p>firewall-cmd &#8211;permanent &#8211;remove-rich-rule=\u201crule family=\u201cipv4\u201d source address=\u201d 192.168.0.0&#8243; port protocol=\u201ctcp\u201d port=\u201c9001\u201d accept&#8221;<\/p>\n\n\n\n<p>\u67e5\u770b\u7aef\u53e3\u5f00\u653e\u60c5\u51b5<\/p>\n\n\n\n<p>firewall-cmd &#8211;list-all<\/p>\n\n\n\n<p>firewall-cmd &#8211;zone= public &#8211;query-port=80\/tcp<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/\/ \u67e5\u770b\u9632\u706b\u5899\u72b6\u6001 systemctl status firewalld \/\/ \u5f00\u542f\u9632\u706b\u5899 systemct &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/thereisno.top\/?p=585\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cCentOS 7 firewalld \u9632\u706b\u5899\u8bbe\u7f6e\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[10],"class_list":["post-585","post","type-post","status-publish","format-standard","hentry","category-linux","tag-linux"],"_links":{"self":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts\/585","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=585"}],"version-history":[{"count":1,"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts\/585\/revisions"}],"predecessor-version":[{"id":586,"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts\/585\/revisions\/586"}],"wp:attachment":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=585"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=585"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=585"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}