Page 1 of 1

Unable to ssh to my Ubuntu VM

Posted: 1. May 2015, 14:50
by odsail
I'm having a difficult time getting my VM network setting setup correctly so I can ssh to it from my OS X host machine. I have OpenSSH Server installed and can connect to from within the VM. However, when trying to connect to it from the OS X Terminal Shell, no such luck. I've setup port forwarding on my network adapter as follows -

Code: Select all

vboxmanage modifyvm $VM_NAME --natpf1 "guestssh,tcp,,2222,,22"
. Is there something else I'm missing?

UPDATE: When I set the Network Adapter to Bridged, I can successfully ssh into the VM. Seems like it has something to do with the NAT and port forward. Ideally, I'd like to be able to connect to the VM(s) by hostname of the VM from a terminal session on my OS X environment. I did use this command to enable that without success.

Code: Select all

vboxmanage modifyvm $VM_NAME --natdnshostresolver1 on
Seems like when the (NAT) port forwarding is resolved this will likely work as well. Thanks!

Re: Unable to ssh to my Ubuntu VM

Posted: 2. May 2015, 12:50
by odsail
I was able to get this resolved by adding the port forwarding rule before powering up the VM. Still not able to connect by dns name so I've manually added an entry in the ~/.ssh/config file.

I also added the VirtuaBox guest additions.

Code: Select all

sudo apt-get install -y virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11