I’m a big fan of using multple Microsoft Virtual PC images, especially for demos and development. My current machine has a second hard disk that is dedicated to images that I use for such work.
One of the problems I’ve run into in the past is getting multiple Virtual PC instances to talk nicely together over a network – regardless of whether the host machine is connected or not. On frequent occasions I’ve turned up to do demos only to find out that Virtual PC #1 cannot see Virtual PC #2 on the network – even though they are on the same machine!
This week I’ve been putting together a demo that involves 4 Virtual PCs talking to each other simultaneously (showing interop between different vendors). I put in some time working out a foolproof way to get each Virtual PC to talk to each other, and also be able to use the network adapter of the host machine.
Here’s how I nailed it:
1. Shutdown all of the Virtual PCs that you want to connect together (they must be turned off – suspend state is not good enough).
2. In the Virtual PC console, select one of the Virtual PCs and select “Settings”
3. In the Setting window, go down to “Networking”
4. Under the “Number of network adapters”, select “2” from the combo box.
5. Set the first adapter to the network interface of your machine (e.g. Intel/PRO/1000 MT Mobile Connection).
6. Set the second adapter to “Local only”
7. Start the Virtual PC – log in and make sure that two network adapters have been recognized.
8. Assign the first network adapter (Local Area Connection) to DHCP – or whatever settings you use on the network connected to your host machine.
9. Set the second network adapter (Local Area Connection 2) to a static, private class C IP address (e.g. 192.168.200.1, with a subnet mask of 255.255.255.0). Set the default gateway to 192.168.200.254. Don’t worry about DNS settings.
10. Repeat Steps 2 – 9 for all your Virtual PCs – make sure you give each Virtual PC a unique IP address in step 9, but within the range of your subnet (e.g. 192.168.200.2, 192.168.200.3 etc. for my example).
11. On each Virtual PC edit the hosts file (found in c:\windows\system32\drivers\etc directory). Add the name of all the other Virtual PCs, together with their IP address.
12. Make sure that the Internet Firewall on adapter #2 is set correctly for the type of applications that you want to work between the Virtual PCs.
That’s it! – from any Virtual PC you will now be able to both access any other Virtual PC using the hostname and/or IP address you allocated on the second network card. You should also be able to access the outside world using the first network adapter.