ipaddress of my VM doesn't look correct

I am trying to setup metasploitable in a Virtualbox VM. My impression is, that once Virtualbox is set up to work in host-only adapter mode, the VMs should follow the networking settings defined in the following screenshot. Let me show how I set this up. I have a metasploitable VM and its displaying 10.0.2.15 for eth0 in the ifconfig output.

enter image description here

Here is how Virtualbox network setting are configured. I got no entrys at NAT networks.

enter image description here

Here is the host-only tabs: enter image description here

If I edit this, here is what I see under adaptor tab: enter image description here

and here is the dhcp tab.

enter image description here

Based on these settings, shouldn't my metasploitable machine obtain the ip address 192.168.56.101 (or up)? Is there anything wrong in my configuration?

UPDATE
Once I update network setting, enabling Bridged Mode for that VM, I am now getting following ip. This doesn't look correct based on my settings:

enter image description here

I get following error with dhclient command

enter image description here


You need to change your settings into a "Bridged" adapter. Your IP information is suggesting/showing that you are running the interface in NAT mode. Click on the image, go to settings for that guest. Select network, then adapter, in the drop down box where you assigned the adapter make sure the "Attached to" settings is set to "Bridged Adapter"

Settings for Network Adapter


As stated in the comments, to use your virtualbox-host-only-dhcp you have to assign host-only mode in your vm config and obtain a new ip via dhcp, other ways to do this are restarting your network interface or rebooting the machine.

Take a look at the manual for more information about networking modes.


I recently faced this and the way to securely create a VM network is to create a NAT Network and assign that to the VMs. Using Mac OS X and VirtualBox (Version 5.2.24 r128163 (Qt5.6.3)), one can create a NAT Network by:

  1. Press ⌘, to open preferences dialog
  2. Select the Network icon
  3. Select "Adds new NAT Network" icon

Then for each VM:

  1. Select the VM
  2. Press ⌘s to open its settings dialog
  3. Select the Network icon
  4. On the Attached To: drop down, select NAT Network

The one you just created should be automatically selected. When you restart each VM they should all be in a network where they can speak to each other and the outside network but not vice-versa. This table expresses that pretty well.