{"id":1061,"date":"2019-05-20T15:00:53","date_gmt":"2019-05-20T07:00:53","guid":{"rendered":"https:\/\/blog.naibabiji.com\/?p=1061"},"modified":"2019-11-01T13:03:59","modified_gmt":"2019-11-01T05:03:59","slug":"centos7-firewall-ming-ling","status":"publish","type":"post","link":"https:\/\/blog.naibabiji.com\/skill\/centos7-firewall-ming-ling.html","title":{"rendered":"CentOS7 firewall\u9632\u706b\u5899\u7ba1\u7406\u547d\u4ee4"},"content":{"rendered":"<p>CentOS7\u9ed8\u8ba4\u9632\u706b\u5899\u4eceiptables\u53d8\u6210\u4e86firewall\uff0c\u867d\u7136<a href=\"https:\/\/blog.naibabiji.com\/skill\/bao-ta-mian-ban-fang-huo-qiang-kai-fang-duan-kou.html\">\u5b9d\u5854\u9762\u677f\u53ef\u4ee5\u76f4\u63a5\u56fe\u5f62\u5316\u6dfb\u52a0\u9632\u706b\u5899\u89c4\u5219<\/a>\uff0c\u4e0d\u8fc7\u5976\u7238\u8fd8\u6709\u4e9b\u670d\u52a1\u5668\u662f\u6ca1\u88c5LNMP\u7684\uff0c\u8fd9\u91cc\u8bb0\u5f55\u4e00\u4e0bCentOS7 firewall\u9632\u706b\u5899\u7ba1\u7406\u547d\u4ee4<\/p>\n<h2>CentOS7 firewall\u9632\u706b\u5899\u7ba1\u7406\u547d\u4ee4<\/h2>\n<h3>firewall\u72b6\u6001\u7ba1\u7406\u547d\u4ee4<\/h3>\n<p>\u542f\u52a8firewalld\u7684\u547d\u4ee4<\/p>\n<pre>systemctl start firewalld<\/pre>\n<p>\u5173\u95edfirewall\u7684\u547d\u4ee4<\/p>\n<pre>systemctl stop firewalld<\/pre>\n<p>\u7981\u7528firewall\u7684\u547d\u4ee4<\/p>\n<pre>systemctl disable firewalld\r\n\r\n<\/pre>\n<p>\u67e5\u770bfirewall\u7684\u72b6\u6001<\/p>\n<pre>systemctl status firewalld<\/pre>\n<p>\u91cd\u542ffirewall\u547d\u4ee4<\/p>\n<pre>systemctl restart firewalld<\/pre>\n<p>\u67e5\u770bfirewall\u662f\u5426\u5f00\u673a\u542f\u52a8<\/p>\n<pre>systemctl is-enabled firewalld<\/pre>\n<h3>firefwall\u7aef\u53e3\u7ba1\u7406\u547d\u4ee4<\/h3>\n<p>firewall\u5f00\u653e\u7aef\u53e3\u7684\u547d\u4ee4\uff08&#8211;permanent\u6c38\u4e45\u751f\u6548\uff0c\u6ca1\u6709\u6b64\u53c2\u6570\u91cd\u542f\u540e\u5931\u6548\uff09<\/p>\n<pre>firewall-cmd --zone=public --add-port=80\/tcp --permanent<\/pre>\n<p>firewall\u5220\u9664\u7aef\u53e3\u547d\u4ee4<\/p>\n<pre>firewall-cmd --zone= public --remove-port=80\/tcp --permanent<\/pre>\n<p>firewall\u5f00\u653e\u7aef\u53e3\u8303\u56f4\u547d\u4ee4<\/p>\n<pre>firewall-cmd --permanent --zone=public --add-port=100-500\/tcp\r\nfirewall-cmd --permanent --zone=public --add-port=100-500\/udp<\/pre>\n<p>\u6dfb\u52a0\u540e\u91cd\u65b0\u52a0\u8f7d\u4e00\u6b21\u9632\u706b\u5899\u89c4\u5219\uff0c\u4e0d\u7136\u4e0d\u8d77\u4f5c\u7528\u3002<\/p>\n<p>\u91cd\u65b0\u52a0\u8f7dfirewall\u89c4\u5219<\/p>\n<pre>firewall-cmd --reload<\/pre>\n<p>\u5982\u679c\u6ca1\u6709\u542f\u7528\u7684\u8bdd\u52a0\u8f7d\u4e0d\u4e86\u65b0\u89c4\u5219\uff0c\u6240\u4ee5\u9700\u8981\u5148\u542f\u52a8firewall\u9632\u62a4\u5899\uff0c\u547d\u4ee4\u5982\u4e0b<\/p>\n<pre>systemctl start firewalld<\/pre>\n<p>&nbsp;<\/p>\n<p>\u914d\u7f6efirewalld-cmd<\/p>\n<pre>\u67e5\u770b\u7248\u672c\uff1a firewall-cmd --version\r\n\u67e5\u770b\u5e2e\u52a9\uff1a firewall-cmd --help\r\n\u663e\u793a\u72b6\u6001\uff1a firewall-cmd --state\r\n\u67e5\u770b\u6240\u6709\u6253\u5f00\u7684\u7aef\u53e3\uff1a firewall-cmd --zone=public --list-ports\r\n\u66f4\u65b0\u9632\u706b\u5899\u89c4\u5219\uff1a firewall-cmd --reload\r\n\u67e5\u770b\u533a\u57df\u4fe1\u606f: firewall-cmd --get-active-zones\r\n\u67e5\u770b\u6307\u5b9a\u63a5\u53e3\u6240\u5c5e\u533a\u57df\uff1a firewall-cmd --get-zone-of-interface=eth0\r\n\u62d2\u7edd\u6240\u6709\u5305\uff1afirewall-cmd --panic-on\r\n\u53d6\u6d88\u62d2\u7edd\u72b6\u6001\uff1a firewall-cmd --panic-off\r\n\u67e5\u770b\u662f\u5426\u62d2\u7edd\uff1a firewall-cmd --query-panic<\/pre>\n\n\n<div class=\"kk-star-ratings kksr-auto kksr-align-center kksr-valign-bottom\"\n    data-payload='{&quot;align&quot;:&quot;center&quot;,&quot;id&quot;:&quot;1061&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;0&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;0&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;4&quot;,&quot;greet&quot;:&quot;\u7ed9\u672c\u6587\u6253\u5206 post&quot;,&quot;legend&quot;:&quot;0\\\/5 - (0 votes)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;title&quot;:&quot;CentOS7 firewall\u9632\u706b\u5899\u7ba1\u7406\u547d\u4ee4&quot;,&quot;width&quot;:&quot;0&quot;,&quot;_legend&quot;:&quot;{score}\\\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>\n            \n<div class=\"kksr-stars\">\n    \n<div class=\"kksr-stars-inactive\">\n            <div class=\"kksr-star\" data-star=\"1\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"2\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"3\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"4\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"5\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n    \n<div class=\"kksr-stars-active\" style=\"width: 0px;\">\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n                \n\n<div class=\"kksr-legend\" style=\"font-size: 19.2px;\">\n            <span class=\"kksr-muted\">\u7ed9\u672c\u6587\u6253\u5206 post<\/span>\n    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>CentOS7\u9ed8\u8ba4\u9632\u706b\u5899\u4eceiptables\u53d8\u6210\u4e86firewall\uff0c\u867d\u7136\u5b9d\u5854\u9762\u677f\u53ef\u4ee5\u76f4\u63a5\u56fe\u5f62\u5316\u6dfb\u52a0\u9632\u706b\u5899\u89c4\u5219\uff0c\u4e0d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1062,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"CentOS7 firewall\u9632\u706b\u5899\u7ba1\u7406\u547d\u4ee4 - \u5976\u7238\u5efa\u7ad9\u7b14\u8bb0","description":"CentOS7\u9ed8\u8ba4\u9632\u706b\u5899\u4eceiptables\u53d8\u6210\u4e86firewall\uff0c\u867d\u7136 \u5b9d\u5854\u9762\u677f\u53ef\u4ee5\u76f4\u63a5\u56fe\u5f62\u5316\u6dfb\u52a0\u9632\u706b\u5899\u89c4\u5219 \uff0c\u4e0d\u8fc7\u5976\u7238\u8fd8\u6709\u4e9b\u670d\u52a1\u5668\u662f\u6ca1\u88c5LNMP\u7684\uff0c\u8fd9\u91cc\u8bb0\u5f55\u4e00\u4e0bCentOS7 firewall\u9632\u706b\u5899\u7ba1\u7406\u547d\u4ee4 CentOS7 firewall\u9632\u706b\u5899\u7ba1\u7406\u547d\u4ee4 firewall\u72b6\u6001\u7ba1\u7406\u547d\u4ee4 \u542f\u52a8firewalld\u7684\u547d\u4ee4 \u5173"},"footnotes":""},"categories":[142],"tags":[],"class_list":["post-1061","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-skill"],"_links":{"self":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/posts\/1061","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/comments?post=1061"}],"version-history":[{"count":0,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/posts\/1061\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/media\/1062"}],"wp:attachment":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/media?parent=1061"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/categories?post=1061"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/tags?post=1061"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}