When I try to restart the dnsmasq, I'm getting error

Thank you both for your answers.

To be honest, I was offline ( so "out-of-date" about latest pihole news ) for a while. So, I recently (easily) installed the PiHole on Raspberry Pi, without reading about its latest changes ( release notes ). And these, in my view, were very important, serious and decisive :

So, from version 4 onwards, they changed (let's not say everything), but very basic things!
It no longer installs the dnsmasq, but it is included in the new so-called "FTLDNS" of the pihole modules.

This for me, where I use the Raspberry Pi for additional other functions of the local network - besides the security and blocking that your pihole offers -, it is very important.
For example, the above problem occurred as I was trying (carefree :stuck_out_tongue_closed_eyes:) to install and configure the OpenVPN correctly, and did not know that the dnsmasq no longer exists.
The following answers helped me and made me suspect that things have now changed :

https://discourse.pi-hole.net/t/error-with-dnsmasq-bad-option-at-line-44/18630/2?u=piopen

https://discourse.pi-hole.net/t/pihole-ftl-failed-to-create-listening-socket-for-port-53/17207/2?u=piopen

https://discourse.pi-hole.net/t/problem-setting-up-openvpn-and-resolving-to-the-server/11384/2?u=piopen

In my opinion, this change (though it might initially bother me), shows me you've taken it very seriously, don't be afraid to dirty your hands even more to optimize your very useful, important, necessary and amazing project! Probably this integration if done right, will have much better - more optimal - results!


However, an amazing documentation is provided :

https://github.com/pi-hole/pi-hole/wiki/Pi-hole---OpenVPN-server

https://docs.pi-hole.net/guides/vpn/overview/

https://discourse.pi-hole.net/t/pi-hole-with-openvpn-vps-debian/861

Before proceeding with the procedure I followed, I would like to ask the following question:

If I want to make special/extra configurations in the dnsmasq for the sake of the OpenVPN, where can i do them ?

I see how all the configuration files are here:

sudo tree /etc/dnsmasq.d/

/etc/dnsmasq.d/
├── 01-pihole.conf
├── 02-pihole-dhcp.conf
├── 04-pihole-static-dhcp.conf
└── README

So, can I add one more configuration file there ( e.g. openvpn.conf ) and will it work?
Or do I need to add the configuration settings I want to any of the above existing configuration files?


The right guide for my case is here : Optional: Dual operation: LAN & VPN at the same time, right ;
Because I want to install OpenVPN on my (home) Raspberry Pi which running on it and they Pihole as well.


Here are my configuration steps:

  1. In the OpenVPN server configuration file /etc/openvpn/server.conf, I added the following :
push "route 192.168.2.0 255.255.255.0"
#push "dhcp-option DNS 192.168.2.123"

# With the following two lines, the OpenVPN server will force clients
# to have it as the default gateway as well as to use
# the nameserver he suggests.
push "redirect-gateway def1"
push "dhcp-option DNS 10.8.0.1""

What do you have to say about my above configuration? Is correct ?
About my dhcp-option configuration ?

Then, I make the following settings on the dnsmasq server - now in the FTLDNS:
sudo vi /etc/dnsmasq.d/openvpn.conf

...
# If you want dnsmasq to listen for DHCP and DNS requests only on
# specified interfaces (and the loopback) give the name of the
# interface (eg eth0) here.
# Repeat the line for more than one interface.
#interface=
# Or you can specify which interface _not_ to listen on
#except-interface=
# Or which to listen on by address (remember to include 127.0.0.1 if
# you use this.)
listen-address=127.0.0.1, 10.8.0.1, 192.168.2.2

# On systems which support it, dnsmasq binds the wildcard address,
# even when it is listening on only some interfaces. It then discards
# requests that it shouldn't reply to. This has the advantage of
# working even when interfaces come and go and change address. If you
# want dnsmasq to really bind only the interfaces it is listening on,
# uncomment this option. About the only time you may need this is when
# running another nameserver on the same machine.
bind-interfaces
....

I make the above configurations because I want the Raspberry Pi box with the OpenVPN server ( and Pi-Hole ) to also run the nameserver debts for OpenVPN clients. For more security.

As for the last important step who mentioned ( - to work properly with the Pi-Hole - to allow it ), as you can see below, I chose "Listen on all interfaces" and no "Listen on all interfaces, permit all origins" that you are suggesting and for the now seems to work fine!

Also see the Pi-Hole settings from here :

cat /etc/pihole/setupVars.conf

WEBPASSWORD=****
DHCP_ACTIVE=true
DHCP_START=192.168.2.10
DHCP_END=192.168.2.251
DHCP_ROUTER=192.168.2.1
DHCP_LEASETIME=24
PIHOLE_DOMAIN=lan
DHCP_IPv6=false
DHCP_rapid_commit=false
BLOCKING_ENABLED=true
DNSMASQ_LISTENING=local
DNS_FQDN_REQUIRED=true
DNS_BOGUS_PRIV=true
DNSSEC=false
CONDITIONAL_FORWARDING=false
PIHOLE_INTERFACE=eth0
IPV4_ADDRESS=192.168.2.2/24
IPV6_ADDRESS=
PIHOLE_DNS_1=9.9.9.9
PIHOLE_DNS_2=149.112.112.112
QUERY_LOGGING=true
INSTALL_WEB_SERVER=true
INSTALL_WEB_INTERFACE=true
LIGHTTPD_ENABLED=true

What is your opinion? It's wrong ?
Why should I put the setting you are suggesting?

Thank you very much!

References :