Installing and configuring network wide adblock with Pi-hole and the Turris Omnia.

My new Turris Omnia arrived on Saturday morning, and it took me almost a full day to get Pi-hole setup and configured, so I thought I’d save someone else the time.

It is pretty straightforward, but there are a few ‘gotchas’ along the way.

  1. Setup your Turris Omnia, and connect to it’s network. You should be able to load the LuCI interface, and access the internet.
  2. Inside LuCI go to Services -> LXC Containers. Create a new container called ‘pi-hole’ and select Ubuntu Xenial. Edit the container, and add the following as a new line: lxc.start.auto = 1
  3. Make sure to start the container.
  4. SSH into your Omnia. $ ssh root@192.168.1.1 should be all you need. Use the password you set when you first set your router up.
  5. Now go into your new LXC container $ lxc-attach -n pi-hole
  6. Install Pi-hole
    1. I had some trouble using the ‘curl’ command they provide on the website. I had to copy/paste the script contents into install.sh, $ chmod +x install.sh, then execute it with $ ./install.sh
    2. Make note of the IP that is displayed.
    3. You may need to symlink pihole to the /usr/bin. $ cd /usr/bin; ln -s ../local/bin/pihole pihole
    4. You may also need to manually update pihole’s block lists with: $ pihole -g
  7. Test Pi-hole
    1. You should be able to set the DNS of your machine to point to the IP of your pi-hole instance, then load a site with a bunch of ads, and navigate to http://*YOUR_PIHOLE_IP*/admin/queries.php to see the queries that were blocked. If things look good, remove the DNS mapping on your machine, load the site with ads again, and you should see the ads this time.
  8. Configure Turris Omnia
    1. Now it’s time to tell the router to apply the DNS at it’s level rather than the machine level so you don’t have to edit the DNS settings of every device you connect.
    2. In LuCI under System -> Startup, ‘Disable’ and ‘Stop’ both the ‘resolver’ and ‘kresd’ initscripts. ‘Enable’ the ‘lxc-auto’ script.
    3. Under Network -> Interfaces, click ‘Edit’ on WAN, then ‘Advanced Settings’. Uncheck ‘
    4. SSH into your Omnia again and inside /etc/config/dhcp change option port ‘0’ to option port ’53’.
    5. Edit /etc/config/lxc-auto to match this:
      1. config container
        option name pi-hole
        option timeout 60
    6. Copy this file https://raw.githubusercontent.com/NickBusey/pihole-led/master/pihole-led.sh to /root/pihole-led.sh
    7. crontab -e, add a new line: @reboot /root/pihole-led.sh
    8. Reboot your Turris Omnia.

Congratulations! If everything went well, you should now be automatically blocking ads for any device that is connected to your Turris Omnia router, and the User 1 LED should be flashing purple with each blocked ad.

Leave a Reply

Your email address will not be published. Required fields are marked *