Virtual Machines: VirtualBox and VMware Tutorial

Introduction

This tutorial provides a hands-on guide to virtual machines (VMs), focusing on Oracle VM VirtualBox and VMware Workstation Pro. As a Windows Server Specialist and Enterprise IT Architect, I've used VMs extensively to improve resource utilization, accelerate testing, and build reproducible lab environments.

In this guide you will find step-by-step instructions for VirtualBox (example: 6.1.40) and VMware Workstation Pro (example: 17.5.2): installation, VM creation, virtual networking (NAT / Bridged / Host‑Only), cloning (full vs. linked), Guest Additions / VMware Tools installation, snapshots and snapshot management, nested virtualization, and targeted troubleshooting tips with real commands and examples.

Follow the examples to build reproducible test environments, run cross-OS validation, and automate VM provisioning workflows.

About the Author

Yuki Tanaka

Yuki Tanaka is a Windows Server Specialist & Enterprise IT Architect with 13 years of experience managing and architecting Windows-based enterprise systems. His expertise includes Windows Server administration, Active Directory, Group Policy, and enterprise infrastructure design. Yuki has worked on large-scale Windows deployments, focusing on security, reliability, and optimal configuration for business-critical environments.

Getting Started with VirtualBox: Installation and Setup

Installing VirtualBox on Your System

Download Oracle VM VirtualBox from the project root: https://www.virtualbox.org/. This guide references VirtualBox 6.1.40 (6.1.x series) as a stable baseline used in many labs.

  • Choose the installer that matches your host OS and CPU architecture (x86_64).
  • On Windows and macOS accept kernel driver/network prompts during installation to enable networking and USB passthrough.
  • On Linux use the distro package or the Oracle-provided package when you need a specific 6.1.x build.

Linux (Debian/Ubuntu) quick install via package manager:

sudo apt-get update
sudo apt-get install -y virtualbox

After installation, launch the VirtualBox GUI or use VBoxManage for CLI-driven workflows.

VirtualBox Extension Pack (features & licensing)

Install the Extension Pack that matches your VirtualBox major version to enable USB 2.0/3.0 passthrough, VRDP, and additional features. The Extension Pack is distributed under the PUEL license β€” review licensing if you're deploying commercially.

  • USB 2.0/3.0 passthrough for devices such as hardware tokens or test peripherals
  • VRDP for remote console access (use host firewall rules to limit access)
  • Host webcam passthrough and disk image encryption features

Host System Requirements

Plan host hardware around the number and type of VMs you will run. Recommended baseline for a small test workstation:

  • CPU: 4 physical cores (Intel i5 / Ryzen 5 or better) with hardware virtualization support (Intel VT-x or AMD-V). Hyper-threading helps but do not rely only on logical cores for vCPU assignments.
  • Memory: minimum 16 GB RAM recommended (32 GB for multi-VM labs). Reserve at least 1.5–2 GB per desktop VM; increase for server workloads.
  • Storage: SSD (NVMe preferred) with 500 GB+ capacity. Use preallocated/fixed virtual disks for I/O-sensitive VMs.
  • Networking: gigabit Ethernet or stable Wi‑Fi; consider a dedicated NIC for lab isolation.

Real-world example: an 8-core host with 32 GB RAM and a 1 TB NVMe drive comfortably runs 3–4 desktop VMs plus CI/build agents.

Virtual Networking Modes (NAT, Bridged, Host-Only)

Understanding virtual network modes is crucial when building labs. Below are concise explanations, when to use them, and concrete examples/commands for VirtualBox.

Host, Hypervisor, and Guest Networking Modes Diagram showing Host OS, Hypervisor (VirtualBox/VMware) and Guests with NAT, Bridged, and Host-Only network flows Host OS Windows / Linux / macOS Hypervisor VirtualBox / VMware Guest A Bridged Guest B NAT Guest C Host-Only Hypervisor Layer External Network NAT -> Host NAT Bridged -> LAN Physical NIC
Figure: Host, hypervisor, and guest network flows (Bridged, NAT, Host-Only)

NAT (Network Address Translation)

