Pi-hole, Tailscale and split horizon

Pi-hole has below directive active:

$ cat /etc/dnsmasq.d/01-pihole.conf
[..]
localise-queries
$ man dnsmasq
[..]
       -y, --localise-queries
              Return answers to  DNS  queries  from  /etc/hosts  and
              --interface-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 re‐
              turn only the address(es) on that subnet. 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  lim‐
              ited to IPv4.

If I add DNS records as an example:

$ ip -br -4 a
lo               UNKNOWN        127.0.0.1/8
eth0             UP             10.0.0.4/24
$ sudo nano /etc/pihole/custom.list
[..]
127.0.0.99 myproxy.mydomain.com
10.0.0.99 myproxy.mydomain.com
$ pihole restartdns
  [✓] Restarting DNS server
$ dig +short myproxy.mydomain.com @127.0.0.1
127.0.0.99
$ dig +short myproxy.mydomain.com @10.0.0.4
10.0.0.99

For above example, I manually edited the custom.list file bc the webGUI doesnt allow to add multiple records with the same domain name for some reason.

1 Like