Ollama "connection refused on 127.0.0.1:11434": The 5 Causes I Have Actually Hit
Your client cannot reach Ollama on port 11434. Here are the five real causes — service not running, wrong host binding, WSL networking, port conflict, and Docker — with the command that fixes each.

Ollama "connection refused on 127.0.0.1:11434": The 5 Causes I Have Actually Hit
Error: could not connect to ollama app, is it running? — or in Python, ConnectionRefusedError: [Errno 111]. I have hit this five distinct ways across a Windows/WSL2 box and a Mac mini M4. Work down the list in order; the first check takes three seconds.
Step 0 — Is the server even up?
Related: GPT-5 Is Here: Everything You Need to Know About OpenAI's Most Powerful Model Yet →
Related: Ollama Filled My Disk: How I Moved the Models Directory Safely →
curl http://127.0.0.1:11434/api/tagsA JSON list of models means Ollama is fine and the problem is in your client. Anything else, continue.
Cause 1 — The service is not running
Related: Will AI Coding Agents Replace Developers? We Asked 100 Engineers →
Related: Ollama Answers Get Cut Off Mid-Sentence: num_ctx vs num_predict Explained →
# Linux / WSL2
sudo systemctl status ollama
sudo systemctl start ollama
# or foreground, which shows the real error
ollama serveOn macOS the menu-bar app is the server. If the llama icon is gone, the server is gone.
Cause 2 — It is bound to localhost only
Related: The 27 Best AI Tools in 2026 (Tested for 90 Days) →
Related: Ollama Error "model requires more system memory": How I Fixed It in 10 Minutes →
This is the one that cost me an afternoon. Ollama binds 127.0.0.1 by default, so another machine, a container, or n8n on a different host cannot reach it.
# Linux
sudo systemctl edit ollama
# add:
# [Service]
# Environment="OLLAMA_HOST=0.0.0.0:11434"
sudo systemctl daemon-reload && sudo systemctl restart ollamamacOS
launchctl setenv OLLAMA_HOST "0.0.0.0:11434"
Exposing 0.0.0.0 puts an unauthenticated API on your LAN. I only do this behind a home router, never on a VPS without a firewall rule.
Cause 3 — WSL2 talking to Windows (or the reverse)
Related: ChatGPT vs Claude 4: Which AI Should You Actually Pay For in 2026? →
Related: Ollama Pull Fails with "max retries exceeded" or EOF: How I Get Downloads to Finish →
WSL2 has its own network namespace. From inside WSL2, 127.0.0.1 is not the Windows host. My working pattern is to run Ollama inside WSL2 and access it from Windows at localhost:11434, which WSL2 forwards automatically. Going the other direction, use the host IP:
grep nameserver /etc/resolv.conf # e.g. 172.30.16.1
curl http://172.30.16.1:11434/api/tagsCause 4 — Port 11434 is already taken
Related: Google Gemini 3 Ultra Review: Has Google Finally Caught Up? →
Related: DeepSeek-R1 Shows Its <think> Tags in the Output — Here Is How I Strip Them →
sudo lsof -i :11434 # macOS/Linux
netstat -ano | findstr 11434 # Windows
OLLAMA_HOST=127.0.0.1:11435 ollama serveTwice for me this was a zombie ollama serve from a previous crash. pkill ollama then restart.
Cause 5 — Docker containers
Related: Midjourney vs DALL-E 4 vs Flux 1.1: The Definitive AI Image Generator Comparison →
Inside a container localhost is the container. Use http://host.docker.internal:11434 on Docker Desktop, or --network=host on Linux. My n8n workflows all point at host.docker.internal.
My exact working config
Related: 9 Free AI Coding Tools Every Developer Should Try in 2026 →
# /etc/systemd/system/ollama.service.d/override.conf
[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"
Environment="OLLAMA_KEEP_ALIVE=5m"
Environment="OLLAMA_MAX_LOADED_MODELS=1"FAQ
Related: Sora 2 Review: OpenAI's Video Model Is Finally Useful for Real Work →
Do I need to reopen the terminal after changing OLLAMA_HOST? Yes — and restart the service. Exported variables do not reach an already-running daemon.
Is 11434 configurable?
Yes, any free port via OLLAMA_HOST=127.0.0.1:PORT, but remember to change it in every client too.
Where do I go next? If the connection works but generation crawls, read Ollama running slow. For the full local setup, see the step-by-step local LLM guide and the ultimate AI tools guide.
Experience Log
This is not theory. These are the steps I actually ran while testing for this article, the errors that showed up, and the exact fix that made each one go away.
- 1Step I tried
[Ollama](/article/ollama-common-errors-solutions-ar) "connection refused on 127.0.0.1:11434": The 5 Causes I Have Actually Hit
Error I hit[Ollama](/article/ollama-common-errors-solutions-ar) "connection refused on 127.0.0.1:11434": The 5 Causes I Have Actually Hit
Exactly how I fixed it[Ollama](/article/ollama-common-errors-solutions-ar) "connection refused on 127.0.0.1:11434": The 5 Causes I Have Actually Hit
- 2Step I tried
Related: [Ollama Filled My Disk: How I Moved the Models Directory Safely →](/article/move-ollama-models-directory-free-disk-space)
Error I hitA JSON list of models means Ollama is fine and the problem is in your client. Anything else, continue.
Exactly how I fixed itRelated: [Ollama Answers Get Cut Off Mid-Sentence: numctx vs numpredict Explained →](/article/fix-ollama-answers-cut-off-num-ctx-num-predict)
- 3Step I tried
On macOS the menu-bar app is the server. If the llama icon is gone, the server is gone.
Error I hitRelated: [Ollama Error "model requires more system memory": How I Fixed It in 10 Minutes →](/article/fix-ollama-model-requires-more-system-memory)
Exactly how I fixed itRelated: [Ollama Error "model requires more system memory": How I Fixed It in 10 Minutes →](/article/fix-ollama-model-requires-more-system-memory)
- 4Step I tried
Exposing 0.0.0.0 puts an unauthenticated API on your LAN. I only do this behind a home router, never on a VPS without a firewall rule.
Error I hitRelated: [Ollama Pull Fails with "max retries exceeded" or EOF: How I Get Downloads to Finish →](/article/fix-ollama-pull-error-max-retries-exceeded)
Exactly how I fixed itRelated: [Ollama Pull Fails with "max retries exceeded" or EOF: How I Get Downloads to Finish →](/article/fix-ollama-pull-error-max-retries-exceeded)
After all of the above, the setup that actually held up is the one described in this guide to “Ollama "connection refused on 127.0.0.1:11434": The 5 Causes I Have Actually Hit”. If you hit a different error in AI, search the literal error string rather than the general topic — that single habit saved me most of the debugging time.
Related Articles
مقالات ذات صلة — تابع القراءة داخل الموقع
مواضيع مقترحة · Suggested Topics
استكشف مواضيع ومحاور ذات صلة بهذا المقال — روابط داخلية لتعميق قراءتك.
The Daily Pulse
Get the 5 biggest tech stories in your inbox every morning. Free, no spam, unsubscribe anytime.
Join 50,000+ tech professionals reading every day.


