(in this post I'm using SSH / port 2222 as a substitute for any program / port; the port could be 80, could be 22, could be 9999; SSH is easy to test stuff out on, however, hence my using SSH as the specific example)
I'm running Ubuntu 20.04 LTS from the Microsoft Store via WSL2. When I do sudo /usr/sbin/sshd -ddd -p2222 via Ubuntu I'm able to connect via the Windows 10 host but not via another machine on the same LAN / subnet.
The Windows firewall is off.
In Ubuntu I added the following iptables rule:
sudo iptables -A INPUT -p tcp --dport 22 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
It didn't help.
I tried doing this (from https://stackoverflow.com/a/63781351/569976):
netsh interface portproxy add v4tov4 listenport=2222 listenaddress=0.0.0.0 connectport=2222 connectaddress=172.30.16.3
For the connectaddress I used the address that I got by doing this:
wsl -d Ubuntu-20.04 bash -c "ifconfig eth0 | grep 'inet ' | awk '{ print \`$2 }'"
No luck.
Any ideas?