Network Infrastructure and Connectivity · Topic 2 of 9
Hypervisors, Virtual Machines and Containers
Learn what hypervisors, VMs and containers do, how Type 1 and Type 2 hypervisors differ, and how virtual switches connect workloads to the network.
- 5 min
- A hypervisor shares one server among many VMs.
- Type 1 runs on bare metal and is used in data centers. Type 2 runs on top of an operating system.
- Each VM has its own operating system, MAC address and IP address.
What it is
Virtualization lets one physical server run many separate workloads. It saves hardware, power and space, and it makes workloads easy to copy, move and back up.
Three terms matter here. A hypervisor is the software that shares the hardware, a virtual machine (VM) is a complete virtual computer, and a container is a lightweight packaged application.
For a network engineer the key question is how each of these attaches to the network, because the switch port facing a virtualization host carries many workloads at once.
How it works
A hypervisor divides the server's resources among VMs. Containers go one step further and share the operating system kernel as well.
Hypervisors
The hypervisor allocates CPU, memory, storage and network connections to each VM, and keeps the VMs isolated from one another.
There are two types:
| Type | Runs on | Typical use |
|---|---|---|
| Type 1 (bare metal) | Directly on the server hardware | Data centers and production servers |
| Type 2 (hosted) | As an application on a normal operating system | Laptops, labs and testing |
A Type 1 hypervisor is efficient and stable because no general purpose operating system sits underneath it. A Type 2 hypervisor depends on the host operating system, so it is slower and less suited to production.
Virtual machines
A VM runs its own full operating system, with its own virtual CPU, memory, disk and network adapters. The guest operating system behaves as if it owned a real computer.
To the network, each VM is a separate host with its own MAC address and IP address. Because the VM is stored as files, it can be copied, snapshotted or moved to another host, often while it keeps running.
A VM carries its own operating system. A container does not.
Virtual switches and network access
VMs connect through a virtual switch inside the hypervisor. The virtual switch links VMs to each other and, through the host's physical NICs (the uplinks), to the real network.
The physical switch port facing the host is usually an 802.1Q trunk, so VMs in different VLANs can share the same uplink. If a VLAN is missing from that trunk, the VMs in it lose connectivity while the other VMs keep working.
A VM that moves to another host keeps its IP address and MAC address. The VLAN therefore has to exist on the trunks of every host that might receive it.
Containers
A container packages an application with the libraries it needs, but not a full operating system. All containers on a host share the host's kernel.
| Feature | Virtual machine | Container |
|---|---|---|
| Includes its own OS | Yes | No, shares the host kernel |
| Typical size | Gigabytes | Megabytes |
| Start time | Minutes | Seconds or less |
| Isolation | Strong, at the hypervisor | Lighter, kernel is shared |
| Typical use | Full systems and legacy apps | Application components and microservices |
Containers start from an image, a read only template. The same image runs the same way on a laptop, a data center server or a cloud host.
Docker is a common tool for building and running containers. Kubernetes is an orchestration system that starts, stops, scales and heals large numbers of containers across many hosts.
Container networking
By default, containers on one host usually sit on a private internal network with their own addresses. To make a service reachable from outside, the host publishes a port, for example mapping host port 8080 to container port 80.
docker run -d -p 8080:80 nginx
This is similar to port forwarding on a NAT device: traffic arrives at the host address and port, and the host passes it to the container. From the outside, the container appears to be the host.
The trade-off for containers is isolation. A VM is separated at the hypervisor level, but containers share one kernel, so a kernel flaw can affect all of them.
Common mistakes
Calling a container a small VM. A container has no guest operating system. It uses the host's kernel.
Mixing up the hypervisor types. Type 1 sits on the hardware. Type 2 sits on an operating system.
Forgetting the trunk. A virtualization host with VMs in several VLANs needs those VLANs allowed on its switch port.
Assuming every VM needs its own physical NIC. The virtual switch lets many VMs share the same uplinks.
Expecting containers to give VM level isolation. They share a kernel, so isolation is lighter.
What to remember for the exam
- A hypervisor shares one server among many VMs.
- Type 1 runs on bare metal and is used in data centers. Type 2 runs on top of an operating system.
- Each VM has its own operating system, MAC address and IP address.
- A container shares the host kernel, so it is smaller and starts faster than a VM.
- A virtual switch connects VMs to each other and to the physical network.
- The switch port toward a virtualization host is usually an 802.1Q trunk.
- Docker builds and runs containers. Kubernetes orchestrates them at scale.
- A published port maps a host port to a container port.
Containers are not small VMs. They have no operating system of their own and rely on the host kernel.
Check yourself
How does a VM differ from a container in operating system, size and start time?
A VM includes its own full operating system, is large and starts in minutes. A container shares the host kernel, is small and starts in seconds or less.
What is the difference between a Type 1 and a Type 2 hypervisor?
Type 1 runs directly on the hardware and suits data centers. Type 2 runs as an application on a normal operating system and suits laptops and labs.
Why is the switch port connected to a virtualization host often a trunk?
The VMs on the host can belong to different VLANs, and the virtual switch sends them all over the same uplink with 802.1Q tags.
Topic 2 of 9 in Network Infrastructure and Connectivity
Test yourself on Network Infrastructure and Connectivity
The full Cisco CCNA 200-301 v2.0 question bank has 1,242 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.