PDA

View Full Version : [SOLVED] Virtualbox accessing ubuntu localhost



Okar
January 30th, 2008, 10:28 AM
hi,
I got Ubuntu 7.10 and WinXP with Virtualbox.
Is there a way to access the localhost of Ubuntu in the WinXP, without beeing in an network?
My Problem is:
I want to do some webstuff. So I installed apache on my Ubunutu. There I can access my stuff by using: localhost/~okar/stuff.. Can I somehow access these things on my WinXP.

Thanks in advance;)

p_quarles
January 30th, 2008, 11:45 AM
Yes, you can, but not using localhost. You'll need to get the IP address that your Ubuntu Apache server is listening on, and then enter that to connect from XP. You can get the correct address by running this:

ifconfig -a
The "inet address" will be the number you want to enter into your browser in XP.

Okar
January 30th, 2008, 05:17 PM
ok thanks.
but this only works if I'm connected to a network. Is there a possibility to achieve the same without being in a network?

mannheim
January 31st, 2008, 02:56 PM
From memory, if you have set up VirtualBox with NAT networking, I think you can access services running on the host from the guest OS. From the guest (WinXP), the host appears as 10.0.2.2. So if you point your WinXP web browser to that address, it should connect to your Ubuntu Apache server. (To the host, this appears to be a connection from localhost, I believe.)

Okar
January 31st, 2008, 07:44 PM
hey nice, that was what I was looking for.
thank you very very much :D

kokaku
July 19th, 2008, 01:06 PM
I'm not having any luck with the ideas offered here. I have a WinXP guest running in VBox 1.5.6 in Ubuntu 8.04. There is a network adapater using NAT (the default, I believe). I network fine withing WinXP but cannot access the Apache2 server running in Ubuntu.

I tried:
* the IP address offered by ifconfig -a
* 10.0.0.2
* the tips offered at http://herbee.fr/?q=VirtualBox-NAT (see my comments at the bottom)

It would be very cool if I could get this working so I would only have to maintain 1 version of Apache2 for Windows browser testing (instead of installing/maintaining a duplicate setup within Windows).

Any ideas?

thx
a

Okar
August 29th, 2008, 06:10 PM
did you try 10.0.0.2 or 10.0.2.2? because the latter is the right one.

matiz
August 30th, 2008, 07:18 AM
Wow, this is really nice work !

gpasci
March 22nd, 2009, 03:40 PM
10.0.2.2
this is what I was looking for :D

emyller
July 13th, 2009, 11:48 AM
Perfect. Much better than run ifconfig everytime I get a new IP address. thank you!

Ebon Lupus
June 6th, 2010, 06:22 PM
I'm using an XP guest in an Ubuntu 9.10 installation of VirtualBox. The http://10.0.2.2/ thing seems to work okay, except IE is not saving cookies. Does anyone know why?

EDIT: Never mind. I figured it out. Silly-stupid me. My bad.

tirengarfio
April 29th, 2011, 10:59 AM
Hi,

I want to check my localhost from the browser of Windows 7 installed in VirtualBox. (I have as main OS Ubuntu).

When I write 10.0.2.2 in W7/IE, I go to the 127.0.0.1 in Ubuntu. But..

what should I do to go to another IP for example 127.0.0.2 ???????

Regards

Javi