I have two virtual machines running in Virtualbox. I have Minix running in one, Linux Mint in the other (and windows on the host machine). I need to ssh from Linux Mint to Minix (so I want to open a terminal in Linux Mint that controls the Minix machine).

I can ssh from the host to minix. I do this using port 2222 on my host machine (which is forwarded to port 22 on the guest machine).

I then tried to forward port 2222 on linux mint to port 2222 on the host machine. This doesn't work however (in fact, when I try this, I can't ssh from my host machine anymore: I have to shutdown the virtual machine for this to become possible again).

I also tried using a different port instead of 2222, but this doesn't make a difference. How can I ssh from Linux Mint into Minix?


There are three ways to do this. All of them involve changing the network type for your guests.

You can set up a host-only network. Your guests will have a virtual LAN that they can use to communicate with each other. The host will also get an interface to the LAN, so the host and the guests can all talk to each other. Virtualbox will let you set up a DHCP server for the LAN.

Alternately, you can change each of the guests to use a bridged network. With bridging, the guest will have direct access to your host's network connection. So each of the guests will be just like a real computer on your local network.

Last, Virtualbox 4.3 added a NAT network feature. It's currently marked as experimental, and I found it to be a little flaky, but you can try it. NAT network also provides a virtual network that the guests can use to communicate with each other, like the host-only network. NAT network also provides a NAT connection to the host's physical network. You can set up port forwarding to let the host (or other computers) access the guests.

  • Good post (I don't have the reputation to upvote though)! Could you elaborate a little? Right now I'm trying to set up a NAT network (option 1 seems complicated, and it seems you have to use a device driver at the host to use a bridged network, which I'd rather avoid). I still want to be able to connect to the internet on both VM's, so I set up the NAT network at adapter 2. When I use ports, won't the VM use the first adapter? I don't understand what the NAT network is doing... – Mon Kee Poo Apr 3 '14 at 19:10

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.