cancel
Showing results for 
Search instead for 
Did you mean: 

Pi-Hole Query

FIXED
Raxiel
Dabbler
Posts: 13
Thanks: 2
Registered: ‎15-01-2024

Re: Pi-Hole Query

I'm currently in the process of trying to set up my own pi-hole on a Pi Zero 2w. Bit of a pain to get it going because the case the vendor recommended doesn't let the mini HDMI cable they sell seat enough to work, so I had to take it back out until it was on Wi-Fi with SSH turned on. 

 

Anyway, now I'm struggling with assigning the fixed IP. I wanted to give it 192.168.1.32, and I found the relevant bit of the Hub's web interface, but no matter how many times I change either the 'Always use this IP address:' slider or type in my preferred address, it doesn't stick. As soon as I exit to 'my devices' and find the pi in the list again, it's back to "Always use this IP address: No"

I've tried saving after each step, I've tried rebooting the router and/or the pi, I've tried changing the router config while the Pi is disconnected. I'd even accept the random IP the Hub gave it via DHCP the first time, but while that's been consistent (at least until the lease ends), it still says it's not fixed every time I re-enter.

Any Idea where I'm going wrong?

Baldrick1
Moderator
Moderator
Posts: 11,737
Thanks: 5,214
Fixes: 420
Registered: ‎30-06-2016

Re: Pi-Hole Query

@Raxiel 

There’s two ways of doing this.

1. You set a fixed IP address in the pi, not the router. If you set it to 192.168.1.32 then the hub will connect to this address automatically. You do not reserve the address in the hub.

2. If instead you use the default settings when installing the operating system then the router will assign an IP address. You can  reserve so effectively fix this address by using the always use this IP address field in the router settings.

I used the second option. Having done this, to always use pi-hole filtering you enter this as both the primary and secondary DNS addresses in the hub settings.

Moderator and Customer
If this helped - select the Thumb
If it fixed it,  help others - select 'This Fixed My Problem'

Raxiel
Dabbler
Posts: 13
Thanks: 2
Registered: ‎15-01-2024

Re: Pi-Hole Query

Thanks, so can option1 only be done during installation, or can I set it afterwards?

 

I've tried doing option 2, but my issue is that the "always use this IP address" toggle always seems to reset to off as soon as I leave that screen. It might actually be fixed on the DHCP address, and the UI resetting to 'no' is just a visual bug, but other than 'wait and see' there doesn't appear to be any way to confirm

Baldrick1
Moderator
Moderator
Posts: 11,737
Thanks: 5,214
Fixes: 420
Registered: ‎30-06-2016

Re: Pi-Hole Query

@Raxiel 

Are you aware that you need to log in to the hub and reserve the address  on the Advanced  Settings / My Network page? It sounds like you are on the Home / My Devices page.

Moderator and Customer
If this helped - select the Thumb
If it fixed it,  help others - select 'This Fixed My Problem'

Dan_the_Van
Aspiring Hero
Posts: 2,602
Thanks: 1,195
Fixes: 75
Registered: ‎25-06-2007

Re: Pi-Hole Query

@Raxiel 

The Hub two can be a bit difficult proving a fixed IP, If you prefer a static IP Address, let it boot up and receive a IP from the Hub.

Then make the following changes to /etc/dhcpcd.conf

sudo nano /etc/dhcpcd.conf

Add the following to the end of the file, (this assumes the Hub's IP Address is the default 192.168.1.254).

interface wlan0
static ip_address=192.168.1.32/24
static routers=192.168.1.254
static domain_name_servers=192.168.1.254 

 

Save the file using CTRL + X and reboot. 

 

HTH

 

Raxiel
Dabbler
Posts: 13
Thanks: 2
Registered: ‎15-01-2024

Re: Pi-Hole Query

@Baldrick1 

Yes, I'm on the advanced settings. This is what I'm looking at

If I flip the 'always use this' toggle and save (and get the green confirmation), then leave the page and return, it just reverts to this.

 

@Dan_the_Van Thanks, I'll try that.

TheRoadCrew
Aspiring Pro
Posts: 146
Thanks: 50
Fixes: 10
Registered: ‎14-05-2017

Re: Pi-Hole Query


@Dan_the_Van wrote:

@Raxiel 

The Hub two can be a bit difficult proving a fixed IP, If you prefer a static IP Address, let it boot up and receive a IP from the Hub.

Then make the following changes to /etc/dhcpcd.conf


I thinnk that's only applicable to Debian 11 based Raspberry Pi OS; for a Debian 12 base I believe networking is handled by NetworkManger by default so static IP would be set using nmcli or nmtui (/etc/dhcpcd won't exist).

 

