# Serve this host's Ollama to the other machines you work from. # # The premise of this router is that a local LLM classifies your task before a # cloud model answers it. "Local" means your hardware, not necessarily the # machine you are typing on — the box with the GPU usually is not the laptop. # Most developers already have WireGuard or a VPN back to a home lab, so the # normal shape is: router and editor on the laptop, Ollama on the workstation, # classifier.base_url pointing across the tunnel. # # Ollama listens on 127.0.0.1:11434 by default, so that fails with # connection-refused until this drop-in is applied on the SERVING host. # # Install (needs root — ollama.service is a system unit): # sudo mkdir -p /etc/systemd/system/ollama.service.d # sudo cp deploy/ollama-over-vpn.conf \ # /etc/systemd/system/ollama.service.d/override.conf # sudo nano /etc/systemd/system/ollama.service.d/override.conf # set the address # sudo systemctl daemon-reload && sudo systemctl restart ollama # # Then on the client machine, in config.yaml: # classifier.base_url: http://:11434/v1 # verification.base_url: http://:11434 # # Bind to the VPN address, NOT 0.0.0.0. Ollama has no authentication of any # kind: anything that can reach the port can run inference, enumerate your # models and pull new ones. 0.0.0.0 also publishes it on whatever cafe or # hotel wifi the laptop is sitting on. Same reasoning that keeps the # dispatcher itself on loopback. # # Replace with this host's own VPN address — 10.x.x.x for WireGuard, # 100.x.x.x for Tailscale. `ip -4 -o addr show` will tell you. [Service] Environment="OLLAMA_HOST=10.0.0.1:11434" # Keep the model resident between requests. Without this, the first # classification after an idle gap pays a cold load — measured at 43s, which # exceeds even the 120s ceiling once the SDK's retries are counted. Serving a # laptop makes this matter more, not less: requests arrive in bursts separated # by long gaps, which is exactly the pattern that keeps evicting the model. Environment="OLLAMA_KEEP_ALIVE=24h"