Virtual switches in Hyper-V

October 31, 2015 / Cloud Server Hosting

i. Summary
ii. Virtual Switch Types
iii. Virtual Switch Creation
iv. Extensions
v. Address Range of MAC

Summary

In the world of virtualization, it is not only about virtual machines but also switches. Moreover, VMware offers the “vSwitch” and Hyper-V itself offers “Virtual Switches”. Today, we will see how to create and configure a vSwitch under Hyper-V hypervisor.

These virtual switches are layer 2, that is to say. It determines the path to taken by an Ethernet packet using the MAC addresses of the devices.

The integration of Hyper-V in Windows 8 means. The hypervisor can be present on different types of machines, not just servers, but especially on laptops. Therefore, virtual switches must be not related to a physical network adapter only, but also to a Wi-Fi network card. The latest version of Hyper-V allows that.

Note: This tutorial is made with Hyper-V on Windows 8.

Virtual Switch Types

Hyper-V provides the ability to create three different types of virtual switches, here they are:

External: As the name implies, this type used to link the virtual switch to a physical network card in your machine to communicate with other network computers. In other words, all the machines connected to the virtual switch have this type of access to the physical network like any physical host.

Internal: Unlike this type of virtual switch makes it possible to connect with the physical network, we stay in-house, that is to say, that communication possible only between virtual machines connected to this type of switch. However, the machine acting as a Hyper-V server will be the only physical machine that can communicate with an internal VM virtual switch.

Private: Resumes the same principle as the “inner” kind, except that here the communication with the physical host acts as a Hyper-V server is not possible. The communication is exclusively inter-VM.

When creating a switch type, the choice is not final, because we can switch from one type to another quite easily from the configuration of the virtual switch.

Virtual Switch Creation

  1. Virtual switches management done via the Hyper-V Manager. To get there, first click on the “Manage Virtual Switch”, available in the “Actions” menu on the right side of the console.
  2. As part of the tutorial, we choose an “external virtual switch type”. But it does not matter since the parameters remain the same.
  3. On the left side, click on “New virtual network switch” and choose the switch type that suits you best. Once you made your choice, click on “Create Virtual Switch”.
  4. Now first, click on your virtual switch in the left menu to access the settings. To start slowly, give the name you want by filling in the field “Name”. And eventually, enter a description in the “Zone Notes”.
  5. Then you will see the “Zone Connection Type”, which is equivalent to selecting whether a virtual switch type is “External” or “Internal” or “Private” so at any time if you want to change the type, you need to make a change here.
  6. Regarding the option “Allow system management operating to share this network adapter”. When selected, you will allowed access to the physical machine with the role of Hyper-V through the card used by the external network (that is to say the one selected in the drop-down list). In case the box is unchecked, you must use a different physical interface than that used by the virtual switch to access your Hyper-V server.
  7. To end this configuration window, the area “VLAN ID” more specifically contains. The option to specify a virtual LAN number (VLAN) to used for communication with the Hyper-V server. In the case where the option is active and if the physical network card supports VLANs.
  8. Now you can click “Apply” so that the settings are applied and that the virtual switch is finalized.
  9. If you have chosen the type switch “external” like in this tutorial. You will get the following message when you apply the settings.

This is explained by the fact that Hyper-V creates a network connection on your Windows operating system and also connects the corresponding connection to the external virtual switch with the physical network adapter attached to it. Therefore, you will see your network connection disconnect then and become available again, very quickly.

Extensions

Click on the little “More” next to the name of your virtual switch, you will see the “submenu Extensions”, but then what it is? It means you can add extensions to your virtual switch which then becomes an “extensible virtual switch”; this is in order to allow the development of extensions that will emulate the functionality of a physical switch.

You will see that by default there are two options – “NDIS Microsoft Capture”. Which is a test extension that enables the capture driver NDIS Microsoft in order to capture network traffic. As for the extension “Microsoft Windows Filtering Platform”. It generally allows for filtering by filtering or modifying the TCP/IP packets and analyzing or allowing connections.

Address Range of MAC

In the Virtual Switch Manager, in the left menu under the selection “Global Network Settings” you will see “MAC Address RANGE”, click it. In the middle section, you will see two fields “Minimum” and “Maximum”. In fact, you define a range of MAC addresses is say, a beginning range (minimum) and endpoint (maximum) for the MAC address to assigned to virtual network cards. In other words, the network cards of your virtual machines will be the cards that have virtual networks.

You will notice the note in the window that Microsoft specifies. That the range you set will not apply to the virtual network cards already attached to virtual machines. To have your virtual network adapter has a MAC address that is part of this range. You must delete and re-add the card. If not, add it once the range is defined in case you have not attached a virtual NIC to a VM.