If you’re interested in getting hands-on with cybersecurity, setting up your virtual lab is a great place to start.
Virtual machines (VMs) provide a safe, sandboxed environment for you to tinker, test, and try your hand at new skills without fear of damaging your system. In this beginner-friendly guide, you’ll learn about the benefits of virtualization technology and follow along as we set up a basic virtual lab using Ubuntu Linux.
What is Virtualization?
Virtualization revolutionized the technology world. Instead of needing 50 physical machines to do 50 different tasks, we can now have one powerful machine hosting 50 virtual machines. This saves money, energy, and maintenance time.
At its core, virtualization is the creation of virtual (rather than physical) versions of operating systems, servers, or machines. These virtual machines look and act like real computers, but they’re entirely digital. Everything about them exists as software running on your physical hardware.
Virtualization began in the 1960s as a way to reduce the number of machines organizations needed. Today, it’s essential for cybersecurity professionals who need safe environments to practice their skills, test malware, or learn new operating systems.
Types of Virtualization
Type 1: Bare Metal Hypervisors
Type 1 hypervisors (also called bare metal, native, or embedded virtualization) sit directly on top of the hardware. There’s no operating system between the hardware and the virtualization software.
Advantages:
- Maximum performance since resources go directly to virtual machines
- More efficient use of hardware resources
- Better for running many VMs simultaneously
Common examples: VMware ESXi, Proxmox, Microsoft Hyper-V Server, XCP-ng
Best for: Server environments, enterprise use, running multiple production VMs
Type 2: Host-Based Hypervisors
Type 2 hypervisors run as applications inside a regular operating system (Windows, Mac, or Linux). This is what we’ll use for our virtual lab.
Advantages:
- Easy to set up on your existing computer
- Great for learning and testing
- Can run VMs only when needed
- No dedicated hardware required
Disadvantages:
- Lower performance compared to Type 1
- Uses resources from your host operating system
- Introduces additional security considerations
Common examples: Oracle VirtualBox (free), VMware Workstation/Fusion, Windows Hyper-V
Best for: Learning, testing, personal labs, development environments
Why Virtual Labs Matter for Cybersecurity
Virtual labs are essential tools for anyone learning cybersecurity. Here’s why:
Safe Testing Environment
You can experiment with potentially dangerous tools, malware, or system configurations without risking your actual computer. If something goes wrong, you simply delete the VM and start over.
OS Flexibility
Need to learn Linux but only have a Windows computer? No problem. Want to test how malware behaves on Windows XP? Easy. Virtual machines let you run any operating system you need for training.
Practice Networking
Create multiple VMs and connect them in a private network. This lets you practice network security concepts, set up servers, or simulate attack and defense scenarios.
Cost Effective
Instead of buying multiple computers to build a home lab, you can create dozens of virtual machines on one decent computer.
Snapshot and Cloning
Made a mistake? Go back to a previous snapshot. Need identical test machines? Clone your VM in minutes.
Hardware Requirements
Before setting up your virtual lab, make sure your computer meets these minimum requirements:
CPU: Intel i5 (10th gen or higher) or AMD Ryzen 5/7 (3000 series or higher)
- Virtualization must be enabled in BIOS
RAM: 8GB minimum, 16GB or more recommended
- Remember: Your host OS and each VM need RAM
Storage: 256GB minimum, 512GB or 1TB recommended
- SSDs provide much better performance than HDDs
- VMs can grow large quickly
Note: The more powerful your machine, the better your VMs will perform. If you’re running Windows 10 as your host OS, that alone requires 4GB of RAM. Each additional VM will need its own allocation.
Getting Started with VirtualBox
VirtualBox is the perfect choice for beginners because it’s:
- Completely free and open source
- Works on Windows, Mac, and Linux
- Well-documented with a large community
- Compatible with almost any operating system you want to run
Step 1: Download VirtualBox
- Go to the VirtualBox download page (search “Oracle VirtualBox downloads”)
- Download two things:
- VirtualBox installer for your operating system (Windows host, OS X host, etc.)
- VirtualBox Extension Pack (same file works on all operating systems)
Step 2: Install VirtualBox
On Windows:
- Double-click the downloaded .exe file
- Click “Next” through the installation wizard
- Accept default settings
- Click “Install” and then “Finish”
On Mac:
- Double-click the downloaded .dmg file
- In the window that opens, double-click the .pkg file
- Follow the installation prompts
- Allow the software in System Preferences > Security & Privacy if prompted
Step 3: Install the Extension Pack
- After VirtualBox is installed, double-click the Extension Pack file
- VirtualBox will open automatically
- Click “Install” when prompted
- Scroll through the license agreement and click “I Agree”
The Extension Pack adds important features like USB support, better display resolution, and improved file sharing between host and guest systems. It is free for personal, educational, and evaluation use.
Creating Your First Virtual Machine
Now for the exciting part: creating your first VM.
Step 1: Get an Operating System
For beginners, Ubuntu Linux is an excellent choice:
- It’s free
- User-friendly
- Widely used in cybersecurity
- Has excellent documentation
Download an Ubuntu ISO file from the official Ubuntu website. For beginners, Ubuntu 24.04 LTS (Long Term Support) is recommended as it receives updates through 2029. An ISO is like a digital DVD that contains the operating system installer.
Step 2: Create a New VM
- Open VirtualBox Manager
- Click the “New” button
- Give your VM a descriptive name (e.g., “Ubuntu Lab 1”)
- Choose the location to store the VM files
- Select the OS type and version (Linux > Ubuntu 64-bit)
Step 3: Allocate Memory (RAM)
For Linux VMs: 1024MB (1GB) is the minimum, 2048MB (2GB) is better
Remember: The RAM you give to the VM is taken from your host system while the VM is running. If you have 8GB total and give 2GB to your VM, your host OS only has 6GB available.
Step 4: Create a Virtual Hard Disk
- Select “Create a virtual hard disk now”
- Choose VDI (VirtualBox Disk Image)
- Select “Dynamically allocated”
- This means the disk file only uses space as needed
- If you allocate 40GB, it might only use 5GB initially
- Set the size to at least 20GB, 40GB recommended
Step 5: Configure Network Settings
Before starting your VM:
- Select your VM in VirtualBox Manager
- Click “Settings”
- Go to “Network”
- Make sure “Adapter 1” is enabled
- Set “Attached to” to NAT (Network Address Translation)
- This provides internet access while keeping your VM isolated from your local network.
Step 6: Add the Installation Media
- With your VM selected, click “Start”
- VirtualBox will ask for an installation disk
- Click the folder icon and browse to your Ubuntu ISO file
- Select it and click “Start”
Step 7: Install the Operating System
The VM will boot from the ISO and start the Ubuntu installer:
- Follow the on-screen prompts
- Choose your language
- Set up a username and password (don’t forget these!)
- Select installation options (defaults are fine for beginners)
- Wait for the installation to complete
- Restart when prompted
Congratulations! You now have a working virtual machine.
Essential VM Management: Cloning and Snapshots
Two features will save you countless hours: cloning and snapshots.
Snapshots: Your Time Machine
A snapshot is like a save point in a video game. It captures the exact state of your VM at a moment in time.
When to take snapshots:
- Right after installing the OS (clean baseline)
- Before installing new software
- Before testing anything risky
- Before making system configuration changes
How to create a snapshot:
- With your VM running or shut down, click “Machine” > “Take Snapshot”
- Give it a descriptive name (e.g., “Fresh Ubuntu install”)
- Add notes about what’s installed or configured
If something goes wrong, you can restore to any snapshot. Everything after that snapshot will be gone, but you’ll have a working system again.
Cloning: Instant Duplicates
Cloning creates a complete, independent copy of your VM.
Why clone?
- Create identical test environments
- Back up your VM before major changes
- Quickly set up multiple machines for network labs
How to clone:
- Right-click your VM in VirtualBox Manager
- Select “Clone”
- Choose “Full clone”
- Select “Generate new MAC addresses for all network adapters”
- Click “Clone”
Now you have two separate VMs. Changes to one won’t affect the other.
Setting Up a Virtual Network
One VM is useful, but the real learning happens when multiple VMs interact. Let’s set up a network.
Creating a NAT Network
By default, each VM with NAT networking is isolated. To let VMs communicate:
- In VirtualBox, go to File > Preferences
- Click “Network”
- Click the green “+” icon to add a NAT Network
- Click “OK”
Tip: You can name your NAT Network something descriptive, like ‘CyberLab’, to keep things organized if you create multiple networks later.
Connecting VMs to the Network
For each VM you want on the network:
- Select the VM (must be powered off)
- Click “Settings” > “Network”
- Change “Attached to” from “NAT” to “NAT Network”
- Select the NAT Network you created
- Click “OK”
Now your VMs can communicate with each other while remaining isolated from your host machine and the internet (unless you configure otherwise).
Testing Your Network
Start two VMs on the same NAT Network. In each VM’s terminal:
- Find the IP address:
ip addrorifconfig - From VM1, ping VM2:
ping [VM2's IP address] - From VM2, ping VM1:
ping [VM1's IP address]
If you see replies, congratulations! Your virtual network is working.
What to Do With Your Virtual Lab
Now that you have a working lab, what’s next?
- Learn Linux Command Line: Master the terminal, file systems, user management, and permissions.
- Practice Networking: Set up DNS servers, web servers, or DHCP servers. Learn how different protocols work.
- Network Traffic Analysis: Install Wireshark on one VM and capture traffic between VMs. Learn to read network packets.
- Security Tools: Try tools like Nmap for network scanning, or set up a security-focused distribution like Kali Linux.
- Capture the Flag Challenges: Download intentionally vulnerable VMs and practice finding and exploiting security flaws.
- Break and Fix: Install something, break it, troubleshoot it, fix it. This is how you learn.
- Container Technology: Once comfortable with VMs, explore Docker containers running inside your VMs. Many cybersecurity tools are now distributed as containers, making this a valuable skill.
Best Practices and Tips
- Start Simple: Begin with one or two VMs. Learn the basics before building complex networks.
- Document Everything: Keep notes on what’s installed, passwords, network configurations, and anything unusual.
- Regular Snapshots: Get in the habit of taking snapshots before making changes.
- Resource Management: Don’t run more VMs simultaneously than your hardware can handle. Performance will suffer.
- Security Awareness: If you connect a VM to the internet or your local network (bridged mode), secure it properly. A vulnerable VM can become a real security risk.
- Backup Your VMs: Export important VMs as OVA files and store them on an external drive or cloud storage. This protects against host machine failure and lets you move your lab to another computer.
- Update Guest Additions: Periodically update VirtualBox Guest Additions in your VMs when you update VirtualBox itself. This ensures compatibility and access to the latest features.
- Keep Learning: Follow the rabbit hole. If you don’t understand something, research it. That’s where the real learning happens.
Conclusion
Virtual labs are one of the most valuable tools for anyone learning cybersecurity. They provide safe, flexible environments where you can experiment, break things, and learn without consequences.
Start with the basics: install VirtualBox, create a VM, take snapshots, set up networking. As you get comfortable, expand your lab. Add more VMs, create complex networks, try new operating systems and tools.
The key is to actually do it. Don’t just read about virtualization or watch videos. Download VirtualBox right now and create your first VM. Make mistakes, break things, and fix them. That’s how you learn.
Your journey into cybersecurity starts here, in your virtual lab, on your own computer. What you do with it is up to you.
Troubleshooting Common Issues
VM won’t start:
- Check that virtualization is enabled in your BIOS/UEFI
- Ensure you have enough free RAM and disk space
- Try disabling Hyper-V on Windows (it can conflict with VirtualBox)
Network isn’t working:
- Verify the network adapter is enabled in VM settings
- Try switching between NAT, NAT Network, and Bridged modes
- Restart the VM after changing network settings
Screen resolution is stuck at 800×600:
- Install VirtualBox Guest Additions
- Restart the VM
- Try View > Virtual Screen 1 > Choose a resolution
Shared folders not appearing:
- Guest Additions must be installed
- The VM user needs to be added to the vboxsf group (Linux)
- Try remounting:
sudo mount -t vboxsf sharename /mount/point
Frequently Asked Questions
What’s the difference between an ISO file and an OVA file?
An ISO file is an installation image, like a digital DVD. You use it to install an operating system from scratch on a new VM.
An OVA (Open Virtual Appliance) file is a pre-built virtual machine. Someone else already installed and configured the OS. You just import it into VirtualBox and it’s ready to use. OVAs are great for getting started quickly with specialized security tools.
Can I access my VM from my host operating system?
Yes, but you need to configure networking properly. The easiest way is to use “Bridged Adapter” mode, which puts your VM on the same network as your host. However, be aware that this makes your VM visible to your entire network, so make sure it’s properly secured.
Alternatively, you can set up port forwarding or use shared folders with VirtualBox Guest Additions installed.
My VM is really slow. What can I do?
Add more RAM: Give your VM more memory if you have it available.
Use an SSD: If you’re storing VMs on a traditional hard drive, moving them to an SSD will dramatically improve performance.
Allocate more CPU cores: In VM settings > System > Processor, increase the CPU count.
Disable unnecessary features: Turn off 3D acceleration or other features you’re not using.
Close other applications: Your host OS needs resources too.
Can I run VirtualBox on a Raspberry Pi?
No. VirtualBox requires an x86/x64 processor (Intel or AMD). Raspberry Pis use ARM processors, which are incompatible. However, you can use QEMU or other ARM-compatible virtualization solutions on Raspberry Pi. For cybersecurity learning, a standard PC or Mac is recommended.
How do I fix “VT-x is not available” or “kernel driver not installed” errors?
On Windows: Restart your computer, enter BIOS/UEFI settings (usually by pressing F2, Delete, or F12 during boot), and enable “Intel Virtualization Technology” or “AMD-V.”
On Mac: Go to System Preferences > Security & Privacy, and allow the Oracle VirtualBox kernel extension.
You may need to restart your computer after making these changes.
Can my internet service provider (ISP) track what I do in my VM?
Your ISP can see the external IP address assigned to your host machine. If your VM uses NAT networking, the ISP won’t see the VM’s internal IP address, but they can still see what websites or services you access from the VM if you’re not using additional privacy tools.
For better privacy, use a reputable VPN service (not a free one) inside your VM.
Should I use an SSD or HDD for my VMs?
SSDs are strongly recommended. Virtual machines involve constant reading and writing of disk data. SSDs are much faster than traditional hard drives, which means:
- VMs boot faster
- Applications load faster
- Overall performance is significantly better
- Better experience when running multiple VMs
How do I share files between my host OS and VM?
Install VirtualBox Guest Additions in your VM:
- With your VM running, go to Devices > Insert Guest Additions CD image
- Follow the installation prompts inside your VM
- After installation, you can set up shared folders or enable drag-and-drop
This allows you to create a folder accessible from both your host and VM, or drag files directly between them.
Can I access the same VM from multiple host machines?
Not simultaneously. However, you can copy the VM files to another computer with VirtualBox installed and run it there. You can also export a VM as an OVA file and import it on another machine.
What’s the difference between NAT and NAT Network?
NAT: Each VM is isolated in its own network. VMs can access the internet but cannot communicate with each other or be accessed from the host.
NAT Network: Multiple VMs share a network. They can communicate with each other and access the internet, but are still isolated from the host machine.
Bridged Adapter: VMs appear as separate physical devices on your local network, with their own IP addresses.
My VM has the same IP address as another VM. Is that okay?
If both VMs are using standard NAT (not NAT Network), yes. Each VM is in its own isolated network, so having the same internal IP address is normal and not a problem.
If you want VMs to communicate, switch them to a NAT Network or Bridged Adapter, and they’ll get unique IP addresses.
Is it safe to test malware in a VM?
Virtual machines provide good isolation for basic learning, but sophisticated malware can sometimes detect and escape VMs. For serious malware analysis:
- Use an isolated network with no internet access
- Never use bridged networking when testing malware
- Consider using specialized malware analysis environments
- Take snapshots before testing so you can restore clean systems
- Understand that VMs provide good but not perfect isolation
How many VMs can I run at once?
It depends on your hardware. As a rough guide:
- Each Linux VM needs at least 1GB RAM (2GB is better)
- Each Windows VM needs at least 4GB RAM
- Your host OS needs RAM too
With 16GB of total RAM, you could comfortably run 2-3 VMs simultaneously, depending on what you’re doing with them.
Can I use VMware Workstation instead of VirtualBox?
Yes! VMware is an excellent alternative, though the licensing has changed recently. As of 2024, Broadcom (which acquired VMware) offers VMware Workstation Pro for free for personal use. However, there have been changes to commercial and educational licensing that can be confusing. VirtualBox remains completely free and open-source for all uses, which is why it’s the standard choice for educational programs. The skills you learn in VirtualBox transfer easily to VMware and vice versa. Mac users on Apple Silicon (M1/M2/M3) may find VMware Fusion works better than VirtualBox, as ARM support is more mature.
Does VirtualBox work on Apple Silicon Macs (M1/M2/M3)?
VirtualBox has limited support for Apple Silicon Macs. While Oracle has made progress, performance and compatibility are not as good as on Intel Macs or Windows PCs. If you have an Apple Silicon Mac, consider using UTM (free, open-source) or Parallels Desktop for ARM-based virtualization, or use VMware Fusion which now has better ARM support. For x86/x64 guest operating systems (like most Linux distributions and Windows), you’ll need to use an emulation layer, which will be slower. If you’re serious about cybersecurity learning and have an M1/M2/M3 Mac, you might want to dual-boot Linux or use a cloud-based lab environment.


