I'm a beginner in networking and try to setup multiple Ubuntu VMs on VirtualBox for the learning purpose.

For the multi-node Hadoop cluster setup,

I installed VirtualBox in my laptop and installed Ubuntu guest VM. Then i cloned the Ubuntu VM as another VM. Then, I modified Network of both VMs by adding adapter# 2 with Host-only option and also enabled the DHCP Server option under Host-only networks in the VirtualBox manager Preferences.

Then, I started both Ubuntu VM and updated below things on both VMs.

For First VM,

  1. sudo gedit /erc/network/interfaces

Added the below lines and saved,

auto eth1

iface eth1 inet static

address <--- Used for 2nd VM

  1. sudo gedit /etc/hosts

Added the below lines after the line localhost and deleted the line my-laptop,    Node1    Node2
  1. sudo gedit /etc/hostnale -- Updated the correct host name.

After these changes, I rebooted both VMs, internet is not working on both and not able to do SSH also. Please advise on this issue. I want to setup two Ubuntu VMs with static ip address and internet connectivity and need to do SSH between them.


First of all you need to understand the type of interfaces and their usage:

1) Host Only: Host only allows you to communicate with host computer only. So you can't use internet or communicate with other VMs.

2) NAT: NAT allows you to communicate with other VMs as well as you can use internet. But you can't access e.g. server running on this VM from other PC on the network.

3) Bridge: Apart from functionality provided by NAT, using Bridge you can access e.g. server running on this VM from other PC on the network.

Hope this helps. Try to test using different interfaces & it'll become more clear.


This is incomplete hint scenario that may need some experimentation to make it working but in theory it shall work.

In Virtual Box you shall have a NAT-LAN network adapter. Put on both virtual machines this network driver. Then devise a IP plan for new "internal" network of 'cluster' servers.

Say your PC has an IP from the range 192.168.56.x your virtual boxes could have 10.0.0.x addresses (see private IPv4 ranges)

In this setup your virtual boxes are separated from your internal network (as they become a subnet to your LAN).

You shall be able to get out to the internet (downloading, accessing sites via the NAT system), you shall also be able to see one VM from another VM (ftp/ssh/ports) but you will be unable to access these machines from your internal network (other pc's that are in your lan, even you shall be unable to access via the net these machines by using SSH from your hosting pc OS). Reason being - they are on two different networks.

This issue should be overcomed by setting a software router that would sit on 192.168.56.x and 10.0.0.x networks (can't give you exact recipe here) but I believe a third virtual machine with two virtual network cards (configured for these two networks) and IPfw or similar software router in function shall resolve the problem. Note that setting of software router is demanding work on its own.

It could also be possible that one of your virtual machines runs also a software router with more than one virtual network card (some being on nat, some being sitting in each network).

Caveat: You may need plenty of RAM and faster PC for this system to run smoothly (as you could be running 4 hosts parallely. Studying mentioned concepts here, will help you learn more about deployment.

  • read another answer given here that explains different network card setups. That is essential hint. Bridge type virtual network card may be used for routing, at any rate that is main 'bridge' function - being a bridge between 2 networks. note also that there is more than this one network scenario that you can be able to setup. – user309383 Aug 1 '14 at 9:41

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.