Skip to header Skip to main navigation Skip to main content Skip to footer

User account menu

  • Log in
Home
Blog

Main navigation

  • Forum
  • Home

WSL 2 host IP access issue for XWin DISPLAY:0.0

Breadcrumb

  • Home
  • Forums
  • Knowledge Base
  • How-To
  • WSL 2 host IP access issue for XWin DISPLAY:0.0
By ongetc | 6:29 PM MDT, Sun March 21, 2021

There are a lot of information on how to enable/install WSL 2 and setup XWin type of configuration so this how-to will just focus on the important part.

Note: I like XWin but you can also use XRdp instead of XWin https://medium.com/@apph/desktop-gui-using-wsl2-xrdp-a870a2d32df8

Assumption:

. You already have WSL 2 enabled and installed if not here is one of them.

https://docs.microsoft.com/en-us/windows/wsl/install-win10

# PowerShell command to manually enable VM feature for wsl 2

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

. You already install some form of XWin server but if not here is one of them.

https://sourceforge.net/projects/vcxsrv/

. You already install one of the Linux distribution if not here is one of them

https://devblogs.microsoft.com/commandline/debian-gnulinux-for-wsl-now-…

At this point, you will have a running Linux distribution in WSL 2.

Here are a few things you need to check before you attempt to run "xterm &" to show on your XWin server.

WSL things:

# see what was in WSL 2
wsl -l -v

# download wsl 2 Linux kernel update and install before you do the next line

https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

# enable VM support

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

# set WSL 2 as your default
wsl --set-default-version 2

# set your Debian distribution to use WSL 2
wsl --set-version Debian 2

Linux distribution things:

# run these commands to make sure your Debian distribution is clean and up to date

sudo apt-get clean && sudo apt-get autoremove && sudo apt-get update --fix-missing && sudo apt-get upgrade --fix-missing

# Set your WSL 2 host as your Xwin host IP by add these two lines to your .bashrc

#export DISPLAY=:0 # in WSL 1
#export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0 # in WSL 2
#export LIBGL_ALWAYS_INDIRECT=1

export DISPLAY="`grep nameserver /etc/resolv.conf | sed 's/nameserver //'`:0"
echo $DISPLAY

# MOST important part to make "xterm &" to display on your XWin server by adding a firewall rule on your Windows 10 PC to allow loop back from your Linux distribution from WSL 2

# Make sure you firewall rule allow VcXSrv on your private or/and public network

###### run this command in PowerShell with administrator permission
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow
######

That's it.

Happy Linux on Windows 10!

How-To

Reseller hosting (free)

Hosting24 (w/ ssh)

A2 Hosting

Popular content

MosDashBoard4SB
COAddOns
MosModule: How to show contact form in content?
MosModule: How to use snippet?
MosModule: Can MosModule be used in custom HTML module?
MosModule
MosCom
MoseCMS
MosPrayerLatestX
MosNewsWriter
Pagination
  • Current page 1
  • Page 2
  • Page 3
  • Page 4
  • Page 5
  • …
  • Next page next ›
  • Last page »
more
Subscribe to Syndicate

Copyright © 2026 OngETC - All rights reserved

Developed and Designed by CO