{"id":69281,"date":"2020-04-20T17:30:35","date_gmt":"2020-04-20T09:30:35","guid":{"rendered":"http:\/\/4563.org\/?p=69281"},"modified":"2020-04-20T17:30:35","modified_gmt":"2020-04-20T09:30:35","slug":"proxmox%e5%88%9bnat%e5%b0%8f%e9%b8%a1%e9%b8%a1%e8%83%bdping%e9%80%9a%ef%bc%8c%e5%b0%8f%e9%b8%a1%e6%9c%89%e5%a4%96%e7%bd%91%e8%ae%bf%e9%97%ae-%e4%bd%86nat%e7%ab%af%e5%8f%a3%e4%b8%8d%e9%80%9a","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=69281","title":{"rendered":"proxmox\u521bNAT\u5c0f\u9e21\u9e21\u80fdping\u901a\uff0c\u5c0f\u9e21\u6709\u5916\u7f51\u8bbf\u95ee \u4f46nat\u7aef\u53e3\u4e0d\u901a"},"content":{"rendered":"\n<p>  \t\t\t\t\t<strong>mymyhope<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3>proxmox\u521bNAT\u5c0f\u9e21\u9e21\u80fdping\u901a\uff0c\u5c0f\u9e21\u6709\u5916\u7f51\u8bbf\u95ee \u4f46nat\u7aef\u53e3\u4e0d\u901a<\/h3>\n<p>  \t\t\u6bcd\u9e21\u914d\u7f6e<\/p>\n<p>  post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp &#8211;dport 9399 -j DNAT &#8211;to 192.168.0.2:8888<br \/>  post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp &#8211;dport 9399 -j DNAT &#8211;to 192.168.0.2:8888<br \/>  post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp &#8211;dport 4775 -j DNAT &#8211;to 192.168.0.2:80<br \/>  post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp &#8211;dport 4775 -j DNAT &#8211;to 192.168.0.2:80<\/p>\n<p>  \u6bcd\u9e21\u53ef\u4ee5ping\u901a\u5c0f\u9e21\uff0c\u5c0f\u9e21\u53ef\u4ee5\u8bbf\u95ee\u6bcd\u9e21\u548c\u5916\u7f51\u3002<\/p>\n<p>  \u4f46\u662f\u5916\u7f51\u8bbf\u95ee\u4e0d\u4e869399\uff0c\u6bcd\u9e21\u76f4\u63a5\u8bbf\u95ee\u5c0f\u9e21192.168.0.2:8888\u63d0\u793ano route to host<\/p>\n<p>  \u5c0f\u9e21\u81ea\u5df1\u8bbf\u95ee0.0.0.0:8888\u662f\u6b63\u5e38\u7684\u3002<\/p>\n<p>  \u73b0\u5728\u641e\u5f97\u6211\u4e00\u8138\u61f5\u903c<\/p>\n<p>  \u6c42\u5927\u4f6c\u652f\u62db<\/p>\n<p>  \u5df2\u7ecf\u914d\u7f6e\u6865\u63a5vmbr2\uff0c\u6700\u5938\u5f20\u7684\u662f\u7b2c\u4e00\u53f0\u5c0f\u9e21\u662f\u6b63\u5e38\u7684\uff0c\u73b0\u5728\u8fd9\u4e2a\u5c0f\u9e21\u7a81\u7136\u4e0d\u6b63\u5e38\u4e86\u3002\u5df2\u7ecf\u91cd\u542f\u8fc7\u6bcd\u9e21\u548c\u5c0f\u9e21 \u65e0\u679c\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>Yancheng<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u4f60\u7167\u6211\u9019\u914d\u7f6e\u8a66\u8a66\u770b, \u81ea\u5df1\u8981\u6539\u7db2\u6bb5, \u770b\u5c11\u4e86\u4ec0\u9ebc<\/p>\n<p>  \u611f\u89ba\u4f60\u5c11\u4e86 POSTROUTING<\/p>\n<p>  auto vmbr2<br \/>  iface vmbr2 inet static<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; address10.21.21.254<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; netmask255.255.255.0<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; bridge-ports none<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; bridge-stp off<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; bridge-fd 0<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; post-up echo 1 &gt; \/proc\/sys\/net\/ipv4\/ip_forward<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; post-up iptables -t nat -A POSTROUTING -s &#8216;10.21.21.0\/24&#8217; -o vmbr0 -j MASQUERADE<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; post-down iptables -t nat -D POSTROUTING -s &#8216;10.21.21.0\/24&#8217; -o vmbr0 -j MASQUERADE<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp &#8211;dport 443 -j DNAT &#8211;to 10.21.21.2:5001<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp &#8211;dport 443 -j DNAT &#8211;to 10.21.21.2:5001<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp &#8211;dport 16881 -j DNAT &#8211;to 10.21.21.2:16881<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp &#8211;dport 16881 -j DNAT &#8211;to 10.21.21.2:16881<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; post-up iptables -t nat -A PREROUTING -i vmbr0 -p udp &#8211;dport 16881 -j DNAT &#8211;to 10.21.21.2:16881<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; post-down iptables -t nat -D PREROUTING -i vmbr0 -p udp &#8211;dport 16881 -j DNAT &#8211;to 10.21.21.2:16881\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>CloudRaft<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t \u672c\u5e16\u6700\u540e\u7531 CloudRaft \u4e8e 2020-4-20 17:55 \u7f16\u8f91 <\/p>\n<p> \u697c\u4e0a\u6b63\u89e3\uff0cNAT\u8868\u91cc\u52a0\u4e0aPOSTROUTING\u5c31\u597d\u4e86<\/p>\n<p>  \u4f60\u8fd9\u8fb9\u7684\u8bdd\u76f4\u63a5\u7ec8\u7aef\u91cc\u8f93\u5165\u5c31\u884c\uff1a<br \/>  iptables -t nat -A POSTROUTING -s &#8216;192.168.0.0\/24&#8217; -o vmbr0 -j MASQUERADE<\/p>\n<p>  \u53e6\u5916\u770b\u770bip_forward\u5f00\u4e86\u6ca1<br \/>  sysctl -p<br \/>  net.ipv4.ip_forward = 1\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u7231\u56fd\u8005\u6363\u86cb<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tmk\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>mymyhope<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tCloudRaft \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-4-20 17:51<br \/>  \u697c\u4e0a\u6b63\u89e3\uff0cNAT\u8868\u91cc\u52a0\u4e0aPOSTROUTING\u5c31\u597d\u4e86<\/p>\n<p>  \u4f60\u8fd9\u8fb9\u7684\u8bdd\u76f4\u63a5\u7ec8\u7aef\u91cc\u8f93\u5165\u5c31\u884c\uff1a<\/p>\n<p> \u8c22\u8c22\u8001\u54e5\u56de\u590d\uff0c\u4e0a\u9762\u8fd9\u4e2a\u8f6c\u53d1\u5230vmbr0\u7684\u6211\u7684vmbr2\u91cc\u9762\u5df2\u7ecf\u6709\u4e86\uff0c\u800c\u4e14\u73b0\u5728\u5c31\u662f\u5176\u4ed6\u51e0\u4e2a\u5c0f\u9e21\u8f6c\u53d1\u90fd\u6b63\u5e38 \u5c31\u8fd9\u4e00\u4e2a\u8f6c\u53d1\u4e0d\u901a\u3002\u6362\u4e00\u4e2a\u5185\u7f51ip\u8f6c\u53d1\u4e5f\u662f\u4e00\u6837\u7684 \u5c0f\u9e21\u662fcentos7 \u4f1a\u4e0d\u4f1a\u662f\u5c0f\u9e21\u672c\u8eab\u7684\u95ee\u9898\uff1f\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>CloudRaft<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tmymyhope \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-4-20 18:01<br \/>  \u8c22\u8c22\u8001\u54e5\u56de\u590d\uff0c\u4e0a\u9762\u8fd9\u4e2a\u8f6c\u53d1\u5230vmbr0\u7684\u6211\u7684vmbr2\u91cc\u9762\u5df2\u7ecf\u6709\u4e86\uff0c\u800c\u4e14\u73b0\u5728\u5c31\u662f\u5176\u4ed6\u51e0\u4e2a\u5c0f\u9e21\u8f6c\u53d1\u90fd\u6b63\u5e38 \u5c31\u8fd9 &#8230;<\/p>\n<p> \u5176\u4ed6\u90fd\u6b63\u5e38\u7684\u8bdd\u4f30\u8ba1\u662f\u5c0f\u9e21\u7684\u95ee\u9898\u4e86\u3002<br \/>  \u7aef\u53e3\u6620\u5c04\u548cNAT\u8f6c\u53d1\u6211\u662f\u4e0d\u5efa\u8bae\u76f4\u63a5\u5199\u5230\u6bcd\u9e21\u7684NAT\u8868\u91cc\uff0c\u6211\u89c9\u5f97\u65b0\u5f00\u4e00\u4e2a\u5c0f\u9e21\u505a\u8f6f\u8def\u7531\u6700\u5408\u9002\uff0c\u591a\u4e00\u4e2aip\u7701\u5f88\u591a\u4e8b\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>ajeef<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u5148\u628a\u4f60\u4e3b\u677f\u4e0a\u7684\u7f51\u5361*\u5305\u542b\u4f60\u8981\u542f\u7528\u7684\u96c6\u6210\u7f51\u5361\uff0c\u90fd\u5907\u6ce8\u597d\uff0c\u4e3b\u4f53\u90e8\u5206\u641e\u597d\u4e86\uff0c\u5c31\u597d\u4e86\u3002<\/p>\n<p>  https:\/\/i.niupic.com\/images\/2020\/04\/20\/7sB3.jpg<br \/>  https:\/\/i.niupic.com\/images\/2020\/04\/20\/7sB5.jpg<br \/>  https:\/\/i.niupic.com\/images\/2020\/04\/20\/7sB6.jpg<br \/>  https:\/\/i.niupic.com\/images\/2020\/04\/20\/7sB7.jpg  \t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>mymyhope<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tYancheng \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-4-20 17:44<br \/>  \u4f60\u7167\u6211\u9019\u914d\u7f6e\u8a66\u8a66\u770b, \u81ea\u5df1\u8981\u6539\u7db2\u6bb5, \u770b\u5c11\u4e86\u4ec0\u9ebc<\/p>\n<p>  \u611f\u89ba\u4f60\u5c11\u4e86 POSTROUTING<\/p>\n<p> \u8c22\u8c22\u8001\u54e5\u56de\u590d\uff0c\u4e0a\u9762\u8fd9\u4e2a\u8f6c\u53d1\u5230vmbr0\u7684\u6211\u7684vmbr2\u91cc\u9762\u5df2\u7ecf\u6709\u4e86\uff0c\u800c\u4e14\u73b0\u5728\u5c31\u662f\u5176\u4ed6\u51e0\u4e2a\u5c0f\u9e21\u8f6c\u53d1\u90fd\u6b63\u5e38 \u5c31\u8fd9\u4e00\u4e2a\u8f6c\u53d1\u4e0d\u901a\u3002\u6362\u4e00\u4e2a\u5185\u7f51ip\u8f6c\u53d1\u4e5f\u662f\u4e00\u6837\u7684 \u5c0f\u9e21\u662fcentos7 \u4f1a\u4e0d\u4f1a\u662f\u5c0f\u9e21\u672c\u8eab\u7684\u95ee\u9898\uff1f  \t\t\t  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>mymyhope \u5927\u4f6c\u6709\u8bdd\u8bf4 : &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\/69281"}],"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=69281"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/69281\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=69281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=69281"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=69281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}