On my Ubuntu host I have my local webserver. I installed VirtualBox and Debian as a guest.

I would like the 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?

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

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


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

On guest machine's browser type which will show you the same content as "localhost" in the host OS. is the "default gateway" for NAT connections and your guest OS' IP is

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.



  • 4
    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
  • 3
    Thank you for this answer. It has gotten me out a similar bind. – kingkool68 Feb 4 '13 at 19:08
  • 1
    "Enable ONE network adapter". Where is this done? – jshen May 8 '14 at 16:39
  • 1
    Note: If you have name-based virtual hosts configured in apache on your host machine, then you can access them by simply creating a mapping in the guest's machines hosts file for yourvirtualhostname.local (or whatever) – User Aug 22 '14 at 1:12
  • 1
    @ТомицаКораћ it does work. For example see: askubuntu.com/questions/36183/… however, you probably should open a separate question to get this solved. – User Jan 6 '15 at 17:11

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


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.

  • To clarify: This is a setting in the client app. It worked for me—it just took me a while to realise it, because IE was too stupid to assume I wanted an HTTP connection when I typed an IP address and port into the address bar. – Michael Scheper Nov 19 '15 at 6:43

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 but the ip for the Windows adapter is


If solution by @Melvyn does not work, as an alternative you can set you network adapter to be bridged.
Go to Settings -> Network -> then change Attached to to Bridged Adapter.

enter image description here

You should be able to call parent by it's hostname or external IP address you can get it by going to Command prompt and typing ipconfig /all enter image description here

enter image description here

Update If you are debugging with Visual Studio and using IIS Express.

go to C:\Users\[uesername]\Documents\IISExpress\config\applicationhost.config

find your website in <configuration>/<system.applicationHost>/<sites>/<site> (name can be deceptive try checking location on the disk in physicalPath attribute)

then add into <bindings> section new binding

    <binding protocol="http" bindingInformation="*:50766:localhost" />
    <binding protocol="http" bindingInformation="*:50766:48qzr12" />

where bindingInformation is *:[port]:[machineName]

Hope this saves you some time.


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

  • Hi! Sorry for too late reply. ifconfig on my host shows 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 is taking too long to respond"... So what should I try next? Thanks in advance. – Maxim May 24 '10 at 17:52

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.