A fresh tailnet is friendly to a fault: every device can talk to every other device. I like that for the first evening, and I don’t like it at all once the tailnet holds my server, my containers and a phone that gets handed around. So here is how I’d tighten it with tags and a short policy file, using grants. You need a Tailscale account with admin rights and a couple of devices to tag. The policy file lives under Access controls in the admin console.
- Time
- 10 min
- Steps
- 12
- Updated
- 19 Nov 2026
You will learn
- The idea in one picture
- Declare the tags in tagOwners
- Write the grants
- Put the tags on the devices
- Tags on Unraid containers
Step 1 of 12: The idea in one picture
Tailscale denies everything that no rule allows. So the plan is simple. Containers get a tag, say tag:container. My admin server gets tag:server. One rule lets the server reach the containers on every port, and one rule lets me reach them from my phone on a few ports only. Nothing else is allowed, so nothing else works.
The Tailscale docs call this a tag-based policy: a tag is an identity for a device that is not a person. Tagging a device removes its user-based authentication, and a device has either tags or a user account, never both. That matters for the phone, as you will see.

Step 2 of 12: Declare the tags in tagOwners
A tag has to exist in tagOwners before you can use it anywhere, and every tag name must start with tag:. The owner list says who may assign the tag. An empty list is shorthand for the admin role, which is fine on a personal tailnet.
"tagOwners": {
"tag:server": ["autogroup:admin"],
"tag:container": ["autogroup:admin"]
}
Pick tag names that say what the device is, like tag:container or tag:prod-database. Tag names are case-insensitive, and the docs say tags cannot be combined inside a rule, so a composite name is the way when you need a narrower group.
Step 3 of 12: Write the grants
A grant has a src, a dst and an ip list. The ip field is where the ports go: the docs show entries like tcp:443. Here is the whole policy. Replace the email with your own login.
{
"tagOwners": {
"tag:server": ["autogroup:admin"],
"tag:container": ["autogroup:admin"]
},
"grants": [
{
"src": ["tag:server"],
"dst": ["tag:container"],
"ip": ["*"]
},
{
"src": ["[email protected]"],
"dst": ["tag:container"],
"ip": ["tcp:443", "tcp:8096"]
}
]
}
The first grant is the server rule: only tag:server gets everything. The second is the phone rule. The port numbers are just examples, 443 for a reverse proxy or Tailscale Serve and 8096 as the usual Jellyfin port; use whatever you actually expose.
One catch I’d flag early. A user-owned phone is covered by the user in src, which means all devices of that user get those ports, laptop included. If you want a rule for the phone alone, you can tag the phone, but remember what tagging does: it stops being “my” device in the policy sense. Pick whichever annoys you less. And the old tailnet-wide allow-all rule has to go, or it will quietly cancel everything above.
Step 4 of 12: Put the tags on the devices
In the admin console, open Machines, use the menu at the right of the device and pick Edit tags. The tag must already exist in the policy file, and the docs say you have to be listed in tagOwners for it. On the command line the flag looks like this:
sudo tailscale up --advertise-tags=tag:container --force-reauth
The docs describe --force-reauth as plain re-authentication. I’d still not run it on a box that I only reach over SSH through Tailscale itself, since re-authenticating can interrupt that very connection. The admin console route is calmer for remote machines. Also note that flags are not saved between runs of tailscale up, so repeat --advertise-tags every time you run it or the tags change.
Two side effects are worth knowing. A tagged device has key expiry disabled by default, which suits servers. And tagging a device removes its user, so it no longer shows up as yours. To undo it, --advertise-tags= with an empty value clears the tags, and a device must keep at least one tag in the console, so there you re-authenticate instead.
Step 5 of 12: Tags on Unraid containers
On Unraid 7 and later, a container can get its own Tailscale device through the per-container setting called Use Tailscale, with a Tailscale hostname that must be unique on the tailnet. The Unraid docs tell you to authenticate by opening the link in the container log and approving it on your tailnet. They say nothing about tags, so I don’t claim a shortcut there. What works with the docs above is simple: let the container register, then open Machines and use Edit tags on it, as in step 3. The container then carries tag:container and the grants apply to it.
If you run many containers this way, the auth keys guide linked below covers a key that already carries the tag, which saves the clicking. Keep one thing in mind: Serve exposes the web UI to your tailnet only, and the Unraid docs state it adds no authentication of its own. The grants are what decide who gets in.
Step 6 of 12: Add tests before you save
The policy file can hold a tests section. Each test names a src and lists accept or deny destinations in host:port form. The docs say that when a test fails, Tailscale rejects the edit and the error names the failing tests. That makes it a seatbelt for exactly the mistake I worry about, locking myself out.
"tests": [
{
"src": "tag:server",
"accept": ["tag:container:443", "tag:container:22"]
},
{
"src": "[email protected]",
"accept": ["tag:container:443"],
"deny": ["tag:container:22"]
}
]
The destination syntax in tests is host:port, and CIDR ranges are not allowed there. If you omit proto, the test covers TCP or UDP. Add a test for every rule you care about and a deny test for the thing you want to stay shut.
Step 7 of 12: Already on acls instead of grants?
Older tailnets use the acls section. The docs say grants can do everything ACLs can, and that both can live in one policy file. The server rule written the old way:
"acls": [
{
"action": "accept",
"src": ["tag:server"],
"dst": ["tag:container:*"]
}
]
In ACLs the destination is host:ports, with a single port, a comma list like 80,443 or a range. The action can only be accept, because denial is the default.

