Question

I have a few sites running on my OS X machine. Since they need to use SSL, each site listens on a different IP address (127.0.0.2, 127.0.0.3, 127.0.0.4). I use nginx if it matters.

On OS X, I edit /etc/hosts and have dev.domain1.com point to 127.0.0.2, dev.domain2.com point to 127.0.0.3, etc.

I need to tests my sites in IE -- so I run Windows in a VM.

How can I setup the Windows VM so that dev.domain1.com, dev.domain2.com points to 127.0.0.2, 127.0.0.3 on the OS X machine?

Was it helpful?

Solution

In addition to editing the C:\Windows\system32\drivers\etc\hosts as SLaks said, you will need to use IP addresses that are accessible from your VM.

The 127.0.0.0/8 range (i.e. any address starting with 127.) will almost certainly not work, since they are loopback addresses, local to the machine itself. In this context, the VM and the host are two distinct machines.

I'm not sure where the settings are in VMWare Fusion, but you should be able to set up its network so that the host and the VM can connect to each other.

VMWare Fusion has a transparent NAT mode, which will set up its own private network (using a different subnet from the one on your actual LAN, to avoid conflicts, probably a subset of 192.168.x.x or 10.x.x.x). It might not be obvious how to find the address of the host (the address of the VM should be obtainable within the guest OS's DHCP settings). The host mode will also set up its own network, except that the guest won't able to communicate with machines outside the host (only the host and other guests). There are more details in "Understanding networking types in VMware Fusion".

The easiest might be to use the bridge mode, in which case the case will have an IP address on your LAN (I'm just assuming you might be on a LAN with a DHCP server, for example), in which case it will be just like another machine and will also be able to talk to the host, using the IP address of its external interface.

You may also be interested in these links:

This should also be configurable in VirtualBox.

OTHER TIPS

I recently had to set up a Windows 8 with IE11 from modern.ie and was using virtual box. I am also running nginx locally with my boxen setup.

Here is what I did to get my local site up and running in my VM:

  1. Get virtual box running your Windows 8 VM

  2. Open notepad AS ADMINISTRATOR (go to your apps window, right click notepad, open as admin)

  3. Open 'hosts' file located in C(whatever local disc is) > Windows > System32 > Drivers > etc. Remember to show all filetypes.

  4. Add your IP of your local environment (do an ifconfig from command line if you're using OSX) along with the name of your site (ie: 127.xx.x.xx mysite.dev)

  5. Make sure you're VM network is setup as NAT (I tried bridged at first but it wasn't happy).

  6. Profit.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top