AIForum.

How to Access a Local AI Server Remotely with Tailscale or WireGuard

On this page

THE SHORT ANSWER

Access a local AI server remotely by placing it on a private encrypted network. Tailscale offers the fastest path with identity, NAT traversal, and Serve TLS; WireGuard gives manual control over peers and routes. Keep Ollama and Open WebUI off the public internet.
Quick facts

The practical answer is to put both the AI server and the remote client on a private encrypted network, then reach the AI service over that network instead of opening a public port. Tailscale is usually the faster path: install it on both devices, authenticate them to the same tailnet, and use Tailscale Serve to publish a local Web UI over HTTPS inside the tailnet. WireGuard gives you more control: configure peer keys and AllowedIPs, then reach the server over its VPN IP or tunnel to localhost with SSH. In both cases, do not expose Ollama or Open WebUI directly to the public internet.

This guide is for a technically curious beginner or intermediate practitioner running a local model on a home server, workstation, or virtual machine. It focuses on the remote-access layer, not on model selection or GPU tuning. The commands are illustrative; exact syntax can vary by operating system and software version, so verify against your installed versions.

What remote access means for a local AI server

A typical local AI stack has at least two services: an inference runtime such as Ollama and a browser front end such as Open WebUI. Ollama commonly exposes an HTTP API on port 11434, and Open WebUI provides a ChatGPT-like interface. The API may have no built-in user authentication, which is why direct public exposure is dangerous. A guide on securely accessing a local LLM remotely notes that automated scanners discover open ports within minutes and can abuse unsecured API endpoints [2].

Tailscale’s own blog describes a self-hosted AI stack built with Proxmox, NixOS, Docker, an NVIDIA A4000 GPU passed through to a VM, Ollama, Open WebUI, and Tailscale Serve [1]. That is one documented path, not the only one. It also illustrates why remote access matters: the GPU server can stay in a controlled location while a laptop, phone, or tablet reaches it securely. The same blog notes that GPU passthrough requires compatible hardware, including the right BIOS and CPU support [1].

Tailscale vs WireGuard: the practical difference

Tailscale is a managed mesh VPN built on WireGuard. WireGuard is the underlying VPN protocol and tool. The distinction matters because Tailscale handles identity, key distribution, NAT traversal, access control, MagicDNS, and TLS proxying through Tailscale Serve. WireGuard gives you the raw tunnel and expects you to manage peers, keys, routing, and firewall rules yourself.

Decision pointTailscaleWireGuard
Setup effortInstall, authenticate, and manage devices from an admin console.Generate keys, write configs, and manage peers manually.
NAT traversalHandled automatically; can fall back to DERP relays if direct connection fails.Usually requires a reachable UDP endpoint or port forwarding for direct access.
Access controlACLs and device identity in the tailnet.AllowedIPs, firewall rules, and peer configuration.
TLS for a Web UITailscale Serve can provide HTTPS inside the tailnet without a reverse proxy [1].VPN encrypts transport, but a browser UI may still need an SSH tunnel or TLS reverse proxy.
Best fitFast secure access from laptops, phones, and tablets with minimal network work.Existing WireGuard deployments, full control, or avoiding a coordination service.

Prerequisites and assumptions

  • A local AI server running Ollama, Open WebUI, or another service you want to reach.
  • Administrative access to the server and the remote client.
  • A Tailscale account, or WireGuard installed on both ends.
  • For WireGuard direct access: a public IP or DNS name and the ability to forward a UDP port, or an existing VPN path.
  • Knowledge of the exact host, port, and bind address for each AI service.

Option A: Tailscale in a local AI stack

Tailscale is the lower-friction option when you want secure access from a laptop, phone, or tablet without building a reverse proxy. Tailscale’s blog describes using Tailscale Serve to access Open WebUI securely from anywhere on your tailnet, with TLS and no reverse proxy configuration required [1].

  1. Install Tailscale on the AI server and on the remote client. Authenticate both devices to the same tailnet.
  2. Verify connectivity with
    tailscale status

    and ping the server’s tailnet name or IP from the client.

  3. Keep the AI services private. If Open WebUI listens on 127.0.0.1:8080, Tailscale Serve can proxy it. Check the listening address with
    ss -tlnp | grep 8080

    .

  4. Publish the Web UI over HTTPS inside the tailnet. An example command is
    tailscale serve https / http://127.0.0.1:8080

    Then check

    tailscale serve status

    . Exact syntax can vary by Tailscale version; use

    tailscale serve --help

    to confirm.

  5. From the remote client, open the machine’s tailnet HTTPS URL, such as https://your-server.your-tailnet.ts.net/. This is tailnet-only by default. Do not enable public Funnel unless you understand the exposure.
  6. For API access, use the server’s tailnet IP and Ollama’s port, commonly 11434:
    curl http://your-server:11434/api/tags

    If Ollama is bound to localhost, either bind it to the tailnet interface with firewall rules or use an SSH tunnel.

Expected result: the remote client can load Open WebUI and query models without opening a router port. If it fails, check Tailscale status, Serve status, and whether the local service is listening on the address you proxied.

Option B: WireGuard with manual peers

