Ability to operate pihole on devices without static IP assignments

I use my router to assign reserved IP addresses to machines based upon their MAC address. It’s a simple and centralized solution. Can you add an option to the install so that it will let you choose whether to assign a static IP address or let you continue to use DHCP?

The pihole setup does not take over your current DHCP setup (unless you start using the pi-hole as a dhcp server after install - totally optional).

It's asking you for the static IP assigned to your device running pihole (for internal settings and perhaps if needed, hdcp server).

If your DHCP server has an established list that it's assigning IPs to based on MAC address, your IP that's being assigned to the device running the pi-hole will never change so it's safe to use whatever the IP is displayed there during the setup process.

What file(s) contain the ip addresses, masks, dns servers, etc. that you enter during the setup process?

Configuration files are under /etc/dnsmasq.d

if you are not using your pi-hole as a DHCP server, you should have only this:

01-pihole.conf

If one uses the pi-hole as DHCP server also then you'd have:

01-pihole.conf
02-pihole-dhcp.conf
03-pihole-wildcard.conf
04-pihole-static-dhcp.conf

The IP address configuration is located at /etc/dhcpcd.conf, I agree that setting the static IP address is not the best solution, it's a setting that is left over from when we were primarily on Raspberry Pi devices and we suggested the setup to be on a fresh Raspbian image. If you have the Pi-hole device set to be received via DHCP reservation, then remove the lines from /etc/dhcpcd.conf and they will not be reset.

There is no file of that name.

I don’t see that directory (or file)

What platform/OS did you install it on ?

odroid c1
14.04.05 LTS

Can you run pihole -d and get us the debug token? This doesn't sound like a standard install if you're missing the configuration directory for dnsmasq and the dhcpcd.conf file for static IP addressing. That file is the only place that we would be able to set a static IP and if that file is missing, then we have not changed your networking in any way.

Ah, I was talking about generic network settings. I hadn’t installed pihole yet. Now that I did I see dhcpcd.conf.

So if I want to let my router assign an ip address, I just remove (comment) the following out?

nohook lookup-hostname
interface eth0
static ip_address=172.16.43.75/24
static routers=172.16.43.1
static domain_name_servers=127.0.0.1

And if I point my router’s DNS settings to point to the PiHole address it will use the values in setupVars.conf? What about the following (I’m not using IP6)?

IPV4_ADDRESS=172.16.43.75/24
IPV6_ADDRESS=

Those are the lines to remove to stop DHCPCD from setting the IP address as static.

The setupVars.conf IPV4_ADDRESS line is the IP address that clients will be directed to instead of the blocked IP address. That's where they will be displayed the block page, if that is applicable.

May I suggest to not do so ?

I am also using my routers DHCP with IP reservations based on the MAC address but for critical parts of your network such as a accesspoints, switches, another router, the Pi-Hole server it's really good practice to use both IP reservations and also a Static IP address!

Just in case one fails the other one takes over :wink:

1 Like