1

I'm not sure if my question makes sense, but I'll try to describe what I'm trying to do.

I have three machines A, B, and C. A is a work machine that is not exposed to the outside world. B is my machine at home that has SSH access, and A is able to SSH to B. I am able to connect to A from B if I connect to my work's VPN. C is a laptop I use on my university's network. Essentially I have the following:

+----VPN-----+
|            |
V            |
A----SSH---->B<--SSH--C

My university blocks all VPN connections and so I am not able to VPN to work. I was wondering if there was some way I could get around this block to be able to access my work machine?

Is there a way to "forward" a VPN connection, or perhaps set up a tunnel via machine B so that C can get to A? One rather convoluted idea I had was to set up a proxy on A to itself, forward the proxy port to B via an SSH connection, and then set up a tunnel from C to B via SSH to forward a local port to the proxy port on B. However, I wasn't really able to do the remote port forwarding once I had the proxy set up (SSH would just hang).

Is there a way to accomplish what I'm trying to do?

0

I think that as long as you maintain VPN connection between A & B you should be able to connect using ssh proxy magic.

Looks like this shall work for you:

foo@C:~ $ ssh -o ProxyCommand="ssh -W %h:%p <B>" <A>

This can be achieved also without VPN by maintaining permanent ssh connection from A to B with remote port forwarding

foo@A:~ $ ssh -R 2222:localhost:22 B # ensure that this connection is up forever

foo@C:~ $ ssh -o ProxyCommand="ssh -W localhost:2222 <B>" <A>

More hacks here: https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Proxies_and_Jump_Hosts

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.