How can I setup an Internal Network with Virtualbox? (Ubuntu 14.04)

Hi I've been trying to setup an Internal Network with two Ubuntu 14.04 virtual machines. But I've been unsuccessful so far. They both have the Internal Network adapters with the same network name, now I need them to communicate inside the network, but the ping tests were unsuccessful.

This is my /etc/network/interfaces.d in the first OS

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.0.100           
netmask 255.255.255.0
gateway 192.168.0.254           

OS #2

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.0.101
netmask 255.255.255.0
gateway 192.168.0.254

I also tried changing the "eth0" to "lo" without success.

I don't understand where the problem is, Any help is welcome! Thanks


Ok I found the solution. I just had to start a DHCP server with VirtualBox. It's well explained in this video: https://www.youtube.com/watch?v=lhOY-KilEeE

Just in case, if the video is unavailable, the gist of it is this:

vboxmanage dhcpserver add --netname intnet --ip 10.10.0.1 --netmask 255.255.0.0 --lowerip 10.10.10.2 --upperip 10.10.10.254 --enable

Run this this in your host OS.

  • --netname intnet: The internal network will be named intnet. This is the name you should then put inside your VM's Network > Adapter > (Internal network) > Name field.
  • --ip 10.10.0.1: The IP address of your DHCP server inside the internal network.
  • --netmask 255.255.0.0: The subnet mask.
  • --lowerip 10.10.10.2: The lower bound of the IP addresses that can be assigned to network members.
  • --upperip 10.10.10.254: The upper bound of the same thing.
  • --enable: Enable the DHCP server.