0

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

migrated from security.stackexchange.com Jul 1 '16 at 18:15

This question came from our site for information security professionals.

  • 1
    Is dynamic IP via DHCP activated in the guest machine? Your Virtualbox config seems to be correct. – hub Jul 1 '16 at 15:12
  • where can I do that? – paul deter Jul 1 '16 at 15:26
  • 1
    You have to run dhclient as a superuser. – hub Jul 1 '16 at 15:38
  • 1
    this seems like more of a serverfault stackexchange type question – CaffeineAddiction Jul 1 '16 at 18:06
2

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

  • Updated my question with your suggested settings applied. Still get same ip address – paul deter Jul 1 '16 at 15:28
  • @pauldeter after you change your settings, you may need to either run dhclient eth0 or statically assign it: ifconfig eth0 192.168.56.100 netmask 255.255.255.0 ; route add default 192.168.56.1 – munkeyoto Jul 1 '16 at 15:31
  • wait a minute, actually restarting the vm bring up a new ip address. I am not sure if its correct one. Let me add that image in my question – paul deter Jul 1 '16 at 15:33
  • 1
    Clarification on Bridge Adapter / Bridged networking: This is for more advanced networking needs such as network simulations and running servers in a guest. When enabled, VirtualBox connects to one of your installed network cards and exchanges network packets directly, circumventing your host operating system's network stack. – hub Jul 1 '16 at 15:42
  • 1
    Means: 192.168.1.5 is an ip assigned by your local dhcp server, propably home router. – hub Jul 1 '16 at 15:43
2

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.

  • ok thanks, will I be able to access internet from my vm with host only mode? – paul deter Jul 1 '16 at 15:54
  • No, hence the name "host only". Unless you use another VM as a router on that network. – multithr3at3d Jul 1 '16 at 17:01
  • Another way to access the internet is using Bridged Mode instead of Host-Only Mode like stated in munkeyotos Answer. Its not really clear what you are trying to achieve because you didnt ask a clear question. – hub Jul 1 '16 at 17:33
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.