Get the IP address of the desktop / windows host in WSL2
When you are IN the wsl2 and you want to know how to connect to the desktop / the windows host, here is how i did it
hostip=$(ipconfig.exe | grep 'vEthernet (WSL)' -A4 | cut -d":" -f 2 | tail -n1 | sed -e 's/\s*//g')
I found lots solutions that were awk’ing the resolve.conf but had the google servers in there.
You need that, when you want to connect to your display server, or use some npipe hacks or else