PTENES
Skip to content
MODULE 2.4

🔗 Private network with Tailscale

Your model runs on a machine at home — but you want to use it from the café, your phone, or work. The answer no is opening ports on the router. It's connecting all your devices into one encrypted private network with Tailscale, as if they were in the same room. This module builds that network from end to end.

6
Topics
~30
Minutes
Practical
Level
Network
Type

Detailed content

1

🌐 The problem: using your models from anywhere

The model is running beautifully — just on your home machine. You leave, and it stays locked behind your router. The wrong instinct is to open a port on the router (port-forward) and point it at the internet. That exposes your PC to the whole world: any bot scanning the internet can find the open port within minutes.

🆕 New here?

"Port" is a number that identifies a service on a machine (Ollama listens on 11434). "Port forwarding" is telling the router to forward that port to the public internet — convenient, but like opening your home’s window to the street. "VPN" is an encrypted tunnel that connects machines as if they were on the same local network.

✗ Open a port on the router

  • ✗Your PC is exposed to the entire internet
  • ✗Bots scan and try to break into the open port
  • ✗Depends on a static IP / dynamic DNS and fragile configuration
  • ✗No end-to-end encryption by default

✓ Private network (Tailscale)

  • ✓No ports exposed to the public internet
  • ✓Only your logged-in devices can see the model
  • ✓Works behind any router, with no fixed IP
  • ✓End-to-end encrypted traffic
Model
stuck at home
Port forwarding
= risk
Meta
access from outside
Path
private network
2

🕸️ What is Tailscale

Tailscale is a Mesh VPN: instead of everyone going through a central server, each device talks directly with the others, through an encrypted tunnel. You install it, sign in with the same account on each device, and that’s it — they form a private network called tailnet, as if they were connected to the same switch.

🆕 New here?

  • Mesh VPN: a network where each pair of devices communicates peer-to-peer, without a server in the middle throttling the traffic.
  • WireGuard: the modern, lightweight encrypted tunneling protocol Tailscale uses under the hood — fast and audited.
  • tailnet: the name of your private network—the group of all your devices signed in to the same account.

🔑 The central idea

Each device on the tailnet gets a fixed, stable address in the range 100.x.y.z. This IP works from anywhere in the world—at home, on 4G, on café Wi-Fi—always pointing to the same device, with encrypted traffic.

  • •Point-to-point: the data goes directly between your devices (WireGuard), with no detour.
  • •Zero network configuration: gets through NAT and firewall on its own; no need to open a port on the router.
  • •Identity, not a password: you sign in with your account (Google, GitHub...), and only your devices can access it.
Laptop100.x.x.11 Cell phone100.x.x.12 Server100.x.x.13 PC + GPU100.x.x.14 model · Ollamaport 11434 tailnet private network

The four devices (in blue) are connected to the same tailnet — dashed lines show that the conversation is direct, peer-to-peer. The model (in cyan) runs on the PC with a GPU and, since it's on the network, any logged-in device can reach it via the IP 100.x.

3

⚙️ Install and log in

Add a device to the tailnet three steps: install the client, bring Tailscale up, and authenticate. Do this on every machine you want on the network (PC, server, laptop)—on your phone, use the store app.

1

Install the client

One script handles Linux and macOS. On Windows, download the installer at tailscale.com/download.

2

Bring it up and authenticate

tailscale up opens a link in the browser; you log in with your account (Google/GitHub/Microsoft), and the device joins the tailnet.

3

Note down the tailnet IP

Each machine gets a 100.x.y.z. This is the address you'll use to reach it from anywhere.

⌨️ Practical example: install and start Tailscale

Objective: connect this machine (Linux/macOS) to your private network. Paste into the terminal, one line at a time.

# 1) install the client (Linux and macOS)
curl -fsSL https://tailscale.com/install.sh | sh
# 2) sign in and authenticate (opens the login in your browser)
sudo tailscale up
# 3) find this machine's IP on the tailnet
tailscale ip -4

How to check: o tailscale ip -4 should print an address starting with 100. (e.g., 100.115.92.14). Run tailscale status to list all your online devices — if they appear, the tailnet is up.

💡 Practical tip

On a machine that stays on all the time (your server/model PC), use sudo tailscale up --ssh so you can also access it over SSH from anywhere on the tailnet — without opening any ports. And turn on the non-expiring key in the admin panel so you don’t have to reauthenticate this host every time.

4

📡 Accessing the model over the network

By default, Ollama only listens on localhost — in other words, only the machine itself can see it. For other devices on the tailnet to call the model, you tell Ollama to listen on all interfaces with OLLAMA_HOST=0.0.0.0. Then any signed-in device can talk to it using the IP 100.x of the host.

🎯 The workflow, across two machines

  • •On the model host (PC + GPU): starts Ollama listening on the network and discovers the IP 100.x of it.
  • •On the other device (laptop): calls the Ollama API at this IP 100.x:11434 — as if the model were running locally.

⌨️ Practical example: expose Ollama on the tailnet and call it from another device

Objective: run the model on one machine and use it from another over the private network.

