Home / Guides / Ollama Behind CGNAT
Ollama Remote Access

How to reach your Ollama API remotely behind CGNAT or on a GPU host

Ollama serves a local model API on port 11434, but calling it from another machine fails when you are behind CGNAT or on a GPU/vast.ai host that blocks inbound ports. NeedPorts gives the Ollama endpoint a stable public address for your apps to call.

View NeedPorts Plans See one-command service publishing

Why Ollama remote access breaks behind CGNAT

Ollama binds to a local port that is only reachable on the same machine or LAN by default. On a home connection behind CGNAT, or a rented GPU host that does not hand out public inbound ports, there is no public path to that port, so remote API calls cannot connect.

What people usually want

Call the Ollama API from an app, another server, or a laptop, using a stable URL that points at the GPU box actually running the model.

What usually goes wrong

Requests to the host time out or refuse, because the GPU host or ISP does not expose an inbound port to the machine running Ollama.

Publish Ollama with one command

NeedPorts gives you dedicated public ports over an outbound tunnel, so nothing depends on your ISP or router. After install, map one of your assigned ports to Ollama (local port 11434) and restart:

sudo needports use ollama <assigned-port>
sudo needports restart

Your Ollama instance is then reachable at your dedicated public endpoint, for example your-server:30000, with no port forwarding on the local network.

When NeedPorts helps

Keep it secure

Ollama does not authenticate callers by default, so an open endpoint lets anyone use your compute. Put an auth proxy or API key in front of it, restrict access where possible, and never publish it without some access control.

Simple validation after install

After mapping the Ollama port, send a request to the public endpoint from another machine (for example a small completion call) and confirm you get a model response. That proves the API is reachable through the tunnel.

Plans start small

NeedPorts plans start at $5/month or $30/year for 25 dedicated ports, which is plenty for Ollama and other self-hosted services on the same box.

Related reading