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,
sudo gedit /erc/network/interfaces
Added the below lines and saved,
auto eth1
iface eth1 inet static
address 192.168.56.101 <--- Used 192.168.56.102 for 2nd VM
netmask 255.255.255.0
sudo gedit /etc/hosts
Added the below lines after the line 127.0.0.1 localhost and
deleted the line 127.0.1.1 my-laptop,
192.168.56.101 Node1
192.168.56.102 Node2
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.
Best Answer
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.