{"id":3675,"date":"2018-10-02T09:48:22","date_gmt":"2018-10-02T01:48:22","guid":{"rendered":"http:\/\/switch.linesno.com\/?p=3675"},"modified":"2018-10-02T09:48:22","modified_gmt":"2018-10-02T01:48: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:\/\/switch.linesno.com\/?p=3675","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><\/div>\n<div>\u542f\u52a8\uff1a systemctl start firewalld<\/div>\n<div>\u5173\u95ed\uff1a systemctl stop firewalld<\/div>\n<div>\u67e5\u770b\u72b6\u6001\uff1a systemctl status firewalld<\/div>\n<div>\u5f00\u673a\u7981\u7528\u00a0 \uff1a systemctl disable firewalld<\/div>\n<div>\u5f00\u673a\u542f\u7528\u00a0 \uff1a\u00a0systemctl enable firewalld<\/div>\n<div><\/div>\n<div><\/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><\/div>\n<div>\n<p>\u542f\u52a8\u4e00\u4e2a\u670d\u52a1\uff1asystemctl start firewalld.service<br \/>\n\u5173\u95ed\u4e00\u4e2a\u670d\u52a1\uff1asystemctl stop firewalld.service<br \/>\n\u91cd\u542f\u4e00\u4e2a\u670d\u52a1\uff1asystemctl restart firewalld.service<br \/>\n\u663e\u793a\u4e00\u4e2a\u670d\u52a1\u7684\u72b6\u6001\uff1asystemctl status firewalld.service<br \/>\n\u5728\u5f00\u673a\u65f6\u542f\u7528\u4e00\u4e2a\u670d\u52a1\uff1asystemctl enable firewalld.service<br \/>\n\u5728\u5f00\u673a\u65f6\u7981\u7528\u4e00\u4e2a\u670d\u52a1\uff1asystemctl disable firewalld.service<br \/>\n\u67e5\u770b\u670d\u52a1\u662f\u5426\u5f00\u673a\u542f\u52a8\uff1asystemctl is-enabled firewalld.service<br \/>\n\u67e5\u770b\u5df2\u542f\u52a8\u7684\u670d\u52a1\u5217\u8868\uff1asystemctl list-unit-files|grep enabled<br \/>\n\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\u00a0&#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: \u00a0firewall-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><\/div>\n<div>\u90a3\u600e\u4e48\u5f00\u542f\u4e00\u4e2a\u7aef\u53e3\u5462<\/div>\n<div>\u6dfb\u52a0<\/div>\n<div>firewall-cmd\u00a0<span class=\"attribute\">&#8211;zone=<span class=\"attribute-value\">public\u00a0&#8211;add-port=80\/tcp\u00a0&#8211;permanent \u00a0 \u00a0\uff08&#8211;permanent\u6c38\u4e45\u751f\u6548\uff0c\u6ca1\u6709\u6b64\u53c2\u6570\u91cd\u542f\u540e\u5931\u6548\uff09<\/span><\/span><\/div>\n<div>\u91cd\u65b0\u8f7d\u5165<\/div>\n<div><span class=\"attribute\"><span class=\"attribute-value\">firewall-cmd\u00a0&#8211;reload<\/span><\/span><\/div>\n<div>\u67e5\u770b<\/div>\n<div><span class=\"attribute\"><span class=\"attribute-value\">firewall-cmd\u00a0&#8211;zone=\u00a0public\u00a0&#8211;query-port=80\/tcp<\/span><\/span><\/div>\n<div>\u5220\u9664<\/div>\n<div>firewall-cmd\u00a0<span class=\"attribute\">&#8211;zone=\u00a0<span class=\"attribute-value\">public\u00a0&#8211;remove-port=80\/tcp\u00a0&#8211;permanent<\/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 \u5173\u95ed\uff1a syst [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-3675","post","type-post","status-publish","format-standard","hentry","category-day"],"_links":{"self":[{"href":"http:\/\/switch.linesno.com\/index.php?rest_route=\/wp\/v2\/posts\/3675","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/switch.linesno.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/switch.linesno.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/switch.linesno.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/switch.linesno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3675"}],"version-history":[{"count":1,"href":"http:\/\/switch.linesno.com\/index.php?rest_route=\/wp\/v2\/posts\/3675\/revisions"}],"predecessor-version":[{"id":3676,"href":"http:\/\/switch.linesno.com\/index.php?rest_route=\/wp\/v2\/posts\/3675\/revisions\/3676"}],"wp:attachment":[{"href":"http:\/\/switch.linesno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/switch.linesno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3675"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/switch.linesno.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}