Taken from ChatGPT
Perfect — Ubuntu 24.04 makes things really smooth. Here’s a more tailored version for you:
SSH into your VPS and run:
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale upThis will:
-
Install Tailscale
-
Prompt you to sign in via a browser (you can copy the link and open it locally)
After that, your VPS is in your Tailscale network.
Do the same on your personal computer:
-
Download Tailscale
-
Sign in with the same account
-
Run
tailscale up
After connecting both devices:
You’ll see something like:
vps-name 100.101.102.103 linux idleYou can now SSH into your VPS like:
ssh username@100.101.102.103
# Or
ssh username@vps-name.tailnet-name.ts.netThis is the key part for keeping it secure while using a VPN:
sudo ufw default deny incoming
sudo ufw default allow outgoingsudo ufw allow from 100.64.0.0/10 to any port 22 proto tcp
100.64.0.0/10is the range used by Tailscale devices.
sudo ufw enable
sudo ufw statusYour VPS now:
-
Rejects all public SSH access
-
Accepts SSH only from your Tailscale-connected devices
-
Doesn’t care if your IP changes via your main VPN
-
Enable MagicDNS in the Tailscale admin panel for easier hostname-based access.
-
You can add ACLs and device tags if you want to control access to certain machines.