Virtualization · Topic 1 of 4

Hypervisors, Virtual Machines and Virtual Switching

Compare type 1 and type 2 hypervisors, understand virtual machines and virtual NICs, and see how a virtual switch connects VMs to the physical network.

  • 5 min
In a nutshell
  • A type 1 hypervisor runs directly on the hardware. A type 2 hypervisor runs on a host operating system.
  • Type 1 is used in the data centre. Type 2 is used on desktops and labs.
  • ESXi, KVM and Hyper-V are type 1 examples. VirtualBox and VMware Workstation are type 2 examples.

What it is

Device virtualization lets one physical server run many separate virtual machines.

The software that makes this possible is the hypervisor. It shares the CPU, memory, storage and network cards of the host among the virtual machines. Each virtual machine behaves as if it were a complete computer with its own operating system.

Physical serverCPU, RAM, NICsrunsHypervisorshares hardwarehostsVirtual machinesown OS eachconnect throughVirtual switchto the LAN

How it works

A hypervisor creates the virtual machines, and a virtual switch connects them.

Type 1 and type 2 hypervisors

The two types differ in what runs underneath them.

FeatureType 1Type 2
Also calledBare metalHosted
Runs onThe hardware directlyA host operating system
Typical useData centres and production serversDesktops, labs and testing
PerformanceHigher, with less overheadLower, because the host OS sits in between
ExamplesVMware ESXi, KVM, Microsoft Hyper-VOracle VirtualBox, VMware Workstation

A type 1 hypervisor is the operating system of the host. A type 2 hypervisor is an application that runs on a normal desktop or laptop operating system.

Hardwaretype 1 serverhostsHypervisorruns directlyhostsVMsguestsHardwaretype 2 laptophostsHost OSWindows, Linux, macOShostsHypervisoran applicationhostsVMsguests

Virtual machines

A virtual machine (VM) is a software computer. It has virtual hardware, which includes a virtual CPU, virtual memory, a virtual disk and one or more virtual network adapters (vNICs).

VMs are isolated from each other. A crash in one does not stop the others. They can be copied, snapshotted and moved between hosts, which makes recovery and scaling much faster than with physical servers.

Containers are a lighter alternative. They share the host operating system kernel instead of each running a full guest operating system. They start faster and use fewer resources, but they are isolated less strongly than VMs.

Virtual switching

A virtual switch (vSwitch) is software inside the hypervisor that connects the vNICs of the VMs to each other and to the physical network.

The vSwitch works at Layer 2. VMs on the same host and the same VLAN can talk through it without the traffic ever leaving the server. The physical network cards of the host act as uplinks that join the vSwitch to the physical switch.

Typical parts of a virtual switch:

  • vNIC ports: the connections to the VMs.
  • Uplinks: physical NICs that connect to the access switch.
  • Port groups: named sets of ports with the same settings, such as a VLAN.
  • VLAN tagging: the vSwitch can tag frames so that one uplink carries several VLANs.

Several products provide virtual switching. Examples are the standard and distributed switches in VMware, and Open vSwitch on Linux and KVM. A distributed switch is managed centrally and spans several hosts, which keeps settings consistent.

Connecting the host to the physical switch

When VMs are in several VLANs, the physical port facing the host is normally a trunk, as in this IOS XE example.

Switch(config)# interface GigabitEthernet1/0/10
Switch(config-if)# description ESXi host uplink
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk allowed vlan 10,20
Switch(config-if)# spanning-tree portfast trunk

The command spanning-tree portfast trunk lets the port forward quickly, because a host is not a switch and creates no loop. Many vSwitches do not forward frames between their uplinks, so they do not add a loop to the network. Check the documentation of the product you use.

Type 2 networking modes

A desktop hypervisor connects its VMs in different ways.

ModeBehaviour
BridgedThe VM appears on the physical LAN with its own address
NATThe VM shares the address of the host
Host onlyThe VM can talk only to the host and other VMs

What to remember for the exam

Seven facts cover most questions on this topic.

  • A type 1 hypervisor runs directly on the hardware. A type 2 hypervisor runs on a host operating system.
  • Type 1 is used in the data centre. Type 2 is used on desktops and labs.
  • ESXi, KVM and Hyper-V are type 1 examples. VirtualBox and VMware Workstation are type 2 examples.
  • A VM has its own operating system and virtual hardware, including vNICs.
  • A vSwitch connects VMs to each other and to the physical network through uplinks.
  • A port facing a host that carries many VLANs is normally a trunk.
  • Containers share the host kernel, and VMs each have a full guest operating system.
Exam tip

To tell the types apart, ask what sits between the hypervisor and the hardware. Nothing means type 1. A host operating system means type 2.

Common mistakes

These four mistakes appear often.

Mixing up the types. Bare metal is type 1, and hosted is type 2.

Forgetting the trunk. If VMs are in several VLANs and the switch port is an access port, only one VLAN works.

Thinking VMs on one host always cross the physical switch. Two VMs on the same vSwitch and VLAN exchange frames inside the host.

Treating containers as small VMs. Containers share the host kernel, so their isolation is different.

Watch out

A virtual switch is not a physical switch. Its features and limits depend on the hypervisor product, so do not assume it behaves like a Catalyst switch.

Check yourself

Work through these three questions.

  • Which type of hypervisor runs directly on the server hardware?

    A type 1 hypervisor, also called bare metal, runs directly on the hardware.

  • What connects a virtual switch to the physical network?

    The physical NICs of the host act as uplinks to the physical switch.

  • Why is the switch port facing a virtualisation host often a trunk?

    The VMs may belong to several VLANs, and a trunk lets one link carry all of them.

Topic 1 of 4 in Virtualization

Test yourself on Virtualization

The full Cisco CCNP 350-401 ENCOR question bank has 854 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Cisco. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.