本文及资源最后更新时间 2021-05-28 by sky995
先注册一个账号然后创建一个网络,得到一个网络ID.
安装方法也很简单
<code class=" prettyprinted"><span class="pln">apt update </span><span class="pun">&&</span><span class="pln"> apt install curl gpg sudo curl </span><span class="pun">-</span><span class="pln">s https</span><span class="pun">:</span><span class="com">//install.zerotier.com | sudo bash</span></code>
然后加入网络,记得点设备得Auth.
<code class=" prettyprinted"><span class="pln">zerotier</span><span class="pun">-</span><span class="pln">cli </span><span class="kwd">join</span> <span class="lit">35c192ce9bebde10</span><span class="pln"> zerotier</span><span class="pun">-</span><span class="pln">cli </span><span class="kwd">set</span> <span class="lit">35c192ce9bebde10</span><span class="pln"> allowGlobal</span><span class="pun">=</span><span class="kwd">true</span><span class="pln"> zerotier</span><span class="pun">-</span><span class="pln">cli </span><span class="kwd">set</span> <span class="lit">35c192ce9bebde10</span><span class="pln"> allowDefault</span><span class="pun">=</span><span class="kwd">true</span></code>
随便找个顺眼得网段.
然后主机找好网段,设置转发.
<code class=" prettyprinted"><span class="pln">ip6tables </span><span class="pun">-</span><span class="pln">A FORWARD </span><span class="pun">-</span><span class="pln">i zt7nnhseel </span><span class="pun">-</span><span class="pln">s </span><span class="lit">2a0c</span><span class="pun">:</span><span class="lit">8fc0</span><span class="pun">:</span><span class="lit">7612</span><span class="pun">::/</span><span class="lit">48</span> <span class="pun">-</span><span class="pln">j ACCEPT ip6tables </span><span class="pun">-</span><span class="pln">A FORWARD </span><span class="pun">-</span><span class="pln">i eth0 </span><span class="pun">-</span><span class="pln">d </span><span class="lit">2a0c</span><span class="pun">:</span><span class="lit">8fc0</span><span class="pun">:</span><span class="lit">7612</span><span class="pun">::/</span><span class="lit">48</span> <span class="pun">-</span><span class="pln">j ACCEPT</span></code>
记得还要打开网卡转发功能.
<code class=" prettyprinted"><span class="pln">net</span><span class="pun">.</span><span class="pln">ipv4</span><span class="pun">.</span><span class="pln">ip_forward </span><span class="pun">=</span> <span class="lit">1</span><span class="pln"> net</span><span class="pun">.</span><span class="pln">ipv6</span><span class="pun">.</span><span class="pln">conf</span><span class="pun">.</span><span class="kwd">default</span><span class="pun">.</span><span class="pln">forwarding </span><span class="pun">=</span> <span class="lit">1</span><span class="pln"> net</span><span class="pun">.</span><span class="pln">ipv6</span><span class="pun">.</span><span class="pln">conf</span><span class="pun">.</span><span class="pln">all</span><span class="pun">.</span><span class="pln">forwarding </span><span class="pun">=</span> <span class="lit">1</span><span class="pln"> net</span><span class="pun">.</span><span class="pln">ipv6</span><span class="pun">.</span><span class="pln">conf</span><span class="pun">.</span><span class="pln">all</span><span class="pun">.</span><span class="pln">proxy_ndp </span><span class="pun">=</span> <span class="lit">1</span><span class="pln"> net</span><span class="pun">.</span><span class="pln">ipv6</span><span class="pun">.</span><span class="pln">conf</span><span class="pun">.</span><span class="pln">all</span><span class="pun">.</span><span class="pln">accept_ra </span><span class="pun">=</span> <span class="lit">2</span><span class="pln"> net</span><span class="pun">.</span><span class="pln">core</span><span class="pun">.</span><span class="pln">default_qdisc </span><span class="pun">=</span><span class="pln"> fq net</span><span class="pun">.</span><span class="pln">ipv4</span><span class="pun">.</span><span class="pln">tcp_congestion_control </span><span class="pun">=</span><span class="pln"> bbr</span></code>
把地址放到ZeroTier上.
然后添加路由,使得网络全部走RFC4193分配的IP出去.
这个时候再看,IP就已经分配了.
然后在另一的机器执行加入ZeroTier网络内.
<code class=" prettyprinted"><span class="pln">zerotier</span><span class="pun">-</span><span class="pln">cli </span><span class="kwd">join</span> <span class="lit">35c192ce9bebde10</span><span class="pln"> zerotier</span><span class="pun">-</span><span class="pln">cli </span><span class="kwd">set</span> <span class="lit">35c192ce9bebde10</span><span class="pln"> allowGlobal</span><span class="pun">=</span><span class="kwd">true</span><span class="pln"> zerotier</span><span class="pun">-</span><span class="pln">cli </span><span class="kwd">set</span> <span class="lit">35c192ce9bebde10</span><span class="pln"> allowDefault</span><span class="pun">=</span><span class="kwd">true</span></code>