{"id":2053,"date":"2019-05-21T14:26:30","date_gmt":"2019-05-21T06:26:30","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=2053"},"modified":"2022-05-27T15:29:09","modified_gmt":"2022-05-27T07:29:09","slug":"firewall-cmd","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/firewall-cmd","title":{"rendered":"firewall-cmd\u547d\u4ee4 – \u9632\u706b\u5899\u7b56\u7565\u7ba1\u7406\u5de5\u5177"},"content":{"rendered":"\n

firewall-cmd\u547d\u4ee4\u7684\u529f\u80fd\u662f\u7528\u4e8e\u9632\u706b\u5899\u7b56\u7565\u7ba1\u7406\uff0c\u662ffirewalld\u670d\u52a1\u7684\u914d\u7f6e\u5de5\u5177\u3002\u4f7f\u7528firewall-cmd\u547d\u4ee4\u4fee\u6539\u7684\u9632\u706b\u5899\u7b56\u7565\u4f1a\u7acb\u5373\u751f\u6548\uff0c\u4f46\u91cd\u542f\u540e\u5931\u6548\uff0c\u56e0\u6b64\u63a8\u8350\u8981\u52a0\u4e0apermanent\u53c2\u6570\u5466\uff01~<\/p>\n\n\n\n

\u5173\u4e8efirewalld\u670d\u52a1\u53cafirewall-cmd\u547d\u4ee4\u8be6\u7ec6\u4f7f\u7528\u65b9\u6cd5\uff0c\u8bf7\u53c2\u9605\u300aLinux\u5c31\u8be5\u8fd9\u4e48\u5b66\u300b\u7b2c8\u7ae0\u8282<\/a>\u5185\u5bb9\u3002<\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f<\/strong>\uff1afirewall-cmd [\u53c2\u6570]<\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570<\/strong>\uff1a<\/p>\n\n\n\n

--state<\/td>\u663e\u793a\u5f53\u524d\u670d\u52a1\u8fd0\u884c\u72b6\u6001<\/td><\/tr>
--zone=public --list-ports<\/td>\u67e5\u770b\u6240\u6709\u6253\u5f00\u8fd0\u884c\u7684\u7aef\u53e3<\/td><\/tr>
--permanent<\/td>\u7b56\u7565\u5199\u5165\u5230\u6c38\u4e45\u751f\u6548\u8868\u4e2d<\/td><\/tr>
--reload<\/td>\u4e0d\u91cd\u542f\u7acb\u5373\u52a0\u8f7d<\/td><\/tr>
--list-all-zones<\/td>\u67e5\u770b\u533a\u57df\u4fe1\u606f\u60c5\u51b5<\/td><\/tr>
--panic-on<\/td>\u62d2\u7edd\u6240\u6709\u5305<\/td><\/tr>
--panic-off<\/td>\u53d6\u6d88\u62d2\u7edd\u72b6\u6001<\/td><\/tr>
--query-panic<\/td>\u67e5\u770b\u662f\u5426\u62d2\u7edd<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n

\u67e5\u770b\u5f53\u524d\u9632\u706b\u5899\u72b6\u6001\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# firewall-cmd --state<\/strong>\nrunning<\/pre>\n\n\n\n

\u67e5\u770b\u9632\u706b\u5899\u5f53\u524d\u653e\u884c\u7aef\u53e3\u53f7\u5217\u8868\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# firewall-cmd --zone=public --list-ports<\/strong><\/pre>\n\n\n\n

\u91cd\u65b0\u52a0\u8f7d\u9632\u706b\u5899\u7b56\u7565\uff0c\u7acb\u5373\u751f\u6548\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# firewall-cmd --reload<\/strong>\nsuccess<\/pre>\n\n\n\n

\u67e5\u770b\u5f53\u524d\u9632\u706b\u5899\u9ed8\u8ba4\u4f7f\u7528\u533a\u57df\u540d\u79f0\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# firewall-cmd --get-default-zone <\/strong>\r\npublic\r<\/pre>\n","protected":false},"excerpt":{"rendered":"

firewall-cmd\u547d\u4ee4\u7684\u529f\u80fd\u662f\u7528\u4e8e\u9632\u706b\u5899\u7b56\u7565\u7ba1\u7406\uff0c\u662ffirewalld\u670d\u52a1\u7684\u914d\u7f6e\u5de5\u5177\u3002\u4f7f\u7528firewal […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/2053"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=2053"}],"version-history":[{"count":14,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/2053\/revisions"}],"predecessor-version":[{"id":10124,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/2053\/revisions\/10124"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=2053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=2053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=2053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}