How to set up working X11 forwarding on WSL2

前端 未结 14 2283
灰色年华
灰色年华 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:41

    Using /etc/resolv.conf nameserver won't work for me since I disabled resolv.conf generation in /etc/wsl.conf (I have a custom resolv.conf).

    Ultimately you want the WSL2 host IP address, which should also be your default route. Here's my ~/.bashrc entry for my Debian WSL2 distro:

    export DISPLAY=$(ip route | awk '/^default/{print $3; exit}'):0
    

提交回复
热议问题