Default for many desktops: the VM can reach external networks (internet) while the VM remains hidden from the LAN. Use NAT when you want simple internet access without exposing the VM to the physical network.

VirtualBox example: enable NAT and a port forward so you can SSH into a Linux guest from the host:

VBoxManage modifyvm "UbuntuVM" --nic1 nat
# Forward host port 2222 to guest port 22 (guest SSH)
VBoxManage modifyvm "UbuntuVM" --natpf1 "guestssh,tcp,,2222,,22"
# Then SSH from host: ssh -p 2222 user@127.0.0.1

Notes: NAT simplifies internet access but can make inbound connections (from LAN to VM) difficult without port forwarding.

Bridged Networking

Bridged mode places the VM on the same L2 network as the host. The VM receives an IP from the LAN DHCP and is reachable by other devices on the network. Use bridged when the VM must be discoverable or provide services to the LAN (e.g., DNS, HTTP testing).

VirtualBox GUI: Settings > Network > Attached to: Bridged Adapter > choose the host NIC.

Host-Only Networking

Host-only creates a private network between host and VMs. Use host-only for isolated lab topologies where VMs need to communicate with the host (and each other) but not the internet. Combine host-only with a second adapter in NAT mode (two NICs) for both internet and isolated LAN access.

VirtualBox example: create a host-only interface (CLI) and attach it to a VM:

# Create a host-only interface (creates vboxnetX)
VBoxManage hostonlyif create
# Attach the new host-only interface in the GUI or via VBoxManage modifyvm --nic2 hostonly --hostonlyadapter2 vboxnet0

Tip: Use host-only for private test services and combining host-only + NAT gives flexible lab topologies: host-only for management, NAT for internet access.

Creating and Configuring Your First Virtual Machine in VirtualBox

Step-by-Step VM Creation

Use the GUI New wizard or VBoxManage for automation. Example CLI sequence creates a Linux VM, configures RAM/CPUs, attaches a 20 GB VDI, and mounts an ISO:

# Create and register a VM
VBoxManage createvm --name "UbuntuVM" --ostype Ubuntu_64 --register
# Set RAM and CPU
VBoxManage modifyvm "UbuntuVM" --memory 2048 --cpus 2 --nic1 nat
# Create a 20GB dynamic VDI
VBoxManage createmedium disk --filename "$HOME/VirtualBox VMs/UbuntuVM/UbuntuVM.vdi" --size 20480 --format VDI
# Attach disk and an installer ISO
VBoxManage storagectl "UbuntuVM" --name "SATA Controller" --add sata --controller IntelAhci
VBoxManage storageattach "UbuntuVM" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$HOME/VirtualBox VMs/UbuntuVM/UbuntuVM.vdi"
VBoxManage storageattach "UbuntuVM" --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium "/path/to/ubuntu-22.04.iso"
# Start the VM with GUI
VBoxManage startvm "UbuntuVM" --type gui

Recommended starter config for a desktop test VM: 2 GB RAM, 1–2 CPU cores, 20 GB disk (dynamic for space savings), NAT network for internet by default.

VM Cloning (Full vs. Linked Clones)

Cloning is useful for quickly producing test copies of a configured VM. Decide between full clones (independent copies) and linked clones (share parent disks to save space). Below are examples and recommended practices for VirtualBox and VMware Workstation Pro (17.5.2).

VM Cloning (VirtualBox)

VirtualBox supports full and linked clones. A full clone duplicates disk content and configuration; a linked clone shares the base differencing disk, which saves space but creates a dependency on the parent.

# Create a linked clone (saves disk space but depends on the parent snapshot)
VBoxManage clonevm "UbuntuVM" --name "UbuntuVM-Clone" --register --options link
# To create a full clone (independent):
VBoxManage clonevm "UbuntuVM" --name "UbuntuVM-FullClone" --register --mode all

Troubleshooting & best practices for VirtualBox cloning:

  • Before creating linked clones, ensure the base VM has a clean snapshot point (use a single snapshot or none) so dependent images remain manageable.
  • Avoid using linked clones as long-term backups β€” export full clones (OVA/OVF) for portability.
  • After cloning, verify MAC addresses and network configuration if the clone will run concurrently on the same network.

