{"id":193299,"date":"2020-06-15T09:33:16","date_gmt":"2020-06-15T01:33:16","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=193299"},"modified":"2020-06-06T12:34:22","modified_gmt":"2020-06-06T04:34:22","slug":"firewall-cmd-network","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/firewall-cmd-network.html","title":{"rendered":"\u5982\u4f55\u4f7f\u7528firewall-cmd\u7ba1\u7406\u7f51\u7edc\u670d\u52a1"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u73b0\u5728\u4f60\u5c06\u770b\u5230\u5982\u4f55\u201c\u6dfb\u52a0\u201d\u3001\u201c\u5220\u9664\u201d\u548c\u201c\u5217\u51fa\u201d\u670d\u52a1\u3001\u534f\u8bae\u548c\u7aef\u53e3\uff0c\u4ee5\u4fbf\u201c\u963b\u6b62\u201d\u6216\u201c\u5141\u8bb8\u201d\u5b83\u4eec\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n \u5728\u4e0a\u4e00\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u63a2\u8ba8\u4e86\u5982\u4f55\u5728 Fedora \u4e2d\u7528\u547d\u4ee4\u884c\u63a7\u5236\u9632\u706b\u5899\u3002<\/p>\n <\/p>\n \u7b80\u77ed\u56de\u987e<\/strong><\/div>\n \u9996\u5148\uff0c\u6700\u597d\u68c0\u67e5\u4e00\u4e0b\u9632\u706b\u5899\u7684\u72b6\u6001\uff0c\u770b\u5b83\u662f\u5426\u6b63\u5728\u8fd0\u884c\u3002\u5982\u6211\u4eec\u5148\u524d\u6240\u5b66\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u72b6\u6001\u9009\u9879\uff08firewall-cmd \u2010\u2010state\uff09\u6765\u5f97\u5230\u3002<\/p>\n \u4e0b\u4e00\u6b65\u662f\u83b7\u53d6\u7f51\u7edc\u63a5\u53e3\u9002\u7528\u7684\u57dfzone\u3002\u4f8b\u5982\uff0c\u6211\u4f7f\u7528\u7684\u684c\u9762\u6709\u4e24\u4e2a\u7f51\u7edc\u63a5\u53e3\uff1a\u4e00\u4e2a\u7269\u7406\u63a5\u53e3\uff08enp0s3\uff09\uff0c\u4ee3\u8868\u6211\u5b9e\u9645\u7684\u7f51\u5361\uff0c\u548c\u865a\u62df\u63a5\u53e3\uff08virbr0\uff09\uff0c\u5b83\u7531 KVM \u7b49\u865a\u62df\u5316\u8f6f\u4ef6\u4f7f\u7528\u3002\u8981\u67e5\u770b\u54ea\u4e9b\u57df\u5904\u4e8e\u6d3b\u52a8\u72b6\u6001\uff0c\u8bf7\u8fd0\u884c firewall-cmd \u2010\u2010get-active-zones\u3002<\/p>\n \u73b0\u5728\uff0c\u4f60\u77e5\u9053\u4e86\u4f60\u611f\u5174\u8da3\u7684\u57df\uff0c\u53ef\u4ee5\u4f7f\u7528 firewall-cmd \u2010\u2010info-zone=FedoraWorkstation \u8fd9\u6837\u7684\u547d\u4ee4\u5217\u51fa\u8be5\u57df\u7684\u89c4\u5219\u3002<\/p>\n \u8bfb\u53d6\u533a\u57df\u4fe1\u606f<\/strong><\/div>\n \u8981\u663e\u793a\u7279\u5b9a\u57df\u7684\u4fe1\u606f\uff0c\u8bf7\u8fd0\u884c firewall-cmd \u2010\u2010zone=ZoneName \u2010\u2010list-all\uff0c\u6216\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u663e\u793a\u9ed8\u8ba4\u57df\u7684\u4fe1\u606f\uff1a<\/p>\n [dan@localhost ~]$ firewall-cmd --list-all\r\nFedoraWorkstation (active)\r\ntarget: default\r\nicmp-block-inversion: no\r\ninterfaces: enp0s3\r\nsources:\r\nservices: dhcpv6-client mdns samba-client ssh\r\nports: 1025-65535\/udp 1025-65535\/tcp\r\nprotocols:\r\nmasquerade: no\r\nforward-ports:\r\nsource-ports:\r\nicmp-blocks:\r\nrich rules:\r\n<\/pre>\n |