In Hyper-V, a virtual machine has one or more virtual network adapters, sometimes also called virtual NICs or vNICs. A vNIC connects to a host’s virtual switch. This allows the virtual machine to potentially talk to other virtual machines on the same virtual switch. An external virtual switch has a port that connects to a physical NIC on host. And this allows virtual machines that are connected to an external virtual switch to talk on the LAN, and potentially on the Internet. Note that this all assumes that machines are on the same VLAN, are routed, don’t have firewalls blocking communications, and that other virtual technologies such as Hyper-V Network virtualization or Port ACLs aren’t in the way. In this post I will discuss the types of NICs available and how to add them to a virtual machine.
Hyper-V offers two kinds of virtual NICs that can be used in virtual machines – one for the past and one for now.
The first kind is simply known as a “network adapter,” but you can think of it as the synthetic network adapter. The synthetic network adapter requires that the guest OS is Hyper-V-aware; in other words, the child partition is enlightened or it is running either the integration components for Windows or the Linux Integration Services.
Hyper-V will add a single synthetic vNIC into a virtual machine’s specification by default. You can add up to eight synthetic vNICs into a single virtual machine. The below screen shot shows a generation 1 virtual machine with a single synthetic vNIC. Note that this vNIC has a name (VM01). By default, a synthetic vNIC is called “network adapter” when created in Hyper-V Manager or in Failover Cluster Manager. This virtual machine was created using System Center Virtual Machine Manager (SCVMM), so the vNIC was given a label. You can also name vNICs using PowerShell, which can be handy if you do want to create lots of vNICs in a single virtual machine.
The second kind is a legacy network adapter. You can have up to four legacy network adapters in a virtual machine. The name suggests the primary focus of this type of vNIC; the legacy network adapter is intended to be used in unenlightened virtual machines that do not have the integration components or Linux Integration Services installed.
A common question on forums is “Why can’t my Windows XP VM connect to a network?” The reason is either of the following must be true:
Another reason to use the legacy network adapter is that it offers support for PXE network boots. Synthetic vNICs do not have support for PXE in generation 1 virtual machines. The use of virtual machines in System Center Configuration Manager (SCCM) and Windows Deployment Services (WDS) for developing and testing OS deployment is common, so you will find yourself using legacy vNICs quite a bit if using generation 1 virtual machines.
Hyper-V uses synthetic network adapters for a reason; that’s because they offer more functionality and they offer better performance. Legacy network adapters are less efficient, causing more context switches between kernel mode and user mode on the host processor.
The generation 2 virtual machine was added in Windows Server 2012 R2 (WS2012 R2) Hyper-V to give us a new virtual machine virtual hardware specification that was legacy-free. It should therefore come as no surprise that generation 2 virtual machines do not offer legacy network adapters.
Generation 2 virtual machines only support synthetic network adapters. You can have eight of these efficient vNICs in a single generation 2 virtual machine.
There is no need for the legacy network adapter in generation 2 virtual hardware. Remember that generation 2 virtual machines only support 64-bit edition of Windows 8 or later, and Windows Server 2012 (WS2012) and later. That means we don’t have an issue of enlightenment. Thanks to the new virtual hardware specification, Microsoft was able to add PXE functionality to generation 2 synthetic vNICs.