Tuesday 31 August 2010

How To Configure Virtual PC And Virtual Server In Windows OS

When several virtual machines are running on a single physical computer concurrently, you have to configure networking between guest and host operating systems depending on their tasks. These are basic usage scenarios of virtual networks on a virtualization platform:
  • creating a virtual machine, which network adapter is shared with a physical network card - as a result, a virtual machine acts as an independent computer in the extranet
  • creating isolated networks with several virtual machines in order to test software, to train personnel, and to use linked servers within an intranet
  • working with a virtual machine in an extranet, when you need only connections initiated by this virtual machine to the extranet
Microsoft virtualization platforms offer a networking type for each option.

Virtual Networking

Microsoft offers this network type to let a virtual machine provide services to an extranet (relative to the host system). In this case a virtual machine acts as an independent computer in a network with the host computer. If there is a DHCP server in the network (Dynamic Host Configuration Protocol) to assign IP addresses, a virtual machine will get it and will work as an independent system in the network (otherwise, you will have to specify an external IP manually). Here is a diagram of this networking type:



Virtual Networking diagram
This networking type is assigned to a virtual machine by default, because it fits most usage scenarios. This virtual networking type also connects a host system with guest operating systems.

Local Only Networking

This networking type allows to join several virtual machines into an isolated network within a host system, so that components of the external network (relative to the host system) do not have access to them. Here is the diagram:



Local Only Networking Diagram
This networking type does not allow virtual machines to interact with the host system.

Shared Network with NAT (Network Address Translation)

Security is one of the most important issues to be taken into account as you plan to use virtual machines in extranets. If a virtual machine is created only to let users and software work with services in extranet without granting its services to the extranet, Shared Networking will be an ideal choice.



NAT Networking Diagram
In this case a host operating system has a DHCP server, which assigns internal IP addresses to virtual machines within the host network. A virtual machine can initiate a connection to extranet with a special service (Network Address Translator) that translates IP addresses. In this case virtual machines use a single IP address of the host system (Shared IP), and they are not visible to extranet.

Configuring Virtual PC Network

As you plan how to deploy several virtual machines on a single physical host, you should think about their network structure beforehand. Virtual PC is often used to create a virtual environment for software tests or to create portable user environments. You should often provide access to extranet for virtual machines as well as their interaction between each other. You can specify individual networking options for each virtual machine by attaching one or several virtual network interfaces to a given network type. Virtual PC allows to create up to four virtual network adapters for a single virtual machine. A guest system detects emulated adapters as DEC / Intel 21140 Based PCI Fast Ethernet adapter. They are fully compliant with IPv6 as well as PXE (Preboot eXecution Environment). Microsoft virtualization platforms do not support Token Ring networks.
When you install a virtual machine in Virtual PC, you can see a network icon in the bottom left corner of the console, which blinks as a virtual machine addresses a virtual network adapter. Right-click this icon and choose "Networking Settings", to configure network for a virtual machine. You can also open network settings by choosing in the main menu "Edit" -> "Settings" -> "Networking":



Configuring network in a virtual machine
Note
A virtual machine usually applies network settings on-the-fly, you don't have to reboot a virtual machine.

Not Connected

If you don't want your virtual machine to have a network adapter so that it couldn't access network resources of the host system and other guest systems, choose "Networking", "Not Connected" for the first network adapter in your virtual machine:



Configuring network in a virtual machine
Remember, if you don't need networking in a virtual machine, you'd better choose this option, because it may speed up applications that check for a network connection (owing to no latencies).

Virtual Networking

Virtual PC users very often have to surf Internet in a guest system. But a guest system must also provide some services to extranet (for example, shared folders). In this case "Virtual Networking" will do - virtual machines within a host system interact between each other and with extranet.
To assign this scenario to a virtual network adapter, choose "Networking" and then your physical network adapter in virtual machine settings:



Configuring network in a virtual machine
Note
A virtual machine on the Virtual PC platform can be started without being connected to other guest systems on a host computer. You can run a virtual machine from a command prompt. Click "Start" -> "Run" -> type "cmd" and then press Enter. Then execute the following command:
"\Virtual PC.exe" –pc -extnetworking -launch
(-extnetworking does not affect Shared Networking.)

Local Only

