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
    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. :) – Ƭᴇcʜιᴇ007 Nov 11 '14 at 15:22
up vote 13 down vote accepted

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.

Thanks Techie007 for your help. I'm obviously a beginner, and didn't know that answering my own question was acceptable. As for exchanging the term "localhost" with "internal IP", I took your advice. However, I was not trying to refer to either the IP address or the host machine; I was (unsuccessfully) trying to refer to the page which is displayed in the internet browser if I type in either localhost or the internal IP address 127.0.0.1. Which term is appropriate for this?

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/

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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