Ollama Has No Login Page—Don’t Expose Port 11434 to the Public Internet
The Ollama API has no authentication by default. Use NetBird to keep Ollama inside a private network, restrict device access to port 11434, and remove router port forwarding. Also clarify the limits of per-device permissions.
Many Ollama servers are exposed on the public internet. On X, Victoria Slocum pointed out something often overlooked: Ollama’s API has no built-in authentication. If you only use it locally, that’s not a big problem. If you want to connect remotely to a GPU machine from a laptop or phone, many tutorials tell you to set OLLAMA_HOST=0.0.0.0, set up port forwarding on your router, and then access it from the public internet. That combination is effectively putting an API with no login page on the internet.
A more robust approach is to use a mesh VPN to put the remote GPU and your devices on the same private network. NetBird is an open-source solution based on WireGuard and also offers a hosted service. The steps are not complicated:
- Install the NetBird client on the machine running Ollama and join it to the network. This machine can be a DGX Spark, a cloud GPU, or a server in the office.
- Add the devices that need to access Ollama to the same network, such as laptops and phones.
- Bind Ollama to the private IP assigned by NetBird, not
0.0.0.0. This way it only responds over the tunnel and is not exposed to the local LAN or the public internet. - Create an access policy that allows only your device group to access the Ollama group on TCP 11434. If the default any-to-any policy is still present, turn it off.
- Change the Ollama address in OpenWebUI, editor plugins, and scripts to
http://<NetBird IP 或 DNS 名称>:11434. - Delete the port forwarding rules on your router. Do not leave a public entry point.
For the full configuration for multiple GPUs and OpenWebUI, NetBird has a guide by Brandon Hopkins: Connect Multiple Ollama GPUs to OpenWebUI with NetBird. It also covers the idea of using private IPs to connect to VS Code Remote, Jupyter, and TensorBoard.
Someone in the replies asked whether NetBird policies can restrict permissions per device—for example, allowing a phone to only chat and only a laptop to pull models. At the network layer, you can control which devices can connect to 11434 by device group. You can create a phone group, a laptop group, and an ollama-server group, and write allow rules for each. But NetBird sees TCP ports, not HTTP paths. Ollama’s chat and model pulling both go through the same API port; mesh VPN policies cannot distinguish between /api/chat and /api/pull.
To make a phone able to only chat and not pull models, you need to put a reverse proxy in front of Ollama for authentication and path control. A simpler approach is to let the phone access only OpenWebUI, and let the machine running OpenWebUI connect to Ollama. If the phone never touches the Ollama API directly, permissions are much easier to lock down.
Ollama is useful, but it was not designed to run naked on the public internet. Before you click that port-forwarding button, think about who is scanning 11434.
Original discussion: Victoria Slocum’s post.
发布时间: 2026-11-25 04:33