On my Ubuntu HOST I have my local webserver. I installed VirtualBox and Debian as a GUEST.

I would like Debian guest to be able to hit my webserver running on my Ubuntu host (for example, I just type http://localhost:8080/ in the browser under Debian).

How can this be done?

Thanks in advance.

link|improve this question
belongs on superuser.com – ax. May 22 '10 at 11:40
feedback

migrated from stackoverflow.com May 23 '10 at 19:04

This question came from our site for professional and enthusiast programmers.

6 Answers

up vote 5 down vote accepted

Enable ONE network adapter. Set it to NAT and start your machine. Don't need to configure anything.

On guest machine's browser type http://10.0.2.2 which will show you the same content as "localhost" in the host OS.

10.0.2.2 is the "default gateway" for NAT connections and your guest OS' IP is 10.0.2.15

Of course you can set a "HOST-ONLY" or an "Internal Network" which will allow you another advanced configurations. I recommend to stay with NAT.

Enjoy

M.

link|improve this answer
Ok, thanks! It's worked!.. Thanks a lot! That was the easiest way for me as I am newbie and can't effectively grasp more advanced solutions. – Maxim May 25 '10 at 9:11
feedback

The easiest way of allow uninterrupted access to your VirtualBox Guest machine is to set the network device as a 'bridge' to your eth0 on to your LAN.

The Guest machine will grab a LAN IP via DHCP from your router.

link|improve this answer
feedback

Well you can get Debian to hit your webserver, but not using localhost. You'll have to use the IP address of the Ubuntu host.

Assuming the guest OS is connected to the network, to grab the IP open up a terminal and type ifconfig. Should look something like 192.168.0.2.

link|improve this answer
Hi! Sorry for too late reply. ifconfig on my host shows 192.168.0.102 for eth0. When I enter this ip in firefox in guest it is trying to connect for a while and then connection is terminated: "The server at 192.168.0.102 is taking too long to respond"... So what should I try next? Thanks in advance. – Maxim May 24 '10 at 17:52
feedback

OR I also found this link which could work: VirtualBox Advanced Network settings for Linux

link|improve this answer
Hi! I tried it, but without success. I am newbie in networking, and this link is quite complicated for me to follow. Anyway, thanks for your answer. – Maxim May 24 '10 at 17:56
feedback

What I found fixed the issue for me was making sure that the windows VirtualHost-Only adapter was set to the .1 address for the ip range so my virtual box host only adapter was 192.168.58.20 but the ip for the Windows adapter is 192.168.58.1

link|improve this answer
feedback

Also a point to make when using the ip address of 10.0.2.2 is if you're using MAMP for instance add the port number :8888 so the full address reads http://10.0.2.2:8888

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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