Running Pi-Hole Ad-Blocker in a VirtualBox VM

Creating the VM

  1. Download Raspberry Pi OS Download
  2. Launch Virtualbox
  3. Create a New VM by selecting Machine > New

    Name: Raspberry Pi-Hole
    Machine Folder: C:\VMs
    Type: Linux
    Version: Debian (32-bit)
    Memory Size: 1024 MB
    Hard disk: Create a virtual hard disk now

  4. Click Create
  5. On the Create Virtual Hard Disk dialog

    Name the virtual disk image Raspberry Pi-Hole.vdi
    File size: 12-16 GB
    Hard disk file type: VDI
    Storage on physical hard disk: Dynamically Allocated

  6. Click Create
  7. Select the VM and Click Settings
  8. Select System > Processor
  9. Give the VM at least 2 processors
  10. Select Display
  11. Slide the Video Memory to 128 MB
  12. Select Network
  13. Set the attached to dropdown to Bridged Adapter
  14. Select Storage
  15. Click on the CD-ROM drive
  16. Select the disc dropdown to the right > Choose a virtual optical disc file...
  17. Browse to and select the Raspberry Pi desktop .iso file
  18. Click OK
  19. Make sure the Raspberry Pi-Hole VM is selected and click Start > Normal
  20. Select Graphical Install
  21. Select a keyboard map > click Continue
  22. Select Guided - use entire disk > click Continue
  23. Click Continue, Continue, Continue
  24. Select Yes to confirm writing the changes to disk > click Continue
  25. Wait while Debian and the Raspberry Pi Desktop are installed
  26. Select Yes to install GRUB on the master boot record > click Continue
  27. Select /dev/sda > click Continue
  28. Click Continue to reboot the VM
  29. Click Next on the welcome dialog
  30. Set the Country, Language and Time Zone > click Next
  31. Enter and confirm a password for the pi user > click Next
  32. Click Skip to updating software
  33. Click Finish to reboot the VM and complete setup

Installing Updates and Pi-Hole

  1. Click the Applications button > Accessories > Terminal
  2. Run the following commands to install updates
    sudo apt update
    sudo apt upgrade -y
    sudo apt clean
    sudo reboot now
  3. Select Devices > Insert Guest Additions CD image...
  4. If the installation autoruns, select Run
  5. On the desktop, Right click on the Guest Additions disc > Open in Terminal
  6. In the Terminal window run the following commands
    sudo sh ./VBoxLinuxAdditions.run
    sudo reboot now
  7. The VM will reboot
  8. Upon rebooting, you can now full screen the VM and the internal resolution will automatically change to match the window size
  9. Click the Applications button > Accessories > Terminal
  10. Run the following command to install Pi-Hole
    curl -sSL https://install.pi-hole.net | bash
  11. Press Enter until the DNS selection is displayed
  12. Select a DNS provider and press Enter
  13. Press Enter through the rest of the Pi-Hole installer, selecting the defaults
  14. Copy the randomly generated admin password (just in case)
  15. Press Enter to complete the installation
  16. Run the following command to change the Pi-Hole admin password
    sudo pihole -a -p
  17. Enter and confirm the new password
  18. Click the Applications button > Internet > Chromium Web Browser
  19. Navigate to http://DNSorIP/admin
  20. Click Login
  21. Authenticate with the admin password

Testing Pi-Hole

  1. Right click the VM network connection > Wireless & Wired Network Settings
  2. Select eth0 from the interface dropdown
  3. Clear out the DNS servers and input the VM IP address
  4. Click Apply
  5. Click Devices > Network > Connect Network Adapter to disable networking
  6. Click Devices > Network > Connect Network Adapter to re-enable networking
  7. In Chromium, open a new tab and navigate to https://yahoo.com
  8. Go back to the Pi-Hole tab and see that some DNS queries have been blocked

Setting Up From Windows Client

  1. Click the Start button > Type control panel > press Enter
  2. Click View By > Small Icons
  3. Click Network and Sharing Center
  4. Click Change adapter settings
  5. Right click on the network connection > Properties
  6. Select Internet Protocol Version 4 (TCP/IPv4) > Properties
  7. Select the radio option next to Use the following DNS server addresses
  8. Input the IP address of the Pi-Hole VM
  9. Click OK on both of the open dialog windows
  10. Right click the Start button > Command Prompt (Admin)
  11. Type the following commands to flush your DNS cache and restart the network connections (note: your network connection will drop if running the commands on a remote machine)
    ipconfig /flushdns
    ipconfig /release
    ipconfig /renew

More on Pi-Hole https://pi-hole.net/