Page 1 of 1

access localhost from virtual machine

Posted: 22. Mar 2010, 23:54
by virtualuk
I'm running Kubuntu 9.10 with VirtualBox 3.0.12. I also have apache server installed with connections limited to localhost only for development purposes. I've installed WinXP in a Virtual Machine so that I can test web sites in IE but I can't connect to the local server. Typing in http://localhost into IE in the virtual machine results in the error message below. How can I access my local server from within a virtual machine?
Internet Explorer cannot display the webpage

What you can try:
•It appears you are connected to the Internet, but you might want to try to reconnect to the Internet.
•Retype the address.
•Go back to the previous page.
•Most likely causes:

•You are not connected to the Internet.
•The website is encountering problems.
•There might be a typing error in the address.

Re: access localhost from virtual machine

Posted: 23. Mar 2010, 00:00
by Perryg
OK every computer in the world has localhost and it always points to 127.0.0.1 so it will only look on its own OS.
If you have the guest set to host-only then the other guest set to host-only you will get an ip address and can use that to access the web server.

Re: access localhost from virtual machine

Posted: 23. Mar 2010, 00:09
by virtualuk
You mentioned "guest" twice in your response so I thought I should clarify my original post. I only have 1 guest OS installed. My host machine is Kubuntu which I have installed VirtualBox and Apache server onto. I need to connect from a WinXP guest OS to localhost on my host OS. Is there a default ip address that can be used from within a guest OS that will automatically point to the host OS?

Re: access localhost from virtual machine

Posted: 23. Mar 2010, 00:16
by Perryg
On the linux box type ifconfig -a in a terminal it will show you an address of 192.168.56.X this is the host-only address
then in the Windows command window type ipconfig /all. It too should have a 192.168.56.X address.

This assumes you setup the network settings of the guest to use host-only.
If you set it to use NAT then you would need to add a second adapter in the guest set to host-only to be able to talk between the host and the guest.