How to Test Pi-Hole on a VM (Part I)
A great way to test experimental new software is to run it in an isolated software environment such as a Virtual Machine. This tutorial will walk you through a the basic steps and a few things you need to know to configure your own test environment using Oracle's Virtual Box and Pi-Hole running in a custom CentOS 7 VM.
Oracle VM VirtualBox |
CentOS 7 Linux |
Open VirtualBox and you may be greeted with an option to download the latest Oracle VM VirtualBox Extension Pack. This isn't required, but I recommend it if you wish to use VirtualBox in the future to test graphical operating systems or wish to use some advanced features like USB 3.0 device pass-through. The download and install happens within the VirtualBox interface, so there is no need to open a browser, just accept some terms of service and authorize the upgrade with your local administrator rights if prompted.
Now we can build the virtual machine.
Click New, and you will see the New Virtual Machine dialogue. For Name, type something memorable like "Pi-Hole Test" and for the Type and Version select Linux, and Red Hat 64-bit. Click Next, we don't need to worry about Expert Mode for this test VM.
Now you will be prompted to create a Hard Disk. A virtual machine hard disk exists as a file on your computer's hard drive. Like the memory, it reserves this space for your virtual machine The default size is 8GB, which is pretty small, but should be plenty for our test. Leave the radio button selector on "Create a virtual hard disk now" and click Create.
Here we need to decide they format of the virtual disk file. Virtual Box uses a proprietary VDI format which we should choose. VHDs are for Microsoft file systems, and VMDKs are for VMware platforms, but we don't need to worry about either for our test so we don't care about compatibility at this point outside of VirtualBox. Leave the radio button on VDI (VirtualBox Disk Image) and click Next.
Now we are given a choice whether to preallocate all 8GB of disk space up front, or allow the size of the virtual disk file to grow as needed up the the 8GB max we allow. For performance reasons, it is always preferable to preallocate the disk space if you have it available. Select Fixed Size and click next.
Finally, we are given the option to give the VDI file a name and location, and define the size. For this example, my hard drive was called Pi-Hole Test, the same as my VM name, and the location is in my home directory under c:\users\username\VirtualBox VMs\Pi-Hole Test\. I'm going to go with the 8GB recommended default for this test, so click Create.
After a few seconds, the VM will be created and you will return to the VirtualBox VM Manager window with a new Red Hat 64-bit VM called Pi-Hole Test. You can see that it is powered off, which is good because we still have one more thing to do before we power it up.
Right click on the Pi-Hole Test VM and click Settings. Click on Storage and then click on the words "empty" under your Controller: IDE section. This is your virtual optical drive. Here we will tell VirtualBox what ISO we would like to mount in the virtual optical drive, so that the system will be able to boot from it when we power it on. Click on the Disk Icon next to IDE Secondary Master and browse to the location where you saved your CentOS 7 Minimal ISO. Select that ISO file click OK.
The next steps for this test will be to configure the virtual machine's network adapter. Since we want to give other machines on the network access to your Pi-Hole server directly, it is simplest to define the network adapter as a bridged adapter. A bridged adapter will share the network card from your Host computer, giving the VM Guest its own physical MAC address and IP address on the same network as the Host. Your home router will see this VM as a new physical computer on the network, the same as a laptop, phone, or Raspberry Pi. This is perfect, because we may want to give other devices like smartphones access to this Pi-Hole VM for a thorough test.
Select Attached to: Bridged Adapter and you should see the name of the adapter you currently use on your Host computer. If you click Advanced you can see some more details about the device the Guest VM will use including the Adapter Type, Promiscuous Mode, MAC Address, and whether the cable should be considered connected when the machine is running. The Defaults are fine here, since the Intel PRO/1000 MT adapter is so common that nearly every Operating System will include drivers for it, Promiscuous Mode should be set to Deny in nearly all cases, the MAC Address is randomly generated and we want the cable to be connected. Click OK.
Now we are ready to start the OS install (in part II)...
Comments
Post a Comment