VM Cloning (VMware Workstation Pro)

VMware Workstation provides a Clone wizard in the GUI with options for full or linked clones. Linked clones (sometimes called "linked" or "snapshot-dependent") share virtual disks with a snapshot of the parent. Use the GUI when you want a guided workflow; the GUI preserves correct configuration and prompts to create or select a snapshot.

GUI steps (Workstation Pro 17.5.2):

  • Right-click the VM in the library > Manage > Clone.
  • Choose the snapshot to base the clone on (for a linked clone) or choose to make a full clone.
  • Finish the wizard; the clone will be registered in the library.

Command-line alternative (safe filesystem method):

# 1. Power off the source VM
# 2. Copy the VM folder (VMX + VMDK files) to a new directory
cp -a "/path/to/SourceVM" "/path/to/CloneVM"
# 3. In VMware Workstation, open the cloned .vmx file (File > Open) to register the clone
# VMware will detect duplicate identifiers and prompt to generate new MAC/UUID values

Notes and best practices for VMware cloning:

  • Use full clones when you need an independent VM for long-term testing or backups.
  • Linked clones are efficient for disposable test fleets, but they rely on the parent's snapshot; deleting or altering the parent snapshot can corrupt linked clones.
  • After cloning, run within the guest: verify network settings, change hostnames, and ensure unique identifiers (MAC, SID on Windows) if running concurrently.

Guest Additions and VMware Tools: Features and Installation

VirtualBox Guest Additions (example: match 6.1.40)

Linux (Ubuntu 22.04) example:

# Inside the guest (Ubuntu/Debian)
sudo apt-get update
sudo apt-get install -y build-essential dkms linux-headers-$(uname -r)
# From the VirtualBox UI: Devices > Insert Guest Additions CD image...
# Then run (from the mounted CD directory):
sudo sh /media/$USER/VBox_GAs_*/VBoxLinuxAdditions.run

Troubleshooting tips:

  • If kernel module builds fail, ensure linux-headers match uname -r and DKMS is installed.
  • On Windows guests use the Guest Additions installer from the Devices menu to install drivers and integration services.
  • Keep Guest Additions versions aligned to host VirtualBox versions (6.1.x) for maximum compatibility.

VMware Tools & open-vm-tools (example: Workstation Pro 17.5.2)

Linux guests: prefer distribution-packaged open-vm-tools for regular security updates and package manager integration. Example:

# Ubuntu/Debian example
sudo apt-get update
sudo apt-get install -y open-vm-tools open-vm-tools-desktop

Windows guests: use VM > Install VMware Tools from the Workstation UI to mount the installer and run the setup.

Security notes: include Guest Additions / open-vm-tools in your patching schedule β€” both include kernel drivers and user-space components that receive security updates.

Exploring VMware: Installation and Initial Configuration

Installing VMware Workstation

Download VMware Workstation Pro from the vendor root: https://www.vmware.com/. This guide uses Workstation Pro 17.5.2 as a reference. During installation, accept driver installs to enable virtual NICs and USB support.

  • Familiarize yourself with the Network Editor in VMware Workstation to define NAT, Host-Only, and Bridged networks and to configure NAT port forwarding.
  • Install VMware Tools or open-vm-tools inside guests to enable integrations and performance improvements.

Setting Up Your First VMware Virtual Machine

Creating a New Virtual Machine

Use Create New Virtual Machine > Typical in VMware Workstation Pro. Select the guest OS, allocate resources, and choose disk options. Recommended starter config for a desktop test VM:

  • Memory: 4 GB
  • CPUs: 2 vCPUs
  • Disk: 20 GB VMDK β€” consider preallocated (fixed) for better I/O
  • Network: NAT for isolated internet access or Bridged to be reachable on the LAN

For automation or local scripting, use vmrun to start/stop and control VMs. For vSphere automation, administrators commonly use VMware PowerCLI (PowerShell module) when interacting with vCenter/vSphere inventories.

VirtualBox vs VMware: Quick Comparison

