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

I'm running Windows XP via VirtualBox on my Mac. I want to load up sites on my Mac's localhost while offline.

I know that I can append my IP and a nice domain name to the host file in C:/WINDOWS/system32/drivers/etc ... then i can load up and test sites locally in XP... but I only have IP while I'm online.

Even if there is an IP (when i have a connection), I still have grab it via Terminal and update the windows hosts' file all the time, since I'm developing from a laptop and have a new IP at the drop of a dime.

I found a tutorial where the author is able to get a permanent IP. He uses VMware Fusion as his VMachine, which is the only difference between his setup and mine. By running the terminal command "ifconfig vmnet1" he gets:

a secret IP the virtual machine uses to talk to OSX

And that doesn't change - which is awesome. I'm assuming it exists even if he's offline. His tutorial is here.

I would be SO much more efficient if I could do my dev testing offline.

Anyone have ideas? Thanks:)

share|improve this question
1  
Please don't use URL shortening. –  Dennis Williamson Jan 20 '10 at 15:39
    
sorry, i thought it was helpful in being more legible. dually noted –  Jonah Jan 21 '10 at 6:06

2 Answers 2

up vote 1 down vote accepted

The network settings in VirtualBox for you VM need to be set to NAT. What this means is the windows XP machine will get a private IP address assigned to it from virtual box and all access to outside networks will be routed through your Mac's IP. I just checked on mine and the private IP for the VM was 10.0.2.15 and 10.0.2.2 for the host. I'm not sure if this is the standard IP it uses or if it picks one at random.

share|improve this answer
    
It was already set to NAT by default. I wasn't sure how to find the private IP it created, but I tried the two that you gave, and 10.0.2.2 seemed to work:) It would be good to know how you found those though if you don't mind sharing. –  Jonah Jan 21 '10 at 5:01
1  
From inside the windows computer open up a command prompt and run: ipconfig /all This will list the IP info for your XP computer which should show the 10.0.2.2 address as the default gateway, which is the Host IP. –  einstiien Jan 21 '10 at 5:25
    
and so it does:) perfecto & thanks again –  Jonah Jan 21 '10 at 6:11

I am not entirely certain about some of the details for OS X, but the theory is the same: Add a virtual network adapter to your XP Virtual and set it to Bridged with a loopback adapter (maybe lo0 for a Mac?) - you could even add an alias:

ifconfig lo0 alias 10.10.10.1

And then assign your bridged adapter in your VM someting in the same subnet. lo0 may not work - you may need to create a new dummy loopback.

See here for a tutorial on doing this will some other software: http://compileyouidontevenknowyou.blogspot.com/2009/03/virtual-networking-with-virtualbox-on.html

share|improve this answer
    
this might work perfectly, but the other solution was just so simple. thanks for the help though. –  Jonah Jan 21 '10 at 5:02

Your Answer

 
discard

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

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