Understanding and Configuring Hyper-V Virtual Networks
Before creating virtual machines with the Hyper-V environment it is worth first gaining an understanding of both the Hyper-V networking architecture and networking options which are available to guest operating systems running within virtual machines. The purpose of this chapter, therefore, is to provide a high level overview of Hyper-V networking and to cover the steps involved in configuring Hyper-V virtual networks.
The Hyper-V Virtual Network Architecture
As previously outlined in the chapter entitled An Overview of the Hyper-V Architecture, it was explained that Hyper-V consists of a parent partition and multiple child partitions. These partitions are essentially virtual machines. Running in the parent partition is an instance of Windows Server 2008 which provides services to the child partitions which contain the guest operating systems. The services provided by the parent partition include networking for the guest virtual machines. A high level view of this architecture is illustrated in the following figure:
As outlined in the above figure, each virtual machine for which networking is configured has a virtual network adapter. This adapter is connected, in turn, to a virtual network switch running in the parent partition. This virtual network switch provides connectivity, depending on the configuration of the selected virtual network, to the parent partition, other virtual machines on the same virtual network and access to the external network via a physical network adapter installed in the host system.
To avoid confusion, it is important to note that there is one virtual switch for each virtual network configured in the Hyper-V environment. In fact, pre-release versions of Hyper-V referred to creating Virtual Network Switches rather than Virtual Networks.
Hyper-V Virtual Network Types
Hyper-V provides the ability to create multiple virtual networks which may be used by virtual machines. The types of virtual networks supported by Hyper-V fall into three distinct categories, details of which are provided in the following table:
Type |
Description |
---|---|
External Virtual Network |
Virtual machines connected to an external virtual network are given access to the external network via a physical network adapter installed in the host system. Virtual machines are also able to communicate with both the parent partition and other virtual machines running on the same virtual network. |
Internal Virtual Network |
Virtual machines connected to an internal virtual network have access to both the parent partition and other virtual machines attached to the same virtual network. Hyper-V Internal Virtual Networks do not require a physical network adapter and no access to external networks is provided. |
Private Virtual Network |
Virtual machines connected to a private virtual network have access only to other virtual machines attached to the same virtual network. Hyper-V private virtual networks do not require a physical network adapter and no access to the parent partition or external networks is provided. |
Note that there is a one to one correspondence between external virtual networks and physical networks adapters. It is not, therefore, possible to bind more than one external virtual network to a physical network adapter. if multiple external virtual networks are required, a physical network adapter must be installed in the host system for each one. If the Hyper-V server is to be administered remotely, it is also necessary to dedicate a separate physical network adapter for this purpose.
Creating a New Hyper-V Virtual Network
Hyper-V virtual networks are created and managed using the Virtual Network Manager. To access this tool, begin by launching the Hyper-V Manager (Start->Administrative Tools->Hyper-V Manager). Unless the Hyper-V Manager is already connected to the required Hyper-V Server, connect to the appropriate server in the left hand panel by right clicking on Hyper-V Manager in the left hand panel and selecting Connect to Server.... Once connected, click on the Virtual Network Manager... link in the Actions panel. Once loaded, the manager dialog will appear as follows:
The left hand pane in the Virtual Network Manager contains a list of existing virtual networks configured on the selected Hyper-V server. In the above example, two external virtual networks are configured. At the top of the list is the option to Add Virtual Network which, when selected, provides the option to add an External, Internal or Private virtual network. Once the virtual network type has been selected, the main panel will change to display the virtual network settings screen:
In the case of private and internal virtual networks, the name of the virtual network needs to be specified together with optional descriptive notes. In the case of external private networks, a physical network adapter must be selected from the drop down list. As previously mentioned, physical network adapters which are already bound to another external network, or that are used for remote administration of the Hyper-V Server cannot be used for other external virtual networks.
The Enable virtual LAN identification for parent partition option is only available for external virtual networks and allows an identification number to be specified in order to isolate network traffic from the parent partition. This option requires a physical network adapter with VLAN support.