Dan_the_Van
Aspiring Hero
Posts: 2,602
Thanks: 1,195
Fixes: 75
Registered: ‎25-06-2007

Re: Pi-Hole Query

Yes, but

 

pi@pi-hole:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

EDIT: The raspberry pi imager uses this version for the Pi Zero 2W

 

Baldrick1
Moderator
Moderator
Posts: 11,737
Thanks: 5,214
Fixes: 420
Registered: ‎30-06-2016

Re: Pi-Hole Query

@Raxiel 

Well I never!

I've just looked at mine and it looks exactly the same!

Mine obviously is working even though claiming 'not connected'. Can you log into yours on 192.168.1.236/admin? The query log will show if it's whirring away doing its thing.

It's obviously a 'feature' that I had not noticed.

Moderator and Customer
If this helped - select the Thumb
If it fixed it,  help others - select 'This Fixed My Problem'

Raxiel
Dabbler
Posts: 13
Thanks: 2
Registered: ‎15-01-2024

Re: Pi-Hole Query

@Dan_the_Van 

I made the change to dhcpdcd.conf (the file was otherwise blank) but after restart it's still stubbornly sticking to 192.168.1.236.

 

I started out with the Pi OS that came pre-installed on the Micro SD I bought with the Pi, which auto-updated the first time it got online.

the hostnamectl output is
 Static hostname: raspberrypi
       Icon name: computer
      Machine ID: 0781a73b1bfe48f7bc655759366265c5
         Boot ID: 517e08e3c5aa4a9b81b59102777bb50a
Operating System: Raspbian GNU/Linux 12 (bookworm)
          Kernel: Linux 6.6.20+rpt-rpi-v7
    Architecture: arm

Does that mean I need a different approach, or do I need to wipe and re-image it with a different version?

@Baldrick1 Yes, I can ssh into the Pi on 192.168.1.236

TheRoadCrew
Aspiring Pro
Posts: 146
Thanks: 50
Fixes: 10
Registered: ‎14-05-2017

Re: Pi-Hole Query

@Raxiel hopefully reading this will help

Dan_the_Van
Aspiring Hero
Posts: 2,602
Thanks: 1,195
Fixes: 75
Registered: ‎25-06-2007

Re: Pi-Hole Query

@Raxiel 

 

nmcli device status
DEVICE  TYPE      STATE                   CONNECTION
eth0    ethernet  connected               Ethernet connection 1
lo      loopback  connected (externally)  lo
wlan0   wifi      unavailable             --

 

Depending on the hardware platform may need  to change the syntax to

sudo nmtui edit "Ethernet connection 1"

 HTH

Raxiel
Dabbler
Posts: 13
Thanks: 2
Registered: ‎15-01-2024

Re: Pi-Hole Query

Thanks both, I also found this myself, but the UI makes it a bit easier to follow what's happening.

https://i.imgur.com/04e0ZSe.png

 

The "gateway" entry is blank, should that be the router's address?

The Pi no longer appears as a device on the network on the router (on the basic or advanced list) but I can ssh into it and access the pi-hole web interface from the browser. I'm not sure the Pi itself can see the outside world though, I tried updating gravity and they all came back refused?

Raxiel
Dabbler
Posts: 13
Thanks: 2
Registered: ‎15-01-2024

Re: Pi-Hole Query

Yes, I definitely broke it, entering the gateway (192.168.1.254) didn't help, setting it back to automatic did, but that also put me back on the original dhcp address.

 

As may be apparent, this is all uncharted waters for me.

 

Edit: But... I just discovered that the Pi is still also reachable on the fixed address i gave it. so... I guess it doesn't matter? I can just use the fixed address as the DNS and ignore the DHCP one?

 

Now I just need to figure out why it's not actually blocking anything...

Baldrick1
Moderator
Moderator
Posts: 11,737
Thanks: 5,214
Fixes: 420
Registered: ‎30-06-2016

Re: Pi-Hole Query

@Raxiel 

Have you cleared your browser cache?

Moderator and Customer
If this helped - select the Thumb
If it fixed it,  help others - select 'This Fixed My Problem'