Localise-queries option now always set?

Hi Everyone

I recently upgraded to v6 and discovered that the dnsmasq option "localise-queries" can't be manually set anymore, instead it is always on. Is this intended?
I tried to manually disable the options in /etc/pihole/dnsmasq.conf which is absolutely useless as it gets overwritten on every restart of pihole-FTL.
I have some custom host-records which should return 2 or more IP addresses, which is obviously not working with this option enabled.

Did anyone else stumble upon this problem?
Any help would be appreciated

localise-queries has been in effect ever since Pi-hole 3 released in 2017.

How so?

Please upload a debug log and post just the token URL that is generated after the log is uploaded by running the following command from the Pi-hole host terminal:

pihole -d

or if you run your Pi-hole as a Docker container:

docker exec -it <pihole-container-name-or-id> pihole -d

where you substitute <pihole-container-name-or-id> as required.

This may be the case, but I was able to disable this somehow. I can't remember if it was via WebGUI or by editing the pihole config file.

I have my custom host-records in an additional file in /etc/dnsmas.d/ in the following formal

host-record=asdf.lan,test.lan,test1.lan,192.168.1.11
host-record=fdsa.lan,test.lan,test2.lan,192.168.5.11

If I query test.lan from within the subnets I will, as expected, only get a single IP in return. The only way to get both IPs is to disable the localise-queries option, which is not possible anymore.

This could be covered by a simple check-box in the WebGUI.

You have two options to choose from.

  1. Enable below in the webGUI settings so those customisations actually gets loaded:

  1. Or skip config files entirely and and enter those dnsmasq directives below:

EDIT: You can also do it via shell:

$ sudo pihole-FTL --config misc.etc_dnsmasq_d
false
$ sudo pihole-FTL --config misc.dnsmasq_lines
[]

I've already tried these options, but without success.
As far as I understand pihole-FTL uses /etc/pihole/dnsmasq.conf as primary config file and then adds the custom config either through the additional files in /etc/dnsmasq.d/ or by appending them to /etc/pihole/dnsmasq.conf.
But since the option localise-queries is baked into the primary config file there is no way to disable it in the custom config options.

Nope.
That was in the old days.

