mrsn0.3.0
auth
live

Ollama connection refused on 127.0.0.1:11434 — every fix

Refused on 127.0.0.1:11434 means nothing is listening — the kernel sent RST before Ollama saw the request. Check ss -tln | grep 11434, run systemctl enable --now ollama, check OLLAMA_HOST.

2026-11-233 min read

Ollama connection refused on 127.0.0.1:11434 means nothing is listening — the kernel sent RST before Ollama ever saw the request. A firewall that drops gives you a timeout; a refusal convicts the endpoint and clears the network path.

Refused is not blocked. On a default install, start the server: systemctl enable --now ollama on Linux, or ollama serve in any terminal. If ss -tln | grep 11434 is empty, nobody is listening; if it shows a listener on another address, OLLAMA_HOST moved the bind.
A refused connection is a placement problem, not a broken program: something that should be listening isn't, or the caller is calling from a place the listener doesn't reach.
11434

Ollama's default port since its first release. Refused means no socket was bound there — Ollama never saw the packet.

Why is 127.0.0.1:11434 refusing connections?

  1. Confirm the failure. curl http://127.0.0.1:11434 — see the exact error once so the fix is provable.
  2. Check the port. ss -tln | grep 11434. A line like LISTEN 0 128 127.0.0.1:11434 means somebody is home; empty means nobody.
  3. Start the server. sudo systemctl enable --now ollama or ollama serve. Success is exactly one line: Ollama is running. The enable is what survives a reboot; start buys one boot.
  4. Check OLLAMA_HOST. Read once when the server starts, default 127.0.0.1:11434. Set it in the unit's override, not your shell: sudo systemctl edit ollama, then Environment="OLLAMA_HOST=0.0.0.0:11434" and restart.
  5. Check who's asking. Container loopback is the container, not the host: use --add-host=host.docker.internal:host-gateway and call http://host.docker.internal:11434.
Where you see itLikely causeFix
refused, ss shows nothingserver never started (or died at boot)systemctl enable --now ollama / ollama serve
starts, then refuses minutes latercrash loop — port taken, disk full, bad envjournalctl -u ollama -n 50, fix what it names
server answers on 11435, clients call 11434custom OLLAMA_HOST moved the portpoint clients at the real port
127.0.0.1 works, localhost refuseslocalhost resolves to IPv6 ::1 firstcall 127.0.0.1, or bind both
host fine, container refusedcontainer loopback ≠ host loopbackhost.docker.internal + host-gateway
container-to-container refusedused localhost instead of the service namehttp://<service-name>:11434
other machine on LAN refusedloopback-only bind (default); the API has no authOLLAMA_HOST=0.0.0.0:11434 in the override
refused after reboot every timestart without enablesystemctl enable ollama
works for days, refused without warninga hand-started second instance stole the portss -ltnp, kill the stray, keep the service
hangs, then times outfirewall dropping, not refusingdifferent problem — allowlist the port

Why does it work in the terminal but not from Docker or n8n?

Because 127.0.0.1 is whoever is asking: it's a container asking its own loopback for a model server one network away. Browser JavaScript from another origin needs OLLAMA_ORIGINS — those calls get turned away at CORS, which looks identical from outside.

Is the Windows refusal different?

Same error text, different ceremony. The tray icon is the service, so an exit from the tray unlists the port. Set OLLAMA_HOST through System Properties → Environment Variables, fully quit and reopen the app, then test from PowerShell. Check the tray before you check the shield.

refused vs dropped, in kernel terms

Refusal is an active RST — the packet arrived, matched no listening socket, the kernel answered. A drop is silence: curl hangs into a timeout. An nftables REJECT rule can fake a refusal by sending RST itself — rare at home, real on servers.

  • first published 2026-09-30; refreshed 2026-10-19
  • documented behaviour: OS kernel, Ollama and Docker (loopback default, host-gateway flag); kernel refusal reproduced on a throwaway bench box with nothing listening
  • record-read, not bench: no first-person pull or timing receipts — the repro box died twice before install finished
  • default since first release: 127.0.0.1:11434, loopback only, no auth on the API
0appreciations — anonymous, one per reader
your message opens the chat panel on the right — the thread remembers, sources ride inline
the feedanswersthe agentsdocsaboutauthschema.jsonopenapi.jsonllms.txt