Folio III Field Notes
Plate III.4 — Sharing Ollama Server

How to share an Ollama server through IP and port

Introduction

I was recently configuring a quick server to run LLMs locally. It's easy in hindsight, but it wasn't as clear-cut as I'd hoped. After some troubleshooting and a read of the official Ollama FAQ, the fix came down to setting the OLLAMA_HOST environment variable. Here's a step-by-step.

The issue

By default, Ollama binds to 127.0.0.1 on port 11434, which restricts access to the local machine. Even if you specify an IP and port on the client side, other devices on the network can't reach the server.

Solution: configuring OLLAMA_HOST

Honestly trivial once you know. Change the bind address from 127.0.0.1 to 0.0.0.0 so the server listens on every available interface. The mechanics differ by OS.

Step 1 — Set the OLLAMA_HOST environment variable

Set OLLAMA_HOST to 0.0.0.0:11434. The exact procedure depends on your OS:

On macOS

Open Terminal and set the variable via launchctl:

launchctl setenv OLLAMA_HOST "0.0.0.0:11434"

Run Ollama as a server:

ollama serve

Verify the variable is set:

echo $OLLAMA_HOST

It should print 0.0.0.0:11434. Make sure the Ollama app is quit before starting it as a server.

On Linux

Edit the systemd service with systemctl edit ollama.service, and add this under the [Service] section:

[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"

Save, exit, then reload systemd and restart Ollama:

sudo systemctl daemon-reload
sudo systemctl restart ollama
On Windows
  1. Quit the Ollama application from the taskbar.
  2. Open Settings (Windows 11) or Control Panel (Windows 10) and search for Environment Variables.
  3. Click Edit environment variables for your account.
  4. Add or edit OLLAMA_HOST and set its value to 0.0.0.0:11434.
  5. Click OK / Apply to save.
  6. Restart the Ollama application from the Start menu.

Step 2 — Verify from another device

From another device on the network, open a browser or use curl:

curl http://your_ip_address:11434

If everything's configured correctly, you'll get a response from the Ollama server.

Additional tips

  • Firewall — make sure your host firewall allows incoming connections on port 11434.
  • Port forwarding — if you're accessing the server from a different network entirely, you may need to configure port forwarding on your router.

Conclusion

You can easily share your Ollama server with other devices on your network with this setup — useful for collaborative projects or accessing the server from multiple devices.

For more, see the official FAQ.

back to folio III · field notes