I have the Xming X Window Server installed on a laptop running Windows XP to connect to some UNIX development servers.
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.
When I start Xming when connected remotely none of my terminal Windows are displayed.
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.
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.
Are there some configuration changes I need to make in Xming to support its use through the VPN?
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:
Start your VPN. Run ipconfig to be sure you have the two IP addresses you mentioned (your local IP and your VPN IP).
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.
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).
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).
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).
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.
X can be ornery to set up but it usually works great once you get the hang of it.
Thanks for the help #Stephen and #Greg Castle, using it I've managed to resolve my problem.
To provide a basic guide for others (from scratch):
Using Xwindows on a Windows PC to connect to a UNIX server over a VPN
What you need to start with:
The Putty Telnet/SSH client, download putty.exe (for free) from:
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
The Xming X server, download Xming (for free) from:
http://sourceforge.net/project/showfiles.php?group_id=156984
What to do:
Install both of the above on your Windows PC
From the Windows start menu select: Programs -> Xming -> Xming
Run the Putty.exe program in the location you downloaded it to
In the PuTTY configuration screen do the following:
Set the IP address to be the IP address of your UNIX server
Select the SSH Protocol radio-button
Click the SSH : Tunnels category in the left hand pane of the configuration screen
Click the Enable X11 forwarding check-box
Click the Open button
Logon as usual to your UNIX server
Check the directory containing the X windows utilities are in your path, e.g. /usr/X/bin on Solaris
Run your X Windows commands in your putty window and they will spawn new windows on your desktop
I got Xming and PuTTY working with Cisco VPN by replacing the PuTTY configuration in Connection > SSH > X11 > X display location, localhost:0.0, with VPNIP:0.0. VPNIP can be seen in the VPN statistics client address information by left-clicking on the VPN client lock icon and choose Statistics....
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:
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
AddressFamily inet
I have got same issue with Xming and Putty on a Windows 10 machine and found the solution here. I have overcome the problem just adding Tunnels to the session in PuTTY. But first you need to check;
sshd_config under /etc/ssh (in rhel7).
Enable X11 forwarding at left navigation pane Connections > SSH > X11
iptables 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.
-A INPUT -m state --state NEW -m tcp -p tcp -m multiport --dports 5901:5903,6000:6003 -j ACCEPT
Then;
Go to Connections > SSH > Tunnels in PuTTY and add a tunnel with Source Port=6000, Destination=127.0.0.1:6000 and check Remote radio button. Then click the Add button.
After your SSH connection established, set your DISPLAY variable manually with the command below:
export DISPLAY=127.0.0.1:0.0
More Information;
If you set DISPLAY variable as 127.0.0.1:1.0, it will communicate over 6001 port . In this case, you need to add another tunnel for port number 6001.
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.
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:
$ x11vnc -display :0
That way I can access everything I had opened during the day. Then when I don't I just exit (Ctrl-C) in the terminal to close x11vnc.
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.
This link might help:
http://www.straightrunning.com/XmingNotes/trouble.php
You may have better luck doing X11 Forwarding 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.
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'.
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.
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.
I tend to prefer the PuTTY option but several of my coworkers use plink from within Xming.
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)
export DISPLAY=0:10.0
(it was set to "localhost:10.0", which did not work)
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:
LinuxBox.mydomain.com
LinuxBox
192.168.1.25
This is the right answer: https://www.slackwiki.com/X_Windows:_Remote_X_to_Windows_with_Xming
Related
I haven't found a question fitting the exact parameters of my situation (please excuse me if I have missed it).
For the last year remote work has been nothing but a blessing, it's the perfect set-up for me and my productivity has skyrocketed. The one blemish I'm still facing is when it comes to accessing work apps and machines (via ssh) for which a connection to the work network is required.
For that I use my work laptop and assorted VPN connection (using F5 Big IP) while most of my dev work/meetings/emailing/etc takes place on my comfortable personal desktop. Working on the work laptop is a miserable affair, it has a tiny, low-res, TNT, 12" panel while my personal PC has two 27" displays.
I would very much like, on the personal PC, to be able to use a dedicated browser plugged into an ssh tunnel running on the laptop to access work-network only apps and to ssh into work machines.
Both machines are running Windows 10, which is fine for my personal PC as all my dev work takes place through WSL2/Docker but is really painful on the work laptop because it's a pre-WSL2 version.
Both PCs use my home wifi connection, through which the work laptop connects to the VPN.
I'm wondering how to go about achieving that ssh tunnel to the work laptop since, once connected to the work VPN, the laptop isn't visible anymore on the local network.
I've been thinking of trying to hook them up via ethernet and use that second connection as the support for the ssh access but I'm not sure that'd work or how to go about it.
Any help would be much appreciated, thank you for taking the time to read this.
Setup a Reverse SSH Tunnel
In short you connect from your laptop to your Windows10 Box using ssh.. (You will need to run sshd on Windows 10) either via Windows or via cygwin or a virtual machine. Once you have that working you can use the OpenSSH "Reverse tunnel" feature which binds a port on your Windows Box and when your connect to it that opens a connection to your Laptop.
This example uses port 22 but you could use any TCP based port. (e.g. 3389 is RDP)
Let's assume that Destination's IP is 192.168.20.55 Laptop that you want to access).
You want to access from Windows10 desktop with IP 138.47.99.99.
Destination (192.168.20.55) <- |NAT| <- Source (138.47.99.99)
SSH from the destination to the source (with public IP) using the command below:
ssh -R 19999:localhost:22 sourceuser#138.47.99.99
port 19999 can be any unused port.
Now you can SSH from source to destination through SSH tunneling:
ssh localhost -p 19999
3rd party servers can also access 192.168.20.55 through Destination (138.47.99.99).
Destination (192.168.20.55) <- |NAT| <- Source (138.47.99.99) <- Bob's server
I HAVE FIXED THIS ISSUE. Please read answer below
I have installed shiny-server on Ubuntu 14.04.4 LTS with VirtualBox. After forwarding port 3838 in my router and setting a bridged network, then assigning a static IP to my virtual Ubuntu machine, I am being able to connect remotely, from a computer outside from my network and visualize the "hello" example app page, but only the HTML code is rendered.
Both R and markdown iframes are not working (connection is reset and they are grayed). On the other hand, I can perfectly browse the hello application from both, my host computer of from the guest machine itself.
The ports are open, I have checked it with a remote computer. My host computer runs on Windows 10 and I have also configured the firewall to allow TCP/UDP in/out traffic through port 3838.
I have got shiny server working on host 0.0.0.0 after running the command options(shiny.host="0.0.0.0") on RStudio but I still only can see the ui.R controls rendered and nothing from server.R that is still grayed.
Any idea of what can be causing this behaviour?
In order to get shiny server running I have followed the official installation guide in www.rstudio.com/products/shiny/download-server/ as mentioned before.
There are a few details that allowed me to make it run from a remote host (a computer outside my network connecting via Internet).
Installing packages always as root user so that they are shared among every user, ie, sudo su - \ -c "R -e \"install.packages('shiny', repos='....... (I cannot post more than 2 links yet :(
Setting Shiny host to 0.0.0.0, but running on R studio this command: options(shiny.host="0.0.0.0")
Opening ports 3838 TCP and UDP, both in and out on my host's firewall.
Opening separately UDP and TCP ports in my router; not "TCP and UPD" but first TCP and then UDP.
Opening the previous ports by the range 3838-3840, not just the 3838 one. This is not something I can give an explanation about since I was expecting that 3838 would be sufficient because shiny-server is running on host 0.0.0.0:3838; but in my case I needed to do it.
In order to make it easier, I assigned a fixed IP to the computer running shiny server. click here to see network connection image
Here is a screenshot of my router configuration just in case someone finds it useful:
Click here to see router port forwarding for shiny image
I'm trying to use NETSH PORTPROXY command to forward packets sent to my XP PC (IP 192.168.0.10) on port 8001 to port 80 (I've a XAMPP Apache server listening to port 80).
I issued the following:
netsh interface portproxy add v4tov4 listenport=8001 listenaddress=192.168.0.10 connectport=80 connectaddress=192.168.0.10
Show all confirms that everything is configured correctly:
netsh interface portproxy show all
Listen on IPv4: Connect to IPv4:
Address Port Address Port
--------------- ---------- --------------- ----------
192.168.0.10 8001 192.168.0.10 80
However, I'm not able to access apache website from http://localhost:8001. I'm able to access through the direct port at http://localhost as shown below.
Additionally, I've also tried the following:
1. Access the Apache website from a remote PC using the link: http://192.168.0.10:8001. Firewall turned off.
2. Changing listenaddress and connectaddress to 127.0.0.1.
Without further information, I can't find a way to resolve the problem. Is there a way to debug NETSH PORTPROXY?
Note: By the way, if you're wondering why I am doing this, I actually want to map remote MySQL client connections from a custom port to the default MySQL Server port 3306.
I managed to get it to work by issuing:
netsh interface ipv6 install
Also, for my purpose, it is not required to set listenaddress and better to set connectaddress=127.0.0.1, e.g.
netsh interface portproxy add v4tov4 listenport=8001 connectport=80 connectaddress=127.0.0.1
If netsh's port proxying is not working as expected, then you should verify the followings, preferably in that order:
Make sure the port proxy is properly configured
Start or restart the related Windows service
Ensure support for IPv6 is installed
Make sure the port is not blocked by a firewall
Make sure the port proxy is properly configured
This might seems to be trivial, but just in case, take the time to review your configuration before you go any further.
From either a command prompt or PowerShell prompt, run the following command:
netsh interface portproxy show all
The result should look something like this:
Listen on ipv4: Connect to ipv4:
Address Port Address Port
--------------- ---------- --------------- ----------
24.12.12.24 3306 192.168.0.100 3306
24.12.12.24 8080 192.168.0.100 80
Carefully review those settings. Make sure that you can indeed connect to the addresses on the right side of that list, from the local computer. For example, can you locally open a web browser and reach 192.168.0.100:80? If the protocol is not HTTP, then use telnet: telnet 192.168.0.100 3306 (see here for how to install the Telnet client on Windows).
Then, are the values on the left side correct? Is the IP address valid for your machine? Is that the port number you are trying to connect to, from the external machine?
Start or restart the related Windows service
On latest versions of Windows, netsh's port proxying is handled by a Windows service named "IP Helper" or "iphlpsvc". Proxying will obviously not work if that service is stopped. I have also faced situations that turned out to be resolved by restarting that service.
To do that in latest versions of Windows:
Open the Task manager, then go to the Services tab.
In the "Name" column, find the service named either "iphlpsvc" or "IP Helper".
Right click on that service, then select Restart. If restart is not available, then the service is probably stopped, and actually has to be started, so select Start.
On previous versions of Windows, look for Services in Administrative Tools, inside the Control Panel.
Ensure support for IPv6 is installed (older releases of Windows only)
On earlier versions of Windows (that is Windows XP, for sure, upto some early releases of Windows 10, apparently, though this is not clear), netsh's port proxying feature (including for IPv4-to-IPv4 proxys) was actually handled by a DLL (IPV6MON.DLL) that was only loaded if IPV6 protocol support was enabled. Therefore, on these versions, support for the IPv6 protocol is required in order to enable netsh's port proxying (see Microsoft's support article here).
From either a command prompt or PowerShell prompt, run the following command:
netsh interface ipv6 install
If you get an error indicating that command interface ipv6 install was not found, then it means that you are using a recent release of Windows, in which netsh's IPv6 support is implicit and cannot be disabled.
Make sure the port is not blocked by a firewall
A local firewall may potentially block the port even before they reach the IP Helper service. To make validate this hypothesis, temporarily disable any local firewall (including Windows' native firewall), then retest. If that works, then simply add a port exclusion to your firewall configuration.
I have the problem with you. I have solve it just now. There is a Windows Service named "IP Helper" that supplies the funcions tunnel connections. You should ensure it has been started.
You must Run Command.exe as Administrator first, by right-clicking the Command Prompt icon and choosing Run as Administrator. You will asked to confirm.
Paste your netsh Command in the command.exe window and press Enter.
If no error message is shown, the command worked.
In your web browser go to http://your-up:8001 to see it works.
The Windows Event Log might have information to help find the cause of a failure.
I am trying to share the internet with the Beaglebone Black from my laptop. Here is what I tried till now-
I connected Beaglebone Black to my laptop running Windows 8 via USB cable. Then, I went to network and sharing center. Then, the network which I want to share, I shared it with the Beaglebone(It says Local Area Connection). Now, I went to the Gate one SSH on Beaglebone and wrote - "ping www.google.com". But it said "Unknown Host".
Now, since the above didn't work, I connected the Beaglebone Black with the standard ethernet cable and again tried sharing my network, but it still didn't work.
Here is what I am trying to do-
If I am able to connect to internet, I want to set up VNC server and through that I want to load the GUI of linux on my laptop.
Any help will be greatly appreciated. If there is any other method to accomplish this, please tell me about it. I have tried most of the tutorials on the internet, but didn't succeed.
Here is the detailed answer, after long long waiting I finally figured out how to share internet on BBB. This question is being seen at least 10 times everyday so I though I should answer it by my own. (Also SO gave me Popular question badge for this!)
First thing I tried was:
I connected the BBB(running angstrom) to laptop (running windows 8). The laptop recognized the device and I was able to SSH it through putty.
Now, I tried to ping my computer back whose IP address is 192.168.7.1 .. This step never worked for me, my BBB was never able to ping my computer back but, I was able to ping the beaglebone itself through the provided IP that is 192.168.7.2 (which is obvious)
I searched everywhere on internet and did everything to overcome this glitch such as:
I made the default gateway in BBB to 192.168.7.1
/sbin/route add default gw 192.168.7.1
but that also didn't worked.
I previously thought that it is necessary for me to ping 192.168.7.1 in order to get the internet on BBB.
Since nothing was working I decided to skip this step.
I simply connected the BBB, and then went to network and sharing center in windows 8 and from there, I shared the internet connection from my wifi connection to the beaglebone.
As you will do this, you will see that BB will loose its connection from the putty (if you started putty before network sharing), This is because computer assigns an IP to the BB which you have to change to 'Obtain the IP automatially'
To do this right click and go to properties of the BB connection and then from the list select the IPV4 tcp/IP and go to its properties. In that, you will see the option 'Obtain IP automatically'
Now again start putty (as previous connection will get terminated) and you will see that BB is able to connect.
Now simply add the default gateway as I showed above and then you will be able to ping 8.8.8.8 or any other IP address. Now, simply add the nameserver like this:
cd /etc
more resolv.conf
nano resolv.conf
and add this line below nameserver 127.0.0.1
nameserver 8.8.8.8
and save it, you will be able to ping google.com.
Now comes the VNC server part. For that case also I was wrong. To connect to VNC server you do not need internet connection on the BBB. Yes, you will need that for installing the VNC server on it but not afterwards. Once it is installed, you have to simple do this in BB:
x11vnc -bg -o %HOME/.x11vnc.log.%VNCDISPLAY -auth /var/run/gdm/auth-for-gdm*/database -display :0 -forever
and press enter and BB will reply with VNC started at port 5900
Thats it, now comeback to windows and start VNC server, add the address 192.168.7.2 and you can see the GUI on the screen. I am also able surf internet on the beaglebone.
Thank you for the support and if I am wrong here in my question then please notify me.
Also if you have any doubt, refer to this awesome video my derek molloy: He has explained it very well and remember to skip the step of pinging back 192.168.7.1 if it is not working.
I have not yet figured it out. I will edit the answer once I get it.
1) On your Beaglebone:
sudo su
ifconfig usb0 192.168.7.2
route add default gw 192.168.7.1
2) Now share the network and make sure your pc's ip is 192.168.7.1 after you do
connect beaglebone black to router via ethernet
now use
adb tcpip 5555
adb connect bbb_ip:5555 then use adb shell
The problem you're facing is of resolving nameservers. If you're able to access the device through SSH (using PuTTy, for example), then you can provide it internet too- but the device needs to know where to look for.
The BeagleBone Black has a utility called Connman that manages its connections.
/usr/lib/connman/test has functions related to it.
Use ./set-ipv4-method in there to set different values. Be sure to set the nameservers right. If in doubt, use 8.8.8.8 as the only entry. Also note that the gateway for your BeagleBone must be your computer.
If you're not a newbie and need more detailed instructions, see this.
To continue from the answer provide by Vikas Arora, 3 things you have to do primarily to provide ethernet over usb connection to your Beaglebone. Firstly, share your PC internet connection with the local network made with Beaglebone, a process well explained above. And also setting up the IP address to be obtained automatically.
Secondly, setting up the nameserver to the public DNS server address 8.8.8.8 also explained above. But this setting is not persistent i.e. once you reboot, the settings will be lost. It is because the network manager on Angstrom 'connman' resets the etc/resolv.conf on startup. To correct that I disabled the connman service on my device by going to /lib/systemd/system and
firing commands
systemctl stop connman.service
systemctl disable connman.service
This will make your nameserver file persistent and you can always start connman service again if you need.
Thirdly you have to set your gateway to the address of your internet sharing machine also explained above. But this setting is also not persistent. To do that make a script like below in your home directory
echo "********Setting up the default gateway"
route add default gw 192.168.7.1
and make a service that will kick off on startup and trigger your script. A process well explained at
https://askubuntu.com/questions/506167/how-do-you-save-the-routing-table-on-the-beaglebone-blackangstrom
and
http://mattrichardson.com/BeagleBone-System-Services/
I am using VMWare Player 3.1.0 on Host OS Windows 7 Professional 64-bit. My guest is is SUSE Linux ES 10. My guest OS (SUSE) runs JBoss App Server which I access from host using HTTP. I used a "Bridged" connection to set up all this.
My problem:
When I am connected to network on the Host (using wired network adapter) I can connect to the http server on the Guest OS and browse the application. However, when I am disconnected from the network on Host (unplugged the wire), I cannot access to the guest OS app server and browse the application. I use the guest OS ifconfig command to find out ip address of the guest OS. This ip address does not change whether connected or disconnected. I have even tried using Wireless Data card, but that does not work either.
I have tried "NAT" as well as "Host Only" connection and rebooted the guest but it does not work either. I think for some reason the guest OS can only recognize the physical network card (which is disconnected).
I need to run this machine (my laptop) independently of the network because I use this for demo and need to be able to connect from my host OS to Guest OS.
I am not sure I understand exactly what you are trying to do, but I do know setting up a working NAT configuration will offer you the most flexibility.
Click the networking icon and select settings, Select NAT.
Follow these steps on your Unix OS
cd /etc/sysconfig/network-scripts
Make a backup of your ethernet adapter configuration
cp ifcfg-eth0 ifcfg-eth0.bak
Next modify the settings to look like the following:
DEVICE="eth0"
BOOTPROTO="dhcp"
HWADDR="What ever was here on your system"br/>
NM_CONTROLLED="yes"
ONBOOT="yes"
Save your changes
Restart your network adapters
/etc/init.d/network restart
Try nslookup www.google.com
You should now be able to connect back and forth from your Windows Host and Linux guest.
theJay28
-p.s. I had screenshots, but I do not have the 10 points yet to post images.
I figured that the solution is to restart the VM after making the changes to the NetWork setting on the VMWare. I selected Network for the VM as "Host Only" shutdown the VM and started it again. After that I was able to do what I wanted to do (i.e. browse the web application on guest from the browser in the host machine) without connecting the host to the network.
So key to the solution in my case was to make the network changes and restart the VM.
Any comments suggestions welcome...