(EDIT: you're right, I missed the /etc/pihole/ bit)

All settings are sourced from below file now:
/etc/pihole/pihole.toml

EDIT: A fresh v6 install:

$ ls -al /etc/dnsmasq.*
-rw-r--r-- 1 root root   24 Aug 12  2024 /etc/dnsmasq.conf.old

/etc/dnsmasq.d:
total 8
drwxr-xr-x  2 root root 4096 Jan  1 22:34 .
drwxr-xr-x 85 root root 4096 May 13 08:55 ..

You're right, but the dnsmasq specific settings in /etc/pihole/pihole.toml are written to /etc/pihole/dnsmasq.conf and then used by pihole-FTL.
I cannot edit /etc/pihole/dnsmasq.conf as it is overwritten each time pihole-FTL is restarted.
It can only work it the localise-queries setting could be set in /etc/pihole/pihole.toml.

Yeah most likely.
Maybe a dev/mod can answer that one.

Was too quick to respond :wink:

1 Like

@DL6ER @DanSchaper

I guess this could be covered as a Feature Request?

There never was a UI option for it, so you only may have changed 01-pihole.conf - but that would never have been a persistent change then, as 01-pihole.conf may have been overwritten upon UI interaction or on Pi-hole updates.

That would only be expected if your Pi-hole host machine would sport an IP address for each of those subnets.

Since you didn't share a debug token yet, I can't know about that, but commonly, the machine hosting Pi-hole would only live in one of those subnets.

Why is it important that test.lan gets resolved to two IPs?
Is it equally important for both of your subnets?

I used my own conf file before v6. All files generated by pihole were replaced.

My pihole aswell as my client have their IP in 192.168.1.0/24. So when my client queries test.lan isn't the whole purpose of localise-queries to give me a reply in relation to my requesting IP?
I also have a client which is in a different subnet and it gets both IPs returned instead of a single.

Yes. I have some services which should be reachable on both IPs under a single name.

Also do mind that the first domain name is treated differently:

$ man dnsmasq
[..]
       --host-record=<name>[,<name>....],[<IPv4-address>],[<IPv6-ad‐
       dress>][,<TTL>]
              Add A, AAAA and PTR records to the DNS.  This  adds  one  or
              more  names  to  the  DNS  with associated IPv4 (A) and IPv6
              (AAAA) records. A name may appear in more than  one  --host-
              record and therefore be assigned more than one address. Only
              the first address creates a PTR record linking  the  address
              to the name. This is the same rule as is used reading hosts-
              files.  --host-record options are considered to be read  be‐
              fore  host-files,  so  a  name appearing there inhibits PTR-
              record creation if it appears  in  hosts-file  also.  Unlike
              hosts-files,  names  are  not  expanded, even when --expand-
              hosts is in effect. Short and long names may appear  in  the
              same --host-record, eg.  --host-record=laptop,laptop.thekel‐
              leys.org,192.168.0.1,1234::100

              If the time-to-live is  given,  it  overrides  the  default,
              which  is  zero  or the value of --local-ttl. The value is a
              positive integer and gives the time-to-live in seconds.

A bit similar as in below file:

$ cat /etc/hosts
[..]
127.0.1.1    ph6c.home.dehakkelaar.nl  ph6c.home  ph6c

ph6c.home and ph6c will be an alias for ph6c.home.dehakkelaar.nl:

$ man hostname
[..]
   THE FQDN
       The FQDN (Fully Qualified Domain Name) of the system  is  the  name
       that the resolver(3) returns for the host name, such as, ursula.ex‐
       ample.com.  It is usually the hostname followed by the  DNS  domain
       name  (the part after the first dot).  You can check the FQDN using
       hostname --fqdn or the domain name using dnsdomainname.

       You cannot change the FQDN with hostname or dnsdomainname.

       The recommended method of setting the FQDN is to make the  hostname
       be  an alias for the fully qualified name using /etc/hosts, DNS, or
       NIS. For example, if the hostname was "ursula", one  might  have  a
       line in /etc/hosts which reads

              127.0.1.1    ursula.example.com ursula

I'm aware about that. Since im only using forward lookups for test.lan this isn't a problem.

If that Pi-hole host doesnt have multiple IP's in different subnets, that localise-queries directive wont apply/do anything:

$ man dnsmasq
[..]
       -y, --localise-queries
              Return answers to DNS queries from /etc/hosts  and  --inter‐
              face-name  and  --dynamic-host which depend on the interface
              over which the query was received. If a name has  more  than
              one  address  associated  with it, and at least one of those
              addresses is on the same subnet as the  interface  to  which
              the query was sent, then return only the address(es) on that
              subnet and return all  the  available  addresses  otherwise.
              This  allows  for  a  server   to have multiple addresses in
              /etc/hosts corresponding to  each  of  its  interfaces,  and
              hosts  will  get  the correct address based on which network
              they are attached to. Currently this facility is limited  to
              IPv4.

It will. It says it right here

You're neglecting the first bit:

Below how its used (EDIT: Pi-hole v5 though!):

Ok. I have two piholes in the subnets 192.168.10.0/24 & 192.168.11.0/24 with only a single IP.

I've added the following config to /etc/dnsmasq.d/

#Test Config
host-record=asdf.lan,test.lan,test1.lan,192.168.10.10
host-record=fdsa.lan,test.lan,test2.lan,192.168.15.10

These are the nslookup from both piholes
pihole 1 in subnet 192.168.10.0/24

$ nslookup test.lan
Server:		192.168.10.6
Address:	192.168.10.6#53

Name:	test.lan
Address: 192.168.10.10

$ 

pihole 2 in subnet 192.168.11.0/24

$ nslookup test.lan
Server:		192.168.11.6
Address:	192.168.11.6#53

Name:	test.lan
Address: 192.168.10.10
Name:	test.lan
Address: 192.168.15.10

$ 

pihole 1 only gets returned a single IP because it is in the same subnet as one of the configured host-records and pihole 2 gets returned two IPs because it is in another subnet.

Thats indeed the expected replies.
What do you expect as a reply for that test.lan domain in both networks?
Bc clients in subnet 2 192.168.11.0/24 wont be able to connect to the 192.168.10.10 or 192.168.15.10 replies (EDIT: without an extra static route).