1

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

Dennis Williamson
  • 62,149
  • 16
  • 116
  • 151
Jonah
  • 123
  • 1
  • 3

2 Answers2

1

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.

einstiien
  • 2,568
  • 18
  • 18
  • 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 05: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 05:25
0

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

Goyuix
  • 3,214
  • 5
  • 29
  • 37
  • this might work perfectly, but the other solution was just so simple. thanks for the help though. – Jonah Jan 21 '10 at 05:02