How to create a Virtual Switch on a Hyper-V server

Networking is a critical part of creating a VM infrastructure. Virtual machines need to communicate with other physical and/or virtual machines and/or with the Internet.

Having the possibility to build a virtual network infrastructure simplifies the job of system administrators. Furthermore it improves network efficiency and decreases costs.

Hyper-V can create and manage virtual switches, the backbone of a virtual network. A switch, physical or virtual, is a device operating at Layer 2 of the Open Systems Interconnect (OSI) reference model.

Hyper-V requires the configuration of a default virtual switch during the installation procedure. You can skip the configuration but sooner or later you’ll be forced to configure at least one virtual switch.

The operation is quite simple. Open your Server Manager and select Hyper-V Manager from the Tools menu:

How to create a Virtual Switch on a Hyper-V server

Open the Virtual Switch Manager:

How to create a Virtual Switch on a Hyper-V server

Hyper-V gives you the possibility to create three types of switch:

  • External: The virtual switch is bound to the networking protocol stack in the host OS and connected to a physical network interface adapter in the Hyper-V server. VMs running on the server’s parent and child partitions can all access the physical network to which the physical adapter is connected.
  • Internal: An internal network switch is bound to a separate instance of the networking protocol stack in the host OS, independent from the physical network interface adapter and its connected network. VMs running on the server’s parent and child partitions can all access the virtual network implemented by the virtual switch, and the host OS on the parent partition can access the physical network through the physical network interface adapter, but the VMs on the child partitions can’t access the physical network through the physical adapter.
  • Private: A private network switch exists only in the Hyper-V server and is accessible only to the VMs running on the child partitions. The host OS on the parent partition can access the physical network through the physical network interface adapter but it can’t access the virtual network created by the virtual switch.

We added an external virtual switch, because in our example we have no default switch and of course we need one to make the hosted VMs able to communicate with the physical network and access the Internet:

How to create a Virtual Switch on a Hyper-V server

As an External virtual switch, it’s mandatory to select a physical network adapter. The network interface adapter can be shared with the local OS or dedicated to the virtual machines. It’s also possible to specify a VLAN ID:

How to create a Virtual Switch on a Hyper-V server

By clicking Apply the virtual switch will be created. In our example we created an External virtual switch with the physical adapter shared with the local OS. This causes a temporarily disconnection of the Hyper-V host, followed by a quick re-connection. Be sure you don’t mess with the VLAN ID settings or you won’t be able to re-access the machine remotely.

Comments