I am trying to create a network using 3 virtual Ubuntu machines (master, slave1, slave2).

I hope posting this question here is acceptable. I'm not sure if the problem lies within Virtualbox configuration or inside my virtual machines. I expect the latter, so I asked my question here.

Host: Windows 7, using Virtualbox 4.2.8, network type is set to NAT. All machines have different MAC addresses. My VMs only need to communicate to each other, host machine serves as router.
master: Ubuntu 14.04
slave1: Ubuntu 14.04
slave2: Ubuntu 14.04

Instruction I'm trying to follow: http://mpitutorial.com/tutorials/running-an-mpi-cluster-within-a-lan/

I want to create an SSH key on master, share it with slave1 and slave2. I should be able to use this command on master:

ssh-copy-id slave1

to copy the ssh key to slave1 (and in the same way to slave2)

Error I get:

ERROR: ssh: connect to host slave1 port 22: No route to host

What is wrong with my configuration and how do I diagnose the problem?

I have tried different IP settings and addresses in hosts file, I run this command after making changes:

sudo /etc/init.d/networking restart

Master hosts file:   localhost   user-VirtualBox   master   slave1   slave2

slave1 hosts file:   localhost   user-VirtualBox   master   slave1   slave2

master IPV4 settings

DNS servers: (empty)

slave1 IPV4 settings

DNS servers: (empty)
  • 1
    You dont want to set your network in Virtualbox to NAT. I am not infront of my PC right now but you want to set it to the option for an independant LAN. In essence you create your own virtual switch and the clients connect to that. When I am infront of my PC later I will take a look. – hatterman Mar 15 '16 at 5:53
  • 1
    OK I got infront of my box quicker than I thought ! In the network section of each VM's settings, select "internal network". Make sure all 3 VMs are connected to the same internal network and try again. Also, on each VM, make sure ssh is allowed through the firewall, or just turn the firewall off... you are on an internal network after all. – hatterman Mar 15 '16 at 6:06
  • @hatterman thanks for your help, it got me on the right track. Had to enable promiscuous mode as well. Now VMs can see each other and I can proceed. – afaf12 Mar 15 '16 at 17:59

Selecting Internal network will mean your host machine has to do the routing. which is fine for normal workloads.

an alternative option would be to use a "Bridged connection" and assign different IPs as you've mentioned. This way you LAN side router should take care of the routing.

  • I too have learned something new today. – hatterman Mar 15 '16 at 18:02

I had to use "Internal network" as suggested by others, VMs could still not see one another. The problem was in advanced settings, I had to enable promiscuous mode, allow VMs. I had used a network of physical machines before, so this was something new. Once I found out VMs were blocking each other, only had to find out why.

enter image description here

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.