Installing VirtualBox
To set the foundation for our lab, we will be using VirtualBox as a virtual hardware platform to host our images. This recipe will outline the steps necessary to do so. In the event that you wish to use an alternate virtualization platform, the same general principles will apply.
When it comes to learning a new set of skills or sharpening the ones you already have, the importance of a testing environment cannot be overstated. It is imperative that you have the means to test against systems in a known state so that you can validate the results of your tests.
One method of saving resources, both physical hardware and computing resources, is to utilize a virtual environment where your testing devices reside. One very popular example of a virtualization platform is Oracle's VirtualBox—a purpose build virtualization environment designed for use with x86 platforms that can host many virtual machines on one physical computer. This allows for the sharing of resources such as disk, RAM, CPU, and so on. Additionally, because VirtualBox supports importing and exporting virtual appliances, resources can be easily moved, shared, and so on.
Getting ready
To prepare for the use of VirtualBox for the remainder of this book, we will need to ensure that we have enough resources on our server to be able to run several of the virtual guests at the same time. The following chart highlights the amount of resources that each of our intended guest systems will require:
Name | Disk required | Memory required | CPU required | Chapters used |
Kali Linux | 80 GB | 8 GB | 2 | 1-10 |
Metasploitable | 65 GB | 4 GB | 1 | 1,2,4-7,10 |
Ubuntu 16.4 LTS | 15 GB | 2 Gb | 1 | 1,6,10 |
Windows XP SP3 | 10 GB | 1 GB | 1 | 1,2,4-7,10 |
Windows 7 - host 1 | 10 GB (thin) | 2 GB | 1 | 1-7 |
Windows 7 - host 2 | 10 GB (thin) | 2 GB | 1 | 1-7 |
Windows 2008 Server | 25 GB (thin) | 2 GB | 1 | 1-7 |
OWASP-BWA | 10 GB | 1 GB | 1 | 1,9 |
VulnOS | 32 GB | 1 GB | 1 | 1,7 |
How to do it...
In this section, we will build out an environment that will allow you to perform security testing without the need for physical hardware:
- Ensure that you have the following resources free on your host machine to support the system combinations mentioned in preceding list. In totality, you will need the following in addition to the resources needed by VirtualBox itself:
- 5 CPU
- 1500+ GB free disk space
- 16 GB free memory
- Download the appropriate version of VirtualBox for your lab environment from www.virtualbox.org.
Note
It would also be good to familiarize yourself with the detailed options available from the VirtualBox manual, which can be found at https://www.virtualbox.org/manual/ch01.html.
- Once you have downloaded the installer, locate it, and start the installation. As the application begins the installation, you will see the following dialog boxes. As of the time of writing this book, the version available was 5.1.8. When you are greeted with the dialog box seen in the following figure, select
Next
:

Initial installation screen
- When given the option at the first
Custom Setup
screen, as seen in the following figure, leave the default options in place, and selectNext
:

First custom setup screen
- At the second
Custom Setup
screen, as seen in the following figure, review the options and determine which are appropriate to your preferences, and selectNext
:

Second custom setup screen
Note
If you leave Register file associations
, this will configure your system to use VirtualBox, to open virtual disk images automatically.
- After the basic configuration options have been decided, the setup will now begin to make changes to the host computer. One such step is the installation of the dedicated virtual network adapters that allow VirtualBox to provide different options in regard to how your systems use networking. During the installation of these drivers, you may experience a brief loss of connectivity; so when prompted, acknowledge this fact by selecting
Yes.
- Once ready to kick off the installation, select
Install
from the next dialog box, and wait until the installation process is complete.
Note
During the installation process, you will be prompted to allow the installation of device drivers. These drivers are predominantly used for the virtual network devices. You may choose to trust device drivers signed by Oracle in the future, or leave that option unchecked.
- Once the installation is complete, you will be given the option to finish, or finish and then start VirtualBox.
Note
Depending on what other uses for this lab you may have in the future, this would be a good time to install the VirtualBox expansion set that includes support for the USB 2.0 and 3.0 USB controllers, host web camera, RDP services, and other features. It is recommended that you install these at this time before starting VirtualBox.
- Once you start VirtualBox, you will need to confirm the settings for network connectivity. You are going to want to find the
Preferences
item under theVirtualBox
menu heading; now, select it. Then, select the network option along the top, and you will be presented with the following window:

VirtualBox preferences dialog - network
- By default,
NatNetwork
should already be created for you. However, if one is not displayed, click on the+
button on the top right to add one.
Note
In the next section, we will be creating networks that exist only on your PC. Although these networks will only be seen on your PC, we strongly recommend that you use subnets that do not coincide with any of the existing networks that you may have access to.
- Once added, review the setup of the network by clicking on the wrench icon, on the lower-right part, and you will be presented with the following dialog box. You can modify the IP subnet as needed. Ensure that
Enable Network is selected, and click on
OK
to continue:

NatNetwork configuration dialog
- Create our test network. Select
Host-only Networks
. By default, no network is created, so click on the+
icon in the upper right-hand corner to create thevboxnet0
network:

Host-only networks dialog box
- Ensure that the
vboxnet0
interface is highlighted, and click on the wrench icon in the lower-right part of the screen. An IPv4 address will already be populated for you. If you are putting this into an existing lab network, or if this range is used in other places in your existing environment, feel free to designate a different network if necessary, as this will be your dirty network for testing purposes:

Host-only network adapter dialog
- Let's review and modify the
DHCP Server
section by selecting it. The defaults should be fine, but you can adjust them as you feel appropriate.
Note
Do not use the whole range for DHCP, as you may want to statically assign IP Addresses to servers on your dirty network.

- Once these steps have been completed, your VirtualBox environment is ready for the next section.
How it works...
In this section, we will download and install the virtual compute environment, VirtualBox, to build the base of our test lab. We configured the basic network configurations and set up DHCP to help with dynamic host networking.