local cname queries goes to upstream server

#1

Expected Behaviour:

CNAME that could be looked up in the LAN.

Actual Behaviour:

When i dig the CNAME on the pihole-box it looks ok but I can’t use nslookup on a Windows client to get it.

Debug Token:

c11347eh81!

Observe that I have changed my dns names and IP’s in the text below for privacy, so it’s a bit different in the debug file.

May 17 21:02:52 dnsmasq[7336]: query[A] ipam from 127.0.0.1
May 17 21:02:52 dnsmasq[7336]: config ipam is <CNAME>
May 17 21:03:26 dnsmasq[7336]: query[A] ipam from 127.0.0.1
May 17 21:03:26 dnsmasq[7336]: config ipam is <CNAME>
May 17 21:03:47 dnsmasq[7336]: query[A] ipam.lan from 192.168.1.xxx
May 17 21:03:47 dnsmasq[7336]: forwarded ipam.lan to 1.0.0.1
May 17 21:03:47 dnsmasq[7336]: reply ipam.lan is NXDOMAIN

I created a 05-cname.conf under /etc/dnsmasq.d with the following,

cname=ipam,homeserver

to make ipam a CNAME of homeserver and with dig and nslookup local on the pihole box it did found it and reported as a CNAME but when I tried on a Windows client i Didnt get it.

nslookup ipam
Server:  piHole.lan
Address:  192.168.1.xxx

*** piHole.lan can't find ipam: Non-existent domain

What I can see in the log above is that when I requested the query from my client it forwared it to my upstream DNS.

I also have a 99-my-conf.conf under /etc/dnsmasq.d with the following configuration,

domain=lan
expand-hosts
local=/lan/

Should not that local=/lan/ do so .lan doesn’t goes to upstream servers?

I have also checked the “Never forward non-FQDNs” in the web gui,

Thanks.

#2

Try using a FQDN:

pi@noads:~ $ echo 'cname=ipam.dehakkelaar.nl,pi.hole' | sudo tee /etc/dnsmasq.d/99-my-settings.conf
cname=ipam.dehakkelaar.nl,pi.hole

pi@noads:~ $ sudo service pihole-FTL reload
pi@noads:~ $

pi@noads:~ $ nslookup ipam
Server:         127.0.0.1
Address:        127.0.0.1#53

Non-authoritative answer:
*** Can't find ipam: No answer

pi@noads:~ $ nslookup ipam.dehakkelaar.nl
Server:         127.0.0.1
Address:        127.0.0.1#53

ipam.dehakkelaar.nl  canonical name = pi.hole.
Name:   pi.hole
Address: 10.0.0.2

C:\>nslookup ipam
Server:  noads.dehakkelaar.nl
Address:  10.0.0.2

Name:    pi.hole
Address:  10.0.0.2
Aliases:  ipam.dehakkelaar.nl

C:\>nslookup ipam.dehakkelaar.nl
Server:  noads.dehakkelaar.nl
Address:  10.0.0.2

Name:    pi.hole
Address:  10.0.0.2
Aliases:  ipam.dehakkelaar.nl

C:\>ping ipam

Pinging pi.hole [10.0.0.2] with 32 bytes of data:
Reply from 10.0.0.2: bytes=32 time<1ms TTL=64
Reply from 10.0.0.2: bytes=32 time<1ms TTL=64
Reply from 10.0.0.2: bytes=32 time<1ms TTL=64
Reply from 10.0.0.2: bytes=32 time<1ms TTL=64

Ping statistics for 10.0.0.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms