OLLAMA_HOST is the environment variable that controls which network address Ollama’s server listens on. By default Ollama binds only to localhost (127.0.0.1:11434), meaning only processes on the same machine can connect. Changing OLLAMA_HOST lets you make Ollama accessible to other devices on your local network, a Docker container, or any other host — which is essential for sharing a single Ollama instance across multiple devices or integrating Ollama with other services.
Why OLLAMA_HOST Matters
The default localhost binding is a deliberate security choice — it prevents remote machines from querying your models without any authentication. But it also prevents legitimate use cases: accessing Ollama from a phone or laptop on the same network, connecting a Docker container to Ollama running on the host, or building a shared local AI server for a small team. OLLAMA_HOST is the correct way to change this behaviour, not a firewall workaround.
Setting OLLAMA_HOST on Each Platform
The value format is HOST:PORT. To listen on all network interfaces, use 0.0.0.0:11434. To listen on a specific IP, use that IP address. To change the port, change 11434 to your preferred port number.
macOS: If you use the Ollama menu bar app, set OLLAMA_HOST in your shell profile (.zshrc or .bash_profile), quit the Ollama app completely from the menu bar, then relaunch it from the terminal with ollama serve or reopen the app. Environment variables set in .zshrc are picked up by apps launched from the same shell session.
Linux (systemd): Edit the Ollama service with sudo systemctl edit ollama.service. This opens an override file where you add an Environment line under a [Service] section. Save, then run sudo systemctl daemon-reload and sudo systemctl restart ollama. Verify with curl http://YOUR_IP:11434 from another machine.
Windows: Open System Properties (Win+Pause), click Advanced, then Environment Variables. Add OLLAMA_HOST as a System variable with value 0.0.0.0:11434. Restart Ollama from the system tray after setting the variable.
Figure 1 — OLLAMA_HOST: common values and their effect
OLLAMA_HOST in Docker
When Ollama runs inside a Docker container, set OLLAMA_HOST via the -e flag or in docker-compose.yml. When Ollama runs on the Docker host and a container needs to reach it, the container should connect to host.docker.internal:11434 (on Mac and Windows) or the host’s bridge IP (on Linux, typically 172.17.0.1). Setting OLLAMA_HOST to 0.0.0.0:11434 on the host combined with the appropriate host network address in the container is the standard pattern for Open WebUI and other Docker-based frontends connecting to a host-installed Ollama.
Security Considerations
Setting OLLAMA_HOST to 0.0.0.0 exposes your Ollama API to all devices that can reach your machine on port 11434. On a home network this is usually fine. On a work network or any machine accessible from the internet, add network-level controls: a firewall rule that restricts port 11434 to known IP ranges, or a reverse proxy (Nginx or Caddy) that adds authentication before forwarding requests to Ollama. The Ollama API has no built-in authentication — anyone who can reach the port can query your models and pull new ones.
Verifying the Configuration
After setting OLLAMA_HOST and restarting Ollama, verify from another device with curl http://MACHINE_IP:11434 — a response of “Ollama is running” confirms external access is working. From the Ollama machine itself, ollama ps and a test prompt verify the server is running correctly. If the connection times out from another device, check the firewall on the Ollama machine first — most OS firewalls block inbound connections on non-standard ports by default even when the application is listening.
Using OLLAMA_HOST with the Ollama Python and JS Libraries
When connecting to an Ollama instance on another machine using the Python or JavaScript client libraries, pass the host address as the host parameter when initialising the client. The client will use this address instead of the default localhost:11434. This lets you run inference on a powerful desktop machine and query it from a laptop, Raspberry Pi, or any other device on your network using the same Python code you would use locally.
Frequently Asked Questions
- Can I change OLLAMA_HOST without restarting Ollama?
- No. The binding address is set at server startup. Change the environment variable and restart the Ollama service or process for the new value to take effect.
- How do I find my machine’s local IP for OLLAMA_HOST?
- On Mac: System Settings → Network. On Linux:
ip addrorhostname -I. On Windows:ipconfigin Command Prompt. Use the IP from your local network adapter (usually 192.168.x.x or 10.x.x.x). - Will setting OLLAMA_HOST to 0.0.0.0 expose Ollama to the internet?
- Only if port 11434 is open in your firewall and you have a public IP. On a typical home router with NAT, internal 0.0.0.0 binding is only accessible from your local network, not from the internet, unless you explicitly port-forward 11434.
Last updated: October 2026
OLLAMA_HOST for Remote Development Workflows
A popular workflow for developers with a powerful desktop and a lightweight laptop is running Ollama on the desktop and accessing it from the laptop over the local network. Set OLLAMA_HOST to 0.0.0.0:11434 on the desktop, configure your firewall to allow port 11434 from your laptop’s IP, and point your laptop’s Ollama client libraries, Continue.dev, or any other tool at the desktop’s local IP address. This gives your laptop access to larger models than it could run locally — a laptop with 8GB RAM can use a 70B model running on a 64GB desktop, with inference happening on the more powerful machine. The network latency on a local Wi-Fi or Ethernet connection is negligible compared to inference time, making this a practically transparent experience.
Combining OLLAMA_HOST with OLLAMA_ORIGINS
When you expose Ollama to your network, browser-based applications like Open WebUI need CORS (Cross-Origin Resource Sharing) permission to make requests to the Ollama API. The OLLAMA_ORIGINS environment variable controls which origins are allowed. By default Ollama allows requests from localhost origins. If you access Open WebUI from another device (e.g. http://192.168.1.50:3000), that origin is different from localhost and may be blocked. Set OLLAMA_ORIGINS to a comma-separated list of allowed origins, or to “*” to allow all origins on your trusted local network. Set both OLLAMA_HOST and OLLAMA_ORIGINS together when configuring a network-accessible Ollama server that serves browser-based clients.
Troubleshooting OLLAMA_HOST Connection Issues
If other devices cannot reach your Ollama instance after setting OLLAMA_HOST to 0.0.0.0:11434, work through these steps in order. Verify Ollama is listening on the right address: run curl http://localhost:11434 on the Ollama machine to confirm it is running, then try curl http://0.0.0.0:11434 or curl http://YOUR_LOCAL_IP:11434 from the same machine. If localhost works but the local IP does not, Ollama did not pick up the OLLAMA_HOST change — confirm the environment variable is set correctly and restart the service. Check the firewall: on macOS, check System Settings → Network → Firewall. On Linux, check iptables or ufw rules for port 11434. On Windows, check Windows Defender Firewall inbound rules. Add an allow rule for port 11434 if one does not exist. Verify the correct IP: use your machine’s local network IP (usually 192.168.x.x), not the loopback address 127.0.0.1 or the public IP. Finally, confirm both devices are on the same network segment — some routers with client isolation enabled prevent device-to-device communication even on the same Wi-Fi network.
OLLAMA_HOST is a small but foundational configuration setting that unlocks Ollama’s usefulness across a home or office network. The default localhost binding is appropriate for single-user development; changing it to 0.0.0.0 or a specific local IP immediately expands what you can do with a single powerful Ollama installation. Pair it with OLLAMA_KEEP_ALIVE set to “-1” and a firewall rule allowing your network devices, and you have a persistent local AI server accessible from every device on your network with no recurring cost and no data leaving your premises.
OLLAMA_HOST and API Clients
Any client that supports the OpenAI API format can connect to a remote Ollama instance by changing the base URL from the OpenAI endpoint to your Ollama server address. This includes the OpenAI Python SDK (pass base_url and api_key=’ollama’ when initialising the client), LangChain’s ChatOllama and OllamaLLM classes (pass base_url parameter), Continue.dev (set apiBase in config.json to http://YOUR_IP:11434), and any other OpenAI-compatible client. This flexibility means a team can share one powerful Ollama server across multiple developer machines, each running their own IDE and client tooling but drawing on the same hardware for inference. The setup cost is minimal — set OLLAMA_HOST once, configure each client’s base URL once, and the shared inference server is available to all team members on the network.
Document your OLLAMA_HOST configuration alongside your model choices and keep_alive settings so that anyone joining the setup or debugging a connection issue has the complete picture of how the server is configured and which devices are expected to connect to it.
Quick Verification Checklist
After changing the setting, confirm three things: the service restarted with the new value, the machine is listening on the expected address, and another device can reach it through any firewall in between.