tailscale在openwrt中的安装方法(内网所有电脑可穿透出去)
2024.09.12:
1、关于tailscale的安装,目前op软件库里边已经有了,只要ssh后opkg update 然后opkg install tailscale ,会自动安装,并且会自动安装好相关依赖,不用上面提到的从github上去下载和解压了,并且发现tailscaled已经设置开机自启。
2、安装完tailscale后,无需新建接口。
3、exit-node的相关设置,需要一条命令,并且应该和subnet是一起设置的,不要分开设置。如下:
tailscale up --advertise-exit-node --accept-dns=false --accept-routes=true --advertise-routes=192.168.1.0/24,39.135.121.0/24
范例:tailscale up --accept-dns=false --accept-routes --advertise-routes=10.170.14.0/23 --advertise-exit-node=false --exit-node-allow-lan-access=false
如何在其他设备上使用相关exit-node:
tailscale set --exit-node=<exit-node-ip> --exit-node-allow-lan-access=true
如何在其他设备上退出相关exit-node:
如何在其他设备上使用相关exit-node:
tailscale up --exit-node=
4、op写入tf卡后,开机后,在防火墙中看到相关自定义是空白的,不需要以前搞iptable之类的了。
5、ssrp的设置中,“访问控制”中可以控制相关监听接口,这一点很重要。如果作为exit-node需要翻墙的话,需要全部监听(不勾选),或者添加接口后来指定这个接口(例如tailscale0)。
6、防火墙设置中,ip动态伪装一定勾选,不然tailscale无法访问其他相关内网设备。
7、还有如果需要访问一些端口转发的机器,目前还没去研究,应该是可以通过添加“接口”,设定防火墙,然后在端口转发中具体规则也要设置一下,我猜想,应该能解决。
8、单位的ip地址可能切换,因此通过tailscale的direct访问,不具备稳定性。但是如果都是移动旗下的宽带,效果还是挺好的。
9、利用exit-node来使用家中的iptv,还是相当不错的,测试了一下电信可以使用的。
以下为旧文:
官方登录地址:https://login.tailscale.com/admin/machines
官方github:https://github.com/tailscale/tailscale
op上安装ts的github:https://github.com/adyanth/openwrt-tailscale-enabler
1.ssh登录软路由
2.wget https://github.com/adyanth/openwrt-tailscale-enabler/releases/download/v1.28.0-e707d17-autoupdate/openwrt-tailscale-enabler-v1.28.0-e707d17-autoupdate.tgz
//以上地址看一下该作者的releases,然后拷贝地址即可。
3.tar x -zvC / -f openwrt-tailscale-enabler-v1.28.0-e707d17-autoupdate.tgz
//解压到如下:
usr/
usr/bin/
usr/bin/tailscaled
usr/bin/tailscale
etc/
etc/init.d/
etc/init.d/tailscale
4.opkg update 后 opkg install libustream-openssl ca-bundle kmod-tun
//安装相关依赖
5./etc/init.d/tailscale start
tailscale up --accept-dns=false --advertise-routes=192.168.1.0/24
/etc/init.d/tailscale enable
ls /etc/rc.d/S*tailscale*
//第一次启动 后面可设置成enable,每次自动启动。subnet网段按实际填写。
6.路由器防火墙规则中添加以下内容,即可内网所有设备通过这个subnet去访问那些100开头的ip:
iptables -I FORWARD -i tailscale0 -j ACCEPT
iptables -I FORWARD -o tailscale0 -j ACCEPT
iptables -t nat -I POSTROUTING -o tailscale0 -j MASQUERADE
7.reboot 后即可搞定,当然在安装时候需要确认一下,登录谷歌账号就会显示sucess。需要翻墙,或者使用微软账号。