1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Linux PiHole setup advice

Discussion in 'Software' started by Sentinel-R1, 8 Feb 2021.

  1. Gareth Halfacree

    Gareth Halfacree WIIGII! Staff Administrator Super Moderator Moderator

    Joined:
    4 Dec 2007
    Posts:
    14,627
    Likes Received:
    3,459
    It sounds like you've set your router up as the primary (and only) DNS server on the network, and configured the router's upstream DNS server as the Pi-Hole. Which will work fine, but as you've noted you'll only see traffic from the router ('cos all your clients are asking the router, then the router's asking the Pi-Hole.)

    A better way is to configure the router to give out the Pi-Hole's IP address as the DNS server, rather than its own. If you can configure that on the router, there's no need to move your DHCP service away from it; if you can't, you'll have to shift your DHCP service. Personally, I have my own DHCP servers outwith the router - but they're not running in Pi-Hole, they're a pooled pair of ISC DHCP.
     
  2. Sentinel-R1

    Sentinel-R1 Chaircrew

    Joined:
    13 Oct 2010
    Posts:
    2,165
    Likes Received:
    272
    Could you please explain, in what way is it better to have the Pi-Hole as the DNS server, other than you could then see per-IP blocks? The way I'm running it now, I can't see that but it's blocking ads on all devices, so what's the benefit of configuring the DHCP to Pi-Hole?

    I don't really want to offload my DHCP away from my Unifi ecosystem, unless there's a compelling reason or significant benefit.
     
  3. Gareth Halfacree

    Gareth Halfacree WIIGII! Staff Administrator Super Moderator Moderator

    Joined:
    4 Dec 2007
    Posts:
    14,627
    Likes Received:
    3,459
    You mean DHCP; Pi-Hole is already the DNS server, or it can't block anything.
    Aside from the ability to track per-device - handy if one device suddenly starts querying a bunch of suspicious-looking Russian servers - there's no real advantage if your existing DHCP server allows you to specify the Pi-Hole, and not your default gateway, as the DNS server.

    Like I say, I don't use Pi-Hole for DHCP myself - but I don't use my router, either.
     
    Sentinel-R1 likes this.
  4. Sentinel-R1

    Sentinel-R1 Chaircrew

    Joined:
    13 Oct 2010
    Posts:
    2,165
    Likes Received:
    272
    I did mean DHCP in the initial quote, my bad.

    OK, thanks for the explanation. I’ll leave my USG handling DHCP in that case. I’m not concerned about viewing per device stats on the pihole, as long as no devices are getting through to any network connected devices.
     
  5. Cookie Monster

    Cookie Monster Multimodder

    Joined:
    27 Aug 2003
    Posts:
    4,149
    Likes Received:
    346
    For the record, I am not a network person

    Yes, I've set the pi-hole's IP as a static DNS in the router.

    This is the only reason behind my want to do it, not sure of its the right thing to do, but I'm a relative pi-hole virgin.
     
    Sentinel-R1 likes this.
  6. Gareth Halfacree

    Gareth Halfacree WIIGII! Staff Administrator Super Moderator Moderator

    Joined:
    4 Dec 2007
    Posts:
    14,627
    Likes Received:
    3,459
    Which isn't the same as setting the router to give out the Pi-Hole as a DNS server.

    What you've got it configured as at the moment, it sounds, is the usual: the router is the DNS server. If you look at your network properties on your desktop/laptop/whatever, you'll see:

    IP: 192.168.0.10
    Subnet: 255.255.255.0
    Gateway: 192.168.0.254
    DNS: 192.168.0.254

    Where "192.168.0.254" is your router.

    What you've done is tell the router to ask the Pi-Hole to resolve domain names, but all the clients are still asking the router. It's not a problem, except as I say you won't get per-device stats - and, technically, things'll be marginally slower because resolution is two hops instead of one.

    If you set it up properly, whether that's by changing the DHCP configuration on the router or by moving DHCP to the Pi-Hole, it'll look like this:

    IP: 192.168.0.10
    Subnet: 255.255.255.0
    Gateway: 192.168.0.254
    DNS: 192.168.0.100

    Where "192.168.0.100" is your Pi-Hole.
     
  7. Cookie Monster

    Cookie Monster Multimodder

    Joined:
    27 Aug 2003
    Posts:
    4,149
    Likes Received:
    346
    @Gareth Halfacree I get you, I'll go look into that while I'm messing about. Thank you.
     

Share This Page