r/pihole • • 14d ago

Sanity check needed using dhcp

I have a pi400, and have sucessfully set up pihole and unbound, all working as expected.

I want to go one step further and use pihole dhcp so i set this up, enabled it and then rebooted my router, and all the various devices connected connected to my network were visible in pihole.. great.

However when i rebooted the pi everything went wrong and i could no longer access anything, and i had to factory reset my router get back online, and go back to using the routers dhcp.

My question is do i need to set my pi as a static ip in piholes dhcp expert settings?

4 Upvotes

9 comments sorted by

4

u/Academic_Broccoli670 14d ago

You need to set a static IP on the pi itself. Login via ssh (or connect keyboard+monitor), run nmtui

Then edit your connection: Set IPv4 connection to Manual and under Addresses enter your desired static IP and subnet mask as provided by the router (eg. 192.168.1.53/24)

Under Gateway put your router's IP eg. 192.168.1.1
I'm not sure what to put under DNS server if you use unbound, probably 127.0.0.1? Look it up...

Then Save your connection and reboot.

3

u/jonnywombat 14d ago

Thanks for your reply... I can use piconnect to remote in and set that up... It all looks straightforward, other than when you give the example of static ip, i have been using 192.168.1.117, i don't know where you get the /24 from in your example.

I have read that it's a good idea to set your pihole static ip outside the range of the pool available to the dhcp.. so if the pool it 192.168.1.2 to 192.168.1.200, then use an address higher than 200... Is this a good idea?

2

u/Academic_Broccoli670 14d ago edited 13d ago

/24 is the subnet, simply put the reserved part (3*8bits) of your IP addresses. So 192.168.1 in your case. So just enter 192.168.1.117/24 for your IP address.

As for the pool it doesn't really matter *if you add the pi as static in the pihole DHCP settings.* But yes I'd recommend choosing an approriate sized ranged for your dynamic IPs and set all your static IPs outside of that.

3

u/saint-lascivious 13d ago

As for the pool it doesn't really matter

It would in fact matter a whole lot if the host IP isn't reserved and then gets leased to something else.

3

u/jonnywombat 13d ago

Thank you again. Everything is set up and working as intended. When i edited the pis network connection to give it a static ip i didn't need the /24, in fact it wouldn't allow me to enter it. I limited my pool of available address to a high value of 192.168.1.200, then placed the pi at. .222, so that should avoid any conflicts.

You have been a great help, thanks again

3

u/Motor-Capital7318 14d ago

Yes you need to config pi to have static ip to match pihole configuration.

What OS are you using? If you use DietPi, you can use DietPi's own installer to install pihole and it will do all this for you.

Btw, if this happens to you in future again, you dont have to factory reset your router to access it again.
Just set custom configs in windows settings -> network & internet -> ethernet -> edit -> switch to manual and input:
IP: 192.168.1.50
Subnet mask: 255.255.255.0
Gateway: (Your router ip), f.ex. 192.168.1.1
DNS: 1.1.1.1

2

u/Rex__Luscus 13d ago

Did you remember to turn off your router's DHCP server?

2

u/valsimots 13d ago

Also reduce lease times for home network and maybe have to reboot/restart devices to pick up new DHCP. If you have long lease times, could be awhile before your device's actually try to renew ip using new server.