WireGuard is a good fit if you already run it, want to avoid a coordination service, or need full control over keys and routing. The tradeoff is manual configuration and a reachable endpoint for direct connections.

  1. Install WireGuard on the server and the client.
  2. Generate key pairs on both machines:
    wg genkey | tee privatekey | wg pubkey > publickey
  3. Create the server configuration at /etc/wireguard/wg0.conf:
    [Interface]
    Address = 10.10.0.1/24
    ListenPort = 51820
    PrivateKey = <server-private-key>
    
    [Peer]
    PublicKey = <client-public-key>
    AllowedIPs = 10.10.0.2/32
    
  4. Create the client configuration:
    [Interface]
    Address = 10.10.0.2/24
    PrivateKey = <client-private-key>
    
    [Peer]
    PublicKey = <server-public-key>
    Endpoint = <server-public-ip-or-dns>:51820
    AllowedIPs = 10.10.0.0/24
    PersistentKeepalive = 25
    
  5. Start and enable the tunnel:
    sudo wg-quick up wg0
    sudo systemctl enable --now wg-quick@wg0
  6. Verify the handshake with
    sudo wg show

    and ping 10.10.0.1 from the client.

  7. Reach the AI service. If Open WebUI is bound to localhost, do not expose it to all interfaces. Use an SSH tunnel over WireGuard:
    ssh -L 8080:127.0.0.1:8080 user@10.10.0.1

    Then browse http://127.0.0.1:8080. For the Ollama API, tunnel port 11434 similarly, or bind Ollama to the WireGuard IP and restrict access with a firewall.

Expected result: the client has a private route to the server, and the AI services remain bound to localhost. If the handshake fails, check UDP port 51820, the endpoint address, the keys, and any NAT or firewall rules.

Security choices that matter more than the VPN

Both Tailscale and WireGuard encrypt traffic, but they do not add authentication to Ollama’s API. The remote-access guide warns that exposed API endpoints can be abused by automated scanners [2]. Use Tailscale ACLs or WireGuard AllowedIPs to limit which devices can reach the AI server. Keep Open WebUI’s own authentication enabled. If you use WireGuard without Tailscale Serve, remember that the VPN encrypts transport but the browser may still use HTTP; for a browser UI, use an SSH tunnel or a TLS reverse proxy. Update both the VPN software and the AI services. Log access where possible, and avoid assuming that a private IP address is the same as authentication.

Troubleshooting checklist

  • Tailscale works but the Web UI does not. Check tailscale serve status and confirm the local port. The service may be on a different port or bound to a different address.
  • WireGuard handshake fails. Check sudo wg show. No handshake usually means the UDP port is blocked, the endpoint is wrong, or the keys do not match.
  • Ping works but the service does not. The service is probably bound to 127.0.0.1. Use an SSH tunnel or bind it to the VPN interface with firewall rules.
  • Tailscale uses a relay. If a direct connection fails, Tailscale may route through DERP relays. This still works but can add latency. Check tailscale status for the direct or relayed path.
  • DNS names fail. Use the tailnet IP or WireGuard IP to isolate DNS issues from connectivity issues.

Which should you choose?

Choose Tailscale if you want the shortest path to secure remote access, especially for phones and tablets, and you value ACLs, MagicDNS, and Serve’s TLS. Tailscale’s blog shows this pattern in a self-hosted AI stack [1]. Choose WireGuard if you already have it, need to avoid a coordination service, or want to manage every peer and route. In both cases, the safest pattern is to keep Ollama and Open WebUI off the public internet and expose only what the private network needs.

Next action: write down the exact host, port, and bind address for each AI service. Then test from a phone hotspot, not just your home Wi-Fi. If you share your setup, include the operating system, VPN tool, service port, and the exact error; that is what makes community troubleshooting useful.

FAQ

Do I need to open a router port for Tailscale?

Generally no for outbound NAT traversal. Tailscale establishes connections between devices and can relay through DERP if a direct connection fails. A guide on local LLM access specifically warns against port forwarding for this use case [2].

Can I use WireGuard without opening a port?

If the server cannot receive inbound UDP, you need a relay, another NAT traversal layer, or an existing VPN path. Otherwise, direct WireGuard access usually requires a reachable endpoint or a forwarded UDP port.

Is WireGuard enough to secure Ollama?

WireGuard encrypts transport, but Ollama's API may not authenticate users. Restrict peers with AllowedIPs and firewall rules, and do not expose Ollama directly to the public internet.

Why can I ping the server but not open Open WebUI?

The Web UI is likely bound to 127.0.0.1. Use an SSH tunnel over the VPN or bind it to the VPN interface and restrict access with a firewall.

What port does Ollama use by default?

Ollama commonly listens on port 11434. Confirm the actual port and bind address on your server before configuring remote access.

References

  1. Tailscale: Self-host a local AI stack and access it from anywhere — https://tailscale.com/blog/self-host-a-local-ai-stack
  2. Securely Accessing a Local LLM Remotely via Tailscale: Complete Guide — https://gids.llmnet.nl/en/lokale-llm-via-tailscale-op-afstand

Related terms

Tailnet
A private network of devices connected through Tailscale.
WireGuard
A lightweight open-source VPN protocol and tool that uses public-key cryptography.
NAT traversal
Techniques that help two devices behind routers establish a direct connection.
Tailscale Serve
A Tailscale feature that can proxy a local service over HTTPS inside a tailnet without a separate reverse proxy (source [1]).
Ollama
A local runtime for running large language models and exposing an HTTP API.
Open WebUI
A browser-based front end commonly used with local model runtimes such as Ollama.
DERP
Tailscale relay servers used when a direct peer-to-peer connection cannot be established.

Leave a Reply

Your email address will not be published. Required fields are marked *