# --- ON THE MODEL HOST (PC + GPU) ---
# make Ollama listen on the network, not just on localhost
export OLLAMA_HOST=0.0.0.0:11434
ollama serve
# what is this host's IP on the tailnet?
tailscale ip -4  # e.g.: 100.115.92.14
# --- ON THE OTHER DEVICE (laptop, already on the tailnet) ---
# call the model using the host's 100.x IP
curl http://100.115.92.14:11434/api/generate \
  -d '{"model":"llama3.2","prompt":"say hi","stream":false}'

How to check: o curl from the laptop should return a JSON object with the field response filled in. If it hangs, check: (a) the host responded to the tailscale status? (b) does the host firewall allow port 11434 in the tailnet interface? A quick test: curl http://100.115.92.14:11434/api/tags should list the installed models.

🔌 The trick

With this, any tool that talks to the Ollama API (Open WebUI, Python scripts, your Trilha 4 agents) starts pointing to the IP 100.x instead of localhost — and works wherever you are. The model becomes a service on your private network.

localhost
just the machine
0.0.0.0
listens to the network
IP 100.x
host address
:11434
Ollama port
5

📱 From phone to laptop

Here’s where the trick becomes concrete: install the app Tailscale on your phone (App Store / Play Store), sign in with the same account, and your phone joins the tailnet. Now, from 4G out on the street, you open a chat interface pointed at the IP 100.x at home and chat with your model — running on your GPU, with no cloud and no open port.

1

App on your phone

Install Tailscale, enable the VPN, and log in to the same account. The phone gets its own IP 100.x.

2

Point it to your home host

In your phone’s browser (or an LLM chat app), use http://100.x.y.z:11434 — your GPU PC’s IP address — or the Open WebUI interface from Track 3 hosted on it.

3

Use it from anywhere

Works on café Wi-Fi, 4G, or a friend's house. The tailnet follows you; the model stays at home.

💡 Practical tip

Enable the MagicDNS in the Tailscale dashboard: instead of memorizing 100.115.92.14, you access the host through a friendly name, such as http://pc-gpu:11434. Easier to remember, and it doesn't change if the IP changes.

App
same account
4G/Wi-Fi
whatever
Model
stays home
You
anywhere
6

🛡️ Security and ACLs

The tailnet is already private — but you can lock it down further. The principle is least privilege: each device only reaches what it needs. On a network with just a few of your own devices, this matters little; when you add a colleague’s machine or a shared server, the ACLs become essential.

🆕 New here?

  • MagicDNS: a feature that gives your devices names (instead of IPs) within your tailnet — pc-gpu instead of 100.x.y.z.
  • ACL (Access Control List): rules that say who can talk to whom on the tailnet — e.g., "the phone can reach port 11434 on PC-GPU, and only that port".

⚠️ Security alert

  • •Don’t expose Ollama to the public internet. OLLAMA_HOST=0.0.0.0 is safe because only the tailnet can reach the machine — never combine this with port forwarding on the router.
  • •Always use least privilege. If you share the tailnet with someone else, use an ACL to allow only the model’s port, not the entire device.
  • •The model doesn’t have a login. The Ollama API doesn't require a password—your only barrier is the network. Keep your tailnet closed to everyone but your own devices.

✓ Good network hygiene

  • ✓Access only through the tailnet, no port forwarding on the router
  • ✓ACL allowing only the model’s port
  • ✓MagicDNS for stable, readable names
  • ✓Review devices in the dashboard; remove anything you don’t use

✗ A recipe for trouble

  • ✗Port forwarding port 11434 to the public internet
  • ✗Open tailnet with full access between everyone
  • ✗Invite people without restricting access by ACL
  • ✗Thinking that "0.0.0.0" is enough without understanding what is listening

⌨️ Practical example: a least-privilege ACL

Objective: to let only your devices reach the port 11434 of the model host. Edit it in the Tailscale admin panel (Access controls).

{
  "acls": [
    {
      "action": "accept",
      "src": ["autogroup:member"],
      "dst": ["tag:modelo:11434"]
    }
  ]
}

How to check: tag the model host with model in the dashboard; then, from an authorized device, the curl 100.x:11434/api/tags responds — and from a device outside the rule, the connection is refused. Least privilege in practice.

Self-check (optional): what's the recommended way to access your local model when you're away from home?

Privilege
the smallest possible
ACL
who talks to whom
MagicDNS
names, not IPs
Internet
never exposed

📌 Module summary

✓
Don’t open ports on your router — port forwarding exposes your PC to the world; a private network is the solution.
✓
Tailscale = mesh VPN (WireGuard) — your devices form the tailnet, each with a stable 100.x IP.
✓
Exposing the model is one line — OLLAMA_HOST=0.0.0.0 and connect using the 100.x IP from another device.
✓
Security = least privilege — ACLs and MagicDNS; never exposed to the public internet.

Next:

Track 3 — Installation & Techniques. You’ve completed Track 2: hardware chosen, foundation ready, and private network up and running. Now it’s time to install your first model and master the techniques.