I am writing this report on the occasion that a friend urged me to install Pi-hole to protect from undesired advertisement attacks (and many more negative aspects). He uses a Raspberry pi but I was not looking to get another hardware device because have FreeNAS and some old hardware among them IGEL H710C which I could use to experiment.
I started with IGEL and installed Debian 8.4, later 10.2 but failed (not the fault of Debian but my IGEL does not like it or is too old), then tried ubuntu-18.04.3-server-amd64 which installed well (using Rufus to create the bootable USB-stick).
Then I wondered if this was possible to do use Pi-hole within a VM on my FreeNAS-11.2-U7. I used Google a little bit (now without the annoying adds thanks to Pi-hole on Ubuntu server 18.04 on my IGEL) but did not find any clear answers if and how FreeNAS and Pi-Hole work.
As always someone is asking how to achieve the task, gets some "don't do this and do that" and at the end of the question there is missing if he succeeded or was hit by a stone. I experimented with jails few years ago but had no real use for it (I confess that I use FreeNAS only for using it as "NAS" so far) but today I tried its VM-feature. It is a long time ago that I enjoyed the night (and the bourbon) like today...
In a nutshell, Pi-hole and FreeNAS (VM on Ubuntu) rocks. To make the story short, here are the steps:
1) Create a VM (in my case 1 CPU / 768 MB RAM / 10 GB Disk)
2) Point to installation file ubuntu-18.04.3-server-amd64.iso (this is really cool because FreeNAS GUI just browses to any place in your file structure and so unlike Citrix etc. you do not have to create/mount iso/nfs directory first to be able to boot from the iso. So in a minute or less you're fine to install :)
3) Follow the next steps (confirm all and start the VM).
4) The VNC feature to connect to the VM is a pretty cool part, working well so even my granny could have managed this if she was still alive.
5) Leave everything as suggested except maybe "Install security updates automatically" and install "OpenSSH server" (because I like to conect to my VM's by SSH)
6) After finalizing the installation and rebooting you log in as the user you created during the Ubuntu install. So you need to change the root password with sudo passwd root.
7) Check with ifconfig the IP your VM received from your DHCP-server (I need this for Bitvise SSH Client to log in with the user I created before). Note: you cannot login as root now because you have to enable root ssh first.
8) I had problems to manage the VM via the VNC-interface because my German keyboard would print ß instead of - so I could not use the necessary console commands but that problem can be due the selection of a German keyboard so may not affect everybody.
9) I like things comfortable so I do sudo apt-get install mc to get Midnight Commander (I remember Norton Commander from DOS-times and like it better than pressing 100 keys while MC can do this for me).
10) Use MC (with sudo to get rights) and go into /etc/netplan and edit 01-netcfg.yaml to change from DHCP to your static IP. In my case I changed:
dhcp4: no
dhcp6: no
addresses: [192.168.2.254/24]
gateway4: 192.168.2.1
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
save and enter sudo netplan generate / sudo netplan apply
Now the IP changed and you have to sign out and in again.
sudo mc
change to /etc/ssh, edit sshd_config and change
#PermitRootLogin prohibit-password
to
PermitRootLogin yes
restart SSH server
service ssh restart
(or reboot VM for the lazy) and log in as root.
Now you can install Pi-Hole (for Linux this is really magic, only one command and it installs completely)
curl -sSL https://install.pi-hole.net | bash
It takes some time (in my case the install did not complain at all - I know you don't believe it, but it is true). At the end best take a screen-shot of the last message where it presents you the login-password to the GUI!!! - I use Screenshot Captor.
You can change Pi-hole's password from console pihole -a -p
Make sure you switch off the DHCP in your current router before you start using Pi-hole in your new VM and from there it is basic, when you start configuring your Pi-Hole with
your-ip-address/admin
enable DHCP in Pi-hole (Settings), reboot your PC's and you're done.
I get no credits for the software I mentioned but I was so fascinated that it worked and only took me one night that I had to share my experience with you.
Ciao from Germany/Eifel mountains/Nürburgring
I started with IGEL and installed Debian 8.4, later 10.2 but failed (not the fault of Debian but my IGEL does not like it or is too old), then tried ubuntu-18.04.3-server-amd64 which installed well (using Rufus to create the bootable USB-stick).
Then I wondered if this was possible to do use Pi-hole within a VM on my FreeNAS-11.2-U7. I used Google a little bit (now without the annoying adds thanks to Pi-hole on Ubuntu server 18.04 on my IGEL) but did not find any clear answers if and how FreeNAS and Pi-Hole work.
As always someone is asking how to achieve the task, gets some "don't do this and do that" and at the end of the question there is missing if he succeeded or was hit by a stone. I experimented with jails few years ago but had no real use for it (I confess that I use FreeNAS only for using it as "NAS" so far) but today I tried its VM-feature. It is a long time ago that I enjoyed the night (and the bourbon) like today...
In a nutshell, Pi-hole and FreeNAS (VM on Ubuntu) rocks. To make the story short, here are the steps:
1) Create a VM (in my case 1 CPU / 768 MB RAM / 10 GB Disk)
2) Point to installation file ubuntu-18.04.3-server-amd64.iso (this is really cool because FreeNAS GUI just browses to any place in your file structure and so unlike Citrix etc. you do not have to create/mount iso/nfs directory first to be able to boot from the iso. So in a minute or less you're fine to install :)
3) Follow the next steps (confirm all and start the VM).
4) The VNC feature to connect to the VM is a pretty cool part, working well so even my granny could have managed this if she was still alive.
5) Leave everything as suggested except maybe "Install security updates automatically" and install "OpenSSH server" (because I like to conect to my VM's by SSH)
6) After finalizing the installation and rebooting you log in as the user you created during the Ubuntu install. So you need to change the root password with sudo passwd root.
7) Check with ifconfig the IP your VM received from your DHCP-server (I need this for Bitvise SSH Client to log in with the user I created before). Note: you cannot login as root now because you have to enable root ssh first.
8) I had problems to manage the VM via the VNC-interface because my German keyboard would print ß instead of - so I could not use the necessary console commands but that problem can be due the selection of a German keyboard so may not affect everybody.
9) I like things comfortable so I do sudo apt-get install mc to get Midnight Commander (I remember Norton Commander from DOS-times and like it better than pressing 100 keys while MC can do this for me).
10) Use MC (with sudo to get rights) and go into /etc/netplan and edit 01-netcfg.yaml to change from DHCP to your static IP. In my case I changed:
dhcp4: no
dhcp6: no
addresses: [192.168.2.254/24]
gateway4: 192.168.2.1
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
save and enter sudo netplan generate / sudo netplan apply
Now the IP changed and you have to sign out and in again.
sudo mc
change to /etc/ssh, edit sshd_config and change
#PermitRootLogin prohibit-password
to
PermitRootLogin yes
restart SSH server
service ssh restart
(or reboot VM for the lazy) and log in as root.
Now you can install Pi-Hole (for Linux this is really magic, only one command and it installs completely)
curl -sSL https://install.pi-hole.net | bash
It takes some time (in my case the install did not complain at all - I know you don't believe it, but it is true). At the end best take a screen-shot of the last message where it presents you the login-password to the GUI!!! - I use Screenshot Captor.
You can change Pi-hole's password from console pihole -a -p
Make sure you switch off the DHCP in your current router before you start using Pi-hole in your new VM and from there it is basic, when you start configuring your Pi-Hole with
your-ip-address/admin
enable DHCP in Pi-hole (Settings), reboot your PC's and you're done.
I get no credits for the software I mentioned but I was so fascinated that it worked and only took me one night that I had to share my experience with you.
Ciao from Germany/Eifel mountains/Nürburgring
Last edited: