This blog will walk you through setting up three different fedora VMs : ram, daisy and rincy; who will be talking to each other and also with the host machine; very soon…
- 3VMs already setup inVirtualBox.
- See mine below. Name doesn’t matter much. You may use your own. My VMs run fedora OS. Depending on your OS, you may have to Google a little more on how to set different configurations. I am sure, Google will be happy to help you.
A little help with my vocabulary:
host machine : machine which runs VirtualBox VM : Virtual Machine
First we need a Host-Only Adapter. This needs to be created in the Virtual Box and not in any particular VMs. So lets do that first.
Go to the preference of VirtualBox. Mine is a Mac. Don’t confuse with the screenshots if you are using another host OS.
Go to the “Network” tab and choose “Host-only Networks” sub-tab and create a new Adapter by clicking on the green plus sign you see on the right side of the window. There comes the new adapter “vboxnet0”
Double-click “vboxnet0” or click on the screw-driver icon on the right side of the window after highlighting “vboxnet0” to see it’s settings. Below are the default values and we are fine with it unless you really want to change it. You can see the “Lower Address Bound and “Upper Address Bound”. We can choose IP from this range for our machines.
Press “OK” if you made some change else “OK” or “Cancel” as you like and we have a working “Host-only Adapter” now.
Now we should connect it to all three VMs.
Highlight a VM and click “Settings” (on the top of the window between “New” and “Show”)
Select the “Network” tab from the window which appeared. Leave “Adapter 1” as we need it to be Attached to “NAT” for accessing internet via host machine. Select “Adapter 2” and select “Host-only Adapter” option from the drop down menu of “Attached to:”. Ofcourse the value for “Name:” is our newly created “vboxnet0”.
Set “Promiscuous Mode:” to “Allow All” or “Allow VMs”. Putting it to “Deny” will stop any communication via this Adapter. Hope you too don’t want that as our intention is otherwise.
Now we need to boot into the VMs and assign a static-IP for each.
I will start will “ram” VM.
In RedHat/Fedora we can use “system-config-network” for this purpose.
Install it using the below command. You should have root privilege or sudo privilege for this.Once installed, run “system-config-network” command to start assigning the static IP.
That will take you to something like this:
Highlight “Device Configuration” from it using arrow keys and press “Enter/Return” key.
We need to edit “vboxnet0”, so highlight it. If you don’t see that, you may highlight “” and press Enter.
Make sure your settings match the below ones. You may choose any IP from the range we saw earlier. I go for 192.168.56.[101-103]. Need not be adjacent ones.
Use tab and arrow keys to highlight the “OK” button and press Enter after the changes.
With this, we have assigned static-IP 192.168.56.101 to VM: ram.
Now lets do a small trick to ease our path ahead; a small DNS resolution.
Lets use the names ram, daisy and rincy instead of the IPs.
For that, open the /etc/hosts file.
Like wise, assign 192.168.56.102 to daisy and 192.168.56.103 to rincy and update the /etc/hosts file.
Now reboot all the VMs to be on the safer side. and try the below commands in all three VMs and host machine.
ping -c 3 ram ping -c 3 daisy ping -c 3 rincy
You will get the below output which means rincy, ram and daisy started talking to each other..
Try from the host machine and you will see Big-Daddy can talk to his children now..