In this guide, we’ll explore the different network adapter settings available in VirtualBox and how they can help you build valuable networking skills. Whether you’re studying for your CompTIA A+ certification or looking to create a virtual lab environment, this tutorial will be an invaluable resource.
Why VirtualBox Networking?
Networking is a critical component of IT infrastructure. Understanding how to configure and utilize different network types in VirtualBox prepares you for real-world scenarios and enhances your overall IT skill set. You’ll learn to:
- Understand key networking concepts
- Develop hands-on troubleshooting skills
- Prepare for IT certifications
- Enhance your real-world IT proficiency
- Run basic command-line networking commands
- Build proficiency in IP addressing
Getting Started
Before we dive in, ensure you have VirtualBox installed on your host machine and at least two VMs set up with a basic OS installation. Updating the Guest Additions on each VM ensures proper functionality and network driver support.
If you are unfamiliar with the VirtualBox setup process, check out this post (link) to learn how to get a Windows VM up and running.
Pre-lab Steps:
Virtual box uses virtualization to take our system’s (host) hardware resources and allocate them to new virtual machines (guests). As you’ll see in this lab, virtual box offers a host of features that allow you to configure several different types of network adaptor settings that will affect how your host and guest machine’s view and interact with one another’s networks.
As a starting point, let’s run the following command in your host system’s terminal to get your IP Address:
ipconfig
Scroll down until you see this information:
This is your host’s IPV4 address. It has been dynamically (randomly) handed over to your computer by your internet provider for access over the internet and other networks. The screenshot I provided depicts my actual network information, so I blocked out the sensitive information. Write down and keep track of your system’s IPV4 address, as it will be referenced a few times going forward.
Lab Procedure: Configuring Network Adapters
Let’s explore each network adapter setting in VirtualBox, understand its use case, and go through the configuration steps.
Scenario 1: NAT (Network Address Translation)
NAT allows VMs to access the internet using the host’s IP address, providing a simple setup for general internet access and basic network configurations.
Select VM1 in the VirtualBox Manager
Navigate to Settings > Network.
Ensure Adapter 1 is enabled and set to NAT.
Start VM1 and verify internet access by running ping www.google.com
in the terminal.
Document the IP address assigned to VM1 using ipconfig
.
Notice anything different about this terminal output? Well, you should!
If you configured the NAT network adaptor when setting up this VM, then what you’re seeing is the result of network address translation at work.
When you choose NAT as the adaptor setting for your VM, virtual box creates a virtual router that also acts as a virtual DHCP server. It’s sending out a private list of IP addresses to any device in it’s network-in this case, our virtual widows machine.
To cement this concept, lets run another command in the virtual machine’s terminal:
tracert 1.1.1.1
This command will show us a route of ‘hops’ a network packet takes to reach a specific IP address, in this case, a server of the technology company, Cloudflare (1.1.1.1). You could also type the actual URL of the site too, if that’s more comfortable for you.
Let’s look at the output of our command:
I’ve blocked out my personal IP information again. But if you look at the 2nd or 3rd line of output, you should see the hop from your virtual machine’s network router to your host machine’s router and then out to Cloudflare.
Scenario 2: NAT Network
NAT Network allows multiple VMs to communicate within the same internal network while also accessing the internet.
- Navigate to Tools > NAT Network Tab.
Notice that there is already a NAT network preconfigured to an IP address prefix. It might be slightly different from mine based on your location. Take note of that IP address range for future reference.
- Now navigate back to the Network Tab > Adaptor 1 of both of your VMs and select NAT Network from the dropdown list. Select NATNETWORK1 from the list of available NAT Networks for both VMs as well.
Let’s power on both of our VMs and check our new network settings in the terminal.
Run ipconfig
in both terminals and notice the new output.
If both of your adaptors are configured correctly, then you’ll notice that both of your machines are now connected to the same subnet!
Now let’s run the tracert
command again from earlier to check that the network translation is still functioning as well.
Success! We now have an interconnected system of virtual machines that uses a virtual router to gain access to the internet via our host’s NIC.
Scenario 3: Bridged Adapter
Bridged Adapter connects VMs directly to the host’s physical network, making them appear as separate physical devices. This setup is perfect for scenarios requiring VMs to interact with the host network and other physical devices.
For security reasons, I’ll leave my screenshots out of this example.
- Select VM1 in the VirtualBox Manager.
- Navigate to Settings > Network.
- Change Adapter 1 to Bridged Adapter.
- Select the host’s network interface to bridge with.
- Repeat steps 1-4 for VM2, selecting the same network interface.
- Start both VMs and verify they receive IP addresses from the host network and can communicate with external network devices.
Conclusion
And there you have it! This guide only scratches the surface of the networking environments and scenarios that you can setup using virtual box. I’ve only listed the most commonly used adaptor settings. there are generic adaptors that allow for extensive levels of customization, cloud-based adaptors for Azure and AWS students to study with, and other scenario-specific settings that one can use to test out bugs and new ideas for work or play.
I hope that this guide was useful to anyone new to setting up virtual lab environments, and also those who wanted to see these different configuration options put to practice without having to do the hard work themselves.
Please continue to look out for more guides and articles discussing topics like this and more. And above all, keep studying!
Cheers!