Ubuntu – How to ssh into the Ubuntu VM when the Mac is on a VPN

mac-osxsshUbuntuvirtualizationvpn

I can ssh into my Ubuntu VM (running in VMware Fusion) when I'm not on my employer's VPN. (It works both when the VM's network connection is NAT and bridged.) But when I connect to the VPN, I can no longer ssh into my VM:

$ ssh 172.16.193.128
ssh: connect to host 172.16.193.128 port 22: Operation timed out

I've tried with the network connection as NAT and bridged, and have the same problem. I've even tried switching from bridged to NAT after connecting to the VPN.

I can ping my Mac from the VM while connected to the VPN.

What is causing this problem? Any advice troubleshooting it? Is there a workaround?

(Note that I want to be able to ssh into the VM so I can mount its filesystem using MacFUSE and edit files using my Mac OS X editor, etc.)

Best Answer

My suspicion is that, when you connect to the VPN, it alters the routing tables on your computer, and redirects that route to the VPN. I believe running netstat -r while both connected and disconnected from the VPN, and diffing the results, would be the way to test for this.

I assume that you can not ping the VM from the Mac when connected, but can when disconnected.

I believe you can work around it by using a reverse SSH tunnel. (Here is one explanation on how to do it -- note that I haven't actually tried it.)

Alternately, does the VM have any other way to access it? Can you use mDNS (Bonjour) to connect, say, using hostname.local, where hostname is the VMs hostname?