Skip to content
,

How to Access Ollama From Another Computer (LAN and Remote, Safely)

7–10 minutes
Woman in a server room holding a tablet with the Ollama logo, hook use Ollama from any PC

Your gaming PC has the big GPU, but you want to use its models from a laptop, a phone, an Open WebUI box or a coding tool on another machine. Out of the box that does not work, because Ollama only listens to the computer it runs on.

This guide shows how to open Ollama to your home network on Windows, macOS, Linux and Docker, how to allow it through the firewall, how to connect from other apps, and how to reach it safely from outside your home without leaving an open AI server on the internet.

TL;DR

  • Default: Ollama binds to 127.0.0.1:11434, so only the same PC can reach it.
  • Open it to the LAN: set OLLAMA_HOST=0.0.0.0:11434 and restart Ollama. The Windows/macOS app also has an Expose Ollama to the network switch in Settings.
  • Firewall: allow TCP port 11434 on private networks only.
  • Connect: point clients at http://<pc-ip>:11434.
  • Outside your home: use a VPN such as Tailscale or a tunnel with auth. Ollama has no built-in password, so never port-forward 11434.

New to Ollama? My Ollama guide covers install, models, commands and fixes in one place.

Why Ollama Is Local-Only by Default

Ollama runs an HTTP server on port 11434. By default it binds to 127.0.0.1 (localhost), which means only programs on the same computer can connect. That is a safe default: the API has no login, so anyone who can reach it can run your models, pull new ones or delete them.

To use it from other devices, you change the bind address to 0.0.0.0 (all network interfaces), or to one specific LAN IP. You do that with the OLLAMA_HOST environment variable.

Easiest Way: the App’s Expose Switch

Recent versions of the Ollama desktop app on Windows and macOS have a toggle for this:

  1. Open the Ollama app and go to Settings.
  2. Turn on Expose Ollama to the network (“Allow other devices or services to access Ollama”).
  3. Restart Ollama if it asks, then continue with the firewall step.

Don’t see the switch? Update first (see how to update Ollama), or use the environment variable method below. It works on every version.

Windows: OLLAMA_HOST

  1. Quit Ollama from the system tray (right-click the icon, then Quit).
  2. Open Start, search for environment variables and choose Edit environment variables for your account.
  3. Click New. Set the name to OLLAMA_HOST and the value to 0.0.0.0:11434.
  4. Click OK, then start Ollama again from the Start menu.

Or do it in one PowerShell line, then restart Ollama:

setx OLLAMA_HOST "0.0.0.0:11434"

Ollama only reads the variable at start-up, so a full quit and restart is needed. More variables are explained in my Ollama environment variables guide.

macOS

For the Mac app, Ollama’s docs use launchctl:

launchctl setenv OLLAMA_HOST "0.0.0.0:11434"

Then quit and reopen the Ollama app. launchctl setenv does not survive a reboot, so either run it again after restarting or use the Settings switch above. macOS may also show an “accept incoming network connections” prompt for Ollama; click Allow.

Linux (systemd)

If you installed with the official script, Ollama runs as a systemd service:

sudo systemctl edit ollama.service

Add these lines in the editor that opens:

