Ben has a great post on using the “Shared Network” functionality of Virtual PC to allow virtual machines to access the host’s physical network. As he points out, this is good if you want to somewhat isolate your virtual machines from your host’s network (they sit behind a NAT) – but can cause problems with server-based applications running in virtual machines.
When I’m building a series of virtual machines, I go one step further. I tend to be *very* paranoid that software I’m installing in the virtual machines will adversely affect my host or other machines and services on the network. I suppose I’m also paranoid that the opposite might happen! My solution is to completely isolate the virtual machines from the “real” network using a loopback adapter and “proxy” their access through the host machine.
This can be accomplished by adding a loopback adapter to the host PC and setting the network address to an unused address on an unused or unrouteable IP subnet. I usually use 192.168.X.X or 10.10.X.X. For example, after adding a loopback adapter to Windows XP you might configure it with an address of 192.168.1.1 and no DNS server. The default gateway setting must be left blank otherwise you’ll have routing issues on the host machine – there will be two network cards each with a default gateway and Windows XP can become quite confused!
Now, once this is done, you can configure all of your virtual machines to use “bridged networking” in Virtual PC and point the bridged network card to the new loopback adapter. At this point, the guest OSes can communicate with the host (via the loopback adapter) but not with any other machines on the network as the host OS doesn’t bridge the two connections. It’s similar to configuring the virtual machine for “Local only” with the added benefit of getting to talk to the host PC. Once you have this working properly then you can download a web proxy application like CCProxy and install it on the host PC to allow your guest PCs to access the Internet through the host. The drawback (or benefit!) to this configuration is that other machines on the host’s network can’t access the virtual machines and (unless it’s through a proxy) the guest machines can’t access anything on the host’s network.
http://weblogs.asp.net/virtual_pc_guy/archive/2005/01/06/347965.aspx | Comments
Virtual PC has a convenient feature called 'Shared Networking'. What this is is a small virtual NAT (network address translation) router - which is quite similar to the cheap hardware broadband routers that a lot of people use (myself included). The advantage of Shared Networking is that your virtual machine can access the external network with needing to be directly connected to it*. This is handy if you don't want to have to worry about whether your virtual machine has all the latest security patches, or if you regularly move your physical machine between different network configurations (e.g. moving a laptop from you work network to your home network).
(Read the rest of Ben’s Post)