Tech Line
Virtual PC Network Binding Breakdown
Here’s how to reliably change the network binding assignment of a running Virtual PC.
Chris: I can’t figure out how to change the network interface that a Virtual PC VM is bound to. When I change a Virtual PC VM’s network adapter, the VM can’t talk to any other system. Is this a bug, or am I doing something wrong?
— Randy
Tech Help—Just An
E-Mail Away |
Got a Windows, Exchange or virtualization question
or need troubleshooting help? Or maybe you want a better
explanation than provided in the manuals? Describe
your dilemma in an e-mail to the MCPmag.com editors
at mailto:[email protected];
the best questions get answered in this column and garner
the questioner with a nifty MCPmag.com baseball-style
cap.
When you send your questions, please include your
full first and last name, location, certifications (if
any) with your message. (If you prefer to remain anonymous,
specify this in your message, but submit the requested
information for verification purposes.)
|
|
|
Randy, this problem could viewed as a bug, depending on who you talk to. The reason I’m calling your specific problem a bug is because the same behavior is not displayed with VM Workstation VMs. Microsoft may see this problem as an “undocumented feature.”
With Virtual PC, you can change the physical or virtual network adapter that a VM is bound to by clicking the Edit menu from the virtual PC VM’s window and selecting Settings. From there you click the Networking setting and select the appropriate adapter to bind the VM to in the Adapter drop down menu.
In theory, if you bind a VM’s virtual NIC to a different physical adapter on the host by selecting the new adapter and then clicking OK in the VM’s Settings dialog box, the VM should immediately bind to the newly selected adapter. However, with Virtual PC, this is rarely the case.
So after binding a Virtual PC VM to a different network adapter, a best practice is to disable and then enable the VM’s network interface. Doing this to reset the interface will reconnect the VM to the newly associated physical network interface on the host. The same process should be followed if you change the virtual network adapter binding from a physical NIC on the host to a virtual, “Local Only” network.
To sum up the work-around, after changing the network adapter binding of a Virtual PC VM, your task of resetting the interface varies, depending on the guest OS installed in the VM. For a Linux guest, the network can be reset by running the following two commands:
/etc/init.d/network stop
/etc/init.d/network start
For a Windows guest VM, you need to access the Network Connections window (such as by right-clicking on the “My Network Places” object and selecting Properties). From the Network Connections window, right-click on the network interface shown and select Disable. Once disabled (it will have a grayed out appearance), right-click on the Interface again and select Enable. For newer Windows guest operating systems, such as Windows XP, you can also right-click on the interface object and select Repair. One other approach with Windows is to use the netsh command to reset the interface. Here's the basic syntax of using netsh to disable an interface:
netsh interface set interface <interface name> DISABLED
For example to disable an interface with its default name “Local Area Connection,” run:
netsh interface set interface “Local Area Connection” DISABLED
To enable the interface, you'd then run:
netsh interface set interface “Local Area Connection” ENABLED
Using this approach to switch network interfaces of a running Virtual PC VM can be useful if you’re using a VM for testing across multiple networks. Of course, one other approach would be to add additional virtual network adapters to the VM and bind each adapter to a different network interface.
With Windows network configuration issues, netsh is literally the jack-of-all-trades command-line admin tool. For more information on netsh, take a look at Microsoft KnowledgeBase Article 242468, "How to Use the Netsh.exe Tool and Command-Line Switches." Good luck with your virtual testing!