[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"

Save, then reload and restart:

sudo systemctl daemon-reload
sudo systemctl restart ollama

Check that it now listens on all interfaces:

ss -tlnp | grep 11434
# should show 0.0.0.0:11434 or *:11434, not 127.0.0.1:11434

Docker

The official image already listens on all interfaces inside the container. You only need to publish the port:

docker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama

To keep it private to the host, publish only to localhost with -p 127.0.0.1:11434:11434. Full GPU setup: Ollama in Docker.

Allow It Through the Firewall

Windows (PowerShell as Administrator), private networks only:

New-NetFirewallRule -DisplayName "Ollama 11434" -Direction Inbound -Protocol TCP -LocalPort 11434 -Action Allow -Profile Private

Make sure your home Wi-Fi is set to Private in Windows network settings, or the rule will not apply.

Linux with ufw, limited to your home subnet (change it to match yours):

sudo ufw allow from 192.168.1.0/24 to any port 11434 proto tcp

macOS: accept the incoming-connections prompt, or allow Ollama under System Settings, Network, Firewall, Options.

Find Your IP and Test

Find the PC’s local IP address:

  • Windows: ipconfig (look for IPv4 Address, such as 192.168.1.50)
  • macOS: ipconfig getifaddr en0
  • Linux: hostname -I

From another device on the same network, open http://192.168.1.50:11434 in a browser. You should see “Ollama is running”. Then test the API:

curl http://192.168.1.50:11434/api/tags

This lists the server’s models. Give the PC a fixed IP (a DHCP reservation in your router) so the address does not change.

Connect Apps From Another Device

Client How to point it at the server
Ollama CLI on a laptop OLLAMA_HOST=http://192.168.1.50:11434 ollama run llama3.1 (PowerShell: $env:OLLAMA_HOST="http://192.168.1.50:11434")
Python library Client(host="http://192.168.1.50:11434"), or set OLLAMA_HOST
JavaScript library new Ollama({ host: 'http://192.168.1.50:11434' })
Open WebUI Admin Settings, Connections, Ollama URL, or OLLAMA_BASE_URL
OpenAI-compatible apps Base URL http://192.168.1.50:11434/v1, any API key text
VS Code extensions (Continue, Cline) Set the Ollama/API base to the server URL

Guides for each: Python, JavaScript, Open WebUI and the Ollama API.

Browser Apps and OLLAMA_ORIGINS

Exposing the port is not always enough for web pages and browser extensions. Browsers block cross-origin requests unless the server allows the page’s origin. Ollama allows 127.0.0.1 and 0.0.0.0 origins by default; add others with OLLAMA_ORIGINS:

# one web app
OLLAMA_ORIGINS=http://192.168.1.20:3000

# browser extensions (from Ollama's docs)
OLLAMA_ORIGINS=chrome-extension://*,moz-extension://*,safari-web-extension://*

Set it the same way as OLLAMA_HOST and restart Ollama. Avoid * on a machine that others can reach.

Access From Outside Your Home (Safely)

Do not forward port 11434 on your router. An open Ollama server can be found by internet scanners and used by anyone, because there is no password.

Safer options, from easiest to most work:

  1. A private VPN (recommended). Tools like Tailscale or WireGuard put your phone, laptop and PC on a private network. Connect to the PC’s VPN address, for example http://100.x.y.z:11434. Nothing is public.
  2. A tunnel with an access layer. Ollama’s docs show Cloudflare Tunnel and ngrok:
    cloudflared tunnel --url http://localhost:11434 --http-host-header="localhost:11434"
    ngrok http 11434 --host-header="localhost:11434"

    A quick tunnel URL is public, so add authentication (Cloudflare Access, or ngrok’s auth options) before you share it.

  3. A reverse proxy with HTTPS and a password. Put Nginx or Caddy in front, and keep Ollama itself on localhost. Ollama’s docs show the basic Nginx forward:
    server {
        listen 80;
        server_name example.com;
        location / {
            proxy_pass http://localhost:11434;
            proxy_set_header Host localhost:11434;
        }
    }

    Add TLS and auth_basic (or your SSO) on top before going public.

Security Checklist

  • Expose only on home or office networks you trust. Turn it off on public Wi-Fi laptops.
  • Limit the firewall rule to your subnet or VPN range.
  • Prefer binding to one interface (for example the Tailscale IP) instead of 0.0.0.0 if you only need VPN access.
  • Keep Ollama updated for security fixes.
  • If you want no cloud features at all, Ollama supports OLLAMA_NO_CLOUD=1 (local-only mode).
  • Watch the Ollama logs for requests you do not expect.

Troubleshooting

Works on the PC, but other devices time out

Check, in order: Ollama was fully restarted after setting OLLAMA_HOST; netstat -an | findstr 11434 (Windows) or ss -tln (Linux) shows 0.0.0.0:11434; the firewall rule exists and the network profile is Private; both devices are on the same network (guest Wi-Fi often blocks device-to-device traffic).

“address already in use” when starting ollama serve

The app or service is already running and holding the port. Quit it, or change only the environment variable and restart the app instead of running a second server.

Browser app shows a CORS error

Add the page’s origin to OLLAMA_ORIGINS, restart Ollama, and reload the page.

Open WebUI in Docker cannot reach Ollama on the same PC

Inside a container, localhost means the container itself. Use http://host.docker.internal:11434, which works on Docker Desktop and on Linux when the container is started with --add-host=host.docker.internal:host-gateway, or use the PC’s LAN IP.

Slow over the network

The network is rarely the bottleneck for text. Check that the model runs on the GPU (ollama ps). On WSL2 with Windows 10, Ollama’s FAQ suggests disabling “Large Send Offload” on the vEthernet (WSL) adapter.

FAQ

Is it safe to set OLLAMA_HOST to 0.0.0.0?

On a trusted home network behind a router, with the firewall limited to your subnet, it is a common setup. It is not safe on public networks or with port forwarding, because Ollama has no authentication.

Can I add a password to Ollama?

Not in Ollama itself. Put a reverse proxy with authentication in front, or use a VPN so only your devices can connect.

Can several people use one Ollama server?

Yes. Ollama handles parallel requests and queues the rest, within your VRAM limits. Bigger models leave less room for parallel users.

How do I undo it?

Turn off the Expose switch, or delete the OLLAMA_HOST variable (or set it back to 127.0.0.1:11434), then restart Ollama and remove the firewall rule.

Does this work with LM Studio too?

LM Studio has its own “serve on local network” option. See my LM Studio API guide and LM Studio vs Ollama.

Sources

Free weekly email

Get new AI guides every week

One short weekly email with our newest local AI, ComfyUI and AI tool guides. No spam, no pop-ups, just the good stuff.

Free. Unsubscribe anytime in one click. We only use your email to send this newsletter. See our privacy policy.

Woman in a server room holding a tablet with the Ollama logo, hook use Ollama from any PC