{"id":134830,"date":"2020-07-21T08:14:15","date_gmt":"2020-07-21T00:14:15","guid":{"rendered":"http:\/\/4563.org\/?p=134830"},"modified":"2020-07-21T23:16:45","modified_gmt":"2020-07-21T15:16:45","slug":"%e5%b1%80%e5%9f%9f%e7%bd%91%e4%b8%80%e5%8f%b0-linux-%e6%9c%8d%e5%8a%a1%e5%99%a8%e9%80%9a%e8%bf%87-zerotier-%e8%bf%9e%e4%b8%8a%e4%ba%86-nas%ef%bc%8c%e5%85%b6%e4%bb%96%e8%ae%be%e5%a4%87%e6%80%8e","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=134830","title":{"rendered":"\u5c40\u57df\u7f51\u4e00\u53f0 Linux \u670d\u52a1\u5668\u901a\u8fc7 zerotier \u8fde\u4e0a\u4e86 NAS\uff0c\u5176\u4ed6\u8bbe\u5907\u600e\u4e48\u901a\u8fc7\u8fd9\u53f0 Linux \u670d\u52a1\u5668\u8fde\u4e0a NAS\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5c40\u57df\u7f51\u4e00\u53f0 Linux \u670d\u52a1\u5668\u901a\u8fc7 zerotier \u8fde\u4e0a\u4e86 NAS\uff0c\u5176\u4ed6\u8bbe\u5907\u600e\u4e48\u901a\u8fc7\u8fd9\u53f0 Linux \u670d\u52a1\u5668\u8fde\u4e0a NAS\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ZenFX <\/span>  <span><i><\/i> 13<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u5c40\u57df\u7f51\u7684\u7f51\u6bb5\u662f 192.168.1.0\/24<\/p>\n<p>zerotier \u7684\u7f51\u6bb5\u662f 192.168.2.0\/24<\/p>\n<p>NAS \u8bbe\u7f6e\u7684 zerotier IP \u662f 192.168.2.5<\/p>\n<p>\u5176\u4ed6\u8bbe\u5907\u5728\u4e0d\u5b89\u88c5 zerotier \u7684\u60c5\u51b5\u4e0b\u600e\u4e48\u8fde\u4e0a NAS<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>11<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"2477714\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : sujin190 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8bbe\u7f6e\u8def\u7531\uff0c\u914d\u7f6e nat \u5c31\u662f\u4e86\u554a\uff0c\u7528 route \u548c iptables \u547d\u4ee4\u52a0\u4e0b\u5c31\u597d                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2477715\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Shirakawa <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7aef\u53e3\u8f6c\u53d1\u5957\u5a03                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2477716\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Jirajine <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5728\u90a3\u53f0 linux \u670d\u52a1\u5668\u4e0a\uff1a<br \/>echo 1 &gt; \/proc\/sys\/net\/ipv4\/ip_forward<br \/>iptables -I FORWARD -j ACCEPT<br \/>iptables -t nat -I POSTROUING -o &lt;zerotier \u7684 interface \u540d\u79f0&gt; -j MASQUERADE<\/p>\n<p>\u5176\u4ed6\u9700\u8981\u8bbf\u95ee nas \u7684\u8bbe\u5907\u4e0a\uff1a<br \/>ip route add 192.168.2.0\/24 via &lt;\u90a3\u53f0 linux \u670d\u52a1\u5668\u5728\u5c40\u57df\u7f51\u4e2d\u7684\u5730\u5740&gt;                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2477717\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yov123456 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0d\u9700\u8981\u6dfb\u52a0\u4efb\u4f55 ipatabes \u3002\u4e0d\u9700\u8981\u914d\u7f6e\u4efb\u4f55\u989d\u5916\u7684 nat\uff0c\u5ba2\u6237\u7aef\u4e0d\u9700\u8981\u914d\u7f6e\u4efb\u4f55\u5176\u4ed6\u4e1c\u897f<br \/>\u670d\u52a1\u5668\u5f00\u542f ip_forward \u540e<br \/>\u8fdb\u5165\u4f60\u7684\u8def\u7531\u5668 \u914d\u7f6e\u9759\u6001\u8def\u7531 192.168.2.0\/24 -&gt; linux \u670d\u52a1\u5668 ip \u3002<br \/>\u540c\u7406 \u4f60\u53ef\u4ee5\u518d\u4e24\u4e2a\u7f51\u6bb5\u4e92\u76f8\u914d\u7f6e\u9759\u6001\u8def\u7531 \u5c31\u53ef\u4ee5\u4e0d\u7ba1 zerotier \u7684 ip \u7aef\u76f4\u63a5\u5b9e\u73b0\u5c40\u57df\u7f51\u4e92\u901a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2477718\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jinhan13789991 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             zerotier \u63a7\u5236\u53f0\u6dfb\u52a0\u8def\u7531\uff0c192.168.1<br \/>0 \uff0f 24 \u8d70 192.168.2.5<br \/>\u5bb6\u91cc\u8def\u7531\u5668\u6dfb\u52a0\u8def\u7531\uff0c192.168.2.0 \uff0f 24 \u8d70\u4f60\u88c5\u4e86 zerotier \u7684 linux \u7684\u5c40\u57df\u7f51 IP                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2477719\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jinhan13789991 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u540c\u65f6 Linux \u7535\u8111\u5f00\u542f\u8def\u7531\u529f\u80fd                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2477720\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jinhan13789991 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6216\u8005\u53ef\u4ee5\u8bd5\u8bd5\u8fd9\u6837<br \/>\u5728\u4f60\u5185\u7f51\u7684 linux \u673a\u5668\u4e0a\u8bbe\u7f6e<\/p>\n<p>\/\/\u5f00\u542f\u8f6c\u53d1\u529f\u80fd<br \/>echo &#8220;1&#8221; &gt; \/proc\/sys\/net\/ipv4\/ip_forward<\/p>\n<p>\/\/\u628a\u6765\u81ea zerotier \u7684\u6570\u636e\u4f2a\u88c5\u6210\u672c\u673a\u7684\u6570\u636e<br \/>iptables -t nat -A POSTROUTING -s 192.168.2.0\/24 -d 192.168.1.0\/24 -j MASQUERADE<\/p>\n<p>\u540c\u65f6\uff0czerotier \u63a7\u5236\u53f0\u6dfb\u52a0\u8def\u7531 192.168.1.0\/24 -&gt; 192.168.2.5<\/p>\n<p>\u6211\u73b0\u67e5\u7684\u8d44\u6599\u3002\u3002\u3002<br \/>http:\/\/cn.linux.vbird.org\/linux_server\/0250simple_firewall_5.php                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2477721\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jinhan13789991 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u62b1\u6b49\uff0c\u5ba1\u9898\u4e0d\u6e05\u695a\u3002\u4e0a\u9762\u5199\u53cd\u4e86\u3002\u3002<\/p>\n<p>zerotier \u63a7\u5236\u53f0\u4e0d\u505a\u4efb\u4f55\u6539\u52a8\u3002<\/p>\n<p>\u5bb6\u91cc\u8def\u7531\u5668\u6dfb\u52a0\u4e00\u6761\u8def\u7531 <br \/>192.168.2.0\/24 -&gt; \u4f60\u88c5 zeroter \u7684 linux \u673a\u5668\u7684 ip\uff0c\u6bd4\u5982 192.168.1.23<\/p>\n<p>linux \u673a\u5668\u6539\u52a8<\/p>\n<p>\/\/\u5f00\u542f\u8f6c\u53d1\u529f\u80fd<br \/>echo &#8220;1&#8221; &gt; \/proc\/sys\/net\/ipv4\/ip_forward<br \/>\/\/\u628a\u6765\u81ea\u5bb6\u91cc\u5c40\u57df\u7f51\u7684\u6570\u636e\u4f2a\u88c5\u6210\u672c\u673a zeroteri \u7684\u6570\u636e<br \/>iptables -t nat -A POSTROUTING -s 192.168.1.0\/24 -o $zeroteir -j MASQUERADE<br \/>$zeroteir \u662f zerotier \u5728\u4f60 linux \u8bbe\u5907\u4e0a\u7684\u865a\u62df\u7f51\u53e3\u540d                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2477722\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : flynaj <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             nas \u5f00\u8f6c\u53d1\uff0c\u8def\u7531\u5668\u4e0a\u6dfb\u52a0\u4e00\u4e2a\u8def\u7531\u8868 192.168.2.0\/24 \u7f51\u5173\u5199 nas \u7684 IP                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2477723\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : flynaj <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5176\u5b9e\u6700\u65b9\u4fbf\u7684\u8fd8\u662f zerotier \u53ea\u63a5\u5f00\u5728\u8def\u7531\u5668\u4e0a\u3002\u597d\u63a7\u5236\u3002\u8def\u7531\u5668\u7528 openwrt \u7cfb\u7edf.<br \/><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/07\/f6NiO79k.png\" alt=\"\u5c40\u57df\u7f51\u4e00\u53f0 Linux \u670d\u52a1\u5668\u901a\u8fc7 zerotier \u8fde\u4e0a\u4e86 NAS\uff0c\u5176\u4ed6\u8bbe\u5907\u600e\u4e48\u901a\u8fc7\u8fd9\u53f0 Linux \u670d\u52a1\u5668\u8fde\u4e0a NAS\uff1f\"> <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2477724\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : laoyur <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @yov123456 \u6211\u4fe1\u4e86\u4f60\u7684\u90aa\uff0c\u4e0d\u6dfb\u52a0\u4efb\u4f55 iptables \u89c4\u5219\u80fd\u901a\u624d\u89c1\u9b3c\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5c40\u57df\u7f51\u4e00\u53f0 Linux \u670d\u52a1\u5668\u901a\u8fc7&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\/134830"}],"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=134830"}],"version-history":[{"count":1,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/134830\/revisions"}],"predecessor-version":[{"id":134832,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/134830\/revisions\/134832"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=134830"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=134830"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=134830"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}