Take the 2-minute tour ×

Here's the scenario:

I have a desktop, running Windows 7 Ultimate. This desktop has VMware Workstation on it, and a virtual machine running a custom linux, that has OpenSSH installed and working.

The desktop gets its internet from a router, which assigns it an IP of (always, using DHCP address reservation). The virtual machine is setup to use bridged networking, and gets the IP (again, always).

This desktop is inaccessible from the outside world, the router isn't the only thing separating it from the modem with the real IP. Hence, I use a proprietary VPN program (TeamViewer), which allows me to connect to this desktop from anywhere.

Here's the problem:

Running a screen sharing program (RDP or TeamViewer) to be able to type commands into a text based virtual machine is slow, wastes bandwidth, and cumbersome. If I can SSH directly into the virtual machine it would be much easier, therefore the VPN's traffic will be only that of SSH.

The VPN assigns an IP for me, and an IP for the desktop. Let's say the desktop's is

My question is, how can I SSH into, and have the desktop correctly forward the incoming SSH connection into the virtual machine?

I though this should do:

 netsh interface portproxy add v4tov4 listenport=22 connectport=22 connectaddress=

But it didn't. Anyone know why?

Can anyone suggest something else? Maybe a simple program that can do proper port forwarding between different interfaces on a Windows machine?

If it helps, I do have a Linux machine, with a real IP, that I can use to create a tunnel from the VM into it, and then SSH from there, any help with how to setup that, is appreciated, but I'd rather avoid it if possible.

share|improve this question
Unclear to me why you must go thru the desktop. Anything you can do with TeamViewer on the desktop you can also do with any VNC variant in the VM and port-forwarding in the router. –  harrymc Feb 14 '13 at 15:45
like i said, port forwarding in the router isnt an option, there's more than 1 NATing device the desktop is behind, i have to configure them all, and i believe the second one, a custom firewall is out of bounds for me to touch. –  Waleed Hamra Feb 15 '13 at 8:20
add comment

2 Answers

up vote 2 down vote accepted

AFAIK, the TeamViewer VPN is only able to connect to the host running the TeamViewer and it doesn't route the traffic to other hosts on the LAN (e.g. the virutal host coz it has a bridged interface). Therefore with only the TeamViewer VPN it is not possible to access any hosts on the LAN. See page 21 of the TeamViewer manual:

Note: If you connect your local computer to the remote computer via TeamViewer VPN, only those two computers will be linked together in a virtual private network. No other computers in the LAN of either computer will be accessible.

I am wondering if setting routing manually on your Windows 7 workstation can help, so that it can route traffics between the TeamViewer VPN (the network) adapter and its LAN (e.g. adatper. Instructions to setup routing and remote access service in Windows 7 can be found here: http://answers.microsoft.com/en-us/windows/forum/windows_7-networking/how-to-enable-ip-routing-in-windows-7/8970e722-e947-460d-80d5-fd6ffc850f3f

Alternatively, you may try setting up other VPN solutions (I recommend OpenVPN) on the Windows 7 workstation, then access it via your TeamViewer VPN, and finally SSH to the virtual host directly.

Certainly, if you have access to the routers and other NAT and firewall devices between Internet and your Win7 workstations, you may directly forward necessary ports to use OpenVPN directly and skip the TeamViewer VPN.

share|improve this answer
thank you, changing the registry, and enabling the service, allowed my netsh command to work. now windows is forwarding ports properly :) –  Waleed Hamra Feb 15 '13 at 20:01
add comment

For these kind of things I always used the last free version of PortTunnel

Here is a link to PortTunnel v1.6.10.197 (I've uploaded this version from my utilities archive, to my knowledge this is the last free version) PortTunnel v1.6.10.197

Anyway, I didn't understand the VPN/Temaviewer thing:

  • it's teamviewer that create the VPN?
  • Or you have a VPN (created by some other software), and use the VPN to connect to the desktop using teamviewer?
  • is the IP the VPN endpoint on your computer? So it's like another network card installed on your computer?

Things to check:

  • is there any kind of connection filtering enforced by the software that create the VPN?
  • maybe that is the windows firewall that is doing something strange... have you tried to disable the windows firewall?
  • have you checked how windows have identified the VPN network? (maybe windows think the VPN network is a public network and then block any not explicitly permitted connection...)

Things you can try to do:

  • Try to create a specific port tunnel that listen on and forward to (you can try using PortTunnel... but it should work even using netsh)
share|improve this answer
add comment

Your Answer


