Last Updated: February 25, 2016
· skeep

Open localhost from VM

For cross browser development we generally need to test application in different OS. To test web app from a Windows VM in Mac follow below steps:

  • Open Terminal and type

ifconfig vmnet1

It should give you something similar as below:

    ether 00:50:56:c0:00:01 
    inet netmask 0xffffff00 broadcast

what we are interested in is

take a note of this ip address.

  • Now switch to Windows VM. Open the below mentioned file

note hosts is the name of the file and do not have an extension.

  • Add below line at the end of the file localhost
  • Now we have flush our DNS to make this work Open command prompt in windows and type
ipconfig /flushdns

Thats it. Open your browser and http://localhost/ should work. Optionally you may need to add a port if your app is running on a port. The port number should be same as in Host system