{"id":922,"date":"2018-07-01T14:23:00","date_gmt":"2018-07-01T06:23:00","guid":{"rendered":"http:\/\/www.langmanezhuang.com\/index.php\/2018\/07\/01\/centos7%e4%bd%bf%e7%94%a8firewalld%e6%89%93%e5%bc%80%e5%85%b3%e9%97%ad%e9%98%b2%e7%81%ab%e5%a2%99%e4%b8%8e%e7%ab%af%e5%8f%a3\/"},"modified":"2022-11-26T20:53:22","modified_gmt":"2022-11-26T12:53:22","slug":"centos7%e4%bd%bf%e7%94%a8firewalld%e6%89%93%e5%bc%80%e5%85%b3%e9%97%ad%e9%98%b2%e7%81%ab%e5%a2%99%e4%b8%8e%e7%ab%af%e5%8f%a3","status":"publish","type":"post","link":"http:\/\/blog.langmanezhuang.com\/index.php\/2018\/07\/01\/centos7%e4%bd%bf%e7%94%a8firewalld%e6%89%93%e5%bc%80%e5%85%b3%e9%97%ad%e9%98%b2%e7%81%ab%e5%a2%99%e4%b8%8e%e7%ab%af%e5%8f%a3\/","title":{"rendered":"CentOS7\u4f7f\u7528firewalld\u6253\u5f00\u5173\u95ed\u9632\u706b\u5899\u4e0e\u7aef\u53e3"},"content":{"rendered":"<div>1\u3001firewalld\u7684\u57fa\u672c\u4f7f\u7528<\/div>\n<div>\u542f\u52a8\uff1a systemctl start firewalld<\/div>\n<div>\u67e5\u770b\u72b6\u6001\uff1a systemctl status firewalld&nbsp;<\/div>\n<div>\u505c\u6b62\uff1a systemctl disable firewalld<\/div>\n<div>\u7981\u7528\uff1a systemctl stop firewalld<\/div>\n<div>&nbsp;<\/div>\n<div>2.systemctl\u662fCentOS7\u7684\u670d\u52a1\u7ba1\u7406\u5de5\u5177\u4e2d\u4e3b\u8981\u7684\u5de5\u5177\uff0c\u5b83\u878d\u5408\u4e4b\u524dservice\u548cchkconfig\u7684\u529f\u80fd\u4e8e\u4e00\u4f53\u3002<\/div>\n<div>\n<p>\u542f\u52a8\u4e00\u4e2a\u670d\u52a1\uff1asystemctl start firewalld.service<br \/>\u5173\u95ed\u4e00\u4e2a\u670d\u52a1\uff1asystemctl stop firewalld.service<br \/>\u91cd\u542f\u4e00\u4e2a\u670d\u52a1\uff1asystemctl restart firewalld.service<br \/>\u663e\u793a\u4e00\u4e2a\u670d\u52a1\u7684\u72b6\u6001\uff1asystemctl status firewalld.service<br \/>\u5728\u5f00\u673a\u65f6\u542f\u7528\u4e00\u4e2a\u670d\u52a1\uff1asystemctl enable firewalld.service<br \/>\u5728\u5f00\u673a\u65f6\u7981\u7528\u4e00\u4e2a\u670d\u52a1\uff1asystemctl disable firewalld.service<br \/>\u67e5\u770b\u670d\u52a1\u662f\u5426\u5f00\u673a\u542f\u52a8\uff1asystemctl is-enabled firewalld.service<br \/>\u67e5\u770b\u5df2\u542f\u52a8\u7684\u670d\u52a1\u5217\u8868\uff1asystemctl list-unit-files|grep enabled<br \/>\u67e5\u770b\u542f\u52a8\u5931\u8d25\u7684\u670d\u52a1\u5217\u8868\uff1asystemctl &#8211;failed<\/p>\n<p>3.\u914d\u7f6efirewalld-cmd<\/p>\n<div>\u67e5\u770b\u7248\u672c\uff1a firewall-cmd &#8211;version<\/div>\n<div>\u67e5\u770b\u5e2e\u52a9\uff1a firewall-cmd &#8211;help<\/div>\n<div>\u663e\u793a\u72b6\u6001\uff1a firewall-cmd &#8211;state<\/div>\n<div>\u67e5\u770b\u6240\u6709\u6253\u5f00\u7684\u7aef\u53e3\uff1a firewall-cmd &#8211;zone=public&nbsp;&#8211;list-ports<\/div>\n<div>\u66f4\u65b0\u9632\u706b\u5899\u89c4\u5219\uff1a firewall-cmd &#8211;reload<\/div>\n<div>\n<div>\u67e5\u770b\u533a\u57df\u4fe1\u606f: &nbsp;firewall-cmd &#8211;get-active-zones<\/div>\n<div>\u67e5\u770b\u6307\u5b9a\u63a5\u53e3\u6240\u5c5e\u533a\u57df\uff1a firewall-cmd &#8211;get-zone-of-interface=eth0<\/div>\n<div>\n<div>\u62d2\u7edd\u6240\u6709\u5305\uff1afirewall-cmd &#8211;panic-on<\/div>\n<div>\u53d6\u6d88\u62d2\u7edd\u72b6\u6001\uff1a firewall-cmd &#8211;panic-off<\/div>\n<div>\u67e5\u770b\u662f\u5426\u62d2\u7edd\uff1a firewall-cmd &#8211;query-panic<\/div>\n<div>&nbsp;<\/div>\n<div>\u90a3\u600e\u4e48\u5f00\u542f\u4e00\u4e2a\u7aef\u53e3\u5462<\/div>\n<div>\u6dfb\u52a0<\/div>\n<div>firewall-cmd&nbsp;<span class=\"attribute\">&#8211;zone=<span class=\"attribute-value\">public&nbsp;<span class=\"attribute\">&#8211;add-port=<span class=\"attribute-value\">80\/tcp&nbsp;&#8211;permanent &nbsp; &nbsp;\uff08&#8211;permanent\u6c38\u4e45\u751f\u6548\uff0c\u6ca1\u6709\u6b64\u53c2\u6570\u91cd\u542f\u540e\u5931\u6548\uff09<\/span><\/span><\/span><\/span><\/div>\n<div>\u91cd\u65b0\u8f7d\u5165<\/div>\n<div><span class=\"attribute\">firewall-cmd&nbsp;&#8211;reload<\/span><\/div>\n<div>\u67e5\u770b<\/div>\n<div><span class=\"attribute\"><span class=\"attribute-value\"><span class=\"attribute\"><span class=\"attribute-value\">firewall-cmd&nbsp;<span class=\"attribute\">&#8211;zone=&nbsp;<span class=\"attribute-value\">public&nbsp;<span class=\"attribute\">&#8211;query-port=<span class=\"attribute-value\">80\/tcp<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/div>\n<div>\u5220\u9664<\/div>\n<div>firewall-cmd&nbsp;<span class=\"attribute\">&#8211;zone=&nbsp;<span class=\"attribute-value\">public&nbsp;<span class=\"attribute\">&#8211;remove-port=<span class=\"attribute-value\">80\/tcp&nbsp;&#8211;permanent<\/span><\/span><\/span><\/span><\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001firewalld\u7684\u57fa\u672c\u4f7f\u7528 \u542f\u52a8\uff1a systemctl start firewalld \u67e5\u770b\u72b6\u6001\uff1a sy &hellip; <a href=\"http:\/\/blog.langmanezhuang.com\/index.php\/2018\/07\/01\/centos7%e4%bd%bf%e7%94%a8firewalld%e6%89%93%e5%bc%80%e5%85%b3%e9%97%ad%e9%98%b2%e7%81%ab%e5%a2%99%e4%b8%8e%e7%ab%af%e5%8f%a3\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb <span class=\"screen-reader-text\">CentOS7\u4f7f\u7528firewalld\u6253\u5f00\u5173\u95ed\u9632\u706b\u5899\u4e0e\u7aef\u53e3<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,1],"tags":[],"_links":{"self":[{"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/posts\/922"}],"collection":[{"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/comments?post=922"}],"version-history":[{"count":1,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/posts\/922\/revisions"}],"predecessor-version":[{"id":953,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/posts\/922\/revisions\/953"}],"wp:attachment":[{"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/media?parent=922"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/categories?post=922"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/tags?post=922"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}