Backup Pi-hole's DHCP Server settings?

I set up Pi-hole to use its own DHCP Server (as it's 'tricky' on my router) and set up static IP addresses for most of my devices through it.

So now I'm wondering if it's possible to backup these settings so I don't have to to re-enter the static IP addresses again if I have problems with my Raspberry Pi, set up Pi-hole on a different device etc.

I noticed Pi-hole Teleporter in Pi-hole's settings, but that only backs up the whitelist and blacklists.

Is it possible to backup the DHCP Server settings? (Or maybe just backup Pi-hole's config/settings files) so they're easy to restore later down the line?

1 Like

Just open the zip.
You'll see it includes "04-pihole-static-dhcp.conf".

Thanks, so on the Raspberry Pi Pi-hole will create a zip with this file that contains the settings?

Where about is this stored on the Raspberry Pi?

Teleporter will back up more than just the whitelist and blacklist.

1 Like

No, you get to download the zip to your local PC.
And when need to restore, you upload the zip via Teleporter.

1 Like

Ah, I didn't realise Teleporter would backup those settings too. Thanks!

I'm running Pi-hole in a docker container. In a running system, what's the path to “04-pihole-static-dhcp.conf”? (If DHCP static leases are used in the docker, the conf file will need to be mapped to the host, to make it persistent between container reboots.)

I have two paths that are persistent /etc/pihole and /etc/dnsmasq.d
If DHCP static leases are used, will the above config file (04-pihole-static-dhcp.conf) appear in one of these two locations? If not, where would it be?

Thanks

Your right, the file in the zip is a direct copy of the file in the "/etc/dnsmasq.d" folder:

pi@noads:~ $ sudo find / -name 04-pihole-static-dhcp.conf
/etc/dnsmasq.d/04-pihole-static-dhcp.conf

Ps. dnsmasq does the DHCP bit on port 67 as can be seen from below:

pi@noads:~ $ sudo netstat -nltup
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
udp        0      0 0.0.0.0:67              0.0.0.0:*                           22181/dnsmasq

Was thinking, I have no experience with Docker but if you need to tell Docker which folders need to keep persistent data, shouldn't the log files used by the Pi-hole web dashboard be included as well ?

pi@noads:~ $ ll /var/log/
drwxr-x---  2 www-data www-data    4096 Nov 19 06:25 lighttpd
-rw-r--r--  1 root     pihole     32360 May 11  2017 pihole_debug.log
-rw-r--r--  1 pihole   pihole    415801 Nov 24 00:00 pihole-FTL.log
-rw-r--r--  1 dnsmasq  root       50665 Nov 24 01:25 pihole.log

I can certainly do that, and it should be done. I hadn't noticed the loss of logs because my server is up 24x7.

Do I have the above right? The absolute path is:
11 /var/logs ?

That's 11(space)/var/log ?

Thanks
(And, man, you'z guys are quick!)

Hehehe, the "ll" command is an alias for "ls -al --color=auto" :

pi@noads:~ $ alias
alias ll='ls -al --color=auto'
alias ls='ls --color=auto'

The path to the log files is "/var/log/".

See!! That was NOOB question! :laughing:

Thanks for the clarification....

NOOB's,, well,, you know how we are.. :crazy_face:

Yeah that's why they promoted me to superN00B :wink:
Raspbian didnt used to add those aliases default but now they do it seems:

pi@noads:~ $ sudo grep "ls --color=auto" -R /etc
/etc/skel/.bashrc:    alias ls='ls --color=auto'

One last item: (I didn't find this is looking through FAQ's or search on the Pi-hole discourse site.)

As we know, static addressing is what it is and that bypasses all.

But, may I take it that if Pi-Hole is the DHCP server, that it will also act as the default DNS proxy for the DHCP clients it gives leases to?

(Sorry, don't mean to monopolize your time.)

Its not really static addressing but rather just a reservation for when a particular MAC address comes knocking at the door.

It doent proxy but does forwarding and caching for DNS lookups.
Pi-hole (dnsmasq) forwards client DNS lookups to upstream DNS servers if it doesnt have the particular DNS record cached already.

When I said static addressing, I meant at the client. If a DNS entry is set, that's it.

Anyway, as I have PI-Hole configured, it first parses name requests against it's lists, then forwards them upstream to 8.8.8.8. Locally, my router is set to bounce name requests to Pi-hole. This is given.

On the other hand, with DHCP settings;
If Pi-hole answers a DHCP request, an IP address is handed out. (In addition to that.) What I'm asking is, if the DNS entry on the DHCP client is set to "Auto", does Pi hole set the DNS address (as it's own) as part of the DHCP process, or is the "Auto" DNS address set later by the gateway/router?

I know this is exhaustive, but I'm looking at an odd use case.

P-hole's dnsmasq will give the clients an IP address, subnet mask, gateway and DNS servers through the DHCP process.
DHCP can hand out man more types of options like for example NTP for time server or "workgroup" for windows.
Have a look here for what options DHCP can push to the clients:

Ps, had to lookup exact definition of proxy again as I was mistaken.
Yes it is a caching DNS proxy.

After reviewing all of that I think the answer is "Yes"! (Pi-Hole assigns it's own address as the DNS server, in DHCP requests.)

But I can and should test it. It's going to be interesting to dig into this further, in VM's.

Thanks for humoring me. :+1:

Partly true.
If configure dnsmasq, you can push any IP address for DNS resolution to the clients using the DHCP options from the wiki.
It doesnt need to be Pi-hole's own one (but you break Pi-hole if you do).

Glad to humor you with my n00bish findings :wink:

Oh the humor thing, it's surprising to see a forum that's so responsive (to NOOB questions :blush:).
On the NOOB thing, we may be in competition.


Even after pecking around the periphery of Linux for awhile, the guru's still never cease to amaze. As it seems, one or two I know could gin up a single command line (with switches, arguments, etc.) that could output a hot stock pick.

While it wasn't my field (just a very closely related aspect) I wasted a lot of time in the Windows graphical environment. Unfortunately, M$ can, and did, alter the environment and how things were done, on several occasions. (As a result, expertise / experience gained was, for the most part, a throw away.)

The command line is where it's at. While more capabilities are added regularly, in the basic's, CLI commands rarely, if ever, change.