Getting VirtualBox+Windows XP to view the Mac’s localhost while offline

ipmac-osxvirtualbox

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:)

Best Answer

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.