Local LLM Deployment

Remote SSH Patterns for Local LLM Deployments

Your model does not have to live on the same machine as your editor. With a few SSH patterns you can run Ollama or llama.cpp on one box and call it safely from another, without exposing it to the internet.

FreeLast tested: 2026-09-06Audience: Developers

When to remote-tunnel a local LLM

The most common reason is hardware separation. You may keep large models on a Linux box with a GPU, but write prompts on a MacBook or Windows laptop. The alternative is copying models between machines, which wastes time and disk space.

A remote local model is also useful when the host should stay offline. If the inference machine has no browser or limited UI, SSH gives you a control path without opening extra ports.

This pattern does not replace cloud APIs for every workload. It is best for development, testing, sensitive drafts, and batch jobs where latency is acceptable.

Basic tunnel to Ollama

Ollama listens on localhost:11434 by default. If the service is running on a remote host reachable by SSH, the simplest access pattern is port forwarding:

ssh -N -L 11434:localhost:11434 user@remote-host

After that, localhost:11434 on your laptop actually reaches the remote Ollama instance. Existing OpenAI-compatible clients keep working because the endpoint address stays the same.

This is the lowest-friction option. It requires no firewall changes and no config on the remote host beyond SSH access. For temporary work sessions, it is usually enough.

Ollama directly on the remote host

If you want the remote box to serve multiple clients, run Ollama there and bind its HTTP server to the private interface instead of only localhost. On Linux or macOS hosts with a Tailscale or LAN IP:

OLLAMA_HOST=0.0.0.0:11434 ollama serve

Then call the remote IP directly from your laptop. Do not expose this address to the public internet. The safer version keeps Ollama on localhost and uses SSH tunneling or VPN access only.

For teams sharing one inference host, pair this with API keys or a small reverse proxy that adds authentication in front of Ollama. That keeps usage auditable without making the model public.

llama.cpp server over SSH

llama.cpp ships a standalone server binary that speaks the OpenAI protocol. If you already use local OpenAI-compatible endpoints, the remote access pattern is identical: run the server on the remote host, then forward or route to it.

A practical pattern is to start the server on demand and bind it to a Unix socket or localhost only. Clients on other machines connect through an existing SSH tunnel. This avoids leaving server processes running when they are not needed.

For automation, wrap start and stop commands in simple scripts. Do not rely on manual terminal sessions if the same remote model is used by CI or scheduled jobs.

VPN and Tailscale alternatives

SSH tunnels are excellent for single-device access, but they are awkward when many clients need the same model. In that case, put the inference host behind a mesh VPN such as Tailscale or a site-to-site WireGuard link.

The benefit is address stability. Once the host has a stable tailnet IP, every client can call it like a local service. No port-forwarding session has to stay open. The trade-off is an extra network layer to maintain and monitor.

Choose the simpler path first. Start with SSH forwarding, and move to VPN only when the number of clients or connection patterns clearly demand it.

Security and access control

Remote access to a local model is still access to compute and data. Treat the API endpoint with the same caution you would give any internal service.

If you are working with regulated or customer-related content, read local LLM deployment with Ollama and llama.cpp privacy considerations before opening remote access.

Recommended baseline stack

For most teams in 2026, the lowest-maintenance remote-local setup is:

  1. Ollama on the inference host for model management.
  2. SSH key auth with a modern key type such as Ed25519.
  3. Port forwarding from laptops for interactive use.
  4. A tailnet or VPN link only if multiple trusted clients need constant access.

That combination avoids firewall exposure, keeps the setup auditable, and preserves the main advantage of local inference: control over where prompts and outputs live.

Limits and notes

Remote access adds latency and a new failure mode: the network. If SSH or the VPN drops, dependent tools fail even though the model is healthy. Build timeouts and fallback rules around that reality.

If you want a broader operations view for local deployments, see local LLM deployment offline-first team playbook 2026 for fallback routing and daily checks.