Accessing host from a Parallels virtual machine

Sometimes I have the need to test the Eclipse applications I build by using a virtual machine (usually running another operating system). As I’ve set up local continuous building using Hudson I always have a Equinox p2 repository ready containing the latest build. The trick is to access this repository (which resides on the host) from Eclipse running on the virtual machine.

The first thing I did was to enable Parallels to show it’s networking information in the OS X system preferences. This is done through the Parallels preference settings as shown below:

Next thing was to figure out the IP-address of the host. This was found in the system network settings when looking for the Parallels Shared Networking Adapter. In my case this address was set to 10.211.55.2. Now this is the IP-address that guest virtual machines will have to use when referencing the host. It should never change so it’s a pretty safe bet. Note that the guest is set up to use shared networking.

The easiest way to let the guest know about this address is to modify /etc/hosts or C:/Windows/System32/drivers/etc/hosts on Windows and add a line mapping the IP-address to a sensible name. I use “vmhost”.

Now I just have to add the repository to the Eclipse update manager running on the virtual machine and install from there. For instance: http://vmhost:8080/job/Buildmonitor/ws/builds/buildmonitor-p2repo/. This will reference the Buildmonitor p2 repository built by the Hudson instance running on the host.