[GH-ISSUE #7280] When server is bound to 0.0.0.0, it should allow also communication redirected by netsh to localhost (issue specific to with WSL2) #4626

Open
opened 2026-04-12 15:32:17 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @mmb78 on GitHub (Oct 20, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/7280

I have ollama server running within WSL2, on Win10. I want to access it from outside. The WSL2 needs to extra tricks to get the network traffic to reach it.

When I set a netsh rule that takes the outside traffic (allowed by Win firewall) and redirects to "WSL2-IP":11434
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=64065 connectaddress=172.18.200.13 connectport=11434

it all works when ollama config has this:
Environment="OLLAMA_HOST=0.0.0.0"

I can connect to: http://"machine IP":64065
and get ollama to respond!

But the problem is that the WSL2 IP is dynamic and will change .. so ideally I would use this netsh rule:
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=64065 connectaddress=localhost connectport=11434
and just keep ollama listening only on localhost

but this somehow does not work and the communication is lost.

Interestingly enough using localhost in netsh for open-webui sever works well!

Maybe I miss some issue but I could not find another solution to this.

Originally created by @mmb78 on GitHub (Oct 20, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/7280 I have ollama server running within WSL2, on Win10. I want to access it from outside. The WSL2 needs to extra tricks to get the network traffic to reach it. When I set a netsh rule that takes the outside traffic (allowed by Win firewall) and redirects to "WSL2-IP":11434 netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=64065 connectaddress=172.18.200.13 connectport=11434 it all works when ollama config has this: Environment="OLLAMA_HOST=0.0.0.0" I can connect to: http://"machine IP":64065 and get ollama to respond! But the problem is that the WSL2 IP is dynamic and will change .. so ideally I would use this netsh rule: netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=64065 connectaddress=localhost connectport=11434 and just keep ollama listening only on localhost but this somehow does not work and the communication is lost. Interestingly enough using localhost in netsh for open-webui sever works well! Maybe I miss some issue but I could not find another solution to this.
GiteaMirror added the wslfeature requestwindows labels 2026-04-12 15:32:17 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#4626