I have set up a Raspberry Pi with pi.hole and everything seems to be running absolutely fine. Now, I have configured the Raspbi as a wireless access point. So, the Raspbi is connected via ethernet to a Fritz!Box which is the DHCP server for the corresponding subnet. With the new configuration you can now additionally connect to the Raspbi via wifi (on the new subnet).
The target is now to set up Pi-ole as a DHCP server for connections via the wlan0 subnet while keeping the Fritz!Box as the DHCP server for the original (separated) network.
Could you kindly give advice on how to achieve this?
(In Raspbi as a wireless access point there is a description on how to use dnsmasq to work as "the DHCP and DNS services for the wireless network". As far as I know Pi-hole is supposed to take over this task instead.)
The instructions you've linked and followed already contain most of the information on a working dnsmasq configuration for your aspired AP.
For coexistence with Pi-hole, make sure you do not install dnsmasq next to Pi-hole on the same machine. As jfb has mentioned, pihole-FTL can be configured in the same way as dnsmasq can, but you'd have to figure yourself what configuration would best work for you.
A few hints should help you proceed in the right direction:
Do not create a dnsmasq configuration file as detailed by your instructions.
Specifically, don't touch any of Pi-hole's own files.
Instead, make sure that your configuration goes into an extra file (e.g. /etc/dnsmasq.d/42-access-point.conf).
When defining your options, verify they do not conflict with any of Pi-hole's own options.
For enabling DHCP only on one interface, you should take a look at the following option
no-dhcp-interface=<interface name>
Do not provide DHCP or TFTP on the specified interface, but do provide DNS service.
thank you so much for your support. I already tried it similarily but failed finally due to the wrong access rights of the file /var/lib/misc/dnsmasq.leases. After changing them temporarily as follows (allow write rights for all) it works:
-rw-rw-rw- 1 root root 66 Sep 29 15:39 /var/lib/misc/dnsmasq.leases
Still, I wonder what the right owner and the correct access rights should be (and why they were wrong. Before that, only root had write access. Maybe the rights were wrong since I accidentally installed dnsmasq at first.)
This would indicate that you're still running dnsmasq next to pihole. Think of pihole as a wrapper for dnsmasq, all configurations happens in /etc/dnsmasq.d/. Remove a seperate dnsmasq installation and configure pihole as indicated by Bucking_Horn
exactly what would inidcate the dnsmasq is still running to pihole? The existance of the file /var/lib/misc/dnsmasq.leases or its access rights?
I did a double-check and it is definitely not installed anymore:
root@raspberrypi:/etc/hostapd# apt list --installed|grep -i dns
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
dns-root-data/stable,now 2019031302 all [installiert]
dnsutils/stable,now 1:9.11.5.P4+dfsg-5.1+deb10u2 armhf [installiert]
libdns-export1104/stable,now 1:9.11.5.P4+dfsg-5.1+deb10u2 armhf [installiert]
libdns1104/stable,now 1:9.11.5.P4+dfsg-5.1+deb10u2 armhf [Installiert,automatisch]
libnss-mdns/stable,now 0.14.1-1+b5 armhf [Installiert,automatisch]
python-dnspython/stable,now 1.16.0-1 all [Installiert,automatisch]
I also made sure that all configuration has been done in /etc/dnsmasq.d/.
I have just removed the file now after having stopped pi.hole in between. Now, without the file it seems to work like a charm. Was this the correct solution?
That is one of dnsmasq's default locations for creating the leases file, so the existence of that file in that location would normally indicate a separate dnsmasq instance running.
However, since you are manually configuring DHCP settings, this would be somehow expected.
If you would enable Pi-hole's DHCP server via Settings | DHCP, Pi-hole would add a line like the following to its configuration in /etc/dnsmasq.d/02-pihole-dhcp.conf:
dhcp-leasefile=/etc/pihole/dhcp.leases
AFAIAAO, there can be only one leases file.
For coexistence with Pi-hole, it would be advisable if you'd decide for one location, preferably Pi-hole's.
If Pi-hole's DHCP UI would suffice for you, you may try to do so by using Pi-hole's UI to configure DHCP, but provide the additional wlan0 interface as well as the DHCP exclusion for Pi-hole's existing interface (presumably eth0) in your custom configuration file.
That said, manually editing dhcp-host definitions in custom configurations certainly offers more flexibility by allowing access to all dnsmasq options.
In any case, it's a custom configuration that would require your willingness to test and figure it out by yourself.
Alternatively, you could set up a second RPi as AP and have that use and distribute your existing Pi-hole as DNS server.
including now the dhcp-leasefile configuration mentioned by you before.
In an additional configuration file (/etc/dnsmasq.d/02-pihole-dhcp_manual.conf) I have added no-dhcp-interface=eth0 to prevent pi-hole to act as a DHCP server on eth0.
The only thing missing compaired to my manual configuration before is the "wlan0" entry in dhcp-range=wlan0,192.168.1.100,192.168.1.199,255.255.255.0,24h, but I hope this is not necessary anyway due to no-dhcp-interface=eth0.
Anyway, this new configuration seems to work even better since I am able to monitor the DHCP leases now in the GUI.