Try   HackMD

Tailscale 是什麼?

Tailscale 是一個 VPN 服務,可以讓您的設備和應用程式在全球任何地方安全且輕鬆地連接。它使用開源的 WireGuard 協議進行加密的 P2P 連接 (稱為 tailnet),這意味著只有您私有網路上的設備才能互相通信。

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Tailscale 還提供 MagicDNS,讓您不需要打 IP,改用 hostname 直接連線到裝置。

安裝 Tailscale

Windows

Tailscale 僅支援 Windows 10 以上系統。

官網下載 exe 安裝,開啟 Tailscale 應用程式,需註冊/登入帳號。

Linux

參考官網指示,使用指令稿安裝。

curl -fsSL https://tailscale.com/install.sh | sh

安裝後設定開機自動啟用 Tailscale 服務。

sudo systemctl enable --now tailscaled # 檢查服務狀態 sudo systemctl status tailscaled

將裝置加入Tailscale網路。

sudo tailscale up

Tailscale 使用

當裝置都加入 Tailscale 網路後,就彷彿處於一個區域網路,可以嘗試互相連線了。

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

如果覺得記 IP 太麻煩,您可以到 Tailscale 的網頁後台 → DNS 啟用 Magic DNS。

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

這樣在裝置連到 Tailscale 網路的情況下,就可以不用 IP,改用裝置的 hostname 來連線了。

連線異常

SSH 很卡、斷線

  • 我的電腦和 VM 互相 ping 不到,或是掉很多包
  • VM ping google.com 也不穩

原因

  • 連 Google 都 ping 不到,代表是負責連上外網的網卡有問題
  • 偷看了一下其他 VM,發現是拿到相同的 IP

解決方法

  1. 嘗試重啟網卡
    • ifconfig 查目前的所有網卡,確認網卡的名稱
    • ifconfig <網卡> down 關閉網卡
    • ifconfig <網卡> up 啟用網卡
    • 但有可能還是拿到相同 IP
  2. 要求 DHCP Server 重新發一個 IP
    • dhclient -r <網卡> 釋出拿到的 IP
    • dhclient <網卡> 要求一個新的 IP

參考資料