Tidqom — Source-linked AI and developer tools
AITid
AI

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.

Diana Park profile photo
August 1, 2026 · 6 min read
Ollama "connection refused on 127.0.0.1:11434": The 5 Causes I Have Actually Hit — AI

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: Midjourney vs DALL-E vs Flux: A Practical Image-Tool Comparison Framework →

Related: Ollama Filled My Disk: How I Moved the Models Directory Safely →

bash
curl http://127.0.0.1:11434/api/tags

A 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: 9 Free AI Coding Tools Every Developer Should Try in 2026 →

Advertisement — In Article

Related: Ollama Answers Get Cut Off Mid-Sentence: num_ctx vs num_predict Explained →

bash
# Linux / WSL2
sudo systemctl status ollama
sudo systemctl start ollama
# or foreground, which shows the real error
ollama serve

On 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: Sora 2 Review: OpenAI's Video Model Is Finally Useful for Real Work →

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.

bash
# Linux
sudo systemctl edit ollama
# add:
# [Service]
# Environment="OLLAMA_HOST=0.0.0.0:11434"
sudo systemctl daemon-reload && sudo systemctl restart ollama

macOS

launchctl setenv OLLAMA_HOST "0.0.0.0:11434"

terminal
Advertisement — In Article

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: How to Clone Your Voice with AI in 2026 (Free and Paid Options) →

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:

bash
grep nameserver /etc/resolv.conf   # e.g. 172.30.16.1
curl http://172.30.16.1:11434/api/tags

Cause 4 — Port 11434 is already taken

Related: DeepSeek-R1 Shows Its <think> Tags in the Output — Here Is How I Strip Them →

bash
sudo lsof -i :11434        # macOS/Linux
netstat -ano | findstr 11434   # Windows
OLLAMA_HOST=127.0.0.1:11435 ollama serve

Twice for me this was a zombie ollama serve from a previous crash. pkill ollama then restart.

Cause 5 — Docker containers

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

ini
# /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

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.

Advertisement

Related Articles

مقالات ذات صلة — تابع القراءة داخل الموقع

View all in AI

مواضيع مقترحة · Suggested Topics

استكشف مواضيع ومحاور ذات صلة بهذا المقال — روابط داخلية لتعميق قراءتك.

The Daily Pulse

Newsletter delivery is not connected yet. This form only saves your address in this browser; no email is sent.

Get concise, source-linked technology notes without the hype.

Advertisement