id: 1aa8897dc9c44abc8de2d25dfa9d1b33
parent_id: 
item_type: 1
item_id: 58cd594eac34408a8d0cdcf676ca59fc
item_updated_time: 1764345623061
title_diff: "[{\"diffs\":[[1,\"ZeroTierEasyTier组网后如何网对网互相访问子网IP【进阶】 [2]\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":40}]"
body_diff: "[{\"diffs\":[[1,\"<html>\\\r\\\n<head>\\\r\\\n  <title>ZeroTier/EasyTier组网后如何网对网互相访问子网IP【进阶】</title>\\\r\\\n  <basefont face=\\\"微软雅黑\\\" size=\\\"2\\\" />\\\r\\\n  <meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html;charset=utf-8\\\" />\\\r\\\n  <meta name=\\\"exporter-version\\\" content=\\\"YXBJ Windows/608924 (zh-CN, DDL); Windows/10.0.0 (Win64); EDAMVersion=V2;\\\"/>\\\r\\\n  <meta name=\\\"content-class\\\" content=\\\"yinxiang.peso.superNote\\\"/>\\\r\\\n  <meta name=\\\"application-data:yinxiang.noteLayout\\\" content=\\\"{\\\"lineSpace\\\":\\\"recommend\\\",\\\"paragraphSpace\\\":\\\"recommend\\\"}\\\"/>\\\r\\\n  <style>\\\r\\\n\\tbody, td {\\\r\\\n\\t  font-family: 微软雅黑;\\\r\\\n\\t  font-size: 12pt;\\\r\\\n\\t}\\\r\\\n  </style>\\\r\\\n</head>\\\r\\\n<body>\\\r\\\n<a name=\\\"38696\\\"></a>\\\r\\\n<h1>ZeroTier/EasyTier组网后如何网对网互相访问子网IP【进阶】</h1>\\\r\\\n\\\r\\\n<div><span><div><br/></div><p><br/></p><div style=\\\"--en-blockquote:true;box-sizing: border-box; padding-left: 19px; padding-top: 6px; padding-bottom: 6px; border-left: 3px solid #b4c0cc; background-position: initial initial; background-repeat: initial initial; margin-top: 6px\\\"><div>原文链接: <a href=\\\"http://mp.weixin.qq.com/s?__biz=MzUzNTExMDE2Mg==&amp;mid=2247486400&amp;idx=1&amp;sn=a3badd54c7bc70f6095428ce9cd77570&amp;chksm=fb3fae37518cf4b716c4892b981a13387ef44b0ff78fa21174da61303bb70919611f103ef361&amp;mpshare=1&amp;scene=1&amp;srcid=0321Kcj6rdlyBJMqneQa4mIA&amp;sharer_shareinfo=9c92edc3441c72f18ee6e060b6b02b75&amp;sharer_shareinfo_first=9c92edc3441c72f18ee6e060b6b02b75#rd\\\" rev=\\\"en_rl_none\\\">http://mp.weixin.qq.com/s?__biz=MzUzNTExMDE2Mg==&amp;mid=2247486...</a></div></div><p><br/></p><div><br/></div><h1 style=\\\"other-props:eyJibG9ja0lkIjoiQWZrZ1J1bzVGLTkifQ==;\\\"> ZeroTier/EasyTier组网后如何网对网互相访问子网IP【进阶】 </h1><div>原创老王杂谈说 老王杂谈说 </div><div>看大家对于组网后直接访问原子网的IP地址非常感兴趣，今天我们就来聊一聊怎么配置，直奔主题。</div><img src=\\\":/4094ea0e249346368437a1cbdc2f3541\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;--en-uploadstate:uploaded;\\\"/><table style=\\\"--en-fitwindow:false;border-left:1px solid #d9d9d9;border-top:1px solid #d9d9d9;border-collapse:collapse;width:190px;\\\" width=\\\"190px\\\"><colgroup><col style=\\\"width: 190px;\\\"></col></colgroup><tbody><tr><td style=\\\"--en-typeInfo:{&quot;type&quot;:&quot;text&quot;,&quot;data&quot;:{}};background-color:rgb(120, 172, 254);border-right:1px solid #d9d9d9;border-bottom:1px solid #d9d9d9;padding:10px;\\\"><div style=\\\"text-align:center;\\\"><span style=\\\"color: rgb(255, 255, 255);\\\"><span style=\\\"font-weight: bold;\\\">共同点</span></span></div></td></tr></tbody></table><div>共同点就是作为组网设备，一定要允许流量的转发功能。</div><div>如果你装在Linux设备上，统一的命令都是下面这条。</div><div style=\\\"--en-codeblock:true;--en-blockId:0_u7Qyk0_dl;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\">sudo sysctl -w net.ipv4.ip_forward=1</div><table style=\\\"--en-fitwindow:false;border-left:1px solid #d9d9d9;border-top:1px solid #d9d9d9;border-collapse:collapse;width:190px;\\\" width=\\\"190px\\\"><colgroup><col style=\\\"width: 190px;\\\"></col></colgroup><tbody><tr><td style=\\\"--en-typeInfo:{&quot;type&quot;:&quot;text&quot;,&quot;data&quot;:{}};background-color:rgb(120, 172, 254);border-right:1px solid #d9d9d9;border-bottom:1px solid #d9d9d9;padding:10px;\\\"><div style=\\\"text-align:center;\\\"><span style=\\\"color: rgb(255, 255, 255);\\\"><span style=\\\"font-weight: bold;\\\">ZeroTier</span></span></div></td></tr></tbody></table><div style=\\\"--en-codeblock:true;--en-blockId:v1G0QKSzamh;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\">https://docs.zerotier.com/route-between-phys-and-virt</div><div>官方文档链接如上：</div><div>我把配置复制过来简单讲解一下。PHY_IFACE = 你的物理网卡的名称，ZT_IFACE = ZeroTier 设备的名称，那么在Linux下，都可以通过ifconfig或者ip link显示两者，ZeroTier的设备名称通常以zt开头。找到这2个之后直接贴到终端回车</div><div style=\\\"--en-codeblock:true;--en-blockId:wuPUT-540wI;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\">PHY_IFACE=eth0; ZT_IFACE=zt7nnig26</div><div>然后才是真正的转发命令，但是这个命令在重启后会失效</div><div style=\\\"--en-codeblock:true;--en-blockId:TmqxR6bZR7l;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\">sudo iptables -t nat -A POSTROUTING -o $PHY_IFACE -j MASQUERADEsudo iptables -A FORWARD -i $PHY_IFACE -o $ZT_IFACE -m state --state RELATED,ESTABLISHED -j ACCEPTsudo iptables -A FORWARD -i $ZT_IFACE -o $PHY_IFACE -j ACCEPT</div><div>所以还需要把这规则写入配置文件，确保他重启后还是处于有效状态。</div><div style=\\\"--en-codeblock:true;--en-blockId:0wVcQ2Vuz3W;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\">sudo apt install iptables-persistentsudo bash -c iptables-save &gt; /etc/iptables/rules.v4</div><div>到这里，只是表示他有这个能力，但是我们还缺最重要的一步就是写路由。假设我们是2个地方组网，这里我们需要写2条。（如果有三个地方组网就要写三条），写完之后系统会自动下面路由到装ZeroTier的设备上。</div><div>前面这个写网段，后面这个写网关（就是装ZeroTier的IP地址）</div><div><span style=\\\"font-size: 14px;\\\">比如:</span></div><div><span style=\\\"font-size: 14px;\\\">A家里是192.168.1.1/24 装ZeroTier的设备得到的ZT IP 是192.168.5.3</span></div><div><span style=\\\"font-size: 14px;\\\">B家里是192.168.0.1/24 装ZeroTier的设备得到的ZT IP 是192.168.5.6</span></div><img src=\\\":/1e259aa337c742b49f4d0341063ab793\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;--en-uploadstate:uploaded;\\\"/><div>那么这样，在ZT下两边互访局域网的IP就结束了</div><table style=\\\"--en-fitwindow:false;border-left:1px solid #d9d9d9;border-top:1px solid #d9d9d9;border-collapse:collapse;width:190px;\\\" width=\\\"190px\\\"><colgroup><col style=\\\"width: 190px;\\\"></col></colgroup><tbody><tr><td style=\\\"--en-typeInfo:{&quot;type&quot;:&quot;text&quot;,&quot;data&quot;:{}};background-color:rgb(120, 172, 254);border-right:1px solid #d9d9d9;border-bottom:1px solid #d9d9d9;padding:10px;\\\"><div style=\\\"text-align:center;\\\"><span style=\\\"color: rgb(255, 255, 255);\\\"><span style=\\\"font-weight: bold;\\\">EasyTier</span></span></div></td></tr></tbody></table><div style=\\\"--en-codeblock:true;--en-blockId:Q6dLRWf6ZpC;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\">https://easytier.cn/guide/network/network-to-network.html</div><img src=\\\":/51dac445d4244cf1937382b84817fbaa\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;--en-uploadstate:uploaded;\\\"/><div><span style=\\\"font-size: 14px;\\\"><u>网对网配置成功后，192.168.1.0/24 子网的设备可以访问 10.1.1.0/24 子网的设备互相通信且无需安装 EasyTier。</u></span></div><div>从官方说明中也可以看出来，几乎跟ZeroTier一样，只是把网络出口的设备名称变成了IP地址。</div><div><span style=\\\"font-size: 14px;\\\">要实现网对网，需要 节点 A 是 192.168.1.0/24 子网的网关。两个 EasyTier 节点的启动及配置参数如下：</span></div><div><span style=\\\"font-size: 14px;\\\"><span style=\\\"font-weight: bold;\\\">节点 A</span></span></div><div style=\\\"--en-codeblock:true;--en-blockId:YnKITi3sxAY;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"># 启动 EasyTier 并代理 192.168.1.0/24 网段，并使用公共服务器帮助组网easytier-core -i 10.144.144.1 -n 192.168.1.0/24 -p tcp://public.easytier.top:11010 --network-name n2n_test\\\n# 允许网关转发流量，并配置防火墙允许转发流量sysctl -w net.ipv4.ip_forward=1iptables -A FORWARD -s 192.168.1.0/24 -j ACCEPTiptables -A FORWARD -d 192.168.1.0/24 -j ACCEPT</div><div><span style=\\\"font-size: 14px;\\\"><span style=\\\"font-weight: bold;\\\">节点 B</span></span></div><div style=\\\"--en-codeblock:true;--en-blockId:JYSJSOk8JMX;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"># 启动 EasyTier 并代理 10.1.1.0/24 网段，并使用公共服务器帮助组网easytier-core -i 10.144.144.2 -n 10.1.1.0/24 -p tcp://public.easytier.top:11010 --network-name n2n_test# 允许网关转发流量，并配置防火墙允许转发流量sysctl -w net.ipv4.ip_forward=1iptables -A FORWARD -s 10.1.1.0/24 -j ACCEPTiptables -A FORWARD -d 10.1.1.0/24 -j ACCEPT</div><div>这样就可以做到双向网络设备通过原IP互相访问。</div><div>那么如果两边都是OpenWrt，这个就会变简单许多，把你需要访问的全都勾上就可以了，系统根据你选择的流量通断生成防火墙对应的规则。</div><img src=\\\":/67311bc9ccb64af59b7a8b67113b9b2d\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;--en-uploadstate:uploaded;\\\"/><div>至此，你们两个组网的网段就可以互访了。下面是我编译好的安装包，按自己的cpu类型下载对应的包。</div><div style=\\\"--en-codeblock:true;--en-blockId:RILYTeb8EI9;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\">https://github.com/djhui/luci-app-easytier</div><div>如果安装好之后，你的OpenWrt里面打开EasyTier报错，检查一下luci-compat是否缺失，如果缺失，安装上即可。</div><div style=\\\"text-align:center;\\\"><span style=\\\"color: rgb(255, 41, 65);\\\"><span style=\\\"font-weight: bold;\\\">感谢花时间看完，如果觉得有用，点个赞吧，未关注的小伙伴，快关注哟~</span></span></div><div><br/></div></span>\\\n</div></body></html>\\u0000\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":12999}]"
metadata_diff: {"new":{"id":"58cd594eac34408a8d0cdcf676ca59fc","parent_id":"f67288c3a0be4374b5d532b5dcc3aabc","latitude":"0.00000000","longitude":"0.00000000","altitude":"0.0000","author":"","source_url":"","is_todo":0,"todo_due":0,"todo_completed":0,"source":"joplin-desktop","source_application":"net.cozic.joplin-desktop","application_data":"","order":1764348826102,"markup_language":2,"is_shared":0,"share_id":"","conflict_original_id":"","master_key_id":"","user_data":"","deleted_time":0},"deleted":[]}
encryption_cipher_text: 
encryption_applied: 0
updated_time: 2025-11-28T21:04:02.322Z
created_time: 2025-11-28T21:04:02.322Z
type_: 13