Step 8 of 12: Check that it works
From the server, ping or open a container’s page: it should work. From the phone, open a port that is in the list and then one that is not; the second one should just hang. If everything still works from everywhere, an allow-all rule is still in the file. If nothing works, I’d check the tag spelling first, since a missing tag: prefix is the classic slip. The tests from step 5 catch the same slips before the edit is saved.
One more check: tailscale ping and tailscale status on a client show whether the other device is reachable at all, but a ping only tells you the device is up. A port-level check, such as opening the page, is what tells you the grant works.
This is written against the current policy file syntax in the Tailscale docs, checked in November 2026. On Unraid, the containers with the per-container Tailscale integration show up as their own devices, so they can carry tags like any other node.
Step 9 of 12: Variants and edge cases
Want every person to reach only their own devices? autogroup:self as a destination matches devices of the same user as the source. The docs say it does not apply to tags and cannot be combined with autogroup:tagged, so it is for personal machines and not for the containers here.
Want to name a group of people? Groups start with group: and list full email addresses, and a group cannot contain another group. Want a friendly name for an address range? hosts maps a name to an IP or CIDR range, without an @ in the name.
Want SSH through Tailscale? That needs a network rule allowing port 22 and a separate ssh rule, and the docs add that tagged devices can only SSH into other tagged devices. Leave this out until you actually use it.
The auth key route has one more rule: when a key is created with tags, a device that logs in with that key takes the tags of the key, and tags cannot be removed with --advertise-tags afterwards. Make a new key for different tags.
Step 10 of 12: Troubleshooting
Everything still works from everywhere. The default policy for a tailnet you never touched is allow-all, and the docs say that a tailnet without access policies gets exactly that. Delete the old allow-all rule once your own grants are in place. The docs also warn that to deny all traffic you use an empty acls section, so an empty file is a closed door.
The tag does not show up in the list. It is missing from tagOwners, or it is spelled without tag:. Tag names are lowercased, so capitals will not be the problem.
I can’t apply the tag. You need to be a tag owner, or an Owner, Admin or Network admin. An empty owner list means the admin roles only.
My phone lost access after tagging it. Tagging removes the user identity, so a grant written for my login no longer matches that device. Write the grant for the tag, or leave the phone untagged.
The edit is rejected. A failing test does that. Read the error, it names the test.
SSH to a tagged box is denied. Check that both the network rule for port 22 and an ssh rule exist, and that the source is tagged too.
Step 11 of 12: My advice
Start with two tags and two grants, exactly like the policy above, and resist adding more until something real needs it. Add the tests in the same edit as the grants; they cost five lines. Do the lockdown from a laptop that has full access, not from the phone you are about to restrict. And keep the grants in one place: I’d rather have one readable file than three clever ones.
The old allow-all rule is the part everyone forgets. Remove it last, after the tests pass, and then open one denied port to see it hang.
Step 12 of 12: Where to go next
Tagged devices have key expiry off, but auth keys have their own expiry, which I cover in my guide on key expiry and auth keys. If your containers are also behind a proxy, the Nextcloud and Nginx Proxy Manager guide shows the other half of the picture.
Further reading
- Tailscale docs: tailnet policy file syntax, tagOwners, grants and acls
- Tailscale docs: Grants
- Tailscale docs: Tags
- Tailscale docs: Policy file and tests
- Tailscale docs: Migrate from ACLs to grants
- Tailscale docs: Grant examples
- 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: Send your tailnet's DNS through your own AdGuard Home with Tailscale split DNS
