Create Virtual Network with Virtualbox

So, I wanted to try some stuff on a local network by making my very own private servers ftp, samba, Apache and others. The only problem was I only had a single laptop!  So, even if I would have made all these servers on my laptop I wouldn’t have been able to test them effectively, not to mention exposing myself to other security implications. Then I thought why not try some Virtualization tools. When it comes to Virtualization I always prefer Virtualbox as it is very easy to use.

There are three ways by which you create a virtual network with Virtualbox:

#1) Set your Virtual Machine’s Network Adapter to Bridged Mode.  In this case your virtual machine will fetch an IP address directly from the router. Let’s say your router has as an IP and your physical machine gets an IP then your VMs will get IP and so on.


#2) Set your Virtual Machine’s Network Adapter to Internal Networking Mode. This will create a network between all of your VMs that are using the same internal network.

However, VirtualBox doesn’t provide any GUI tools to configure any additional settings for this mode as you will find for Host-only network. So, either you have to set static addresses for all your VMs or you can add a DHCP server for your internal network by typing the following line in a terminal:

VBoxManage dhcpserver add --netname intnet0 --ip --netmask --lowerip --upperip --enable

If you want to remove the DHCP server then type the following line in a terminal:

VBoxManage dhcpserver remove --netname intnet0


#3) Create a Host-only network by going to VirtualBox Managers Preferences. Go to File ->Preferences -> Network. You can configure all of the settings for Host-only network from here. If you want your VM’s to fetch an IP automatically then enable the DHCP server as well.  And set your Virtual Machine’s Network Adapter to Host-only network.

Adding host-only network

If you want you can use the previous commands here also, just change the name with the host-only network name. The command would look like this:

VBoxManage dhcpserver add --netname vboxnet0 --ip --netmask --lowerip --upperip --enable

In this case not only will the VMs be the part of that network but your Physical machine will also be a part of that network. Your Physical machine will get an additional network interface that usually goes by vboxnet’x’ where ‘x’ can be any number starting from 0 depending on the number of host-only networks that you have.

Well, now that you have your network setup, have fun with it !!:)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s