Guide: How to install Pi-Hole on Gold/Purple/Orange (Beta)

Follow

Comments

118 comments

  • Avatar
    Greg

    Is there any way to build this into the the FWG.  I'm not a complete novice but I'm very intimidated to try this on my own, now that I have my network and FWG all setup and working perfectly.  

    0
    Comment actions Permalink
  • Avatar
    Rob Dennison

    The OP script doesn't appear to work for me.

    After entering:

    sudo ip route add 172.16.0.0/24 dev br-$(sudo docker network inspect pi-hole_default |jq -r '.[0].Id[0:12]') table lan_routable

    I get the following error:

    Error: No such network: pi-hole_default
    Cannot find device "br-null"

    Now it seems to me (and I admit, Docker is relatively new to me) that the YAML file at no point specifies a pi-hole_default network, in fact the script only uses the word "pihole", never "pi-hole", so I'm not sure how a pi-hole_default network would have been created.

    Is there something I'm missing here? I can see that this tutorial has been up for a while and people are obviously having success... what am I missing?

     

    0
    Comment actions Permalink
  • Avatar
    Larry Lindenbaum

    Doh!  You are correct -- I name the directory the same as my services container, it takes it from the directory it finds the yaml in (here created as pi-hole) 

    Your Gold is running the 1.971 software?  I think before the 1.971 you needed to use a different network, 172.0.0.0/24 not 172.16.0.0/24

    Also just double checking there were no errors on the docker-compose pull or up commands?

     

     

    0
    Comment actions Permalink
  • Avatar
    Rob Dennison

    Yes - running 1.971 software. There were no errors on docker-compose pull or up commands: 

    0
    Comment actions Permalink
  • Avatar
    Rob Dennison

    But wait - as I'm going back through the commands, I see that I put the YAML file in the docker folder, not docker/pi-hole, which is very likely my problem. Let me try this again...

    0
    Comment actions Permalink
  • Avatar
    Larry Lindenbaum

    That'll do it!  

    0
    Comment actions Permalink
  • Avatar
    Rob Dennison

    After moving the YAML file into docker/pi-hole, the "up" won't work because "pool overlaps with other one on this address space"

    I removed the old route ("sudo ip route del 172.16.0.0/24"), so the only route left that's close is 172.17.0.0/16. There is also a default route through my WAN IP, but I don't think I should touch that ;)

    The rest are VPN, upstream DNS and LAN.

    sudo docker ps -a

    shows no containers (running or not), but 

    sudo docker network ls

    shows the following networks

    NETWORK ID NAME DRIVER SCOPE
    b2070f2cd3f5 bridge bridge local
    eb90dc2fedb3 docker_default bridge local
    079641ced105 host host local
    8208d92558af none null local

    That docker_default looks suspect because I learned earlier in this thread that the network created is based on the folder the YAML file is in, so this could have been created when I UPed the container from run/docker. The network name "docker_default" is scary, but when I inspect it:

    sudo docker network inspect eb90dc2fedb3
    [
    {
    "Name": "docker_default",
    "Id": "eb90dc2fedb3edbd364818f895ecb9ff917522fd023b4dabaa69c91e9634baeb",
    "Created": "2021-01-03T17:43:32.309277911Z",
    "Scope": "local",
    "Driver": "bridge",
    "EnableIPv6": false,
    "IPAM": {
    "Driver": "default",
    "Options": null,
    "Config": [
    {
    "Subnet": "172.16.0.0/24",
    "Gateway": "172.16.0.1"
    }
    ]
    },
    "Internal": false,
    "Attachable": true,
    "Ingress": false,
    "ConfigFrom": {
    "Network": ""
    },
    "ConfigOnly": false,
    "Containers": {},
    "Options": {},
    "Labels": {
    "com.docker.compose.network": "default",
    "com.docker.compose.project": "docker",
    "com.docker.compose.version": "1.25.4"
    }
    }
    ]

    This looks like the culprit. Before I go all "sudo docker network rm eb90dc2fedb3" on this, is there something I'm missing?

    I don't want to irreparably break things here so I have to reflash the Gold and rebuild the network config, rules, groups, etc.

    0
    Comment actions Permalink
  • Avatar
    Rob Dennison

    Nope - DNS now broken... I think maybe I shouldn't have deleted that route ><

    0
    Comment actions Permalink
  • Avatar
    Larry Lindenbaum

    The beautiful thing about the Firewalla is that rebooting it will restore things to a good state and you can run the docker-compose commands again 8)

    Though honestly removing that route and then finishing the setup should have worked though you might have needed to do a "sudo docker system prune -a -f" in case you had an untagged image that was still using the network (or trying to).  That command should also remove all stopped networks anyway, so that's probably a better option than deleting the network directly.

    0
    Comment actions Permalink
  • Avatar
    Eric Hawley

    How do we port forward (and firewall restrict to a certain external network range) to the docker container?  

    (want to make containerized Pihole DNS on FWG available externally to a specific network)

     

    0
    Comment actions Permalink
  • Avatar
    Larry Lindenbaum

    It's actually fairly simple, and this guide here descibes it pretty well:

    https://docs.docker.com/config/containers/container-networking/

    as does this one:

    https://runnable.com/docker/binding-docker-ports

    You can also use the "ports: HOST:CONTAINER" tags in the YAML config file to specify which ports you want exposed for a given container (since I think those other references talk more to exposing ports in an already running container).  

    The routing to/from the network itself would be configured in the Firewalla Gold app by creating your network segments and then rules to pass (or block) traffic between them.

     

    0
    Comment actions Permalink
  • Avatar
    Pimbox


    I've tried everything but I can't even ping the ip I selected for the pi-hole, I believe the docker has another ip and I don't know how to change it ... my network uses the 192.168.25.0/24 range

    if someone can help me, I will be more thanked!

    0
    Comment actions Permalink
  • Avatar
    Pimbox

    I follow exactly all steps, in the end the ip 172.16.0.2 ping normal, but when i try enter in pi-hole web site interface it show: the page canot be found. Some tip?

     

    ------------------------------------------------------------------------------------

    -----------------------------------------------------------------------------

     My Network is:

    Firewalla Gold eth0: My modem (bridged) connection (stactic ip).

    Firewalla gold eth1 (br1): Vlan in 192.168.25.9 ip (all my devices is in this network)

    Firewalla eth2 (br1): My Server with stactic network ip (192.168.25.222)

    Firewalla eth3 (br0): This port i need change the vlan because i link it in my wireless router wan port and it have a 192.168.25.0/24 in 4 lan ports and wi-fi ips too so WAN port need another range ip (192.168.24.9 in firewalla port)

    I try change the docker ip but its back to 172.17.0.1 when i restart the Firewalla Gold.

    I need fix it to run 2 (very light) dockers: 1 pi-hole and 1 TeamSpeak Server.

    I will be very grateful if anyone can help me, i tried to install the pi-hol keeping the default ipof the tutorial and it also didn´t work. ping the ip (172.16.0.2) but does not enter the page through the browser.

    Here is the picture of my Firewalla Gold config:

     

    0
    Comment actions Permalink
  • Avatar
    Rob Abbott

    Thanks for the tip, this is really great info.  I would like to keep pi-hole on the firewalla, so I changed the database retention to 90 days. And I'll keep an eye on disk usage.   My FTL db was already at 508MB, it's been running a little under 90 days.

    Add "MAXDBDAYS=90" in /data/pi-hole/etc-pihole/pihole-FTL.conf and restart the container.

    The FTL db lives in the above directory so you can have a look there if you want to see how much storage it's consuming.

     

    0
    Comment actions Permalink
  • Avatar
    Firewalla

    Totally agree with @Joel, if you do plan to use a lot of storage, please leave the service off Firewalla. (or you can get a USB storage and use that instead) We get too many of these cases in our support, and it is wasting us a lot of time (which we can use for other things) supporting and debug disk full errors.

    0
    Comment actions Permalink
  • Avatar
    Blake

    Wow.  Mine is about 729 MB.  So do I trim this thing down?

     

    0
    Comment actions Permalink
  • Avatar
    Brian Newbold

    I updated pihole-FTL.conf to:
    DBINTERVAL=60
    MAXDBDAYS=30

    It will only write to the DB every 60 minutes in order to save the SD card.

    0
    Comment actions Permalink
  • Avatar
    Brian Newbold

    On Blue+ I'm deploying via portainer now, and have this YAML set up in Stacks. Working quite well and much easier to manage than going to SSH every 5 seconds.

    ---BEGIN YAML 4 PORTAINER STACK---

    version: '2'

    # More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
    services:
    pihole:
    container_name: pihole
    image: pihole/pihole:latest
    environment:
    - TZ=Los_Angeles/America
    - DNS1=192.168.86.1
    - DNS2=no
    # set a secure password here or the default will be firewalla
    - WEBPASSWORD=yopasswordherebruddah
    # Volumes store your data between container upgrades
    volumes:
    - '/data/pi-hole/etc-pihole/:/etc/pihole/'
    - './etc-dnsmasq.d/:/etc/dnsmasq.d/'
    - '/etc/localtime:/etc/localtime:ro'
    restart: unless-stopped
    network_mode: host
    dns:
    - 127.0.0.1
    - 192.168.86.1
    ports:
    - "53:53"
    - "443:443"
    - "80:80"

    0
    Comment actions Permalink
  • Avatar
    K Kaji

    @Firewalla,

    Totally agree with @Joel, if you do plan to use a lot of storage, please leave the service off Firewalla. (or you can get a USB storage and use that instead)

    I highly recommend you to add a note of this advice at the top of this article :)

    Anyway, I want to thank you for your efforts to develop such a great device, Firewalla Gold!

    0
    Comment actions Permalink
  • Avatar
    Rob Dennison

    I've had the network go down a couple of times now with no explanation, and the only solution is to reboot the Firewalla Gold and have all the devices in the network reacquire IP addresses. Further reflection (and reading this thread) tells me that it's likely the pi-hole container that's blowing up the Firewalla storage, and rebooting clears out that history.

    To me, this means it's really not viable for my network. Is there any way the OP can update the original post (OP?) to account for a change to the pihole-FTL.conf to cap the storage?

    Either that, or maybe the better solution is to run pi-hole on a RPi on a new subnet (discussed here: https://help.firewalla.com/hc/en-us/articles/360062551673-How-to-run-external-pi-hole-on-the-Firewalla-Gold , but there are different issues there), which could maybe use a tutorial?

    Honestly, I'd poke around on it myself, but the amount of time the network would be down while I messed things up and corrected isn't feasible with 2 people WFH and 2 kids SFH here. Smarter people than me probably know how to set this up without having to experiment much.

    Thoughts?

    0
    Comment actions Permalink
  • Avatar
    Ma Ar

    It appears to me that there is some kind of exploit in cloudflared container. I have my setup regularly breached and the logs are pointing to a large amount of activity in dockerd.

    0
    Comment actions Permalink
  • Avatar
    Chris Hewitt

    @Ma At

    Not sure what you mean. Can you explain what you mean that your “set-up [is] regularly breached?” What “exploit” do you think you are seeing?

    What “Cloudflared container”? Are you using Cloudflare DNS over HTTPS in your Pi-Hole docker?

    Can you share the logs?

    0
    Comment actions Permalink
  • Avatar
    Alex M

    Is there a way to set maxdbdays and dbinterval with this approach?

    In a 'non-docker' setup, this would be set in pihole-ftl.conf...

    Thanks in advance!

     

    0
    Comment actions Permalink
  • Avatar
    Andy brown

    The pihole-FTL.conf is located

    /.firewalla/run/docker/pi-hole/etc-pihole

     

    0
    Comment actions Permalink
  • Avatar
    Alex M

    Thanks Andy!
    I was looking and I don't have that directory, in .... /pi-hole/ I only have docker-compose.yaml and etc-dnsmasq.d, which has 01-pihole.conf  and  06-rfc6761.conf...

    No etc-pihole to be seen...

    0
    Comment actions Permalink
  • Avatar
    Andy brown

    should be in yaml file:

    Volumes store your data between container upgrades
        volumes:
          - '/data/pi-hole/etc-pihole/:/etc/pihole/'
          - './etc-dnsmasq.d/:/etc/dnsmasq.d/'
          - '/etc/localtime:/etc/localtime:ro'

     

    0
    Comment actions Permalink
  • Avatar
    Alex M

    Found it!

    It was indeed in the yaml file, and based on that I found that the conf file is in /data/pi-hole/etc-pihole.

    Cheers!

    0
    Comment actions Permalink
  • Avatar
    Alex M

    Btw, anyone tried this docker image that includes pihole and unbound yet?

    https://github.com/chriscrowe/docker-pihole-unbound/tree/master/one-container


    I'm considering giving it a go...

    0
    Comment actions Permalink
  • Avatar
    Andy brown

    https://help.firewalla.com/hc/en-us/community/posts/1500001172701-Pihole-and-Unbound

    Have a look at this before you try.

    Firewalla are looking into it, but I failed to get it work

    0
    Comment actions Permalink
  • Avatar
    Alex M

    In terms of updating, am I doing anything wrong by reapplying the above procedure (I have the yaml file pointing to :latest) and then running

    sudo docker image prune -a

    afterwards to remove old docker images?

    0
    Comment actions Permalink

Please sign in to leave a comment.