When you netstat can you output the IP it binds to? (If that is also a localhost ip it does not allow access from outside the wsl2 vm but can be accessed from inside the vm)
I was curious about that, still understanding the mechanics of WSL2. I have a Postgres service on my Windows machine that is not the same (from my understanding) as as the one running within the WSL2.
When I do the netstat mentioned above this is what it outputs:
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN
unix 2 [ ACC ] STREAM LISTENING 20997 /var/run/postgresql/.s.PGSQL.5432
I did try to setup the Postgres instance on Windows and access that via ip bu then receive the “non-existing domain - :nxdomain” error.
I have an inbound windows firewall rule to allow all incoming traffic from the WSL2 IP to port 5432
WSL2 IP when running ifconfig: 172.24.95.116
Windows IPv4: 172.24.80.1