Virtual Networking for Hyper-V (Part 1)

by [Published on 8 June 2010 / Last Updated on 8 June 2010]

How virtual networking works in a Hyper-V environment and how you can configure the virtual network in a way that helps you to achieve your networking goals.

If you would like to read the first part in this article series please go to:

Introduction

Understanding Hyper-V’s inner workings is the key to achieving good server performance and resiliency. This article series explains how virtual networking works in a Hyper-V environment and how you can configure the virtual network in a way that helps you to achieve your networking goals.

One of the main reasons why many organizations initially choose to begin virtualizing their data centers is to reduce hardware costs by using more of the existing server hardware’s total capacity. While making better use of underutilized server hardware sounds appealing, I have seen several organizations that have pushed their servers too far and ended up with a variety of performance problems as a result. Obviously, there is a fine line between using more of your server’s capabilities, and over stressing your server hardware. Often times this difference boils down to understanding how the server’s configuration affects performance.

That being the case, I want to take the opportunity to talk in depth about virtual networking. The way that virtual networking is configured can have a big impact on a server’s performance and on the overall resiliency of the virtual servers that it hosts.

Before I get started, it is important to understand that each virtualization product implements virtual networking in a different way. For the purposes of this article series, I will be discussing virtual networking as it applies to Microsoft’s Hyper-V.

The Virtual Network Adapter

The first aspect of virtual networking that I want to show you is that of the virtual network adapter. For the sake of demonstration, I have installed Hyper-V on top of Windows Server 2008 R2. In Hyper-V speak, the server’s primary operating system is known as the parent partition. The parent partition was referred to as the host operating system in Microsoft’s Virtual Server, and you will still occasionally see it referred to as the host operating system even in regard to Hyper-V.

With this configuration in mind, take a look at Figure A. This screen capture shows the network adapters that are visible within the server’s primary partition. 

Virtual Network 1A.jpg
Figure A: Hyper-V creates a Virtual Network Adapter

The network adapter on the far left side of the window is a physical network adapter, and it is connected to a physical Ethernet switch. Before I installed Hyper-V, I configured this adapter to use an IPv4 address. I then used this network connection to join the server to a domain and to download any available updates from Microsoft.

Initially, it would seem that there is absolutely nothing special about this network adapter, and prior to installing Hyper-V there really wasn’t. That all changed when I installed Hyper-V though. To see what I mean, take a look at Figure B. This screen capture shows the properties sheet for this network connection.

Virtual Network 1B.jpg
Figure B: Hyper-V makes some drastic changes to the way that the physical network adapter is configured within the parent partition

As I mentioned earlier, I used this network adapter when I joined my server to a domain, and when I downloaded versions updates to Windows Server. If you look closely at the figure above though, you will notice that both IPv4 (Internet Protocol Version 4 (TCP/IPv4)) and IPv6 (Internet Protocol Version 6 (TCP/IPv6)) have been disabled. The Client for Microsoft Networks has also been disabled, along with pretty much every other item on the list. 

The only item that is enabled is the Microsoft Virtual Network Switch Protocol. This protocol isn’t installed by default. It is only added when you install Hyper-V.

If you look back at Figure A, you will notice that the second network adapter that is listed is also a physical Ethernet adapter, and that it has been disabled. This actually has nothing to do with Hyper-V or with virtual networking. I had originally configured my server to use two physical network adapters, for reasons that I will explain later in the series. Last week, this particular adapter stopped working. Since I haven’t been able to schedule a time when I could take the server down to replace the failed adapter, I simply disabled it for the time being. Therefore, for the purposes of this article, you can completely ignore this network adapter.

The network adapter shown on the right hand side of Figure A looks just like the other two adapters at first glance, but you will notice that the adapter’s description says “Local Area Connection – Virtual Network”. As the name implies, this is a virtual network adapter that was added to the parent partition when I installed Hyper-V.

Now, take a look at Figure C. Figure C shows the properties for the parent partition’s virtual network adapter. As you can see in the figure, the virtual network adapter is configured similarly to the way that the server’s physical network adapter was configured prior to the installation of Hyper-V. The IPv4 and the IPv6 protocols are both enabled, as are the Client for Microsoft Networks, the QoS Packet Scheduler, and File and Printer Sharing for Microsoft Networks.

Virtual Network 1C.jpg
Figure C: The parent partition’s virtual network adapter is configured similarly to the way that the physical network adapter had been prior to Hyper-V being installed

In spite of its initial appearance to the contrary, the virtual network adapter has not adopted the physical network adapter’s configuration. It only seems that way, because prior to my installing Hyper-V, the physical network adapter was configured to use the default set of items. Since the virtual network adapter is also using a default configuration, it is easy to assume that the virtual network adapter based its configuration on the physical network adapter’s original configuration. This simply isn’t the case though.

Prior to installing Hyper-V, I had configured my server’s physical network adapter to use a static IPv4 address. The virtual network adapter did not adopt this address. In fact I had to manually assign an IPv4 address to the virtual network adapter before I could use it. It is worth noting though, that if a DHCP server were available, then the virtual network adapter could easily have been assigned a dynamic IP address.

So far I have shown you the virtual network adapter’s configuration, and how it differs from the way that the physical network adapter is configured, but I have yet to explain what the virtual network adapter is, or what it does.

In Hyper-V, the parent partition does not have full control over the server’s hardware. Most of the hardware functions are managed by a low level component called the Hyervisor. The Hypervisor ensures that hardware resources are made available to each virtual machine and to the server’s primary operating system.

As you will recall, Microsoft refers to the server’s primary operating system as the parent partition. Virtual machines are said to exist within child partitions (which are sometimes referred to as guest partitions). The point is that each operating system resides in its own partition on top of the Hypervisor. That being the case, the parent partition does not directly use the physical network adapter. Instead, all network requests pass through the virtual network adapter, and then through a virtual switch, and ultimately to the physical network adapter. The diagram shown in Figure D illustrates how this works.

Figure D: The parent partition passes all network requests through the virtual network adapter

Conclusion

Hopefully, you are beginning to get the picture of how virtual network adapters are used in Hyper-V. In Part 2 of this series, I will explain the role played by the virtual network switch.

If you would like to read the first part in this article series please go to:

Featured Links