CCNA Hypervisors, Virtual Machines and Containers Explained
A hypervisor is the software that carves one physical server into isolated virtual machines, each with its own operating system on virtual hardware, while a container is a set of isolated processes that shares the host's own kernel. CCNA v2.0 exam topic 1.2 asks you to describe the role and function of all three, and to a network engineer they matter because routers, firewalls and servers increasingly run as VMs and containers behind a single switch port. This lesson covers Type 1 and Type 2 hypervisors, what a VM is made of, CPU and memory overcommitment, virtual switches and VLAN tagging, live migration, how containers are isolated and networked, what an orchestrator adds, and how to choose between a VM and a container.
On this page10 sections
- What does a hypervisor do?
- Type 1 vs Type 2 hypervisors
- What is a virtual machine?
- How do VMs share CPU and memory, and what is overcommitment?
- How do VMs connect to the network?
- What happens during live migration?
- What is a container, and how is it isolated?
- How do container images, data and networking work?
- What does a container orchestrator add?
- When should you use a VM, a container or a virtual network function?
- Describe what a hypervisor does and distinguish Type 1 (bare-metal) from Type 2 (hosted) hypervisors
- Explain what a virtual machine is made of, and how snapshots, clones and backups differ
- Recognise the symptoms of CPU and memory overcommitment on a hypervisor host
- Explain how virtual switches, port groups and host trunk uplinks connect VMs to VLANs, and what live migration requires
- Describe how containers share the host kernel, how namespaces and cgroups isolate them, and how images, writable layers and volumes behave
- Explain Docker bridge networking, port publishing and the role of a container orchestrator such as Kubernetes
- Choose between VMs and containers for a stated need, and describe virtual network functions
What does a hypervisor do?
A hypervisor is the software layer that abstracts a physical host's CPU, memory, storage and network interfaces, hands each virtual machine (VM) its own share of them, and keeps the VMs isolated from one another. Each VM believes it owns a complete computer; in reality the hypervisor schedules it onto the shared hardware.
Its jobs, in the order you meet them on a host:
- Abstraction: it presents virtual hardware (vCPUs, virtual RAM, virtual disks, virtual NICs) to each guest operating system.
- Resource scheduling: it decides which vCPU runs on which physical core and when, and how physical memory is shared out.
- Isolation: a crash, a reboot or a kernel fault inside one VM stays inside that VM; the others keep running.
- Virtual networking: it provides a virtual switch that connects VMs to each other and to the physical NICs (covered below).
- Lifecycle features: because a VM is just a set of files, the hypervisor can snapshot, clone and move it.
This is what makes server consolidation work: a dozen lightly used physical servers can become a dozen VMs on two hosts, each still running its own operating system, without one workload's failure taking down its neighbours.
Type 1 vs Type 2 hypervisors
A Type 1 (bare-metal) hypervisor is installed directly on the server hardware and owns it; there is no general-purpose operating system underneath. A Type 2 (hosted) hypervisor is an application that runs on top of an existing desktop or server operating system and borrows that OS's drivers and scheduler.
| Type 1 (bare-metal) | Type 2 (hosted) | |
|---|---|---|
| Runs on | The hardware directly | A host OS (Windows, macOS, Linux) |
| Examples | VMware ESXi, Microsoft Hyper-V, KVM, Xen | VMware Workstation, VMware Fusion, Oracle VirtualBox |
| Typical use | Data centres and production workloads | Labs, testing and desktops that must keep their own OS |
| Overhead | Lower: nothing between the hypervisor and the hardware | Higher: every request also passes through the host OS |
| When the host OS restarts | Not applicable: there is no host OS | Every VM stops with it |
Two practical consequences. First, a laptop that must keep running Windows for everyday work while also running lab router images needs a Type 2 hypervisor; installing ESXi would replace Windows, and dual-booting means only one of them runs at a time. Second, Type 2 VMs live and die with the host OS: when Windows installs updates and restarts, the lab VMs stop, while VMs on an ESXi server carry on because nothing sits underneath the hypervisor to be patched and rebooted.
KVM is a Linux kernel module that turns Linux itself into the hypervisor, and Hyper-V slides beneath Windows once enabled, so both are usually classed as Type 1 even though an OS is involved.
What is a virtual machine?
A virtual machine is a complete, isolated computer built from virtual hardware (vCPU, vRAM, one or more vNICs and a virtual disk) on which its own guest operating system is installed. The guest OS does not have to match the host: a Linux host running KVM can run Windows Server guests, and twenty VMs on one ESXi host can run a mix of Linux, Windows and network operating systems.
A new VM is an empty computer. Before any application can run in it, you install a guest OS on its virtual disk, exactly as you would on a bare server; an application cannot simply be dropped into a VM without one.
Drivers still matter. The hypervisor presents virtual devices, and the guest needs drivers for them. Paravirtualized devices such as KVM's virtio NIC are fast but Windows has no built-in virtio driver, so a Windows guest given a virtio NIC shows no network adapter at all until the virtio drivers are installed (or the VM is given an emulated NIC model it does recognise). A missing adapter is a driver problem; an adapter that is present but cannot pass traffic points to the network.
A VM is a set of files (configuration, virtual disk, memory state) on a datastore, which enables:
| Feature | What it is | Use it for |
|---|---|---|
| Snapshot | A point-in-time rollback marker. The base disk becomes read-only and new writes go to a delta disk that keeps growing. | Quick rollback around a risky change. Revert discards changes since the snapshot; delete merges (consolidates) them into the base disk and keeps them. |
| Clone / template | A full, independent copy of a VM | Building new VMs fast; testing a copy |
| Backup | A copy stored on separate storage | Surviving the loss of the datastore or host |
A snapshot is not a backup: it lives on the same datastore as the VM and depends on the base disk. Snapshots left in place for weeks fill the datastore and slow disk performance, so delete them once the change has succeeded.
How do VMs connect to the network?
VMs connect through a virtual switch inside the hypervisor. Each VM's vNIC plugs into a virtual switch port; the host's physical NICs are the virtual switch's uplinks to the physical access switch. The path is: vNIC → virtual switch → physical NIC → physical switch port.
Same host, same VLAN stays inside. The virtual switch forwards frames between vNICs on the same host and the same VLAN itself, so that traffic never appears on the physical uplink or in a capture taken on the physical switch port. A standard virtual switch is a Layer 2 device, though: it does not route. Traffic between two VMs on the same host but in different VLANs goes out the uplink to the gateway (for example an SVI on a distribution switch), is routed there, and comes back down the same uplink. Heavy inter-VLAN traffic between VMs on one host can therefore congest that host's uplink.
Port groups and VLANs. On a VMware standard vSwitch, VMs attach to a port group, and the port group's VLAN ID decides how their traffic is tagged:
| Port group VLAN ID | Behaviour |
|---|---|
| 0 (or none) | Frames leave the host untagged; the physical switch decides the VLAN (access VLAN, or the native VLAN of a trunk) |
| 1–4094 | The vSwitch adds that one VLAN tag on the way out and removes it on the way in; the VM never sees tags |
| 4095 | Tags are passed through to the guest (virtual guest tagging); the guest OS must tag and untag frames itself |
Because a host normally carries VMs in several VLANs over one uplink, the physical switch port facing it must be an 802.1Q trunk that allows every VLAN the port groups use, with a native VLAN that matches the port groups that send untagged frames. An access port carries only one VLAN, so tagged port groups behind it fail. Trunk configuration itself belongs to the switching domain; here, remember why the host needs one.
What the physical switch sees. Each vNIC has its own MAC address (VMware vNIC MACs usually start 00:50:56 when vCenter assigns them, or 00:0C:29 when a standalone host generates them), so the switch learns many MAC addresses, in several VLANs, on one port. That pattern in show mac address-table is the signature of a hypervisor host. Containers behave differently: on Docker's default bridge they share the host's own MAC and IP address towards the LAN, so a container host on its own looks like a single station. Port-security limits on a port facing a host must allow for every vNIC behind it.
What happens during live migration?
Live migration (VMware vMotion, Hyper-V Live Migration, KVM live migration) moves a running VM from one host to another without rebooting it. Its memory is copied across while it runs, then execution switches to the destination host in a pause too short for users to notice. The VM keeps its MAC address and IP address; the destination host announces the MAC so physical switches update their tables at once.
Two things must therefore be true on the destination host:
- Storage: it can reach the VM's disk (shared storage), or the disk is copied as part of the move (storage migration).
- Network: the VM's VLAN is carried on the destination host's uplinks, with a matching port group. The VM's IP address never changes, so its subnet has to exist there.
The hypervisor checks that the destination has a suitable port group, but it cannot see the physical switch configuration. If the port group exists but the physical port facing the destination host does not carry the VLAN, the move completes and the VM then loses reachability until the VLAN is added to that trunk or the VM is moved back. The design rule follows: carry every VM VLAN to every host a VM can move to. What moves with the VM is its own identity (vNIC MAC, IP address, running state); the hosts' physical uplinks are only the path, so the requirement is that the path carries the VM's VLAN.
What is a container, and how is it isolated?
A container is an isolated set of processes that shares the host's operating system kernel, packaged with the application's own libraries and dependencies. There is no guest OS to boot, which is why a container starts in about a second and uses far less memory than a VM. The price is that a container must match the host kernel's OS family: Linux containers need a Linux kernel and Windows containers need a Windows kernel. (Docker Desktop runs Linux containers on Windows and macOS by running a small Linux VM underneath.)
Because there is only one kernel, anything that asks the kernel about itself from inside a container gets the host's answer: the reported kernel release is the host's, whichever distribution the image's user space comes from. Kernel features work the same way. A kernel module, such as a file-system or tunnelling driver, is part of the host's kernel; an image carries user-space files only, so a container can use a module only when it is loaded into the host's kernel, where every container on the host shares it.
Two Linux kernel features provide the isolation:
| Feature | What it does | Example |
|---|---|---|
| Namespaces | Limit what a container can see: its own process list, network stack (interfaces, routes, ports), mounts and hostname | Each container can have its own network namespace with its own IP address and routing table |
| Control groups (cgroups) | Limit what a container can use: CPU, memory, I/O | Capping each container's memory so one leaking app cannot starve the host |
Other building blocks have different jobs: seccomp profiles restrict which system calls a container may make, and a union file system such as overlay2 stacks the image layers. Resource limits are the job of cgroups alone. Because every container uses the one host kernel, a flaw in that kernel can affect every container on the host. A VM's isolation boundary is the hypervisor, and each VM has its own kernel, which is why VMs give stronger separation between tenants who do not trust each other.
How do container images, data and networking work?
A container is started from a read-only image, writes to a disposable layer of its own, and on Docker's default network sits behind the host's address. Each of those three behaviours is tested.
Images and registries
An image is a read-only, layered template containing an application and its dependencies, identified by a name and tag such as webportal:3.4. Images are stored and shared through a registry (Docker Hub, a cloud provider's registry, or a private one such as Harbor). A container is a running instance created from an image, and one image can start any number of identical containers side by side.
Container data
Each container gets a thin writable layer on top of the read-only image. Its lifecycle is the trap:
- Stop and start: the writable layer is kept on the host's disk, so files written inside the container survive.
- Remove (
docker rm) and run a new container from a newer image: the writable layer is deleted with the old container, and the new one starts clean. Writes never go back into the image.
Data that must outlive a container, such as a database or log files, belongs outside the writable layer: in a named volume managed by Docker, or a bind mount of a host directory, mounted at the application's data path. The rule is to keep the application in the image and the state in storage that Docker manages separately, so containers can be replaced freely.
Container networking
On Docker's default bridge network, each container gets a private address from the bridge's subnet (172.17.0.0/16 by default) behind a virtual bridge on the host. That address is reachable from the host itself, not from the LAN.
- Outbound: the host source-NATs (masquerades) container traffic to its own IP address. A router or ACL further along sees the host's address, never 172.17.x.x, and replies come back through the host.
- Inbound: a container is reachable from outside only through a published port.
-p 8443:443means host port 8443 → container port 443: the first number is on the host, the second inside the container. A LAN client openshttps://<host-IP>:8443; the container's 172.17.x.x address and its internal port 443 are not reachable from the LAN.
docker ps shows the mapping, for example 0.0.0.0:8443->443/tcp: host port on the left, container port on the right.
What does a container orchestrator add?
A container orchestrator such as Kubernetes manages containers across many hosts: it places new containers on nodes with spare capacity, restarts or recreates failed ones, and scales the number of instances up and down with load. Three roles are easy to confuse:
| Component | Role | Examples |
|---|---|---|
| Container runtime | Runs containers on one host | containerd, CRI-O, Docker Engine |
| Registry | Stores and distributes images | Docker Hub, Harbor |
| Orchestrator | Schedules, heals and scales containers across a cluster | Kubernetes |
The difference shows when a host fails. A Docker restart policy (--restart) restarts a crashed container on the same host, so it does nothing when the host itself is down. In Kubernetes, an application run as a Deployment declares a desired number of replicas; when a node becomes unavailable, Kubernetes recreates its pods on healthy nodes. A container someone started by hand on a node with the runtime's own CLI is outside Kubernetes' control, so it dies with that node and is not recreated anywhere.
When should you use a VM, a container or a virtual network function?
Use a VM when you need a different OS or kernel from the host, or strong isolation between tenants; use containers for many small same-OS apps that must start fast and use little memory; and use virtual network functions to run network appliances as software. The deciding constraint usually picks the answer:
| Need | Better fit | Why |
|---|---|---|
| A different OS or kernel from the host (a Windows-only app on a Linux host) | VM | Each VM boots its own kernel |
| Strong isolation between tenants who do not trust each other | VM | The hypervisor boundary, not a shared kernel |
| Many small apps on one OS family, fast start, low memory per instance | Container | No guest OS per instance |
| Automatic placement, healing and scaling across hosts | Containers + orchestrator | Kubernetes manages the cluster |
The two are often combined on one host: Linux microservices as containers for density, plus a VM for the one workload that needs a different OS. Running every small service in its own VM works but wastes a guest OS per service; a Windows-only app cannot run in a Linux container, and a Windows container still needs a Windows kernel.
Network functions virtualization (NFV) applies the same idea to the network: routers, firewalls and other appliances run as software, as virtual network functions (VNFs), on standard x86 servers instead of dedicated hardware. The Cisco Catalyst 8000V virtual router is an example. A VNF is an ordinary VM, so its GigabitEthernet interfaces are vNICs attached to port groups: one vNIC per port group places one interface in each VLAN. To route several VLANs over a single vNIC, attach it to a port group that passes tags to the guest (VLAN ID 4095 on a VMware standard vSwitch) and configure 802.1Q subinterfaces on the router, as a router-on-a-stick would on a physical trunk. A port group with one VLAN ID strips the tag, so subinterfaces for other VLANs would see nothing.
Tip. CCNA v2.0 topic 1.2 is a describe objective, but the exam frames it in network terms. Expect short scenarios in which a team has a constraint (a laptop that must keep its desktop OS, the lowest overhead, tenants who do not trust each other, data that must outlive a container, a host that might fail) and you identify the hypervisor type, VM feature, container behaviour or orchestration tool that fits. Evidence-first items show output such as show mac address-table on a port facing a host, a switch port configuration behind a host with several VLANs, uname output from inside a container or docker run and docker ps port mappings, and ask what they reveal. Several items hinge on telling closely related terms apart, so know precisely what each hypervisor type, VM feature, isolation mechanism and orchestration component does. A few items are multiple response and ask for two accurate statements.
- A hypervisor abstracts the host's CPU, memory, storage and NICs, gives each VM a share and keeps VMs isolated.
- Type 1 runs on the hardware (ESXi, Hyper-V, KVM, Xen); Type 2 runs as an app on a host OS (Workstation, Fusion, VirtualBox), and its VMs stop when that OS restarts.
- Every VM needs its own guest OS, which need not match the host, plus drivers for the virtual devices it is given.
- A snapshot is a rollback point with a growing delta disk on the same datastore, not a backup; revert discards changes, delete keeps them.
- Overcommitted vCPUs wait for free physical cores, so a VM's performance can depend on how busy the rest of the host is; CPU ready time on the hypervisor shows it.
- A virtual switch keeps same-host, same-VLAN traffic inside the host; different VLANs are routed outside and hairpin back over the uplink.
- A host with VMs in several VLANs needs an 802.1Q trunk uplink, and the switch learns one MAC per vNIC on that port.
- Live migration keeps the VM's MAC and IP, so the destination needs the VM's storage and its VLAN.
- Containers share the host kernel: namespaces isolate what they see, cgroups limit what they use, and a host kernel flaw affects them all.
- On Docker's default bridge, outbound traffic is NATed to the host IP and inbound needs -p host-port:container-port; Kubernetes recreates managed containers when a node fails.
Frequently asked questions
What is the difference between a Type 1 and a Type 2 hypervisor?
A Type 1 (bare-metal) hypervisor, such as VMware ESXi, Microsoft Hyper-V or KVM, runs directly on the server hardware with no general-purpose operating system underneath, which gives it lower overhead and makes it the choice for data centres. A Type 2 (hosted) hypervisor, such as VMware Workstation or Oracle VirtualBox, runs as an application on an existing operating system, which suits labs on a laptop that must keep its desktop OS; its VMs stop whenever that host OS restarts.
What is the difference between a virtual machine and a container?
A virtual machine runs its own guest operating system and kernel on virtual hardware provided by a hypervisor, so it can run a different OS from the host and is strongly isolated. A container is a group of isolated processes that shares the host's kernel and carries only the application and its libraries, so it starts in about a second and uses much less memory, but it must match the host's OS family and shares any kernel flaw with every other container on the host.
Does traffic between two VMs on the same host leave the host?
Only if the VMs are in different VLANs. A virtual switch forwards frames between VMs on the same host and the same VLAN internally, so the traffic never reaches the physical uplink. Traffic between different VLANs must be routed by a gateway, so it leaves through the host's uplink to that gateway (for example an SVI on a distribution switch) and returns down the same uplink.
Why does a switch port connected to a hypervisor host need to be a trunk?
A hypervisor host usually runs VMs in several VLANs over one physical uplink, and its virtual switch tags each VM's frames with the port group's VLAN ID. An access port carries only one untagged VLAN, so the switch port facing the host must be an 802.1Q trunk that allows every VLAN the port groups use, with its native VLAN matching any port group that sends frames untagged.
What do namespaces and cgroups do for containers?
Namespaces and cgroups are the Linux kernel features that make containers possible. Namespaces control what a container can see, giving it its own process list, network stack, mounts and hostname. Control groups (cgroups) control what it can use, such as limits on CPU and memory, so one container cannot starve the others. Neither gives a container its own kernel.
How do you reach a Docker container from another computer on the LAN?
On Docker's default bridge network a container has a private address that the LAN cannot reach, so it must be started with a published port, for example -p 8443:443, which maps host port 8443 to container port 443. Clients then connect to the host's IP address on the host port, such as https://host-IP:8443. Outbound traffic from the container is source-NATed to the host's address.
What is the difference between a container runtime and Kubernetes?
A container runtime, such as containerd, CRI-O or Docker Engine, starts and runs containers on a single host. Kubernetes is a container orchestrator that manages containers across a cluster of hosts: it places them on nodes with capacity, recreates them on healthy nodes when a node fails, and scales the number of instances. A restart policy alone cannot recover from the failure of the whole host.
Is a VM snapshot a backup?
No. A snapshot is a rollback point: the VM's base disk becomes read-only and new writes go to a delta disk on the same datastore. It lets you revert quickly after a failed change, but it depends on the base disk and is lost with the datastore. A backup is a copy kept on separate storage. Snapshots left in place keep growing and slow disk performance, so delete them once a change succeeds.
Source
This lesson covers the "Network Infrastructure and Connectivity" domain of the official CCNA exam guide. Vendors revise their guides — check the source for the current version.
Sign up free to mark lessons complete, bookmark topics and track your exam readiness.