Virtualization - Network Part 4
Virtual networking is a valuable tool for any network administrator. Virtual networking can run several networks through a single physical network. Allowing you to segregate network traffic and give the different virtual "networks" different levels of security.
Network virtualization enables a network administrator to isolate virtual machines that share the same host. This is an effective solution when you are hosting virtual machines for another organization, because network traffic is separated into separate virtual LANs (VLANs).
When network virtualization is implemented, each virtual machine has two IP addresses:
- The customer IP address assigned by the customer to the VM so that the VM can communicate with the customer's internal network. This is the IP address that is displayed when you use the ipconfig command on the VM.
- The provider IP address assigned by the hosting provider to the VM so that the provider can manage the VM. This address is visible to the host and to other hosts on the physical network, but not from within the VM itself.
Because each provider address is different, multiple virtual machines on a host can actually have the same customer IP address without causing addressing conflicts.
Network virtualization can be configured in several ways:
- Create virtual switches and connect different VM adapters to different switches in order to segment the network.
- Implement VLANs to extend network segmentation into the physical network, and have two hardware switches that support VLANs.
Dividing a network between multiple virtual switches and multiple physical adapters, and implementing VLANs, are options to isolate network traffic and optimize Hyper-V network performance.
A virtual switch controls network traffic between virtual machines, including virtual machines hosted on the same server and virtual machines hosted on other servers on the physical network. Hyper-V on Windows Server 2012 supports three different types of virtual switches.
- External - Used to map a network to a specific network adapter or network adapter team.
- Internal - Used to communicate between the virtual machines on the host, and between the virtual machines and the host itself.
- Private - Used to communicate between virtual machines, not between the virtual machines and the host itself.
When you configure a virtual switch, you can also configure VLAN IDs so that you can associate existing VLANs on the physical network with VLANs within the Hyper-V host. This enables you to separate network traffic into logical networks, where traffic can move from one VLAN to another only after passing through a router.
Media access control (MAC) addresses uniquely identify a network card. They are 6-byte hexadecimal numbers that identify a NIC. The first three identify manufacturer and the last three the actual NIC assignment. This poses a problem with virtual network adapters. The virtual switch in Hyper-V is a traditional layer 2 switch, meaning that it switches based on MAC address. The MAC addresses of the source and destination machines are sent in each packet, and the switch uses these addresses to route the packet.
An external virtual switch is connected to the external world (the world outside the virtualized environment) through the physical NIC. Ethernet packets from a Virtual Machine destined for a machine outside the virtual environment are sent out through this physical NIC. This means that the physical NIC must be able to carry the traffic from all the Virtual Machines connected to this virtual switch. This is harder than it seems because the packets being routed through the physical NIC will contain multiple MAC addresses, one for each Virtual Machine‘s virtual NIC.
Unless you specify static MAC addresses for each Virtual Machine's network adapter, Hyper-V will allocate MAC addresses from an address pool. By default, a MAC address pool contains 255 MAC addresses.
When you have only one Hyper-V host, automatic MAC address allocation should not present any problems because the host will ensure that each Virtual Machine has a unique MAC address from the pool. However, when you have multiple Hyper-V hosts that are connected to external networks, you should consider configuring each host so that it uses a different address pool.
In addition, when Virtual Machines get their IP addresses through DHCP, you should consider assigning static MAC addresses so that the DHCP reservation ensures that the IP address is always allocated to the same MAC address.
If you are configuring MAC address ranges for several hosts, you might want to change the values of the fifth pair of hexadecimal digits.
High Availability and Failover
Virtual Network Adapters
Hyper-V is similar to the preceding product, Virtual Server, but has key differences. Hyper-V only binds the virtual network service to a physical network adapter when a virtual switch is associated with the physical network adapter in question. You must assign a virtual switch to your actual physical host machine's network card.
Hyper-V has two kinds of virtual network adapters that you can choose from:
- A network adapter (formerly known as a synthetic network adapter) that is designed specifically for VMs to significantly reduce CPU overhead during network I/O by using shared memory on the VM bus for more efficient data transfer.
- A legacy adapter (formerly known as an emulated network adapter) that simulates a hardware NIC.
In the virtual machine settings, when the virtual machine is turned off, you can add either or both network adapter types. In the properties of the network adapter, you can choose which virtual switch or none, to connect the network adapter to. Different NICs can be connected to different physical network adapters, if needed.
The network adapter can provide VLAN tagging. If you choose to do this, performance will be significantly better if the physical network adapter supports
NDIS ENCAPSULATION IEEE 802 3 P AND Q IN OOB
encapsulation for both large send and checksum offload. Without this support, Hyper-V cannot use hardware offload for packets that require VLAN tagging, causing decreased network performance.
The network adapter has much better performance than the legacy adapter, but requires a driver in the guest operating system. This driver is added when you install integration services. The legacy adapter does not require a driver, and can be used for older guest operating systems that do not support integration services, or for virtual machines such as bare metal boxes that must PXE boot from the network.
Unless you require the legacy adapter, you should delete any that you have. If you do require a legacy adapter to boot from the network, make sure that it is listed first in the virtual machine settings, under Hardware, under BIOS, in the Startup Order.
There are several properties you can configure for a virtual network adapter.
- Virtual Switch - The virtual switch associated with the NIC.
- VLAN ID - The ID for the virtual LAN.
- Bandwidth Management - The ability to manage bandwidth to better organize network traffic.
- MAC Address - The physical address of the NIC. In the case of a virtual NIC, the virtual address.
SR-IOV - This new feature allows you to assign a network adapter that supports single-root I/O virtualization (SR-IOV) directly to a virtual machine.
- SR-IOV - This allows a PCIe device to appear to be multiple separate physical PCIe devices. The end result is network performance that is almost the same as in a physical, non- virtualized network. You can only select SR-IOV if there support in the BIOS, the operating system, and the hypervisor that is running on the hardware.
Note: VLANs is beyond the scope of this blog. For more information, see "Understanding Hyper-V Virtual Networks - Part 1 - Switching basic concepts" at http://blogs.technet.com/b/apb/archive/2009/03/10/understading-hyper-v-virtual-networks-internally.aspx.