Home » Technology » Supercharge Your Local AI Setup: Expose Ollama API from WSL to Windows

Supercharge Your Local AI Setup: Expose Ollama API from WSL to Windows

Views:133

Running Ollama inside WSL (Windows Subsystem for Linux) is a great way to supercharge your local AI Setup with large language models. By default, Ollama binds to 127.0.0.1:11434 inside WSL, which means it’s only accessible from within the Linux-windows environment. If you want to call Ollama’s API from Windows applications or even other devices on your LAN, you need to expose it properly.

Having spent more than two decades building software, working deep inside engineering environments, and helping organizations adopt emerging technologies, I’ve learned that innovation delivers real value only when it is practical, accessible, and well understood. From writing code and integrating complex systems to guiding technology adoption across different environments, one constant remains—developers and teams need clear, hands-on pathways to experiment and deploy new capabilities effectively.

This tech concept, takes you through the process step by step, helping bridge the gap between experimentation and real-world developments while maintaining control, accessibility, and performance.

Step 1: Configure Ollama to Listen on All Interfaces

Inside your WSL terminal, set the environment variable before starting Ollama:

export OLLAMA_HOST=0.0.0.0:11434
ollama serve
  • 0.0.0.0 tells Ollama to listen on all available interfaces.
  • You can also bind to a specific WSL IP (check with ip addr show eth0).

Step 2: Make It Permanent with systemd

Ollama runs as a systemd service inside WSL. To avoid re-exporting the variable every time:

sudo systemctl edit ollama

Add:

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

Then reload and restart:

sudo systemctl daemon-reload
sudo systemctl restart ollama

Now Ollama will always start bound to 0.0.0.0:11434.

Step 3: Forward Traffic from Windows to WSL

WSL runs in a lightweight VM, so Windows doesn’t automatically expose its ports. Use portproxy to forward traffic:

netsh interface portproxy add v4tov4 listenport=11434 listenaddress=0.0.0.0 connectport=11434 connectaddress=<WSL_IP>

Replace <WSL_IP> with the IP you found via ip addr show eth0.

Step 4: Open Windows Firewall

Allow incoming connections on port 11434:

netsh advfirewall firewall add rule name="Ollama API" dir=in action=allow protocol=TCP localport=11434

Step 5: Test the API

From Windows PowerShell or browser:

Invoke-RestMethod -Uri "http://localhost:11434/api/tags" -Method GET

From another device on your LAN for example :

curl http://192.168.1.32:11434/api/tags

You should see JSON listing your installed models.

Security Considerations

  • Binding to 0.0.0.0 makes Ollama reachable by anyone on your LAN.
  • Use firewall rules or reverse proxies (like Nginx with HTTPS + basic auth) if you plan to expose it beyond your local network.
  • For development, LAN exposure is fine, but for production you should secure it.

My Tech Advice: Technology becomes far more powerful when it is made accessible and integrated into real-world workflows. By exposing Ollama running inside WSL to Windows and your local network, you move beyond isolated experimentation toward building scalable, connected AI experiences. Whether you are developing custom applications, enabling cross-device collaboration, or embedding AI into everyday workflows, this setup creates a strong foundation for practical innovation and future-ready experimentation.

Ready to build your own tech solution ? Try the above tech concept, or contact me for a tech advice!

#AskDushyant

Note: The names and information mentioned are based on my personal experience; however, they do not represent any formal statement.
#TechConcept #TechAdvice #Ollama #WSL #OllamaAPI #Windows #WindowsNetworking #WSLIntegration #AIModelsLocal #CrossPlatformAI

Leave a Reply

Your email address will not be published. Required fields are marked *