{"id":37,"date":"2018-04-10T20:11:20","date_gmt":"2018-04-10T12:11:20","guid":{"rendered":"http:\/\/140.143.235.248\/?p=37"},"modified":"2018-04-10T20:13:35","modified_gmt":"2018-04-10T12:13:35","slug":"centos7-firewalld%e5%91%bd%e4%bb%a4%e6%95%b4%e7%90%86","status":"publish","type":"post","link":"https:\/\/subk.me\/?p=37","title":{"rendered":"CentOS7-firewalld\u547d\u4ee4\u6574\u7406"},"content":{"rendered":"<div>\n<div style=\"margin: 0px;color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px\"><b>\u9632\u706b\u5899\u76f8\u5173<\/b><\/div>\n<div style=\"margin: 0px;color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px\">firewalld\u662fcentos7\u7684\u4e00\u5927\u7279\u6027\uff0c\u6700\u5927\u7684\u597d\u5904\u6709\u4e24\u4e2a\uff1a\u652f\u6301\u52a8\u6001\u66f4\u65b0\uff0c\u4e0d\u7528\u91cd\u542f\u670d\u52a1\uff1b\u7b2c\u4e8c\u4e2a\u5c31\u662f\u52a0\u5165\u4e86\u9632\u706b\u5899\u7684\u201czone\u201d\u6982\u5ff5\u3002<\/div>\n<div style=\"margin: 0px;color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px\">\n<div style=\"margin: 0px;color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px\"><b>\u67e5\u770b\u8bbe\u7f6e<\/b><\/div>\n<blockquote style=\"margin: 0px 0px 0px 40px;padding: 0px;color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px;border: none\">\n<div style=\"margin: 0px\">\u663e\u793a\u72b6\u6001\uff1a$ firewall-cmd &#8211;state<\/div>\n<div style=\"margin: 0px\"><span style=\"color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px\">\u663e\u793a\u6240\u6709\u5f00\u653e\u60c5\u51b5\uff1a<\/span>firewall-cmd &#8211;list-all<\/div>\n<div style=\"margin: 0px\">\u663e\u793a\u5141\u8bb8\u7684\u7aef\u53e3\u6216\u8005\u670d\u52a1\uff1afirewall-cmd &#8211;list-ports \u00a0\uff08firewall-cmd &#8211;list-service\uff09<\/div>\n<div style=\"margin: 0px\">\u67e5\u770b\u533a\u57df\u4fe1\u606f: $ firewall-cmd \u2013get-active-zones<\/div>\n<div style=\"margin: 0px\">\u67e5\u770b\u6307\u5b9a\u63a5\u53e3\u6240\u5c5e\u533a\u57df\uff1a$ firewall-cmd \u2013get-zone-of-interface=eth0<\/div>\n<div style=\"margin: 0px\">\u62d2\u7edd\u6240\u6709\u5305\uff1a# firewall-cmd \u2013panic-on<\/div>\n<div style=\"margin: 0px\">\u53d6\u6d88\u62d2\u7edd\u72b6\u6001\uff1a# firewall-cmd \u2013panic-off<\/div>\n<div style=\"margin: 0px\">\u67e5\u770b\u662f\u5426\u62d2\u7edd\uff1a$ firewall-cmd \u2013query-panic<\/div><\/blockquote>\n\u00a0\n\n<\/div>\n<div style=\"margin: 0px;color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px\"><b>\u589e\u52a0\u6216\u5173\u95ed\u7aef\u53e3\u6216\u670d\u52a1<\/b>\n<span class=\"Apple-converted-space\">\u00a0<\/span>\u00a0<span style=\"color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px\">\/\/\u589e\u52a0\u64cd\u4f5c\u540e\u9700\u8981reload\u624d\u80fd\u751f\u6548\uff0c\u9ed8\u8ba4\u533a\u57df\u662f<span class=\"hljs-literal\" style=\"color: #006666;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.875rem;font-style: normal;font-weight: 400;text-align: start;text-indent: 0px\">&#8211;<\/span>\n<span class=\"hljs-literal\" style=\"color: #006666;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.875rem;font-style: normal;font-weight: 400;text-align: start;text-indent: 0px\">&#8211;<\/span>\n<span class=\"hljs-comment\" style=\"color: #880000;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.875rem;font-style: normal;font-weight: 400;text-align: start;text-indent: 0px\">zone=public<\/span><\/span><\/div>\n<blockquote style=\"margin: 0px 0px 0px 40px;padding: 0px;color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px;border: none\">\n<div style=\"margin: 0px\">\u4ee5\u4e0b\u547d\u4ee4\u7b49\u540c\u4e8e\uff1a<span class=\"hljs-comment\" style=\"color: #880000;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.875rem;font-style: normal;font-weight: 400;text-align: start;text-indent: 0px\">firewall<\/span>\n<span class=\"hljs-literal\" style=\"color: #006666;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.875rem;font-style: normal;font-weight: 400;text-align: start;text-indent: 0px\">&#8211;<\/span>\n<span class=\"hljs-comment\" style=\"color: #880000;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.875rem;font-style: normal;font-weight: 400;text-align: start;text-indent: 0px\">cmd<\/span>\n<span style=\"color: #000000;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.875rem;font-style: normal;font-weight: 400;text-align: start;text-indent: 0px;background-color: #f6f8fa\"><span class=\"Apple-converted-space\">\u00a0<\/span><\/span>\n<span class=\"hljs-literal\" style=\"color: #006666;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.875rem;font-style: normal;font-weight: 400;text-align: start;text-indent: 0px\">&#8211;<\/span>\n<span class=\"hljs-literal\" style=\"color: #006666;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.875rem;font-style: normal;font-weight: 400;text-align: start;text-indent: 0px\">&#8211;<\/span>\n<span class=\"hljs-comment\" style=\"color: #880000;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.875rem;font-style: normal;font-weight: 400;text-align: start;text-indent: 0px\">zone=public<\/span>\n<span style=\"color: #000000;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.875rem;font-style: normal;font-weight: 400;text-align: start;text-indent: 0px;background-color: #f6f8fa\"><span class=\"Apple-converted-space\">\u00a0<\/span><\/span>\n<span class=\"hljs-literal\" style=\"color: #006666;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.875rem;font-style: normal;font-weight: 400;text-align: start;text-indent: 0px\">&#8211;<\/span>\n<span class=\"hljs-literal\" style=\"color: #006666;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.875rem;font-style: normal;font-weight: 400;text-align: start;text-indent: 0px\">&#8211;<\/span>\n<span class=\"hljs-comment\" style=\"color: #880000;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.875rem;font-style: normal;font-weight: 400;text-align: start;text-indent: 0px\">add<\/span>\n<span class=\"hljs-literal\" style=\"color: #006666;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.875rem;font-style: normal;font-weight: 400;text-align: start;text-indent: 0px\">&#8211;<\/span>\n<span class=\"hljs-comment\" style=\"color: #880000;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.875rem;font-style: normal;font-weight: 400;text-align: start;text-indent: 0px\">port=80\/tcp<\/span>\n<span style=\"color: #000000;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.875rem;font-style: normal;font-weight: 400;text-align: start;text-indent: 0px;background-color: #f6f8fa\"><span class=\"Apple-converted-space\">\u00a0<\/span><\/span>\n<span class=\"hljs-literal\" style=\"color: #006666;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.875rem;font-style: normal;font-weight: 400;text-align: start;text-indent: 0px\">&#8211;<\/span>\n<span class=\"hljs-literal\" style=\"color: #006666;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.875rem;font-style: normal;font-weight: 400;text-align: start;text-indent: 0px\">&#8211;<\/span>\n<span class=\"hljs-comment\" style=\"color: #880000;font-family: Consolas, Inconsolata, Courier, monospace;font-size: 0.875rem;font-style: normal;font-weight: 400;text-align: start;text-indent: 0px\">permanent<\/span><\/div><\/blockquote>\n<blockquote style=\"margin: 0px 0px 0px 40px;padding: 0px;color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px;border: none\">\n<blockquote style=\"margin: 0px 0px 0px 40px;padding: 0px;border: none\">\n<div style=\"margin: 0px\">\u6c38\u4e45\u6253\u5f00\u4e00\u4e2a\u7aef\u53e3\uff1a firewall-cmd &#8211;permanent &#8211;add-port=8080\/tcp<\/div><\/blockquote>\n<blockquote style=\"margin: 0px 0px 0px 40px;padding: 0px;border: none\">\n<div style=\"margin: 0px\">\u6c38\u4e45\u5173\u95ed\u4e00\u4e2a\u7aef\u53e3\uff1a firewall-cmd &#8211;permanent &#8211;remove-port=8080\/tcp<\/div><\/blockquote>\n<blockquote style=\"margin: 0px 0px 0px 40px;padding: 0px;border: none\">\n<div style=\"margin: 0px\">\u6c38\u4e45\u6253\u5f00\u67d0\u9879\u670d\u52a1\uff1a firewall-cmd &#8211;permanent &#8211;add-service=http<\/div><\/blockquote>\n<blockquote style=\"margin: 0px 0px 0px 40px;padding: 0px;border: none\">\n<div style=\"margin: 0px\">\u6c38\u4e45\u5173\u95ed\u67d0\u9879\u670d\u52a1\uff1a firewall-cmd &#8211;permanent &#8211;remove-service=http<\/div><\/blockquote>\n<\/blockquote>\n<div style=\"margin: 0px;color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px\"><\/div>\n<div style=\"margin: 0px;color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px\"><b>\u8fdb\u884c\u7aef\u53e3\u8f6c\u53d1<\/b><\/div>\n<blockquote style=\"margin: 0px 0px 0px 40px;padding: 0px;color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px;border: none\">\n<div style=\"margin: 0px\">firewall-cmd &#8211;permanent &#8211;add-forward-port=port=80:proto=tcp:toport=8080:toaddr=192.0.2.55<\/div>\n<div style=\"margin: 0px\">\u5141\u8bb8\u8f6c\u53d1\u5230\u5176\u4ed6\u5730\u5740\uff1a firewall-cmd &#8211;permanent &#8211;add-masquerade<\/div><\/blockquote>\n<div style=\"margin: 0px;color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px\"><b>\u91cd\u65b0\u52a0\u8f7d\u9632\u706b\u5899<\/b><\/div>\n<div style=\"margin: 0px;color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0firewall-cmd &#8211;reload<\/div>\n<div style=\"margin: 0px;color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px\"><\/div>\n<div style=\"margin: 0px;color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px\"><b>\u8fd0\u884c\u3001\u505c\u6b62\u3001\u7981\u7528firewalld<\/b><\/div>\n<blockquote style=\"margin: 0px 0px 0px 40px;padding: 0px;color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px;border: none\">\n<div style=\"margin: 0px\">\u542f\u52a8\uff1a# systemctl start firewalld<\/div>\n<div style=\"margin: 0px\">\u67e5\u770b\u72b6\u6001\uff1a# systemctl status firewalld \u6216\u8005 firewall-cmd \u00a0&#8211;state<\/div>\n<div style=\"margin: 0px\">\u505c\u6b62\uff1a# systemctl disable firewalld<\/div>\n<div style=\"margin: 0px\">\u7981\u7528\uff1a# systemctl stop firewalld<\/div>\n<div style=\"margin: 0px\"><span style=\"color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px\">\u91cd\u542f\uff1a<\/span>systemctl restart\u00a0 firewalld<\/div><\/blockquote>\n<div style=\"margin: 0px;color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px\"><b>\u00a0<\/b><\/div>\n<div style=\"margin: 0px;color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px\"><b>\u914d\u7f6efirewalld<\/b><\/div>\n<blockquote style=\"margin: 0px 0px 0px 40px;padding: 0px;color: #000000;font-family: Helvetica, 'Hiragino Sans GB', \u5fae\u8f6f\u96c5\u9ed1, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size: 1rem;font-style: normal;font-weight: normal;text-align: start;text-indent: 0px;border: none\">\n<div style=\"margin: 0px\">\u67e5\u770b\u7248\u672c\uff1a$ firewall-cmd \u2013version<\/div>\n<div style=\"margin: 0px\">\u67e5\u770b\u5e2e\u52a9\uff1a$ firewall-cmd \u2013help<\/div><\/blockquote>\n\n<hr>\n\n<h1 class=\"csdn_top\" style=\"font-family: 'PingFang SC', 'Microsoft YaHei', SimHei, Arial, SimSun;margin: 0px;padding: 0px 29px;font-weight: bold;color: #2c3033;font-size: 1.5rem;font-style: normal;text-align: start;text-indent: 0px\">firewalld\u5bf9\u6307\u5b9aIP\u5f00\u653e\u6307\u5b9a\u7aef\u53e3\u7684\u914d\u7f6e<\/h1>\n<div><\/div>\n<h2 id=\"2-\u6dfb\u52a0\u9632\u706b\u5899\u89c4\u5219\u5bf9\u6307\u5b9aip\u5f00\u653e\u6307\u5b9a\u7aef\u53e3\" style=\"font-family: 'PingFang SC', 'Microsoft YaHei', SimHei, Arial, SimSun;margin: 8px 0px 16px;padding: 0px;color: #4f4f4f;font-size: 1.5rem;font-style: normal;text-align: start;text-indent: 0px;background-color: #ffffff\"><span style=\"font-weight: normal\"><span style=\"font-size: 1.333rem\" data-wiz-span=\"data-wiz-span\">\u6dfb\u52a0\u9632\u706b\u5899\u89c4\u5219\uff08\u5bf9\u6307\u5b9aip\u5f00\u653e\u6307\u5b9a\u7aef\u53e3\uff09\/\/\u91cd\u542f\u540e\u751f\u6548<\/span><\/span><\/h2>\n<div><span style=\"color: #4f4f4f;font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif, SimHei, SimSun;font-size: 1rem;font-style: normal;font-weight: 400;text-align: justify;text-indent: 0px;background-color: #ffffff\">\uff081\uff09 Postgresql\u7aef\u53e3\u8bbe\u7f6e\u3002\u5141\u8bb8192.168.142.166\u8bbf\u95ee5432\u7aef\u53e3 \u00a0accept \u6216\u8005drop<\/span><\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>\u9632\u706b\u5899\u76f8\u5173 firewalld\u662fcentos7\u7684\u4e00\u5927\u7279\u6027\uff0c\u6700\u5927\u7684\u597d\u5904\u6709\u4e24\u4e2a\uff1a\u652f\u6301\u52a8\u6001\u66f4\u65b0\uff0c\u4e0d\u7528\u91cd\u542f\u670d\u52a1\uff1b\u7b2c\u4e8c\u4e2a [&hellip;]<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[8,9],"class_list":["post-37","post","type-post","status-publish","format-standard","hentry","category-it","tag-centos7","tag-firewalld"],"_links":{"self":[{"href":"https:\/\/subk.me\/index.php?rest_route=\/wp\/v2\/posts\/37","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/subk.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/subk.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/subk.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/subk.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=37"}],"version-history":[{"count":2,"href":"https:\/\/subk.me\/index.php?rest_route=\/wp\/v2\/posts\/37\/revisions"}],"predecessor-version":[{"id":39,"href":"https:\/\/subk.me\/index.php?rest_route=\/wp\/v2\/posts\/37\/revisions\/39"}],"wp:attachment":[{"href":"https:\/\/subk.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/subk.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/subk.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}