{"id":165036,"date":"2020-10-03T05:07:18","date_gmt":"2020-10-02T21:07:18","guid":{"rendered":"http:\/\/4563.org\/?p=165036"},"modified":"2020-10-03T05:07:18","modified_gmt":"2020-10-02T21:07:18","slug":"%e6%b1%82%e5%8a%a9%e4%b8%80%e4%b8%aa%e5%85%b3%e4%ba%8e-centos-8-%e9%98%b2%e7%81%ab%e5%a2%99-firewalld-%e7%9a%84%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=165036","title":{"rendered":"\u6c42\u52a9\u4e00\u4e2a\u5173\u4e8e CentOS 8 \u9632\u706b\u5899 Firewalld \u7684\u95ee\u9898"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u6c42\u52a9\u4e00\u4e2a\u5173\u4e8e CentOS 8 \u9632\u706b\u5899 Firewalld \u7684\u95ee\u9898               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : scfhao <\/span>  <span><i><\/i> 2<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u6211\u7684\u73af\u5883\uff1a \u5728\u4e00\u4e2a\u53f0\u5f0f\u673a\u4e0a\u5b89\u88c5\u4e86 CentOS 8\uff0c\u5728 CentOS 8 \u4e0a\u5b89\u88c5\u4e86 Docker\uff0c\u5728 Docker \u91cc\u8fd0\u884c\u4e86 Postgres \u6570\u636e\u5e93\u7684\u5bb9\u5668\uff0c\u5bb9\u5668\u7684\u7aef\u53e3\u66b4\u6f0f\u5230\u4e3b\u673a\uff08-p 5432:5432 \uff09\u3002 \u9047\u5230\u7684\u95ee\u9898\uff1a \u5728\u672c\u673a\uff08 CentOS 8 \uff09\u4e0a\u53ef\u4ee5\u901a\u8fc7 5432 \u7aef\u53e3\u8bbf\u95ee Postgres \u6570\u636e\u5e93\u670d\u52a1\uff0c\u4f46\u662f\u53ea\u8981 CentOS \u7684\u9632\u706b\u5899\u5f00\u7740\uff0c\u5728\u540c\u4e00\u4e2a\u5c40\u57df\u7f51\u4e2d\u7684\u5176\u4ed6\u7535\u8111\u8bbf\u95ee\u4e0d\u5230\uff08 telnet: Unable to connect to remote host: No route to host \uff09\uff1b\u5982\u679c\u5173\u4e86 CentOS \u7684\u9632\u706b\u5899\uff0c\u5176\u4ed6\u4e3b\u673a\u53ef\u4ee5\u6b63\u5e38\u8bbf\u95ee Postgres \u3002 \u9700\u8981\u8865\u5145\u7684\u8bf4\u660e\uff1a<\/p>\n<ol>\n<li>Postgres \u7684\u4e24\u4e2a\u914d\u7f6e\u6587\u4ef6<code>postgresql.conf<\/code>\u548c<code>pg_hba.conf<\/code>\u5df2\u6b63\u5e38\u914d\u7f6e\u5141\u8bb8\u5176\u4ed6\u4e3b\u673a\u8bbf\u95ee\u3002<\/li>\n<li>\u5728 CentOS 8 \u7684\u9632\u706b\u5899\u4e2d\u5df2\u6dfb\u52a0 Postgres \u670d\u52a1\uff1a<code>firewall-cmd --zone=public --add-service=postgresql<\/code>\uff0c\u4e5f\u5c1d\u8bd5\u8fc7<code>firewall-cmd --zone=public --add-port=5432\/tcp<\/code>\u3002<\/li>\n<li>\u4e5f\u5c1d\u8bd5\u8fc7\u5173\u95ed SELinux\uff0c\u540c\u6837\u4e0d\u8d77\u4f5c\u7528\u3002<\/li>\n<\/ol><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>5<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3628172\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wtks1 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7528 [netstat -atnp | grep LISTEN] \u770b\u770b\u5bf9\u5e94\u7aef\u53e3\u662f\u54ea\u4e2a IP \u5728\u76d1\u542c\u7684                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3628173\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wtks1 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u554a\uff0c\u62b1\u6b49\uff0c\u5c11\u770b\u4e86\u4e00\u8282\uff0c\u5173\u4e86\u9632\u706b\u5899\u5c31\u884c\u4e86\u7684\u8bdd\uff0c\u6700\u597d\u4ece\u5176\u4ed6\u7fa4\u5c40\u57df\u7f51\u8bbe\u5907\u4e0a telnet \u4e00\u4e0b\u8fd9\u4e2a\u7aef\u53e3\uff0c\u770b\u770b\u7aef\u53e3\u662f\u4e0d\u662f\u771f\u7684\u5f00\u653e\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3628174\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : mikeguan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5efa\u8bae docker \u548c firewallld \u4e0d\u5171\u7528\uff0c\u6362 iptables                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3628175\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : scfhao <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @wtks1 \u5173\u4e86\u9632\u706b\u5899\u7684\u8bdd\uff0ctelnet \u662f\u901a\u7684\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3628176\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wtks1 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @scfhao \u5f00\u4e86\u9632\u706b\u5899\u4e0d\u901a\u7684\u8bdd\uff0c\u90a3\u5c31\u8bc1\u660e\u4f60\u6dfb\u52a0\u7684\u653e\u884c\u7b56\u7565\u5e76\u672a\u751f\u6548\uff0c\u9700\u8981\u518d\u7814\u7a76\u4e00\u4e0b firewall \u7684\u547d\u4ee4                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u6c42\u52a9\u4e00\u4e2a\u5173\u4e8e CentOS 8 \u9632&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/165036"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=165036"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/165036\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=165036"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=165036"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=165036"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}