Skip to content

Instantly share code, notes, and snippets.

@davidalexander
Created July 16, 2011 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidalexander/1086440 to your computer and use it in GitHub Desktop.
Save davidalexander/1086440 to your computer and use it in GitHub Desktop.
VMware Fusion - Find Magic IP

VMware Fusion

Most of us (developers) already use virtualization in some form for testing, but in order to take advantage of this particular environment – MAMP with virtual hosts – we need to update the hosts file on the virtual machine so that it resolves the domains to the Mac's IP.

One catch: if you’re on a latop, chances are the Mac’s IP will change often. That’s why we need to get the secret IP the VM uses to talk to the Mac. Here’s how we find it:

Type ifconfig vmnet1 into a Terminal window. You should get a return like this:

vmnet1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500  
inet 192.168.115.1 netmask 0xffffff00 broadcast 192.168.115.255  
ether 00:50:56:c0:00:01

The 'inet' number is your 'secret' IP (in my case, 192.168.115.1).

Now that we have that number, we can edit the hosts file on the VM. We find it in: C:/WINDOWS/system32/drivers/etc.
Just open the host file with Notepad, and add each virtual host (domain) on it’s own line at the end of the document, like so:

192.168.115.1  dev.triumphofgrace.com

and save. Afterwards refresh the VM’s DNS cache by typing ipconfig /flushdns in a command line window.

(Do this for each virtual host you added in VHX.)

Voila! Now you should be able to access the custom virtual hosts you created in VHX on your PC using that wonderful browser we all love, Internet Explorer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment