Solved: Can access HA from localhost but not IP address on same computer

Hi friends. I’ve installed HA Core v.2023.2.2 on WSL using the guide at home-assistant io installation windows #install-home-assistant-core
HA starts up ok and I can reach it at http://localhost:8123
However, I can’t reach it at http://192.168.1.178:8123
where 192.168.1.178 is the IP address of the PC running WSL / HA Core.
I want to be able to use the IP address so I can access it from other machines on my local network.
Can anyone help please?

1 Like

Assuming you haven’t changed the name under “Settings > System > Network”, you should also be able to access from “http://homeassistant.local:8123/” - does this work?

Hi Michael, thanks for your reply. No, I can’t access that either - only http://localhost:8123

it seems to be something related to wsl’s network setting, a quick way to test it is to go find some simplest web server and run it inside wsl, and see if u can open the webpage by IP address just like u tried with home assistant.

similar issue here: Access a web server which is running on WSL (Windows Subsystem for Linux) from local network - Stack Overflow
u will need some bridge to do so I guess

If I do remember it’s on docker for Windows where you need to bind the port to LAN.

You may also need to check your firewall rules

Just out of curiosity, what’s the relevant purpose in running HA-Core, in WSL ? , to me it sounds/seems like trying to maximize the complexity, and obviously not do to “limited” hardware resources

Hi Kerbal, thanks for your replies. I ran a webserver from wsl using the command python3 -m http.server and I could access it at 127.0.0.1:8000, but not 192.168.1.178:8000, so you’re right, it is WSL’s network settings. The SO link you found is exactly the same issue, so I’m going to read through the suggestions there and decide what to do next.

Thanks Benoit, I’ve checked firewall rules but I think they’re ok.

Hi Boheme, it’s a good question and I may have made the wrong choice! I was going with what seemed easiest and most appropriate for my situation. I’m running HA on a spare PC, as I can’t get a Pi at the moment, and I don’t want to take Windows off that PC. I chose Core rather than OS on a VM as I only wanted to install the absolute minimum and so didn’t want to install vm stuff. That will be the next thing to try though if I can’t get it working this way.

Have you upgraded to WSL 2 ?

On my setup everything is run in Docker Desktop,.I had to upgrade to WSL 2 to make it work.

I use it for my dev environment but dockers containers to others machines if bound to 0.0.0.0

Can you send a screenshot of your UI, the one displaying binded ports?

OK, so thanks to Kerbal’s link (Access a web server which is running on WSL (Windows Subsystem for Linux) from local network - Stack Overflow) I have managed to fix this.
I ran

netsh interface portproxy add v4tov4 listenport=8123 listenaddress=0.0.0.0 connectport=8123 connectaddress=w.x.y.z

where w.x.y.z was the eth0 inet address shown by ifconfig, and I can access HA at 192.168.1.178:8123, both on this PC and another PC connected to same router. Result!

Reading through the SO page, it looks like I will need to set up a script so that this will be fixed every time the PC restarts, so that’s my next task.

Thanks all for your help.

1 Like