Linux – SSH remote access vpn tunnel

linuxsshssh-tunneltunnelingvpn

I have two machines both running CentOS linux, one is public facing machine with a real ip address (foo). The other is at a client's site behind a very restrictive firewall and with no real ip and no possibility of natting or opening an port to it (bar).

I can ssh from bar to foo, however obviously not the other way round.

Ideally I would like to be able to ssh from foo to bar so I am able to send file, work remotely, etc. Would really appreciate any help or advice on how best to get this working, have seen various tutorials on the internet which suggest it should be possible to setup a VPN connection over ssh but can't quite seem to figure it out.

Jona

Best Answer

Under Centos the answer appears to be as follows:

on bar (the restricted machine) run the following command:

ssh -N -R 1234:localhost:22 foo.theinternet.com

then on foo (the open machine) run:

ssh -p 1234 localhost

I suspect there are refinements to be made to this, but hopefully it will be enough to get any googlers started.

Thanks to pkaeding for putting me on the right track.