Hitting the Host Webserver From The Guest OS

Discussion in 'Parallels Desktop for Mac' started by samizdat, Apr 6, 2006.

  1. Hello All,

    Yes, it's a damn fine product! Visual Studio works like a charm compiling, intellisense, the whole bit.
    However, what I'd most like to figure out how to do is view web pages being served from Apache in OS X in IE on XP.

    Here's what's been tried and hasn't worked:
    The network adapter gets a unique address from the DHCP server, but pinging the guest from the host doesn't work or vice versa.
    For kicks and giggles I tried the loopback ( and got the expected result.

    This is all over Airport so no kernel panics.

    Any help is appreciated, thanks!
  2. Not able to connect to Localhost (on host machine) from virtual machine

    Just a DITTO for this post. I need to access the webserver on my host machine (e.g. http://localhost or from my virtual machine.

    I think this is a fairly common scenario so I am hoping someone can provide a workaround. Please!

    and thank you.

  3. Workaround

    Got bit by this last night and the workaround is totally trivial.

    You must use the IP address of the host mac. Parallels VM actually grabs an IP of its own. localhost just hits the VM, not the host OS.

    So if your mac's IP address is, you would access a webserver running on it by typing in:

    You can find out your mac's IP address from the Network control panel.

    Hope that helps..
  4. Wish Parallels handled this internally

    Thanks for the reply. That will work, but I wish that parallels could figure this out for me. In other words, have some "special" IP in the guest OS (e.g. that routes all requests to a given IP on the host (e.g.


    1) I can't ever hit the host machine unless I am on a network (for instance, I can't use it in the park, or on a bus, etc.)

    2) Everytime I am on a new network, or get a new IP address, I have to keep track.

    I will add this to the wish list for parallels.

    Thanks again for the workaround.
  5. Parallels says that they're going to add host-only networking and the ability to define more than one interface before release. The combination of those two features will solve the problem nicely.
  6. Yeah, this workaround is really only good for static IPs, without a doubt. I am using an iMac on ethernet, so this will work for me as a final solution. It is not so good for DHCP.

    I wonder if running a local DHCP or DNS server on the host would do the trick, something along those lines.. just thinking out loud.
  7. A good idea, but for DHCP didn't seem to make a difference.

    Glad to hear that better networking is on the way, so for the Parallels team, CODE, CODE, CODE :)
    There's a lot of people with $50 burning a hole in their pockets, myself included.
  8. Not sure that will be sufficient

    Neuron -

    Does Host-Only mean that I will have to choose between having a VM that connects to the outside world and one that connects to my host only?

    What I want is a VM that can do both. Is that what they mean?
  9. That's why it's the combination of host-only (ie: not bridged to the outside network) and having multiple interfaces (ie: 1 host-only, 1 bridged) will allow you to access everything you need to. When not connected to the outside world, you will still be able to access the guest/host over the host-only connection, and when net access is available the guest will be able to make use of it.
  10. but you still have to switch

    even then, you would still need to switch between the two, manually. That is why I suggested some "reserved" IP Address, when used from the guest machine, would always forward to the host. That way you would have "host-only" and bridged during the same VM session. That would be my preference. But I could get by if I had to switch depending on my situation.
  11. Well, I am using Beta2, just started today, and I can't get this working at all. I can actually ping the host from the guest (WinXP), and I can ping the guest from the host. But I can't get http://host from the guest to work. Nor can I get http://host-IP-address to work. Any more suggestions?

    This is the only reason I want to use Parallels. I am developing a web application, and I need to ensure that it works properly from IE. At the moment, I am remote-desktoping into a Windows 2003 server to do this, and it works fine. But being able to do it all from my own machine would be awesome.
  12. Andrew @ Parallels

    Andrew @ Parallels Parallels Team

    Unfortunately we still have some problems with host-guest networking in Beta2. We are working hard to resolve it and the fix will be included in the nearest update.
  13. Thank you for the prompt response. I'll be waiting for the next beta release anxiously. And so will two of my coworkers.

  14. I downloaded and installed Beta3, and now I can access the host (http://hostname) from the guest. Great work!
  15. Using RC2 now and this works without a problem to get to the host's (mac) localhost document root by using the host's IP address. I have an additional question along these lines though .... on the host mac, I am developing multiple websites and I have them set up each as virtualhosts under apache (i.e. http://website1, http://website2, etc.). They're all on port 80.

    Anybody know how to find these? Thanks in advance.
  16. I'm assuming you've set up your /etc/hosts file on the OS X side of it so you can access them properly in OS X? Assuming that you have, all you need to do is copy the relevant parts of your /etc/hosts file from OS X to the file C:\WINDOWS\system32\drivers\etc\hosts in XP (assuming you're using XP). The file format is the same. Restart IE, and it should just work...

  17. Thanks Rob. I did set up the /etc/hosts file on OSX and everything works well there. Hosts are mapped from to the virtual host names. Hitting http://website1hostname works on the Mac.

    The problem on the windows side is that it does not recognize as the Mac OSx localhost. If I just copy the mac hosts configuration, it does not work.

    I tried mapping the IP address assigned to the MacOSX to the virtual host specified (i.e. 192.168.x.xxx website1hostname) in the Windows hosts file, and that does not seem to work either.

    I was just going to put these websites on different ports on localhost, but the apache install on my Mac seems to crash whenever I specify multiple Listen directives. No idea why.

    -- brian
  18. This is what I do, and it works. What do you have the NameVirtualHost directive set to in your httpd.conf file? You need to also change this to be 192.168.x.x, instead of I think you can use * as well... Make sure that your <VirtualHost> directive is the same way, i.e. use 192.168.x.x instead of

    I'm not sure about that. The virtualhost method is probably preferable to you anyway - it's just a matter of working out the kinks. I can tell you that it does work once you get everything set up, though.

  19. Thanks Rob - you got it! I had to use the ip assigned to the OSX (i.e. 192.168.x.x). NameVirtualHost needs to be set for that ip address. The VirtualHost directive needs to include the 192.168.x.x as well. And the Windows hosts file needs to have a pointer from 192.168.x.x to whatever the ServerName is set to in the VirtualHost directive. ServerName is set to whatever I want it to be (e.g. website1). Then in IE http://website1 gets me what I want on my apache server on OSX.

    Greatly appreciate the help! This just made my life easier for testing on IE :)

Share This Page