If you want other devices in the same LAN to access your local Ollama API, follow these steps.
Set the listening host
First, set Ollama to listen on all network interfaces:
OLLAMA_HOST=0.0.0.0:11434
Open the firewall
In Windows Firewall advanced settings, create an inbound rule and allow the target port (for example 8080):
- Press Win + S, search and open “Windows Defender Firewall”.
- Click “Advanced settings”.
- Select “Inbound Rules” -> “New Rule…”.
- Choose “Port”, then click “Next”.
- Select protocol (usually TCP), enter the target port in “Specific local ports” (for example
8080), then click “Next”. - Choose “Allow the connection”, then click “Next”.
- In “Profile”, select Domain, Private, and Public, then click “Next”.
- Name the rule (for example
OpenPort8080) and click “Finish”.
Run Ollama
Ollama run 模型
Access the model through API
|
|