Linux – How to ssh into a remote host that is hidden behind a NAT router

linuxsshteamviewervpn

I can use TeamViewer to get into this remote host.

It has sshd running.

I would like to ssh to it. But it gives the system's IP as 192.168.xx.yy.

How do I ssh into it?

Best Answer

There are some possibilities to do this.

VPN

For a very easy way to make a VPN try Hamachi. Theres a Linux beta version. The advantage is that the VPN is set up VERY VERY easily. Just follow what the program has to say

If you want something more complex (heh.) but not tied to LogMeIn try an OpenVPN

This will not be very good though if you need to access it from multiple places, since you'd need to set up the VPN software for every one of them.

If this is the case, there is:

Port forwarding

Refer to portforward.com for tutorials on how to make the router of the destination PC forward the SSH port (22). This is very different on every router so I can't describe it universally.

Reversed SSH

I found a tutorial here which explains how to do reversed SSH connections (from the SSH server to the client). It only applies to you if your client is accessible from the outside world but your server isn't.