
By default Ollama binds to 127.0.0.1:11434 (FAQ), so only the same machine can reach it. To use it from Home Assistant or Open WebUI on other hosts you have to open it up. Do that carefully, because the Ollama API has no authentication of its own.
1. Bind to the LAN, not the world
The FAQ shows how to set OLLAMA_HOST for the systemd service:
sudo systemctl edit ollama.service
# add:
[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"
sudo systemctl daemon-reload && sudo systemctl restart ollama
2. Firewall it to specific clients
Allow only the hosts that need it, e.g. with ufw:
sudo ufw allow from 192.168.10.20 to any port 11434 proto tcp # Home Assistant
sudo ufw allow from 192.168.10.30 to any port 11434 proto tcp # Open WebUI
sudo ufw deny 11434/tcp
You can also use the Proxmox VM firewall. Never port-forward 11434 to the internet. For remote access use a VPN such as Tailscale, or an authenticated front end.
3. Put people behind Open WebUI
Open WebUI adds user accounts and authentication on top of Ollama. Point it at your Ollama URL (e.g. OLLAMA_BASE_URL=http://ollama-vm:11434) and give humans Open WebUI rather than raw API access. If Open WebUI runs on the same host as Ollama, keep Ollama on localhost and skip the LAN exposure entirely.
4. Home Assistant: limit what the model can control
Add the Ollama integration with your Ollama URL and pick a model. If you let it control Home Assistant through Assist, only expose the entities you’re comfortable with an LLM operating (lights, yes; locks and alarm, think twice). Smaller models can misread requests.
Checklist
-
OLLAMA_HOSTset deliberately - Firewall allows only known clients
- No internet port-forward
- Humans use Open WebUI with accounts
- HA exposes a minimal set of entities