欢迎来到好人卡资源网,专注网络技术资源收集,我们不仅是网络资源的搬运工,也生产原创资源。寻找资源请留言或关注公众号:烈日下的男人

使用ZeroTier One组网实验

linux sky995 来源:TaterLi 3年前 (2021-05-28) 935次浏览 0个评论

本文及资源最后更新时间 2021-05-28 by sky995

先注册一个账号然后创建一个网络,得到一个网络ID.

使用ZeroTier One组网实验

安装方法也很简单

<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>

随便找个顺眼得网段.

使用ZeroTier One组网实验

然后主机找好网段,设置转发.

<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上.

使用ZeroTier One组网实验

然后添加路由,使得网络全部走RFC4193分配的IP出去.

使用ZeroTier One组网实验

这个时候再看,IP就已经分配了.

使用ZeroTier One组网实验

然后在另一的机器执行加入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>

好人卡资源网 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:使用ZeroTier One组网实验
喜欢 (2)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址