{"id":168675,"date":"2020-10-21T11:35:30","date_gmt":"2020-10-21T03:35:30","guid":{"rendered":"http:\/\/4563.org\/?p=168675"},"modified":"2020-10-21T11:35:30","modified_gmt":"2020-10-21T03:35:30","slug":"%e8%af%b7%e6%95%99%e4%b8%80%e4%b8%8bsnat-%e7%9a%84%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=168675","title":{"rendered":"\u8bf7\u6559\u4e00\u4e0bSNAT \u7684\u95ee\u9898"},"content":{"rendered":"\n<p>  \t\t\t\t\t<strong>why?<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3>\u8bf7\u6559\u4e00\u4e0bSNAT \u7684\u95ee\u9898<\/h3>\n<p>  \t\tauto enp3s0<br \/>  iface enp3s0 inet static<br \/>  &nbsp; &nbsp;address 120xxxxxx<br \/>  &nbsp; &nbsp;netmask 255.255.255.0<br \/>  &nbsp; &nbsp;gateway 120xxxxx.254<br \/>  &nbsp; &nbsp;bridge-ports enp2s0<br \/>  &nbsp; &nbsp;bridge-stp off<br \/>  &nbsp; &nbsp;bridge-fd 0<\/p>\n<p>  auto vmbr0<br \/>  iface vmbr0 inet static<br \/>  address 10.10.10.254<br \/>  netmask 255.255.255.0<br \/>  bridge_ports none<br \/>  bridge_stp off<br \/>  bridge_fd 0<br \/>  post-up echo 1 &gt; \/proc\/sys\/net\/ipv4\/ip_forward<br \/>  post-up iptables -t nat -A POSTROUTING -s &#8216;10.10.10.0\/24&#8217; -o enp3s0 -j MASQUERADE<br \/>  post-down iptables -t nat -D POSTROUTING -s &#8216;10.10.10.0\/24&#8217; -o enp3s0 -j MASQUERADE<\/p>\n<p>  #################\u7f51\u5361\u914d\u7f6e<\/p>\n<p>  #################\u8f6c\u53d1\u8bbe\u7f6e<br \/>  -A PREROUTING -i enp3s0 -p tcp -m tcp &#8211;dport 443 -j DNAT &#8211;to-destination 10.10.10.100:443<\/p>\n<p>  #########<\/p>\n<p>  \u901a\u8fc7DNAT \u540e\uff0c\u5185\u7f51\u65e0\u6cd5\u8bbf\u95ee120xxxxxx,<\/p>\n<p>  \u5982\u4f55\u901a\u8fc7 iptable\u914d\u7f6e SNAT\u4f7f\u5176\u53ef\u4ee5\u8bbf\u95ee<\/p>\n<p>  \u767e\u5ea6\u5230\u7684\u770b\u4e0d\u61c2\u5440 \uff0c\u6c42\u5927\u4f6c\u76f4\u63a5\u7ed9\u4e2a\u53e5\u5b50\u53c2\u8003 \t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>52usa<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u5e2e\u9876\uff0c\u6280\u672f\u5927\u4f6c\u624d\u80fd\u56de\u7b54\u4e86<\/p>\n<p>  \u5c0f\u767d\u9876\uff01<\/p>\n<p>  :lol:lol:lol\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>Firedoge<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u4e71\u4e03\u516b\u7cdf\u7684\u3002\u5148\u8bf4\u6e05\u695a\u4f60\u60f3\u5b9e\u73b0\u600e\u6837\u7684\u529f\u80fd\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>why?<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tFiredoge \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-10-20 20:21<br \/>  \u4e71\u4e03\u516b\u7cdf\u7684\u3002\u5148\u8bf4\u6e05\u695a\u4f60\u60f3\u5b9e\u73b0\u600e\u6837\u7684\u529f\u80fd<\/p>\n<p> :L<br \/>  \u901a\u8fc7DNAT \u540e\uff0c\u5185\u7f51\u65e0\u6cd5\u8bbf\u95ee120xxxxxx<\/p>\n<p>  \u8def\u7531\u56de\u6d41\u4f60\u5f00\u5c0f\u9e21 \u4f60\u5c31\u61c2\u4e86<\/p>\n<p>  \u767e\u5ea6 DNAT SNAT\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>Waylon<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u73b0\u5728\u516c\u7f51\u80fd\u6b63\u5e38\u8bbf\u95ee 120xxxxxx:443 \u5417\uff1f\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>why?<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tWaylon \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-10-20 20:53<br \/>  \u73b0\u5728\u516c\u7f51\u80fd\u6b63\u5e38\u8bbf\u95ee 120xxxxxx:443 \u5417\uff1f<\/p>\n<p> \u53ef\u4ee5\u7684\uff0c\u5c31\u662f\u5185\u7f51\u65e0\u6cd5\u8bbf\u95ee\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>diocat<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u4f60\u8be5\u4e0d\u4f1aipforward\u6ca1\u5f00\u5427\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>why?<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tdiocat \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-10-21 07:38<br \/>  \u4f60\u8be5\u4e0d\u4f1aipforward\u6ca1\u5f00\u5427<\/p>\n<p> :'( \u5f00\u4e86<br \/>  post-up echo 1 &gt; \/proc\/sys\/net\/ipv4\/ip_forward  \t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>diocat<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\twhy? \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-10-21 08:58<br \/>  \u5f00\u4e86<br \/>  post-up echo 1 &gt; \/proc\/sys\/net\/ipv4\/ip_forward<\/p>\n<p> 1\u3001\u5199sysctl\u91cc\uff0c\u7528sysctl -p\u89e6\u53d1\u4e0b\u518d\u8bd5\u8bd5<\/p>\n<p>  2\u3001\u5185\u7f51\u80fd\u4e0d\u80fdping\u901a120\u7684\u672c\u673aip\uff1f\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>why?<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tdiocat \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-10-21 09:02<br \/>  1\u3001\u5199sysctl\u91cc\uff0c\u7528sysctl -p\u89e6\u53d1\u4e0b\u518d\u8bd5\u8bd5<\/p>\n<p>  2\u3001\u5185\u7f51\u80fd\u4e0d\u80fdping\u901a120\u7684\u672c\u673aip\uff1f<\/p>\n<p>  1. \u6211\u67e5\u770b\u8fc7\u4e86 \u8fd9\u4e2a\u8f6c\u53d1\u662f\u6709\u5f00\u542f\u7684<br \/>  2.\u53ef\u4ee5ping \u901a\u7684<br \/>  \u6709\u4eba\u63cf\u8ff0\u7684\u5f88\u6e05\u695a\uff0c\u4f46\u6211\u4e0d\u4f1a\u5199\u90a3\u4e2asnat<br \/>  https:\/\/www.openset.wang\/network\/internal-host-cannot-access-the-intranet-service-through-public-network\/  \t\t\t  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>why? \u5927\u4f6c\u6709\u8bdd\u8bf4 : \u8bf7\u6559\u4e00\u4e0b&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\/168675"}],"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=168675"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/168675\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=168675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=168675"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=168675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}