If you choose this networking type for guest systems, virtual machines will interact only with each other, they won't get access to extranet of the host system. In this case network traffic between virtual machines does not reach the host system, it's located in intranet. Keep in mind that Virtual PC does not use a DHCP server in this networking type, so you'll have to configure IP addresses of virtual machines manually. It should be noted that a network adapter of one of guest systems working in promiscuous mode in such a virtual network (when a network card accepts all packets, not just the ones sent to it) can intercept traffic of other virtual machines.
In order to set a virtual network adapter to this mode, choose "Networking" and then "Local Only":



Configuring network in a virtual machine

Shared

As we have already mentioned, this networking type "hides" a virtual machine behind a host operating system. It allows to initiate connections to extranet from a guest system via a modem or LAN connection (however, Microsoft does not recommend using a modem in virtual machines). Access to virtual machines from extranet will be impossible (you should take it into account as you work in a virtual machine). In this case a DHCP server works within a virtual network, which assigns 192.168.131.x internal addresses to virtual machines, where x ranges from 1 to 253 (unfortunately, Virtual PC does not allow to change this range). Remember that this networking type does not support interaction between virtual machines as well as connections from a host system to a guest one. Only the first virtual network adapter can be used for Shared Networking.
In order to set a virtual network adapter to this mode, choose "Networking" and then "Shared Networking (NAT)":



Configuring network in a virtual machine
If you do not belong to the administrator group in a host system, you cannot work with the extranet via ICMP (Internet Control Messages Protocol).

Setting up several virtual networks in a host system

As you deploy virtual machines on desktops, you often have to configure a network between virtual machines and a physical host, when there is no connection to an extranet. Sometime a physical computer does not have a network adapter at all. However, even in this case you can set up networking between a host OS and virtual machines. Besides, in some cases you must set up several isolated "Local Only" virtual networks, where guest systems will interact. Microsoft offers a simple and elegant solution: virtual machines work with the host system via Loopback Adapter, which connects virtual machines and a host system into a common isolated network. As you add this interface, a host system allows to choose it as a network adapter in a virtual machine, so they can interact with a host within a common virtual network. In this case a loopback adapter acts as a virtual switch or hub, to which network adapters of the host and guest systems are connected. You can add several such adapters to create several virtual isolated networks. These networks can be connected by a virtual machine with two virtual network adapters - you just assign each adapter to a corresponding loopback adapter of the host system. When you access Internet from a virtual machine in such network, don't forget to enable Internet Connection Sharing in the host system.
To add a loopback adapter, do the following steps in the host system:
  1. Click "Start" -> "Settings" -> "Control Panel" -> "Add Hardware".
  2. Click "Next", choose "Yes, I have already connected the Hardware", then click "Next":



    Adding a loopback adapter

  3. Then choose the last "Add a new hardware device" element from the list and click "Next":



    Adding a loopback adapter

  4. Choose "Install the hardware that I manually select from a list" in the new window and click "Next":



    Adding a loopback adapter

  5. Choose "Network Adapters" from the list and click "Next":



    Adding a loopback adapter

  6. In the Manufacturer list choose "Microsoft" and in the next list choose "Microsoft Loopback Adapter":



    Adding a loopback adapter
Then click "Next" and "Finish". The list of hardware devices will now contain a loopback adapter in the Network Adapters category. So you can "assign" virtual network adapters to it like to a switch.
Open network settings of a virtual machine ("Virtual PC Console" -> "Settings"), choose "Networking", and bind a virtual network adapter to the loopback adapter:



Binding a virtual network adapter
After that, specify an IP address and network mask for the network adapter. You are recommended to choose an IP address within the 192.168.x.y range (where x ranges from 0 to 255, y – from 1 to 254) to avoid conflicts with other extranet addresses. Then you should configure the IP address of a network adapter in the guest system in compliance with the host network (x must match this number in the host, 255.255.255.0 mask).
Other adapters can be bound to other interfaces to join virtual networks.

Using Wi-Fi adapters in Virtual PC 2007

Some users of Virtual PC 2007 need to use a wireless network in a virtual machine through a Wi-Fi adapter in the host system. But such adapters are not always recognized. Users often face the following problem:



Wi-Fi adapter detection error
In this case virtual machines won't be able to access extranet and host resources, if this Wi-card is used for Virtual Networking, because Virtual Machine Network Services are disabled for this connection. To make virtual machines work with a Wireless adapter, right-click the Wi-Fi network connection in the host system and choose "Properties". Select the "Virtual Machine Network Services" checkbox:



Activating Virtual Machine Network Services

Configuring Virtual Server R2 network

Unlike Virtual PC, Virtual Server R2 has more features to configure networking between virtual machines, but their network principles are the same. Virtual Server uses two networking types:
  • Internal Network (similar to Local Only in Virtual PC)
  • External Network (it uses a physical network adapter of the host system to work with extranet)
After you install Microsoft Virtual Server, it automatically creates one internal and several external networks (as many as the number of physical network adapters in the host system).
To see the list of available networks in Virtual Server, choose "Virtual Networks" -> "Configure" -> "View All":



The list of available networks in Virtual Server
Then you will see the list of available virtual networks:



The list of available virtual networks
As you can see in the picture, we can use a virtual loopback adapter just like in Virtual PC. To edit virtual network properties, point a mouse cursor at a virtual network name and choose "Edit Configuration".



Editing virtual network properties
We can edit network or DHCP settings here. As you click "Network Setting", you will open a virtual network editor:



Virtual network editor
You can change the name of a virtual network. The network adapter field specifies a type of the virtual network. If it contains "None (Guest Only)", virtual machines, which network adapters are connected to this network, will work only with each other. Network of the host system will be inaccessible (similar to Local Only in Virtual PC). If you choose a physical adapter of the host system, the networking type will be similar to Virtual Networking in Virtual PC.
You can add a virtual network adapter to the edited network in the "Disconnected virtual network adapters" field. You can edit a description in the "Virtual network notes" field.
If you get back and click the DHCP Server link, you can enable and configure a DHCP server for this virtual network:



Configuring a DHCP server
DHCP settings include all necessary properties of a network adapter it specifies at startup (starting and ending IP addresses, default gateway, subnetwork, DNS and WINS servers, etc). As you configure a DHCP server, you must take into account that the first 16 addresses of a given range are reserved by the server and are never assigned to virtual machines. DHCP server is disabled by default for external networks, so that virtual machines could obtain network settings from the external network.
After you configure a virtual network, you may proceed to the configuration of virtual network adapters. You can also create your own virtual network by clicking the Add link in the Virtual Networks category. Virtual Server allows to create an unlimited number of virtual networks with as many virtual machines as you like. When you create a virtual network, a .vnc file with network settings is created in the \Documents and Settings\All Users\Documents\Shared Virtual Networks folder. You can then import this file to Virtual Server. Remember that virtual networks cannot be moved to another physical host, because their settings depend on the host hardware.

Configuring network adapters in a virtual machine

To configure one or several virtual network adapters, move the mouse cursor to the name of a virtual machine in the main Virtual Server window, then click "Edit Configuration" and "Network adapters".



Configuring network adapters in a virtual machine
On this page you can choose a virtual network, to which a virtual network interface will be added, add another network interface (up to four interfaces in a virtual machine), and specify a static or dynamic MAC address (Media Access Control) of a network adapter. Microsoft recommends to use dynamic MAC addresses to avoid network conflicts between virtual machines. If you use static addresses, make sure they are unique in each virtual machine (this is especially important, when you deploy virtual machines from a single virtual appliance on different servers). If there is still a conflict of MAC addresses, in the .vmc file replace the line
0003FFxxxxxx
with

then reboot the guest system, so that Virtual Server could assign a unique MAC address to the network adapter.
Like in Virtual PC, you can disable networking in a virtual machine by choosing "Not Connected" in the "Connected to" field. Virtual Server does not have Shared Networking. But you can easily get similar functionality by binding virtual machines to a loopback adapter and then enabling Internet Connection Sharing.

Conclusion

Virtual PC and Virtual Server platforms allow users to create virtual networks with various interaction scenarios. Even though they are not configured as flexibly as in VMware products, they still allow all popular scenarios of using several virtual machines on a single host working in one or several isolated or connected networks. As both Microsoft platforms are free, they can be used by enthusiasts, home users, and small companies. Virtual Server and Virtual PC offer a huge field for experiments, virtual networks training, if you don't have an opportunity to build a real network.

No comments:

Post a Comment