Ollama Is Not Reachable Over The Local Network

Ollama Is Not Reachable Over The Local Network

The other day I needed to serve Ollama (on Ubuntu) over the local network and I had problems connecting.

It timed out.

The timeout happened because Ollama was bound only to the loopback interface (127.0.0.1).
That means it was accessible only from the same machine and not from other devices on the local network.

Once bound to 0.0.0.0, Ollama becomes accessible from other devices in the local network.

sudo systemctl edit ollama.service

in the opened file:

Environment="OLLAMA_NUM_THREAD=12"
Environment="OLLAMA_NUM_PARALLEL=2"
Environment="OMP_NUM_THREADS=12"
Environment="OMP_WAIT_POLICY=ACTIVE"

Environment="OLLAMA_MAX_LOADED_MODELS=1"
Environment="OLLAMA_KEEP_ALIVE=5m"

Environment="OLLAMA_NUM_CTX=20384"

close the file and don't forget to restart

sudo systemctl daemon-reload && sudo systemctl restart ollama

I tripped over this multiple times lol.

Have fun!

Read more