How to set up working X11 forwarding on WSL2
问题 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 WSL2 on Windows 10 as I did with WSL1? 回答1: TL;DR: Add the following to your ~/.bashrc : export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0 export LIBGL_ALWAYS_INDIRECT=1 Enable Public Access on your X11 server for Windows.* Add a separate inbound rule for TCP port 6000 to the windows firewall