<p>I have the Xming X Window Server installed on a laptop running Windows XP to connect to some UNIX development servers. </p>

<p>It works fine when I connect directly to the company network in the office. However, it does not work when I connect to the network remotely over a VPN.</p>

<p>When I start Xming when connected remotely none of my terminal Windows are displayed.</p>

<p>I think it may have something to do with the DISPLAY environment variable not being set correctly to the IP address of the laptop when it is connected.</p>

<p>I've noticed that when I do an ipconfig whilst connected remotely that my laptop has two IP addresses, the one assigned to it from the company network and the local IP address I've set up for it on my "local network" from my modem/router.</p>

<p>Are there some configuration changes I need to make in Xming to support its use through the VPN?</p>

[{'answer_id': 4574, 'author': 'UberAlex', 'author_id': 170, 'author_profile': 'https://Stackoverflow.com/users/170', 'pm_score': 0, 'selected': False, 'text': '<p>Haven\'t have the exact problem, but I think you need to look at the xhost and make sure that the vpn remote is allowed to send data to the x server. </p>\n\n<p>This link might help:\n<a href="http://www.straightrunning.com/XmingNotes/trouble.php" rel="nofollow noreferrer">http://www.straightrunning.com/XmingNotes/trouble.php</a></p>\n'}, {'answer_id': 4683, 'author': 'grom', 'author_id': 486, 'author_profile': 'https://Stackoverflow.com/users/486', 'pm_score': 1, 'selected': False, 'text': "<p>I had nothing but problems with Xming. When I could get it to work it was extremely slow (this is over a VPN). IMO X is not designed to run over slow connections its too chatty. And by slow connection I mean anything less then a LAN connection.</p>\n\n<p>My solution was to use x11vnc. It lets you access your existing X11 session through VNC. I just ssh into my box through the VPN and launch:</p>\n\n<pre><code>$ x11vnc -display :0\n</code></pre>\n\n<p>That way I can access everything I had opened during the day. Then when I don't I just exit (<kbd>Ctrl</kbd>-<kbd>C</kbd>) in the terminal to close x11vnc.</p>\n"}, {'answer_id': 4691, 'author': 'Stephen Pellicer', 'author_id': 360, 'author_profile': 'https://Stackoverflow.com/users/360', 'pm_score': 4, 'selected': True, 'text': "<p>Chances are it's either X authentication, the X server binding to an interface, or your DISPLAY variable. I don't use Xming myself but there are some general phenomenon to check for. One test you can do to manually verify the DISPLAY variable is correct is:</p>\n\n<ol>\n<li>Start your VPN. Run ipconfig to be sure you have the two IP addresses you mentioned (your local IP and your VPN IP).</li>\n<li>Start Xming. Run 'netstat -n' to see how it's binding to the interface. You should see something that either says localIP:6000 or VPNIP:6000. It may not be 6000 but chances are it will be something like that. If there's no VPNIP:6000 it may be binding only to your localIP or even 127.0.0.1. That will probably not work over the VPN. Check if there are some Xming settings to make it bind to other or all interfaces.</li>\n<li>If you see VPNIP:6000 or something similar, take note of what it says and remote shell into your UNIX host (hopefully something like ssh, if not whatever you have to get a text terminal).</li>\n<li>On the UNIX terminal type 'echo $DISPLAY'. If there is nothing displayed try 'export DISPLAY=VPNIP:0.0' where VPNIP is your VPN IP address and 0.0 is the port you saw in step 3 minus 6000 with .0 at the end (i.e. 6000 = 0.0, 6010 = 10.0).</li>\n<li>On the UNIX host run something like 'xclock' or 'xterm' to see if it runs. The error message should be informative. It will tell you that it either couldn't connect to the host (a connectivity problem) or authentication failed (you'll need to coordinate Xauth on your host and local machine or Xhosts on your local machine).</li>\n</ol>\n\n<p>Opening Xhosts (with + for all hosts or something similar) isn't too bad if you have a locally protected network and you're going over a VPN. Hopefully this will get you started tracking down the problem. Another option that is often useful as it works over a VPN or simple ssh connectivity is ssh tunneling or X11 forwarding over ssh. This simulates connectivity to the X server on your local box by redirecting a port on your UNIX host to the local port on your X server box. Your display will typically be something like localhost:10.0 for the local 6010 port.</p>\n\n<p>X can be ornery to set up but it usually works great once you get the hang of it.</p>\n"}, {'answer_id': 4768, 'author': 'Greg Case', 'author_id': 462, 'author_profile': 'https://Stackoverflow.com/users/462', 'pm_score': 0, 'selected': False, 'text': '<p>You may have better luck doing <a href="http://tldp.org/HOWTO/XDMCP-HOWTO/ssh.html" rel="nofollow noreferrer">X11 Forwarding</a> through SSH rather than fiddling with your DISPLAY variable directly.  X11 Forwarding with SSH is secure and uses the existing SSH connection to tunnel, so working through a VPN should be no problem.</p>\n\n<p>Fortunately this is fairly straightforward with Xming.  If you open your connection from within Xming (e.g. the plink option) I believe it sets up X11 forwarding by default.  If you connect using another SSH client (e.g. PuTTY) then you simply need to enable X11 forwarding (e.g. \'ssh -X user@host\').  In PuTTY the option is under Connection -> SSH -> X11 -> click on \'Enable X11 Forwarding\'.</p>\n\n<p>Make sure Xming is running in the background on your laptop and do the standard X test, \'xclock\'.  If you get a message like \'X connection to localhost:19.0 broken (explicit kill or server shutdown).\' then Xming is most likely not running.</p>\n\n<p>Also, make sure you\'re not explicitly setting your DISPLAY variable in any startup scripts; SSH will set up an alias (something like localhost:10 or in the example above localhost:19) for the X11 tunnel and automatically set DISPLAY to that value.  Overwriting DISPLAY will obviously mean you will no longer be pointing to the correct X11 tunnel.  The flip side of this is that other terminals that don\'t have SSH X11 Forwarding set can use the same DISPLAY value and take advantage of the tunnel.</p>\n\n<p>I tend to prefer the PuTTY option but several of my coworkers use plink from within Xming.</p>\n'}, {'answer_id': 17796, 'author': 'David', 'author_id': 381, 'author_profile': 'https://Stackoverflow.com/users/381', 'pm_score': 3, 'selected': False, 'text': '<p>Thanks for the help @Stephen and @Greg Castle, using it I\'ve managed to resolve my problem.</p>\n\n<p>To provide a basic guide for others (from scratch):</p>\n\n<p><strong>Using Xwindows on a Windows PC to connect to a UNIX server over a VPN</strong></p>\n\n<p>What you need to start with:</p>\n\n<ul>\n<li><p>The Putty Telnet/SSH client, download putty.exe (for free) from:</p>\n\n<p><a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" rel="noreferrer">http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html</a></p></li>\n<li><p>The Xming X server, download Xming (for free) from: </p>\n\n<p><a href="http://sourceforge.net/project/showfiles.php?group_id=156984" rel="noreferrer">http://sourceforge.net/project/showfiles.php?group_id=156984</a></p></li>\n</ul>\n\n<p>What to do:</p>\n\n<ol>\n<li><p>Install both of the above on your Windows PC</p></li>\n<li><p>From the Windows start menu select: Programs -> Xming -> Xming</p></li>\n<li><p>Run the Putty.exe program in the location you downloaded it to</p></li>\n<li><p>In the PuTTY configuration screen do the following:</p>\n\n<ul>\n<li><p>Set the IP address to be the IP address of your UNIX server</p></li>\n<li><p>Select the SSH Protocol radio-button</p></li>\n<li><p>Click the SSH : Tunnels category in the left hand pane of the configuration screen</p></li>\n<li><p>Click the Enable X11 forwarding check-box</p></li>\n<li><p>Click the Open button</p></li>\n<li><p>Logon as usual to your UNIX server</p></li>\n<li><p>Check the directory containing the X windows utilities are in your path, e.g. /usr/X/bin on Solaris</p></li>\n<li><p>Run your X Windows commands in your putty window and they will spawn new windows on your desktop</p></li>\n</ul></li>\n</ol>\n'}, {'answer_id': 551575, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>putty + XMing - I had to set the DISPLAY environment variable manually to get things running (alongside with checking "Enable X11 forwarding" in putty - Connection/SSH/X11)</p>\n\n<p>export DISPLAY=0:10.0</p>\n\n<p>(it was set to "localhost:10.0", which did not work)</p>\n'}, {'answer_id': 27852421, 'author': 'Jack Kidwell', 'author_id': 4435124, 'author_profile': 'https://Stackoverflow.com/users/4435124', 'pm_score': 2, 'selected': False, 'text': "<p>I got Xming and PuTTY working with Cisco VPN by replacing the PuTTY configuration in <code>Connection &gt; SSH &gt; X11 &gt; X display location</code>, <code>localhost:0.0</code>, with <code>VPNIP:0.0</code>. <code>VPNIP</code> can be seen in the <code>VPN statistics client</code> <code>address information</code> by left-clicking on the <code>VPN client</code> lock icon and choose <code>Statistics...</code>.</p>\n\n<p>I didn't muck with the DISPLAY environment variable on the remote host. But, like others, I modified sshd_config on the remote host, adding these lines:</p>\n\n<pre><code>X11Forwarding yes\nX11DisplayOffset 10\nX11UseLocalhost yes\nAddressFamily inet\n</code></pre>\n"}, {'answer_id': 45979044, 'author': 'Ersel Er', 'author_id': 4681316, 'author_profile': 'https://Stackoverflow.com/users/4681316', 'pm_score': 2, 'selected': False, 'text': '<p>I have got same issue with Xming and Putty on a Windows 10 machine and found the solution <a href="http://blog.markusbordihn.de/2009/04/ssh-forwarding-with-putty-and-xming.html" rel="nofollow noreferrer">here</a>. I have overcome the problem just adding <strong>Tunnels</strong> to the session in PuTTY. But first you need to check;</p>\n\n<ul>\n<li><strong>sshd_config</strong> under /etc/ssh (in rhel7). </li>\n<li><strong>Enable X11 forwarding</strong> at left navigation pane <code>Connections &gt; SSH &gt; X11</code></li>\n<li><p><strong>iptables</strong> under /etc/sysconfig/ (in rhel7). If ports are blocked and you have permission, open the ports for 6000. I have added below line before first reject line to open ports from 6000 to 6003. It may be more specific in your case.</p>\n\n<p><code>-A INPUT -m state --state NEW -m tcp -p tcp -m multiport --dports 5901:5903,6000:6003 -j ACCEPT</code></p></li>\n</ul>\n\n<p>Then;</p>\n\n<ul>\n<li>Go to <code>Connections &gt; SSH &gt; Tunnels</code> in PuTTY and add a tunnel with <code>Source Port=6000</code>, <code>Destination=127.0.0.1:6000</code> and check <code>Remote</code> radio button. Then click the <code>Add</code> button. </li>\n<li>After your SSH connection established, set your DISPLAY variable manually with the command below:\n<br> <code>export DISPLAY=127.0.0.1:0.0</code></li>\n</ul>\n\n<p><strong>More Information;</strong>\n<br>\nIf you set <code>DISPLAY</code> variable as <code>127.0.0.1:1.0</code>, it will communicate over 6001 port . In this case, you need to add another tunnel for port number 6001.</p>\n'}, {'answer_id': 53330378, 'author': 'Alan Xie', 'author_id': 10660573, 'author_profile': 'https://Stackoverflow.com/users/10660573', 'pm_score': 0, 'selected': False, 'text': '<p>You have to add the Linux machine\'s DNS name(s) and IP address to the C:\\Program Files\\xming\\X0.hosts file. File should contain:</p>\n\n<pre><code>LinuxBox.mydomain.com\nLinuxBox\n192.168.1.25\n</code></pre>\n\n<p>This is the right answer: <a href="https://www.slackwiki.com/X_Windows:_Remote_X_to_Windows_with_Xming" rel="nofollow noreferrer">https://www.slackwiki.com/X_Windows:_Remote_X_to_Windows_with_Xming</a></p>\n'}]
['https://Stackoverflow.com/questions/4519', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/381/']