Access localhost on Mac OS X from Parallels machine
Solution 1:
Try finding out your Mac's local IP address and accessing the webpage on your VM using that address.
You can find out your Mac's IP address under System Preferences, using the command ifconfig, or with some apps or Dashboard widgets (like iSlayer's iStat).
Solution 2:
Type 'ipconfig' on your Windows command line. You will see information similar to what I see below:
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : localdomain
IPv6 Address. . . . . . . . . . . : fdb2:2c26:f4e4:0:a1e2:ed15:e43a:daf7
Temporary IPv6 Address. . . . . . : fdb2:2c26:f4e4:0:b5d9:4d70:47a:b0b0
Link-local IPv6 Address . . . . . : fe80::a1e2:ed15:e43a:daf7%11
IPv4 Address. . . . . . . . . . . : 10.211.55.3
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 10.211.55.1
If you note, in the last line is your Default Gateway and two lines above that is IPv4 Address. Default Gateway is the virtual router between your Windows and Mac OS X. Since, Windows is using IP address of x.x.x.3 and router is using x.x.x.1, then Mac is available at x.x.x.2. In my case I am able to access Mac at 10.211.55.2. So you can access your web server using http://x.x.x.2/ and in my case I use:
http://10.211.55.2/
I have edited my Windows 'hosts' file with following entry:
10.211.55.2 localhost.mac
Now, I can type http://localhost.mac/ to access the web server running on my Mac. Though, this step of editing 'hosts' file in not required, it helps me.
As a side note, you can access your Windows based web server from Mac using the IPv4 address you get when you type 'ipconfig' on Windows.
Another way you can get Mac's virtual IP address is to type the following command on Mac OS X's Terminal:
ifconfig vnic0
'vnic0' is the virtual ethernet that Parallels installs on your Mac. In case, you have multiple Virtual Machine instances running you will see multiple virtual ethernet. All these virtual ethernets will begin with the word 'vnic'. If you have two VMs running, you will see 'vnic0' and 'vnic1' listed when you simply run 'ifconfig' command on Terminal.
In my case, when I type 'ipconfig vnic0' I get the following output, you will note that you get inet x.x.x.x IP address listed which.
vnic0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=3<RXCSUM,TXCSUM>
ether 00:1c:42:00:00:08
inet 10.211.55.2 netmask 0xffffff00 broadcast 10.211.55.255
media: autoselect
status: active
I hope this helps you.
Cheers!
SG
Solution 3:
My successful settings for access localhost:8001
for win (localhost
running on my Macintosh).
- Setup Parallels Shared network: In menu settings
Configure > Hardware > Network adapter 1: Default Adapter
and then in Configure settings:Preferences > Advanced > Network: Change Settings > Shared
. - Then run this in the Macintosh command line:
ifconfig | grep inet
. - Get the IP from subnet. Mine is
10.211.55.2
. - If your local site running on the Mac as:
http://localhost:8001/
Then be sure setup hosts: Open in mac/etc/hosts
and write it down—like in my case—10.211.55.2 localhost
instead of127.0.0.1 localhost
- Be sure thats your port is open
8001
in Windows and Mac. Follow next steps. - For Macintosh:
nmap -p 8001 10.211.55.2
it should success status (port open). - For Windows:
telnet 10.211.55.2 8001
it should success status (port open). - Open hosts file in Windows and write. For example:
10.211.55.2 localhost
- Open the Windows browser and open the site
http://localhost:8001
Solution 4:
Just run in the terminal:
ifconfig
And go to vnic0: inet address from the Parallels (like http://1x.2xx.5x.2:3000/ for ex.)