使用tailscale默認的中轉節點延遲很高,因為服務器都在國外。
感謝大佬提供的方案:Tailscale 搭建derp中繼節點,不需要域名,不需要備案,不需要申請證書(最新) - yafeng - 博客園
基于這個方案,直到運行 tailscale netcheck 命令都一切正常,可以看到 "Nearest DERP"是自己搭建的derp中繼,延時大概幾十毫秒,比默認節點至少快十幾倍。但是!!!最后一步卻 ping 不通!!!
折騰了半天,終于搞定了。本人純小白,也不知道以下哪個步驟起了作用,記錄一下。
根據上面大佬的方案配置完后,再運行以下步驟。
一、在配置derp的服務器上安裝tailscale
運行自動安裝腳本:
curl -fsSL https://tailscale.com/install.sh | sh
啟動tailscale并登陸:
tailscale up
進入登陸網頁登陸tailscale賬號。
重啟derp服務:
systemctl daemon-reload
systemctl restart derp
?二、重啟 Tailscale 服務:
在所有相關設備上(包括配置derp的服務器),重啟 Tailscale 服務以確保配置生效。
Linux 系統:
sudo systemctl restart tailscaled
Windows系統:
以管理員身份打開cmd,然后運行:
net stop Tailscale
net start Tailscale
三、檢測是否配置成功
使用以下命令查看:
tailscale netcheck
使用tailscale ping查看是否通過自己設置的中繼連接。
如果在DERP latency中出現自己剛才設置的服務器Test Derper,并且能ping通,即為安裝成功。
其他、關于tailscale的Access Controls配置文件
在配置文件里的'ssh'之前粘貼以下內容(以下是對我來說起作用的配置):
?? ?"derpMap": {
?? ??? ?"OmitDefaultRegions": true,? //加入這個會只用自己的節點
?? ??? ?"Regions": {
?? ??? ??? ?"900": {
?? ??? ??? ??? ?"RegionID": ? 900,
?? ??? ??? ??? ?"RegionCode": "test",
?? ??? ??? ??? ?"RegionName": "Test Derper",
?? ??? ??? ??? ?"Nodes": [
?? ??? ??? ??? ??? ?{
?? ??? ??? ??? ??? ??? ?"Name": ? ? ? ? ? ? "900a",
?? ??? ??? ??? ??? ??? ?"RegionID": ? ? ? ? 900,
?? ??? ??? ??? ??? ??? ?"HostName": ? ? ? ? "alicloud", //這個隨便寫
?? ??? ??? ??? ??? ??? ?"IPv4": ? ? ? ? ? ? "xx.xx.xx.xx", //改成自己的IP
?? ??? ??? ??? ??? ??? ?"InsecureForTests": true,
?? ??? ??? ??? ??? ?},
?? ??? ??? ??? ?],
?? ??? ??? ?},
?? ??? ?},
?? ?},
總結
完成以上配置后,每次連接時執行以下操作:
在配置derp的服務器上運行以下命令,hostname改成阿里云服務器的公網ip:
derper --hostname="12.12.12.12" -certmode manual -certdir ./
按照上面的步驟二,重啟?Tailscale 服務。