A VPS with a few websites has two jobs: serve the sites to the world, and be managed by you. Only the first job needs the internet. This guide puts the VPS on your tailnet next to your home network, moves all admin access onto Tailscale, and leaves only ports 80 and 443 open.
- Time
- 8 min
- Steps
- 6
- Updated
- 24 Nov 2026
You will learn
- Install Tailscale on the VPS and tag…
- Put a home machine on the tailnet
- Move SSH onto the tailnet
- Close the public door
- Watch out for Docker
What you get, and what you need
At the end the websites are still public, but SSH, admin panels and databases answer only on the tailnet. The VPS can also reach one service at home, for example a media server or an API, without opening anything on your home router. I describe it for Ubuntu or Debian on the VPS; the Tailscale steps are the same on other Linux.
You need a Tailscale account with admin rights, root on the VPS, a way to get in when you lock yourself out (the console of your VPS provider), and a second SSH session open while you change the firewall. Websites that should stay public keep their normal DNS records.
Step 1 of 6: Install Tailscale on the VPS and tag it
Install with the official script, as in Tailscale’s Linux install guide.
curl -fsSL https://tailscale.com/install.sh | sh
Before you connect, open the policy file in the admin console and define two tags: one for the VPS, one for the home machine. A tag must exist in tagOwners before you can apply it, according to the tags page. Here is a small policy that does everything in this guide:
{
"tagOwners": {
"tag:vps": ["autogroup:admin"],
"tag:home": ["autogroup:admin"]
},
"acls": [
{"action": "accept", "src": ["autogroup:member"], "dst": ["tag:vps:*"]},
{"action": "accept", "src": ["tag:vps"], "dst": ["tag:home:8096"]}
],
"ssh": [
{"action": "check", "src": ["autogroup:member"], "dst": ["tag:vps"], "users": ["autogroup:nonroot"]}
]
}
The first rule lets your own devices reach everything on the VPS. The second lets the VPS reach port 8096 (Jellyfin’s default) on the home machine and nothing else. Tailscale denies by default, so every path that is not listed stays closed. Change 8096 to the service you want to reach. The ssh block is for Tailscale SSH in step 3, and its check action asks you to re-authenticate now and then.
Now connect the VPS with its tag.
sudo tailscale up --advertise-tags=tag:vps
Open the login URL it prints. A tagged device loses its user identity and, per Tailscale, key expiry is switched off when a tag is first applied, so the server does not drop off the tailnet after 180 days. Tags are meant for servers, so leave your laptop untagged.

This is the first thing to check. Tailscale refuses a tag that is not in tagOwners when you connect, so a tag shown here means the policy accepted it. The search box on this page also takes a tailnet address, which is a quick way to find one machine among many.

Step 2 of 6: Put a home machine on the tailnet
The simplest route is Tailscale on the machine that runs the service you want, tagged tag:home. Run the same install, then sudo tailscale up --advertise-tags=tag:home. Tailscale itself recommends installing on each device where you can, rather than using a subnet router.
If you cannot install it on the device (a NAS, a printer), make another machine at home a subnet router instead. Enable forwarding, advertise the route, and approve it on the Machines page.
echo 'net.ipv4.ip_forward = 1' | sudo tee -a /etc/sysctl.d/99-tailscale.conf
sudo sysctl -p /etc/sysctl.d/99-tailscale.conf
sudo tailscale set --advertise-routes=192.168.1.0/24
Replace the range with your own LAN. The subnet router docs add two things I would not skip: a Linux client needs sudo tailscale set --accept-routes before it uses the route, and you still need a rule that allows traffic to that range. Approving a route does not grant access by itself.

On the Machines page, a router with approved routes shows the Subnets badge, and the same row shows whether key expiry is on. My own Unraid server is a subnet router, and I keep its expiry off so it stays on the tailnet without anyone renewing a key. Open the row menu and choose Edit route settings to approve or remove a route.
Step 3 of 6: Move SSH onto the tailnet
Find the VPS’s tailnet address and log in over it from your own computer.
tailscale ip -4
ssh [email protected]
If that works, you can stop using the public address. You have two choices. Keep OpenSSH and only reach it over Tailscale, or let Tailscale run the SSH login with sudo tailscale set --ssh. The second one uses your tailnet identity and the ssh rule from step 1, and it does not touch sshd_config or authorized_keys, so normal SSH still works next to it. Be careful: turning it on hangs existing SSH sessions to the Tailscale address, so do not do it from the only session you have.
Step 4 of 6: Close the public door
Now the firewall. These commands follow Tailscale’s guide to securing an Ubuntu server. Keep your second session open and do this part in order.
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow in on tailscale0
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw delete allow 22/tcp
sudo ufw enable
sudo ufw status verbose
The rule for tailscale0 lets everything in from your tailnet; the access rules in your policy file decide who is on it. The delete line removes the public SSH rule, and the name must match how you added it, so check sudo ufw status numbered first. Now test from a different network, such as your phone on mobile data: SSH to the public address must time out, SSH to the Tailscale address must work, and the websites must still load.
Step 5 of 6: Watch out for Docker
If the sites run in Docker, ufw may not protect you the way you expect. Docker’s documentation says published container ports are diverted before ufw’s own rules, so ufw does not block them. I could not verify the exact syntax to bind a published port to one address from the docs I read, so test it with a port scan from outside before you trust it. The safer pattern in the meantime: keep admin tools off published ports, let the container listen on 127.0.0.1 only, and put them on the tailnet with tailscale serve, which expects a local target such as http://127.0.0.1:3000.
sudo tailscale serve --bg --https=443 http://127.0.0.1:3000
tailscale serve status
That makes the panel reachable at your VPS’s tailnet name with an automatic certificate, and for no one else. Your public websites stay behind their normal web server on 80 and 443.
Step 6 of 6: How to check it, and how it breaks
From your laptop, tailscale status should list the VPS and the home machine. From the VPS, test the one allowed path with a request to the home machine’s tailnet address on the port you opened; any other port should time out. If the VPS cannot reach home, the usual causes are a missing rule (remember the policy denies by default), a service listening only on the home machine’s LAN address, or a route you advertised but never approved.

Most of the fixes in this section are in that row menu. Edit route settings is where an advertised route waits for your approval, Edit ACL tags is where a wrong tag gets corrected, and the key expiry entry is where you turn expiry on or off for a single machine.
The classic lockout is key expiry. Tagged servers skip it by default, but an untagged server expires after 180 days unless you disable it on the Machines page, and Tailscale advises against renewing a key over SSH. Know where your provider’s console is before you delete the SSH rule.
Further reading
- Tailscale: install on Linux
- Tailscale: tags
- Tailscale: subnet routers
- Tailscale: Tailscale SSH
- Tailscale: secure a Ubuntu server
- Tailscale: Serve
- On this site: Manage your Unraid server from anywhere with Tailscale and no open ports
- On this site: Why a Tailscale device vanishes after 180 days, and how to stop it
- On this site: Lock down your tailnet with Tailscale ACLs and tags
