Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 10.0.2.15 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: serverfault.com/questions/57106/… –  Goyuix Dec 27 '09 at 0:32

2 Answers 2

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:

http://kdl.nobugware.com/post/2009/02/17/virtualbox-nat-ssh-guest/
http://mydebian.blogdns.org/?p=111

share|improve this answer

Your Answer

 
discard

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