Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using VirtualBox trying to set up Windows as my dev environment, but an Ubuntu VM as my "virtual server".

So, Windows 7 is my host OS on my laptop. My guest OS is Ubuntu, which will run my LAMP setup. I take my laptop to friends places and my girlfriends place. Sometimes I use my ethernet adapter, sometimes the wireless - so I use different networks and different adapters and am trying to keep my configuration independant if this is possible.

I'd like the guest to have a static IP so I can set my hosts file in Windows to point to my Ubuntu "virtual server".

How should I do this?

I have managed to set up a static IP address in Ubuntu using NAT in VirtualBox, but of course I can't access anything from Windows - I need to be able to visit in my broswer, but the virtual machine's hidden behind NAT ...

Any ideas? Can you point me in the right direction on how this should be configured?

Thanks in advance!

share|improve this question
duplicate:… – Goyuix Dec 27 '09 at 0:32
up vote 0 down vote accepted

Give the machine two interfaces -- a NAT interface for communicating with the outside world, and a host-only interface for communicating with your Windows host. This can have a static address, and you can point any Windows-side tools at it.

Your default route should be out the NAT interface.

share|improve this answer
While I use port forwarding to access the virtual web server, I needed this for XDebug - thanks for the tip! – searbe Dec 28 '09 at 19:49

port forwarding as per the following was the best solution:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.