{"id":180596,"date":"2020-05-11T08:00:30","date_gmt":"2020-05-11T00:00:30","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=180596"},"modified":"2020-04-26T09:58:21","modified_gmt":"2020-04-26T01:58:21","slug":"firewall-iptables","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/firewall-iptables.html","title":{"rendered":"firewall \u9632\u706b\u5899\u670d\u52a1"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nCentos7 \u9ed8\u8ba4\u7684\u9632\u706b\u5899\u662f firewall\uff0c\u66ff\u4ee3\u4e86\u4ee5\u524d\u7684 iptables,firewall \u4f7f\u7528\u66f4\u52a0\u65b9\u4fbf\u3001\u529f\u80fd\u4e5f\u66f4\u52a0\u5f3a\u5927\u4e00\u4e9bfirewalld \u670d\u52a1\u5f15\u5165\u4e86\u4e00\u4e2a\u4fe1\u4efb\u7ea7\u522b\u7684\u6982\u5ff5\u6765\u7ba1\u7406\u4e0e\u4e4b\u76f8\u5173\u8054\u7684\u8fde\u63a5\u4e0e\u63a5\u53e3\u3002\u5b83\u652f\u6301 ipv4 \u4e0e ipv6\uff0c\u5e76\u652f\u6301\u7f51\u6865\uff0c\u91c7\u7528 firewall-cmd (command) \u6216 firewall-config (gui) \u6765\u52a8\u6001\u7684\u7ba1\u7406 kernel netfilter \u7684\u4e34\u65f6\u6216\u6c38\u4e45\u7684\u63a5\u53e3\u89c4\u5219\uff0c\u5e76\u5b9e\u65f6\u751f\u6548\u800c\u65e0\u9700\u91cd\u542f\u670d\u52a1\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

\"\"<\/p>\n

\u67e5\u770b firewall \u7248\u672c\uff1afirewall-cmd --version<\/strong><\/div>\n
[root@localhost ~]# firewall-cmd --version\r\n0.4.4.4\r\n[root@localhost ~]#<\/pre>\n
firewalld\u7684\u57fa\u672c\u4f7f\u7528<\/strong><\/div>\n

\u542f\u52a8\uff1a <\/p>\n

systemctl start firewalld<\/pre>\n

\u67e5\u770b\u72b6\u6001\uff1a <\/p>\n

systemctl status firewalld<\/pre>\n

\u505c\u6b62\uff1a <\/p>\n

systemctl disable firewalld<\/pre>\n

\u7981\u7528\uff1a <\/p>\n

systemctl stop firewalld<\/pre>\n
\u914d\u7f6efirewalld<\/strong><\/div>\n

\u67e5\u770b\u7248\u672c\uff1a <\/p>\n

firewall-cmd --version<\/pre>\n

\u67e5\u770b\u5e2e\u52a9\uff1a <\/p>\n

firewall-cmd --help<\/pre>\n

\u663e\u793a\u72b6\u6001\uff1a <\/p>\n

firewall-cmd --state<\/pre>\n

\u67e5\u770b\u6240\u6709\u6253\u5f00\u7684\u7aef\u53e3\uff1a <\/p>\n

firewall-cmd --zone=public --list-ports<\/pre>\n

\u66f4\u65b0\u9632\u706b\u5899\u89c4\u5219\uff1a <\/p>\n

firewall-cmd --reload<\/pre>\n

\u67e5\u770b\u533a\u57df\u4fe1\u606f: <\/p>\n

firewall-cmd --get-active-zones<\/pre>\n

\u67e5\u770b\u6307\u5b9a\u63a5\u53e3\u6240\u5c5e\u533a\u57df\uff1a <\/p>\n

firewall-cmd --get-zone-of-interface=eth0<\/pre>\n

\u62d2\u7edd\u6240\u6709\u5305\uff1a<\/p>\n

firewall-cmd --panic-on<\/pre>\n

\u53d6\u6d88\u62d2\u7edd\u72b6\u6001\uff1a <\/p>\n

firewall-cmd --panic-off<\/pre>\n

\u67e5\u770b\u662f\u5426\u62d2\u7edd\uff1a <\/p>\n

firewall-cmd --query-panic<\/pre>\n
\u6dfb\u52a0<\/strong><\/div>\n
firewall-cmd --zone=public --add-port=80\/tcp --permanent<\/pre>\n

\uff08--permanent\u6c38\u4e45\u751f\u6548\uff0c\u6ca1\u6709\u6b64\u53c2\u6570\u91cd\u542f\u540e\u5931\u6548\uff09<\/p>\n

\u91cd\u65b0\u8f7d\u5165<\/strong><\/div>\n
firewall-cmd --reload<\/pre>\n
\u67e5\u770b<\/strong><\/div>\n
firewall-cmd --zone= public --query-port=80\/tcp<\/pre>\n
\u5220\u9664<\/strong><\/div>\n
firewall-cmd --zone= public --remove-port=80\/tcp --permanent<\/pre>\n","protected":false},"excerpt":{"rendered":"

[root@localhost ~]# firewall-cmd –version 0.4.4.4 [roo […]<\/p>\n","protected":false},"author":1469,"featured_media":46589,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-180596","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/180596","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1469"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=180596"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/180596\/revisions"}],"predecessor-version":[{"id":180668,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/180596\/revisions\/180668"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/46589"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=180596"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=180596"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=180596"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}