How to set up working X11 forwarding on WSL2

前端 未结 14 2227
灰色年华
灰色年华 2020-12-12 12:09

When moving from WSL1 to WSL2 many things change; apparently this applies to X11 forwarding as well.
What steps do I need to make in order to use X11 forwarding with WSL

14条回答
  •  庸人自扰
    2020-12-12 12:44

    I don't know if that's specific to my configuration but these solutions don't work on my computer. They return the address 192.168.0.254 which is my gateway and not my host computer.

    To make it work I had to use the following on my Ubuntu/WSL2 :

    export DISPLAY="`ip -4 address | grep -A1 eth0 | grep inet | cut -d' ' -f6 | cut -d/ -f1`:0"
    

提交回复
热议问题