Networking with Virtual PC 2007

I wrote a post last month about how impressed I was with Virtual PC 2007 and how it has changed the way I work. This is a follow-up about a networking problem that I didn't discover until it was almost too late, as well as how to fix it.

I decided to install Vista Business on my laptop a few months ago, and aside from a few application compatibility issues, I've been pretty happy with it so far. One of the main problems is that Oracle 9i doesn't work with Vista, and that's a database we need to develop against. So, I fired up my Windows XP virtual machine, installed Oracle, and then connected to Oracle on the virtual machine just like I would if it were installed on another server. Everything was working smoothly, or so I thought.

A little background: The default networking option for your virtual PC is "Shared Networking." This allows the virtual PC to share your host PC's internet connection, but doesn't allow the host PC to talk to the virtual PC. So, instead of using shared networking, I set the virtual machine to directly use my wireless network. Both the host PC and the virtual PC got separate IP addresses from the router, and could therefore talk to each other. The only thing I didn't think about was that the second my laptop lost its connection to my router, I couldn't communicate with the virtual PC.

So, there I was, minutes before a demo with an important client, and my application server couldn't talk to my database, even though they were both on the same laptop.

The solution was relatively simple, but for some reason the information was really hard to find. First install Microsoft's Loopback Adapter on the host PC, and then tell the virtual PC to use it for its network access. The process is explained very well here.