Ollama API Unreachable at localhost:11434? OLLAMA_HOST Bind Address, Firewall & Service Status Diagnosis Guide

Key takeaway
When a program cannot reach Ollama at localhost:11434, the server is rarely broken: it is either not running, listening only on the loopback address, blocked by a firewall, or the client is going to the wrong address. Four controlled comparisons — the same machine against two addresses, the listen table, the same address from two machines, and the explicit client URL — separate the five gates a request must pass.
Introduction
The model is installed. The terminal can run it, and `ollama run` answers normally in the same window. Then a web interface, a phone app, a script, or another computer tries to reach `http://localhost:11434` or `http://192.168.1.10:11434`, and the connection is refused, or it waits until it times out. Nothing about the model changed. The model loads, it answers, and it runs on the graphics card without any trouble. The only thing that changed is who is asking, and from where.
That combination — a healthy model, a working terminal session, and a client that cannot connect at all — has a specific shape, and it points in a specific direction. The model is not the problem, because the terminal proves the model works. What is failing is the connection layer between the client and the server: the request never reaches the server, or the server is not listening where the client is looking.
The server has a name and an address. Ollama runs as an HTTP server, started by `ollama serve` or by the desktop application in the background, and by default it binds to `127.0.0.1` on port 11434 — the loopback address, which only the same machine can reach. That is a design choice, not a fault. A request from another machine, another device, or a container has to pass five gates before it reaches the server: the server must be running, it must be listening on an address the client can reach, the port must be the one the client is using, the firewall must let the request through, and the client must be going to the right address in the first place.
This guide explains how those five gates work, how to prove which one is closed, and how to avoid the mistakes that make the diagnosis look confusing. It is a diagnostic guide for one narrow shape: a program that cannot connect to the Ollama API at all, while `ollama run` in the terminal works. If the model loads but runs on the CPU, if the model unloads after a few minutes, if the model cannot be found inside Docker, or if the answer stops halfway through, different articles apply, and the boundary section near the end says which ones.
Symptom definition: what counts as this problem
This article covers one narrow shape. All three of the following must be true; if any one is missing, the problem belongs somewhere else.
First, a program — a web interface, a phone app, another computer, or a script — tries to connect to `http://localhost:11434` or `http://<machine IP>:11434` and the connection is refused or times out. The reference check is `curl http://127.0.0.1:11434`, which should answer `Ollama is running`. If it does not answer, the shape is this article's shape.
Second, the problem is not "the model cannot load". Model loading, running on the CPU, out of memory, and unloading are separate routes: model loading and out of memory follow article #552 and article #553, running on the CPU follows article #556, and unloading after a few minutes follows article #555. This article is about the connection layer: the request never reaches the server, or the server is not listening on the address the client is using.
Third, `ollama run` in the terminal may work perfectly. The terminal runs against the same server on the same machine, so a working terminal session next to a failing client is not a contradiction — it is evidence. It proves the model and the server are healthy, and it narrows the fault to the address, the port, the firewall, or the client.
These three shapes need to be kept apart because each one is measured differently. A model that loads but runs on the CPU is the `num_gpu` layer-count route in article #556. A model that unloads after a few minutes of idling is the `keep_alive` lifecycle route in article #555. Ollama inside Docker that cannot find the graphics card is the container-runtime route in article #554. Training or inference that runs out of memory is the allocator and budget route in articles #552, #553, and #564. An answer that stops halfway through is the generation-parameter route in article #566, in the same batch. This article is about the remaining shape: the API connection layer — whether the server is running, which address it is listening on, whether the firewall lets the request through, and whether the client is going to the right place.
Five layers of mechanism
A request from a client to the Ollama server must pass five gates, and each gate has its own test. The Ollama official FAQ and two independent guides agree on the mechanism, and the details below come from the sources listed at the end of this article.
Layer one: the service-status layer — whether the Ollama server is running at all. This is a main subject of this article. The Ollama server is an HTTP server, started by `ollama serve` or by the desktop application in the background. If it is not running, nothing is listening on port 11434, and every connection to that port is refused. When `ollama serve` cannot take the port because another program already holds it, it exits at once, and the error message names the address and ends with `bind: address already in use`. The evidence for this layer is test T2. Across the whole article library, the string "11434" appears zero times in either language, and "ollama serve" appears only in article #555 (in `ollama serve --help` version-check context, not connection diagnosis).
Layer two: the bind-address layer — 127.0.0.1 against 0.0.0.0. This is a main subject of this article. By default the server binds to `127.0.0.1:11434`, the loopback address, which accepts connections only from the same machine. That is the documented default, stated in the Ollama official FAQ: "Ollama binds 127.0.0.1 port 11434 by default. Change the bind address with the `OLLAMA_HOST` environment variable." To accept connections from another machine, a phone, or a container, the bind address must be changed to `0.0.0.0:11434`, which listens on all IPv4 interfaces. `OLLAMA_HOST` controls both the address and the port together — there is no separate `OLLAMA_PORT` variable. The way to separate this layer is test T1. Across the whole article library, "OLLAMA_HOST" appears zero times in either language, and "localhost:11434" and "127.0.0.1:11434" appear zero times in either language.
Layer three: the firewall layer — whether port 11434 is blocked. This is a main subject of this article. Even when the server listens on `0.0.0.0:11434`, a firewall that blocks port 11434 still keeps another machine out. The ssdnodes guide states the point directly: "A request working locally and failing remotely does not identify the bind address on its own: firewall rules and routing failures also prevent remote access." Local success with remote failure does not, by itself, prove a bind-address problem — the firewall and routing can produce exactly the same shape. The way to separate this layer is test T3. Across the whole article library, the Chinese term for firewall appears zero times. One honest rule travels with this layer: turning the firewall off is a test, not a fix. Once the firewall layer is confirmed, the correct action is to turn the firewall back on and add a single exception rule for port 11434.
Layer four: the client-URL layer — the client going to the wrong address or port. This is a main subject of this article. The client's `OLLAMA_HOST` or base URL can point at an old port or a wrong IP address, while the server itself is perfectly healthy and listening normally. The server is fine, the listen table is fine, and the client still reports a connection failure, because it is knocking on the wrong door. The same trap appears when the server's port is moved — for example from 11434 to 11435 — but the terminal still carries the old default, so `ollama list` fails while the server is running. The way to separate this layer is test T4. This layer is the easiest to misread as "the server is dead", because the error message the client shows looks exactly the same as a dead server.
Layer five: the security-boundary layer — do not strip the API bare to make it connect. This is a boundary layer, not a test. The Ollama API has no authentication: anyone who can reach port 11434 can use the models. The convly guide states it plainly: "The local API has no authentication, so keep it on a network you trust." The codingkit guide says the same: "Ollama's API does not require a username or password. Never expose port 11434 directly to the internet… use a VPN (such as Tailscale) or put an authenticated reverse proxy in front of it." Binding to `0.0.0.0` belongs only on a trusted local network. It must never be exposed directly to the internet. This layer is not a diagnostic test; it is a boundary the article must state, because the fix for layer two can create a security problem if it is applied without it.
The mechanism leads to one key distinction: "cannot connect" is not one cause, it is one of five gates closed. Each gate has its own test, each test changes a different variable, and each test's outcome variable is different.
The same variable name on both sides
`OLLAMA_HOST` has two identities, and that is the trap that makes layer four so easy to miss. On the server side, it decides where the server listens. On the client side — the `ollama` command-line tool and other programs — it decides where the client connects. The two sides are set independently, and they can disagree silently. A shell that exports `OLLAMA_HOST=http://127.0.0.1:11435` changes only the programs started from that shell, including the `ollama` CLI itself. A Linux systemd service does not inherit a shell's environment variables at all: to change the server's bind address under systemd, the variable must be set through `systemctl edit ollama.service` with an `Environment="OLLAMA_HOST=..."` line, followed by a daemon reload and a service restart. Exporting the variable in a terminal and then wondering why the service did not change is the most common form of this mistake, and it is exactly the confusion test T4 is built to expose.
Why localhost working proves nothing about the network
The official FAQ also states that "Ollama allows cross-origin requests from `127.0.0.1` and `0.0.0.0` by default." That is about cross-origin requests, not about which machines can connect. The two facts must not be confused: cross-origin permission does not open the bind address, and a server bound to loopback still refuses every connection from another machine, however permissive the cross-origin setting is. The only evidence that counts for the bind address is test T1 — the same machine, two addresses — because a remote test mixes the bind address and the firewall together, and the ssdnodes guide says so explicitly.
Seven-step diagnosis
- Characterise the shape. Decide which kind of failure it is: a local program cannot connect (follow T2 and T4), another machine cannot connect (follow T1 and T3), or nothing can connect after the port was moved (follow T4). Record the baseline: which machine the server is installed on, which operating system, whether Ollama is the desktop application or a systemd service, and which URL the client is using.
- Check the service. Run `ollama list` and read the listen table with `ss -ltnp | grep 11434` on Linux, or `netstat -ano | findstr 11434` on Windows (T2). A listen entry means the service is running — move on. No entry means the service is not running, or `ollama serve` failed to take the port (`bind: address already in use`).
- Check the local connection. Run `curl http://127.0.0.1:11434` on the server machine. It should answer `Ollama is running`. If it answers, the server itself is healthy. If it does not, go back to step 2 — the service layer is not settled yet.
- Compare the bind address. On the same machine, run `curl http://<LAN IP>:11434` (T1). If it fails, change `OLLAMA_HOST` to `0.0.0.0:11434` and restart the service. If it answers, the bind address is not the problem.
- Compare the firewall. From another machine, curl the same LAN IP address (T3). If it fails, add an exception rule for port 11434 — and turn the firewall back on if it was switched off for the test. If it answers, the connection layer itself is healthy.
- Compare the client. Check the client's URL and its `OLLAMA_HOST` (T4). If writing the actual address explicitly makes the connection work, fix the client's setting so both sides agree.
- Stop. If all four tests still do not separate the cause, record four things — the server's listen address from the `ss` output, the client's URL, the value of `OLLAMA_HOST` on both sides, and the firewall rules — and bring those notes to a check. Do not reinstall Ollama or the graphics driver one after another: reinstalling cannot change a bind address.
Four decisive tests
Each test changes exactly one variable and watches whether the connection answers. Use the same server, the same port, and the same client for every run, and judge by the response — `Ollama is running` — not by whether a program's error message sounds confident.
T1: Bind-address comparison — the same machine, curl 127.0.0.1:11434 against curl LAN-IP:11434
On the machine Ollama runs on, first run `curl http://127.0.0.1:11434`. It should answer `Ollama is running`. Then run `curl http://<this machine's LAN IP>:11434` — the same server, reached through the machine's network address instead of loopback.
- Variable: which address the client uses to reach the same server.
- Outcome variable: which address answers and which is refused.
- If loopback answers and the LAN IP is refused, the bind-address layer is confirmed: the server listens on loopback only. Change `OLLAMA_HOST` to `0.0.0.0:11434` and restart the service.
- If both answer, the bind address is not the problem. Move to T3.
- This test must be run on the same machine, so that the firewall is excluded. A remote machine that cannot curl the LAN IP mixes the bind address and the firewall together, and the two cannot be separated from that result — the ssdnodes guide states this explicitly.
Why this test is new: "11434", "OLLAMA_HOST", "localhost:11434", and "127.0.0.1:11434" appear zero times in either language across the whole article library. Articles #555 and #556 discuss model loading and unloading, and never teach a two-address comparison. Article #554 discusses `nvidia-smi` inside Docker, not the host machine's bind address. Article #561 discusses the device parameter of faster-whisper, not an API listen address. T1's variable is "which address the client uses for the same server" and its outcome is "which address answers" — no neighbouring article has that variable combination.
T2: Service-status and listen comparison — whether `ollama list` works, plus whether anything is listening on 11434
First, run `ollama list` in the terminal. If it lists the models, the command-line tool can reach the server, which means the service is running. If it cannot list them, that does not yet prove the service is dead — run T4 first, because the client's own variable may be wrong. Second, read the listen table: on Linux, `ss -ltnp | grep 11434`; on Windows, `netstat -ano | findstr 11434`; on macOS, `lsof -i :11434`. If there is output, read the listen address as well — `127.0.0.1:11434` or `0.0.0.0:11434` — because that address is the direct evidence for layer two. If there is no output, nothing is listening: either the service is not running, or `ollama serve` failed to take the port, and its error message ends with `bind: address already in use`.
- Variable: whether anything is listening on port 11434.
- Outcome variable: the service is running or not running, and which address it listens on.
- If nothing is listening, start the service — reopen the desktop application, or run `ollama serve`. If the port is held by another program, find that program, or move Ollama to another port by changing `OLLAMA_HOST`.
- If the listen table shows `127.0.0.1:11434` and the client is on another machine, move to T1.
Why this test is new: "11434" appears zero times across the library, and "curl" appears zero times in Chinese. Article #555 teaches `ollama ps` to see which models are loaded — its variable is "which model is loaded" and its outcome is "whether it stays loaded". T2's variable is "whether anything is listening on the port" and its outcome is "whether the service is running". Article #556 teaches the PROCESSOR column of `ollama ps` — its variable is `num_gpu` and its outcome is CPU against GPU. T2 does not read the PROCESSOR column at all; it reads the listen table. The two variable sets are entirely different.
T3: Firewall comparison — the server's own machine curls the LAN IP successfully, another machine curls the same IP and fails
First, on the server machine, run `curl http://<LAN IP>:11434`. This is the second half of T1, and it is assumed to answer. Then, on another machine on the same network, run `curl http://<the same LAN IP>:11434`.
- Variable: which machine the request comes from.
- Outcome variable: which machine can connect.
- If the local machine connects and the remote machine cannot, the firewall layer or the routing layer is confirmed — the bind address has already been excluded by T1. Add an exception rule for port 11434, and keep the firewall on.
- If both machines connect, the connection layer itself is healthy, and the problem is in one particular client's setting. Move to T4.
- Turning the firewall off is a test, not a fix. If the firewall was switched off to run this comparison, switch it back on and add the exception rule instead. Leaving the firewall off is not a repair; it creates a second problem.
Why this test is new: the Chinese term for firewall appears zero times across the library. Article #151 discusses power plans, not firewalls. No neighbouring article teaches a "same IP, local machine against remote machine" firewall comparison. T3's variable is "which machine sends the request" and its outcome is "which machine can connect" — different from T1's variable (which address) and different from T2's variable (whether anything is listening).
T4: Client-URL comparison — the same server, the CLI with its default URL against the CLI with an explicit URL
The server is healthy — T2 proved it is listening — but `ollama list` reports a connection failure. First, check whether the terminal has `OLLAMA_HOST` set: `echo $OLLAMA_HOST` on Linux and macOS, `echo %OLLAMA_HOST%` on Windows. If it is set, and its value points at an old port — for example the server moved to 11435 but the variable still says 11434, or the reverse — the client's variable is wrong. Then run the comparison: `OLLAMA_HOST=http://127.0.0.1:11434 ollama list`, with the server's actual listen address written out explicitly, against the usual bare `ollama list`.
- Variable: which URL the client uses.
- Outcome variable: whether the same healthy server can be reached.
- If the explicit address works and the usual command fails, the client-URL layer is confirmed. Fix the client's setting so both sides agree.
- The same logic applies to other programs: check the base URL in their settings — for example, Open WebUI's `OLLAMA_BASE_URL` — and confirm it matches the address the server actually listens on.
- If the port was changed, both sides must change together. Changing the server's port without changing the client's URL creates exactly this layer, and the sources agree on the point.
Why this test is new: "OLLAMA_HOST" appears zero times across the library. Articles #555 and #556 never mention that the client variable and the server variable share one name with two identities. T4's variable is "which URL the client uses" and its outcome is "whether the same healthy server can be reached" — no neighbouring article has that variable.
Auxiliary observations
These are useful supporting observations. They are deliberately not counted among the four decisive tests.
The desktop application's "Expose Ollama to the network" switch. The macOS and Windows desktop versions have a switch with this name, and its effect is to start the server with `OLLAMA_HOST=0.0.0.0`. It is deliberately not counted among the four tests: it is only the graphical form of T1's variable, not an independent variable. The Linux systemd installation has no such switch.
Docker port mapping (`-p 11434:11434`). Ollama inside a container listens on 11434 inside the container, but the host machine can only reach it through a port mapping. This is deliberately not counted among the four tests: container port mapping belongs to article #554's container layer, not to this article's host API layer. This article mentions it only as a boundary, and does not make it a main subject.
The `OLLAMA_HOST=http://0.0.0.0` trap — a scheme with no port. The convly guide verifies this: if the value is written with an `http://` scheme but no port, the default becomes port 80 (or 443 for https), not 11434. This is an auxiliary observation, not a decisive test, because it is only one concrete way of writing T1's and T4's variable incorrectly.
The `ss` output itself. Use it only to confirm the premise — which address the server listens on. It is not a separate test, because reading the listen table is already the second half of T2.
The four tests, in one table
| Test | Variable changed | Outcome variable | What a positive result means |
|---|---|---|---|
| T1: 127.0.0.1 vs LAN IP, same machine | Which address the client uses | Which address answers | Server listens on loopback only |
| T2: `ollama list` + listen table | Whether anything listens on 11434 | Service running or not; listen address | Service not running, or port held by another program |
| T3: same LAN IP, local vs remote machine | Which machine sends the request | Which machine can connect | Firewall or routing blocks the port |
| T4: default URL vs explicit URL | Which URL the client uses | Same healthy server reachable or not | Client setting points at the wrong address or port |
| Auxiliary: "Expose Ollama to the network" switch | Graphical form of T1 | Same as T1 | Desktop switch is the bind-address setting |
| Auxiliary: Docker `-p 11434:11434` | Container port mapping | Host can reach the container or not | Belongs to #554's container layer |
Common misconceptions
- "Cannot connect means Ollama is dead or not installed properly." Wrong. The server may be running perfectly well and listening only on loopback, while the connection attempt comes from another machine. Run T2 and read the listen table first; do not start by reinstalling.
- "Setting OLLAMA_HOST changes the server." Wrong. A Linux systemd service does not inherit a shell's environment variables. The server's variable must be set through `systemctl edit ollama.service` with an `Environment="OLLAMA_HOST=..."` line, followed by a daemon reload and a service restart. Exporting the variable in a shell changes only the programs started from that shell — including the `ollama` CLI itself, which is the T4 trap.
- "OLLAMA_HOST=0.0.0.0 fixes every connection problem." Wrong. Binding to all interfaces only settles the bind-address gate; the firewall can still block the port. And the API has no authentication, so exposing `0.0.0.0` to an untrusted network hands the GPU and the models to anyone who can reach the port.
- "Local works and remote fails, so the bind address must be wrong." Wrong. The ssdnodes guide states it directly: firewall rules and routing failures produce exactly the same shape. Only T1 — two addresses on the same machine — can exclude the bind address, and only T3 — the same IP from two machines — can point at the firewall.
- "curl failing means the server is not running." Wrong. A curl failure can also be a wrong client URL (T4), a wrong port, or a firewall block. Read the listen table first, then check the client's URL. Do not jump to a conclusion.
- "Turning the firewall off is the fix." Wrong. Turning the firewall off is a test. Once the firewall layer is confirmed, the correct action is to turn the firewall back on and add a single exception rule for port 11434. Leaving the firewall off is not a repair; it is a second problem.
Boundary cases: what this article is not
| Situation | Which route applies | Why it is not this article |
|---|---|---|
| Model loads but runs on the CPU, graphics card idle | #556 | `num_gpu` layer count, not the connection layer |
| Model unloads after a few minutes, every question reloads it | #555 | `keep_alive` lifecycle, not the connection layer |
| Ollama inside Docker cannot find the graphics card | #554 | Container runtime layer; the program never had a device |
| Model fails with out of memory while loading or during inference | #552 / #553 | Allocator and vLLM budget layer, not the connection layer |
| LoRA training runs out of memory halfway through a run | #564 | Training pool layer, not the connection layer |
| Answer stops halfway through (truncation) | #566 (this batch) | Generation parameter layer — only reached after the connection works |
| Another machine connects, but slowly | #562 / #555 | Data and concurrency layer, not the connection layer |
| Reaching Ollama over the internet | Security boundary | API has no authentication; use a VPN or an authenticated reverse proxy, never expose 11434 directly |
Neighbour articles and the boundary map
This article is #565, and its companion in the same batch is #566, which covers an Ollama answer that stops halfway through. The two share a batch and a diagnostic style — five layers, seven steps, decisive tests — but nothing else: one is the API connection layer, the other is the generation-parameter layer, and they share no test, no variable, and no outcome. A connection failure happens before generation starts; a truncation happens only after the connection has already worked.
The closest neighbours, read closely. Article #555 is the Ollama lifecycle article. It covers `keep_alive` in four forms, concurrent requests, loading limits, and the `ollama ps` columns. Its tests are all about "whether a model stays loaded": a keep-alive timing test, a concurrency-position test, and a `num_ctx` and model-size test. This article's four tests use variables — the bind address, the listen state, the requesting machine, and the client URL — that are all different from #555's. Article #555 contains zero occurrences of "11434" and "OLLAMA_HOST" in full. Article #556 is the Ollama-on-CPU article. It covers `num_gpu` in three settings, the PROCESSOR column of `ollama ps`, and a layer-count against speed gradient. This article covers which address the server listens on and which address the client goes to. The two variable sets are entirely different, and #556 contains zero occurrences of "11434" and "OLLAMA_HOST". Article #554 is the Docker article: container runtime and device passthrough. Docker port mapping appears here only as an auxiliary observation, not a main subject, and #554 contains zero occurrences of "11434". Article #561 is the faster-whisper article: device, compute type, and model size — inference-tool settings, not a server bind address. Article #562 is the training-data article: `num_workers`, data placement, and waiting time, with zero occurrences of "11434" and "OLLAMA_HOST". Articles #552 and #553 are the out-of-memory articles: the PyTorch allocator and the vLLM KV Cache budget. Out of memory only happens after a connection succeeds; a failed connection never reaches the allocator, so those tests do not apply here.
The library scan. Across the whole article library, "11434" appears zero times in Chinese and zero times in English; "OLLAMA_HOST" appears zero times in both languages; "localhost:11434" and "127.0.0.1:11434" appear zero times in both languages; "curl" appears zero times in Chinese and zero times in English; the Chinese term for firewall appears zero times; "ollama serve" appears only in article #555 (in `ollama serve --help` version-check context, not connection diagnosis).
Sources and honesty gaps
The facts in this article come from the following sources, checked by search on 2026-11-23: the Ollama official FAQ, at https://docs.ollama.com/faq, for the statement that Ollama binds 127.0.0.1 port 11434 by default and that the bind address is changed with the `OLLAMA_HOST` environment variable, for the per-system ways of setting environment variables (Windows system environment variables, macOS `launchctl setenv`, Linux systemd `systemctl edit` with `Environment=`), and for the statement that Ollama allows cross-origin requests from `127.0.0.1` and `0.0.0.0` by default; the ssdnodes guide "The Ollama API and port 11434 explained", at https://www.ssdnodes.com/learn/ollama-api-and-port-11434, for reading the listen address with `ss -ltnp | grep 11434`, for the statement that Ollama binds `127.0.0.1` port 11434 by default and accepts connections from the server itself and from nowhere else, for the statement that a request working locally and failing remotely does not identify the bind address on its own, for the `bind: address already in use` exit message when `ollama serve` cannot take the port, for the client and server double identity of `OLLAMA_HOST`, and for the fact that a systemd service does not inherit shell variables; the convly guide "Ollama Port: Default 11434 and How to Change It", at https://convly.ai/ollama-port-configuration-guide/, for the statement that the default Ollama port is 11434 and the server speaks plain HTTP and binds to `127.0.0.1`, for the statement that there is no `OLLAMA_PORT` variable, for `curl http://127.0.0.1:11434` answering `Ollama is running`, for the desktop "Expose Ollama to the network" switch being equal to `OLLAMA_HOST=0.0.0.0`, for the trap that `OLLAMA_HOST=http://0.0.0.0` with no port becomes port 80, and for the statement that the local API has no authentication; and the codingkit guide "Ollama Environment Variables Tutorial", at http://codingkit.com/ollama/environment-variables/, for the `OLLAMA_HOST` default of `127.0.0.1:11434`, for the three systems' setting methods, and for the statement that the API does not require a username or password and that port 11434 must never be exposed directly to the internet, with a VPN or an authenticated reverse proxy as the safe route.
Three honesty gaps must be stated plainly. First, there was no local reproduction: no Ollama server was run on a local machine for this article, so the `ss` output, the curl responses, and the `bind: address already in use` message all come from the external sources listed above, and the exact output format may differ between systems and versions. This article describes the mechanism and the comparison design, and does not fix one system's exact command output. Second, the setting paths differ between systems — Windows environment variables, macOS `launchctl setenv`, Linux `systemctl edit` — and this article covers all three rather than writing Linux only; the desktop "Expose Ollama to the network" switch exists only on the macOS and Windows desktop versions, and the Linux systemd installation has no such switch. Third, the `netstat` and `ss` commands differ between systems — Windows uses `netstat -ano`, macOS uses `lsof -i :11434` — and this article writes them per system rather than assuming the reader uses Linux. Two source conflicts were handled by not stating a fixed fact: ssdnodes and convly order the checks differently — one reads the listen table first, the other changes `OLLAMA_HOST` and then opens the firewall — and the two are not contradictory, only differently ordered, so this article uses the order "listen table, then local curl, then bind comparison, then firewall comparison", because the listen table is the only evidence that shows the bind address directly without changing any setting; and one recent source mentions a November 2026 Ollama vulnerability, but it is a single source whose details were not independently verified, so this article cites no vulnerability identifier and states only the conclusion all three sources agree on — the API has no authentication and must not be exposed to the internet.
Frequently asked questions
Why does `ollama run` work in the terminal, but my web interface cannot connect?
Because the terminal and the web interface reach the server by different routes. The terminal talks to the server on the same machine, usually through loopback, and the model itself is healthy. The web interface may be going to the wrong address, the wrong port, or an address the server is not listening on. Run test T2 to confirm the server is listening, then test T4 to check the client's URL against the server's actual listen address.
What does `curl http://127.0.0.1:11434` answering `Ollama is running` prove?
It proves the server is running and listening on loopback. It proves nothing about the network: a server bound to `127.0.0.1` answers loopback and refuses every other address. To test the network path, run test T1 — curl the machine's LAN IP from the same machine — and then test T3 — curl the same IP from another machine.
I set OLLAMA_HOST in the terminal, but the server still listens on 127.0.0.1. Why?
Because the server does not inherit the terminal's environment variables. A Linux systemd service reads its own environment, set through `systemctl edit ollama.service` with an `Environment="OLLAMA_HOST=..."` line, followed by a daemon reload and a service restart. Exporting the variable in a shell changes only the programs started from that shell — including the `ollama` CLI itself.
My phone can reach the server, but my laptop on the same network cannot. Is the bind address wrong?
Not necessarily. If the bind address were wrong, no remote machine could connect. One machine connecting and another failing points at the firewall or routing for that machine, or at that machine's own client setting. Run test T3 with the failing machine, then test T4 on the failing machine's client URL.
Should I turn the firewall off to fix the connection?
No. Turning the firewall off is a test, not a fix. If switching it off makes the connection work, the firewall layer is confirmed — then switch the firewall back on and add a single exception rule for port 11434. Leaving the firewall off trades one problem for a larger one.
Is it safe to set OLLAMA_HOST to 0.0.0.0?
Only on a trusted local network. The Ollama API has no authentication, so anyone who can reach port 11434 can use the models. Binding to `0.0.0.0` on a home or office network is the standard way to let other machines on that network connect. It must never be exposed directly to the internet — use a VPN or an authenticated reverse proxy instead.
I have run all four tests and still cannot separate the cause. What now?
Record four things — the server's listen address from the `ss` output, the client's URL, the value of `OLLAMA_HOST` on both sides, and the firewall rules — and bring those notes to a check. Do not reinstall Ollama or the graphics driver one after another — reinstalling cannot change a bind address. If there is a hardware suspicion (for example, the machine itself is unstable, or the network card behaves abnormally), the machine can be taken to the workshop for a further check.
Conclusion
A program that cannot reach Ollama is a connection-layer problem with a fixed shape: a healthy model, a working terminal session, and a request that never arrives. The four comparisons in this article — the same machine against two addresses, the listen table, the same address from two machines, and the explicit client URL — separate the service, the bind address, the firewall, and the client with the server's own answer as the only judge, and each one changes exactly one variable on the same setup.
When to seek professional help: if the server will not start at all, if the port stays held by an unknown program, or if all four tests fail to separate the cause — or if the machine crashes, or the network card itself behaves abnormally — the problem is no longer a setting. It may involve the installation, the operating system, or the hardware itself, and is worth having checked by a technician.
If the tests point to a hardware fault rather than a setting — the machine is not detected, the machine crashes, or the setup fails with an error that no setting changes — the machine and the setup can be checked at the Shek Mun workshop: Dali Plaza, Room 1209, Shek Mun, Hong Kong. Phone 2186 8010, WhatsApp 6558 6806. Diagnosis and repair pricing follows the workshop's published three-tier range of HK$400–HK$2,800, quoted before any work begins.