23

I've been trying to learn more about security by following http://www.pentesterlab.com/bootcamp/week2/, but I'm struggling to access my VM's internal IP localhost from the host machine.

I'm able to access the host machine's internal IP from the VM (using 10.0.2.2) and I can access the VM's internal IP from the VM(10.0.2.15), but that is not what I'm interested in. I want to do it the other way around.

Obviously, I can access my host machine's IP from the host machine (192.168.1.142), but I cannot access the VM's IP from the host machine. I've tried many ways to find the VM's IP and used everything I could think of, but nothing will load.

I have tried switching from NAT to Bridged Adapter and back multiple times and changing various settings, but I only lose the ability to connect to the IP the other way around under Bridged Adapter. I've explored Google links of people with similar problems for hours, but can't find anything that works. Thanks for your help!

1
  • 1
    If you found an answer add it as an answer. You are allowed (encouraged even) to answer your own questions. For now I'm removing the answer from your question. Also I'd advise researching what "localhost" means, as you're not using that term correctly. :) Nov 11, 2014 at 15:22

2 Answers 2

24

For old installations of Virtualbox

I finally found the solution, on the third page of Google. :/ There was a great power point at http://www.slideshare.net/powerhan96/networking-between-host-and-guest-v-ms-in-virtual-box which explained everything that needed to be done. In addition, on the Virtual Manager, I had to make it fullscreen, File->Preferences->Network->Host Only Networks->Add. I needed both a Host-Only adapter and an NAT adapter for it to work both ways, which the powerpoint explains.

Update: Virtualbox 5.2

In Virtualbox 5.2, stop your VM. From the main menu, select "Global Tools-> Host Network Manager". Click "Create", and a new Host-Only Network called vboxnet0 should be created. Navigate back to the main menu by clicking "Machine Tools". From here, right-click on your VM image and go to "Settings->Network", and attach to your new Host-only Adapter called vboxnet0. When you restart your VM, its IP should have changed from 10.0.*.* to 192.168.*.*, and should now be accessible from your host machine.

1
  • 2
    I almost missed this part: "I needed both a Host-Only adapter and an NAT adapter". This is the key if you don't want to bridge. Apr 13, 2019 at 6:03
2

In the latest virtualbox (5.2.2) instead of going to "File->Preferences->Network" I went to "Device->Network->Network Settings" and enabled Adapter 1 to be Host-only networking.

Then I rebooted the VM. The notable change after this was that the IP of the virtual machine (from viewing ifconfig output) changed from a 10.2.0.15 ip address to something like 192.168.56.101

Then I could go to my webbrowser and view a default page that apache server had with http://192.168.56.101/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .