Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Access localhost via name from Parallels Desktop Network
I use Parallels Desktop mainly to make sure my websites work on IE. As the IP address of the virtual network devices installed by Parallels are assigned by a dedicated DHCP server also installed by Parallels, and the IP address of my laptop changes as I change locations, I use the following setup to be able to access my laptops webserver by name from Windows.
  • Switch the Parallels virtual machine to host-only networking.
  • Set up OS X Internet Sharing (in the Sharing System Preferences panel) to share the connection with the Parallels Host-Guest adapter.
  • Open ports 80, 443, and any other ports you use for your development server (i.e. 3000-30xx for Rails development with locomotive) in the OS X firewall by adding a new rule.
  • Assign static IP addresses (from an unused network range) to the Parallels Host-Guest adapter and the network interface in Windows (I used 192.168.123.1 and 192.168.123.2 with network mask 255.255.255.0).
  • Add this to C:\WINDOWS\system32\drivers\etc\hosts:
    192.168.123.1   yourcomputer
Now you can access your Macs's development server by entering yourcomputer as the URL in IE, no matter what IP addresses are assigned to your mac.

Optionally, you can even comment the lines that start the Parallels DHCP-NAT server in /Library -> StartupItems -> Parallels -> Parallels, as with this setup, you use neither DHCP nor Parallels' NAT (but OS X's own NAT is used).

[robg adds: I haven't tested this one.]
    •    
  • Currently 2.60 / 5
  You rated: 4 / 5 (5 votes cast)
 
[54,457 views]  

10.4: Access localhost via name from Parallels Desktop | 12 comments | Create New Account
Click here to return to the '10.4: Access localhost via name from Parallels Desktop' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Access localhost via name from Parallels Desktop
Authored by: apenstaartje on Jan 16, '07 08:30:07AM

I have the Parallels act as a seperate identity on the network, installed Bonjour for Windows and now I can access my mac by using the Bonjour (Rendezvous) name.



[ Reply to This | # ]
Bonjour does the trick
Authored by: Lectrick on Jan 16, '07 11:40:04AM

I also got around this exact same issue using Bonjour for Windows... easy to install, requires no network config change, works a charm

---
In /dev/null, no one can hear you scream



[ Reply to This | # ]
10.4: Access localhost via name from Parallels Desktop
Authored by: cp420 on Jan 18, '07 06:32:23PM

same here, gotta love that 'it just works' feeling in a windoze OS!!



[ Reply to This | # ]
10.4: Access localhost via name from Parallels Desktop
Authored by: Nem on Jan 16, '07 08:47:43AM

Looks like some backslashes got eaten in the path to the hosts file:

C:\WINDOWS\system32\drivers\etc\hosts


Being a UNIX bigot, I've always found the /etc/hosts file in Windows funny. :)

---
Nem W. Schlecht
http://geekmuse.net/



[ Reply to This | # ]
10.4: Access localhost via name from Parallels Desktop
Authored by: mike3k on Jan 16, '07 04:24:39PM

Alternately, if you're using shared networking, look at the IP address of Parallels NAT (usually en3) and use that IP address for the hosts file. I'm running Ubuntu linux in a VM and I added the following to my /etc/hosts file:

10.211.55.2 realhost



[ Reply to This | # ]
10.4: Access localhost via name from Parallels Desktop
Authored by: gorilla on Apr 12, '07 02:03:18PM

I installed bonjour and want to access my rails server (localhost:3000 on my mac). Doesn't seem to work.... Any ideas?



[ Reply to This | # ]
10.4: Access localhost via name from Parallels Desktop
Authored by: nullset on May 19, '07 09:46:35AM

Instead of trying to access it via localhost:3000 try using

COMPUTERNAME.local:3000

where COMPUTERNAME is the name of your machine.



[ Reply to This | # ]
10.4: Access localhost via name from Parallels Desktop
Authored by: vocaro on Jul 17, '07 09:51:12AM

Go to System Preferences on your Mac and click the Sharing icon, then switch to the Services tab. You will see a message saying, "Other computers on your local subnet can access your computer at ..." followed by a name ending with ".local". Use this name, followed by ":3000", to access your local Rails server.



[ Reply to This | # ]
10.4: Access localhost via name from Parallels Desktop
Authored by: hellohamish on Dec 09, '08 01:36:57AM

Hello,

Has anyone had any luck getting this to work with 10.5? I'm a bit lost as to what to do.

Thanks so much!
Hamish



[ Reply to This | # ]
10.4: Access localhost via name from Parallels Desktop
Authored by: lemonaise on Apr 15, '09 02:35:57AM

I accessed my local web server by typing my Macbook's IP address in the address bar, on my Parallels browser. E.g. 192.168.0.2/site1. Using Shared Networking.



[ Reply to This | # ]
10.4: Access localhost via name from Parallels Desktop
Authored by: chrisburbridge on Dec 19, '09 07:10:47PM

I develop lots of websites on a virtual server on my Mac. I have a hosts file configured to interpret lots of different domains locally, e.g.,

127.0.0.1 mydomain.local
127.0.0.1 my-other-domain.local
etc.,
etc.,

I wanted IE within Parralels to also interpret these, but it does not recoginize localhost, or 127.0.0.1 the same.

But thanks to a few suggestions here, I figured it out.

To quote the other nice person,

"Go to System Preferences on your Mac and click the Sharing icon, then switch to the Services tab. You will see a message saying, "Other computers on your local subnet can access your computer at ..." followed by a name ending with ".local". Use this name, followed by ":3000", to access your local Rails server."

In other words, find out what your computer is called on the network. Let's say it was mymac.local

Then, I found out what IP address the virtual Windows thinks mymac.local resolves to. It gave me some other IP address.

Then, I took all of the lines in my hosts file on my Mac, and copied them into a new file, and did a search and replace on the normal localhost IP of 127.0.0.1, with that new IP.

Then, I opened up C:\WINDOWS\system32\drivers\etc\hosts, and added those lines to it.

It works. Yay!



[ Reply to This | # ]
10.4: Access localhost via name from Parallels Desktop
Authored by: chrisburbridge on Dec 20, '09 12:23:33PM

Important pre-step (also from the above other contributions):

You must first install Bonjour for Windows (http://support.apple.com/downloads/Bonjour_for_Windows) from within the Windows instance.



[ Reply to This | # ]