{"id":1623,"date":"2017-01-21T13:06:58","date_gmt":"2017-01-21T05:06:58","guid":{"rendered":"http:\/\/www.youthtribe.com\/?p=1623"},"modified":"2017-01-21T13:15:04","modified_gmt":"2017-01-21T05:15:04","slug":"centos7-%e9%98%b2%e7%81%ab%e5%a2%99firewalld%e4%bd%bf%e7%94%a8%e6%96%b9%e6%b3%95%e6%b1%87%e6%80%bb","status":"publish","type":"post","link":"http:\/\/www.youthtribe.com\/archives\/1623","title":{"rendered":"centos7 \u9632\u706b\u5899firewalld\u4f7f\u7528\u65b9\u6cd5\u6c47\u603b"},"content":{"rendered":"

\u56e0\u4e3acentos7 \u7684\u9632\u706b\u5899\u9ed8\u8ba4\u7684\u662ffirewalld\u4e86\uff0c\u5982\u679c\u7528iptables\u7684\u8fd8\u662f\u81ea\u5df1\u5b89\u88c5\u3002\u4e2a\u4eba\u89c9\u5f97\u8fd8\u662f\u5e94\u8be5\u4e0e\u65f6\u4ff1\u8fdb\u4e00\u4e9b\u597d\uff0c\u76f4\u63a5\u62e5\u62b1\u65b0\u4e8b\u7269\u5427\u3002<\/p>\n


\n
1\u3001firewalld\u7684\u57fa\u672c\u4f7f\u7528<\/div>\n
\u542f\u52a8\uff1a systemctl start firewalld<\/div>\n
\u67e5\u770b\u72b6\u6001\uff1a systemctl status firewalld<\/div>\n
\u505c\u6b62\uff1a systemctl disable firewalld<\/div>\n
\u7981\u7528\uff1a systemctl stop firewalld<\/div>\n
<\/div>\n
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
\n

\u542f\u52a8\u4e00\u4e2a\u670d\u52a1\uff1asystemctl start firewalld.service
\n\u5173\u95ed\u4e00\u4e2a\u670d\u52a1\uff1asystemctl stop firewalld.service
\n\u91cd\u542f\u4e00\u4e2a\u670d\u52a1\uff1asystemctl restart firewalld.service
\n\u663e\u793a\u4e00\u4e2a\u670d\u52a1\u7684\u72b6\u6001\uff1asystemctl status firewalld.service
\n\u5728\u5f00\u673a\u65f6\u542f\u7528\u4e00\u4e2a\u670d\u52a1\uff1asystemctl enable firewalld.service
\n\u5728\u5f00\u673a\u65f6\u7981\u7528\u4e00\u4e2a\u670d\u52a1\uff1asystemctl disable firewalld.service
\n\u67e5\u770b\u670d\u52a1\u662f\u5426\u5f00\u673a\u542f\u52a8\uff1asystemctl is-enabled firewalld.service
\n\u67e5\u770b\u5df2\u542f\u52a8\u7684\u670d\u52a1\u5217\u8868\uff1asystemctl list-unit-files|grep enabled
\n\u67e5\u770b\u542f\u52a8\u5931\u8d25\u7684\u670d\u52a1\u5217\u8868\uff1asystemctl –failed<\/p>\n

3.\u914d\u7f6efirewalld-cmd<\/p>\n

\u67e5\u770b\u7248\u672c\uff1a firewall-cmd –version<\/div>\n
\u67e5\u770b\u5e2e\u52a9\uff1a firewall-cmd –help<\/div>\n
\u663e\u793a\u72b6\u6001\uff1a firewall-cmd –state<\/div>\n
\u67e5\u770b\u6240\u6709\u6253\u5f00\u7684\u7aef\u53e3\uff1a firewall-cmd –zone=public\u00a0–list-ports<\/div>\n
\u66f4\u65b0\u9632\u706b\u5899\u89c4\u5219\uff1a firewall-cmd –reload<\/div>\n
\n
\u67e5\u770b\u533a\u57df\u4fe1\u606f: \u00a0firewall-cmd –get-active-zones<\/div>\n
\u67e5\u770b\u6307\u5b9a\u63a5\u53e3\u6240\u5c5e\u533a\u57df\uff1a firewall-cmd –get-zone-of-interface=eth0<\/div>\n
\n
\u62d2\u7edd\u6240\u6709\u5305\uff1afirewall-cmd –panic-on<\/div>\n
\u53d6\u6d88\u62d2\u7edd\u72b6\u6001\uff1a firewall-cmd –panic-off<\/div>\n
\u67e5\u770b\u662f\u5426\u62d2\u7edd\uff1a firewall-cmd –query-panic<\/div>\n
<\/div>\n
\u90a3\u600e\u4e48\u5f00\u542f\u4e00\u4e2a\u7aef\u53e3\u5462<\/div>\n
\u6dfb\u52a0<\/div>\n
firewall-cmd\u00a0–zone=public\u00a0–add-port=80\/tcp\u00a0–permanent \u00a0 \u00a0\uff08–permanent\u6c38\u4e45\u751f\u6548\uff0c\u6ca1\u6709\u6b64\u53c2\u6570\u91cd\u542f\u540e\u5931\u6548\uff09<\/span><\/span><\/div>\n
\u91cd\u65b0\u8f7d\u5165<\/div>\n
firewall-cmd\u00a0–reload<\/span><\/span><\/div>\n
\u67e5\u770b<\/div>\n
firewall-cmd\u00a0–zone=\u00a0public\u00a0–query-port=80\/tcp<\/span><\/span><\/div>\n
\u5220\u9664<\/div>\n
\n

firewall-cmd\u00a0–zone=\u00a0public\u00a0–remove-port=80\/tcp\u00a0–permanent<\/span><\/span><\/p>\n<\/div>\n

\u4ee5\u4e0a\u5185\u5bb9\u81ea\uff1ahttp:\/\/www.cnblogs.com\/moxiaoan\/p\/5683743.html<\/div>\n
\n
\n

centos7\u7684firewall-cmd\u600e\u4e48\u8ba9\u6307\u5b9aip\u80fd\u8bbf\u95ee\u6307\u5b9a\u7aef\u53e3\uff1f<\/p>\n<\/div>\n

\u7b54\u6848\uff1a<\/div>\n
firewall-cmd –permanent –add-rich-rule ‘rule family=ipv4 source address=192.168.0.1\/2 port port=80 protocol=tcp accept’<\/div>\n
\n
\n

firewalld\u5982\u4f55\u5f00\u653e\u4e00\u4e2a\u7aef\u53e3\uff1f<\/p>\n<\/div>\n

#\u6dfb\u52a0<\/div>\n
firewall-cmd\u00a0–zone=public\u00a0–add-port=21\/tcp\u00a0–permanent \u00a0<\/span><\/span><\/div>\n
\n
#\u91cd\u65b0\u8f7d\u5165<\/div>\n
firewall-cmd\u00a0–reload<\/span><\/span><\/div>\n<\/div>\n
\n
\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n
\u6700\u540e\u5199\u4e0a\u5b98\u65b9\u6587\u6863\u5730\u5740\uff0c\u7f51\u9875\u672c\u4ee5\u4e3a\u53f3\u4e0a\u89d2\u6709\u4e2d\u6587\uff0c\u53ef\u5176\u5b9e\u662f\u6ca1\u6709\u3002\u3002\u82f1\u6587\u597d\u7684\u5c31\u6162\u6162\u5543\u5427\u3002<\/div>\n
https:\/\/access.redhat.com\/documentation\/en-US\/Red_Hat_Enterprise_Linux\/7\/html\/Security_Guide\/sec-Using_Firewalls.html#sec-Introduction_to_firewalld<\/div>\n","protected":false},"excerpt":{"rendered":"

\u56e0\u4e3acentos7 \u7684\u9632\u706b\u5899\u9ed8\u8ba4\u7684\u662ffirewalld\u4e86\uff0c\u5982\u679c\u7528iptables\u7684\u8fd8\u662f\u81ea\u5df1\u5b89\u88c5\u3002\u4e2a\u4eba\u89c9\u5f97\u8fd8\u662f\u5e94\u8be5\u4e0e\u65f6\u4ff1\u8fdb\u4e00\u4e9b\u597d\uff0c\u76f4\u63a5\u62e5\u62b1\u65b0\u4e8b\u7269\u5427\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,273],"tags":[278],"_links":{"self":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/1623"}],"collection":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/comments?post=1623"}],"version-history":[{"count":4,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/1623\/revisions"}],"predecessor-version":[{"id":1627,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/1623\/revisions\/1627"}],"wp:attachment":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/media?parent=1623"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/categories?post=1623"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/tags?post=1623"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}