I saw that 127.0.0.1 is used as the link address in the tutorial. This method is possible in wsl1, but I can’t implement it on wsl2. I can only use export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk'{print $2; exit;}'):0.0 Get the ip of wsl2 dynamically. And the link will be broken every time the wifi is changed or disconnected. Can you explain how to use 127.0.0.1 in wsl2?
You can't use 127.0.0.1. WSL2 is no longer running natively (i.e. through translation). It's a virtual machine now. So it'll function the same as a VM; it'll have it's own network interfaces separate from those of Windows.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I saw that 127.0.0.1 is used as the link address in the tutorial. This method is possible in wsl1, but I can’t implement it on wsl2. I can only use export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk'{print $2; exit;}'):0.0 Get the ip of wsl2 dynamically. And the link will be broken every time the wifi is changed or disconnected. Can you explain how to use 127.0.0.1 in wsl2?
You can't use 127.0.0.1. WSL2 is no longer running natively (i.e. through translation). It's a virtual machine now. So it'll function the same as a VM; it'll have it's own network interfaces separate from those of Windows.