The table below summarizes core differences to help you choose a tool for labs, development, or more advanced desktop use.

Aspect VirtualBox (example: 6.1.40) VMware Workstation Pro (example: 17.5.2) When to choose
Cost Free (open-source core; Extension Pack has separate license) Commercial (paid license for Pro features) Use VirtualBox for budget labs; VMware for commercial/enterprise desktop labs
Enterprise features Basic VM management, snapshots, shared folders; Extension Pack adds USB/VRDP Advanced networking, cloning, linked clones, and integration with VMware tooling Choose VMware when advanced networking and enterprise parity matter
Performance Good for desktop/dev-test workloads; preallocate disks for better I/O Often better I/O with preallocated VMDKs and advanced controllers Use VMware when I/O sensitivity or enterprise features are required
Automation VBoxManage CLI and API vmrun for local automation; PowerCLI for vSphere automation Both support automation; pick based on ecosystem

Pro Tips: VirtualBox

  • Enable I/O APIC for modern guests (especially multi-core Windows guests) to improve interrupt routing and SMP support.
  • Prefer a SATA controller for disks and use preallocated (fixed) VDI when disk I/O matters: fixed disks reduce host fragmentation and improve sustained throughput.
  • Use the Guest Additions CD for seamless integration; build kernel modules with DKMS so modules persist across kernel updates.
  • For headless or CI usage, use VBoxManage to script VM lifecycle: createvm, modifyvm, storagectl, storageattach, startvm, and snapshot management. Example: automate snapshot creation before a configuration change:
VBoxManage snapshot "UbuntuVM" take "pre-change-$(date +%F)" --description "Before config change"
# Revert later with:
VBoxManage snapshot "UbuntuVM" restore "pre-change-2025-12-27"

Note: avoid long snapshot chains; create short-lived snapshots, then export the VM (OVA/OVF) for long-term backups.

Pro Tips: VMware Workstation

  • Choose a Paravirtual SCSI controller (where available) for I/O-intensive guests to reduce CPU overhead and increase throughput.
  • Use preallocated (thick) VMDKs for production-like I/O tests to match upstream vSphere behavior.
  • Leverage VMware Workstation's Network Editor to configure NAT port forwarding and isolated networks for reproducible lab topologies.
  • Use vmrun for scripting local VMware operations and PowerCLI for vSphere-level automation; include these steps in CI pipelines to provision test VMs automatically.
  • Snapshot strategy: keep snapshot chains short, commit/merge snapshots regularly, and export critical VMs as OVF/OVA for immutable backups.

Best Practices and Troubleshooting Tips for Virtualization

Prerequisite: Enable Hardware Virtualization (VT-x / AMD-V)

Enable VT-x or AMD-V in BIOS/UEFI before creating 64-bit guests or nested virtualization. Quick checks:

  • Windows: run systeminfo and check Virtualization Enabled In Firmware.
  • Linux: check CPU flags for vmx or svm:
    egrep -c '(vmx|svm)' /proc/cpuinfo || echo "No virtualization extensions detected"

Optimizing Resource Allocation

  • Do not overcommit CPU and RAM. Keep assigned vCPUs less than or equal to physical cores for predictable scheduling.
  • Prefer fixed/preallocated disks for I/O-heavy guests to reduce fragmentation and latency.
  • Provision adequate host RAM to reduce swapping; host swap will drastically degrade VM performance.

Security Considerations

  • Keep host and guest integration tools (Guest Additions, open-vm-tools) updated through your normal patch processes.
  • Minimize attack surface: disable unnecessary shared folders and USB passthrough unless required.
  • Restrict management interfaces (VM consoles, remote access) to trusted networks and use host firewall rules and VPNs.
  • Use snapshots for quick rollback during testing, but do not treat them as backups β€” export VMs (OVA/OVF) or copy disks to external storage for long-term backups.

Common Troubleshooting Techniques

  • Network issues: verify NIC mode (NAT vs Bridged vs Host-only). Switch modes in the GUI or via VBoxManage (VirtualBox) or the Network Editor (VMware).
  • Logs: VirtualBox logs are available via the GUI (Show Log) or VM folder; VMware writes vmware.log in the VM directory β€” inspect these for driver/module errors.
  • CLI checks: VBoxManage showvminfo "VM_NAME" inspects VM configuration and runtime state; use vmrun on VMware Workstation to control VMs.
  • Performance: identify disk vs CPU bottlenecks. If disk I/O is the problem, consider an SSD host, fixed-size disks, or more RAM for caching.

Example: switch a VirtualBox VM from Host-Only to NAT:

VBoxManage modifyvm "UbuntuVM" --nic1 nat

Useful Commands & Tools

  • VirtualBox: VBoxManage (createvm, modifyvm, startvm, snapshot)
  • VMware (local automation): vmrun for controlling Workstation VMs

PowerShell (for Hyper-V or with VMware PowerCLI)

If you're managing Hyper-V hosts or vSphere environments via PowerCLI, use PowerShell for inventory tasks. PowerCLI is a PowerShell module provided by VMware and must be installed separately when interacting with vSphere. Example: list VMs (requires the appropriate module/role):

Get-VM | Select-Object Name, CPU, MemoryGB, State

Note: the command above requires Hyper-V cmdlets when targeting a Hyper-V host, or VMware PowerCLI when connected to a vCenter/vSphere instance.

Advanced Topics (Nested Virtualization)

Nested virtualization lets a VM host a hypervisor (useful for labs and CI that validate VM workflows). Requirements and steps:

  • Host CPU must support VT-x/AMD-V and it must be enabled in firmware.
  • Enable nested virtualization on the VM before powering it on.

VirtualBox: enable nested virtualization

VBoxManage modifyvm "UbuntuVM" --nested-hw-virt on

Confirm nested flags inside the guest (Linux):

egrep -c '(vmx|svm)' /proc/cpuinfo || echo "No nested virtualization detected"

VMware Workstation: enable nested virtualization

Enable the guest option "Expose hardware-assisted virtualization to the guest" in VM settings (or add vhv.enable = "TRUE" to the VMX file while the VM is powered off). Verify inside the guest as above.

Security & Performance Notes

  • Nested virtualization increases CPU and memory overhead; use it for short-lived test scenarios rather than production workloads.
  • Some CPU features may not be fully passed through. Validate required features for your nested hypervisor.

FAQ

Can I run Hyper-V and VirtualBox/VMware on the same Windows host?
On Windows, enabling Hyper-V can prevent other hypervisors from accessing VT-x/AMD-V. Either disable Hyper-V to allow VirtualBox/VMware to use hardware virtualization, or use host builds and hypervisor features that explicitly support Hyper-V integration.
How should I back up VMs?
Export important VMs as OVA/OVF for portable backups or copy the VM's disk files and configuration to external storage. Do not rely on snapshot chains as the only backup mechanism.
How do I reclaim disk space after deleting snapshots?
After deleting snapshots, consolidate/commit changes (VirtualBox and VMware both provide snapshot/commit operations). For VirtualBox, ensure snapshots are merged and consider exporting the VM as an OVA to produce a clean copy.
What's the recommended way to share files between host and guest?
Use Guest Additions / open-vm-tools shared folders for occasional file exchange. For higher performance and security, use network-based transfers (SCP, SMB, or NFS) over an isolated host-only network where possible.

Key Takeaways

  • Virtual machines provide isolated environments for testing and running multiple OSes on a single host.
  • VirtualBox (6.1.40) is a strong free option for labs; VMware Workstation Pro (17.5.2) offers advanced desktop features and enterprise integration.
  • Always enable hardware virtualization in firmware before creating 64-bit guests or using nested virtualization.
  • Install Guest Additions or VMware Tools / open-vm-tools inside guests and include them in your patch schedule for security and stability.

Conclusion

By following these steps you can build reproducible test labs, evaluate software across OS versions, and automate VM provisioning. Start small: create a host with two VMs (one Linux, one Windows) and experiment with networking modes, cloning, snapshots, and guest integration to gain practical skills.

Vendor resources at their roots: VirtualBox and VMware.


Published: Dec 04, 2025 | Updated: Jan 09, 2026