[Dnsmasq-discuss] Does dnsmasq support cname within same domain?

Frank Liu gfrankliu at gmail.com
Wed Mar 2 17:45:48 UTC 2022


On Wed, Mar 2, 2022 at 7:14 AM Matus UHLAR - fantomas via Dnsmasq-discuss <
dnsmasq-discuss at lists.thekelleys.org.uk> wrote:

> >> > > On Tue, Mar 01, 2022 at 01:01:51AM -0800, Frank Liu wrote:
> >> > > > I am running dnsmasq for dhcp/dns of a local test domain:
> test.example.com.
> >> > > > Everything works fine. When a dhcp client (eg: client1) comes up,
> it gets
> >> > > > the IP from dnsmasq, and I can dig/nslookup
> client1.test.example.com to get
> >> > > > its IP.
> >> > > >
> >> > > > When I add a cname in the same domain, eg:
> >> > > > cname=alias.test.example.com,client1.test.example.com
> >> > > >
> >> > > > dig/nslookup of alias.test.example.com only returns name
> >> > > > client1.test.example.com, not the actual IP of
> client1.test.example.com
> >> > > >
> >> > > > It's interesting that if I add the cname for a different domain,
> eg:
> >> > > > cname=alias.dummy.example.com,client1.test.example.com
> >> > > >
> >> > > > dig/nslookup of alias.dummy.example.com will return both name
> >> > > > client1.test.example.com and its IP.
> >> > > >
> >> > > > I tried a few different versions but that doesn't make a
> difference.
>
> >> > On Tue, Mar 1, 2022 at 3:37 AM Geert Stappers via Dnsmasq-discuss
> wrote:
> >> > > Please name those different versions.
>
> >> On Tue, Mar 01, 2022 at 09:21:58AM -0800, Frank Liu wrote:
> >> > 2.76 (Debian 9),   2.85 (Debian 11).
>
> >On Tue, Mar 1, 2022 at 2:39 PM Geert Stappers via Dnsmasq-discuss
> > <dnsmasq-discuss at lists.thekelleys.org.uk> wrote:
> >> Ah, I'm now beyond the ambiguty of different version of dig/nslookup.
>
> On 02.03.22 01:28, Frank Liu wrote:
> >I don't think it matters with test OS or test application.
>
> it may matter,
>
> >I also tried:
> >ping alias.dummy.example.com works, but ping alias.test.example.com gives
> >unknown host error.
> >(even though both names cname to the same client1.test.example.com in
> >dnsmasq).
>
> What do there result in?
>
> dig alias.dummy.example.com alias.test.example.com
> client1.test.example.com
> dig -t any alias.dummy.example.com alias.test.example.com
> client1.test.example.com
>
>
In below test, dnsmasq server (192.168.0.253) runs dnsmasq 2.85 (from
Debian11).
I have below in the dnsmasq conf:

cname=alias.test.example.com,client1.test.example.com
cname=alias.dummy.example.com,client1.test.example.com

Test client is another Debian11 box

$ dig -v
DiG 9.16.22-Debian

$ dig @192.168.0.253 alias.dummy.example.com alias.test.example.com
client1.test.example.com

; <<>> DiG 9.16.22-Debian <<>> @192.168.0.253 alias.dummy.example.com
alias.test.example.com client1.test.example.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29718
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;alias.dummy.example.com. IN A

;; ANSWER SECTION:
alias.dummy.example.com. 0 IN CNAME client1.test.example.com.
client1.test.example.com. 0 IN A 192.168.0.70

;; Query time: 20 msec
;; SERVER: 192.168.0.253#53(192.168.0.253)
;; WHEN: Wed Mar 02 17:34:27 UTC 2022
;; MSG SIZE  rcvd: 114

;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62870
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;alias.test.example.com. IN A

;; ANSWER SECTION:
alias.test.example.com. 5 IN CNAME client1.test.example.com.

;; Query time: 20 msec
;; SERVER: 192.168.0.253#53(192.168.0.253)
;; WHEN: Wed Mar 02 17:34:27 UTC 2022
;; MSG SIZE  rcvd: 96

;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40301
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;client1.test.example.com. IN A

;; ANSWER SECTION:
client1.test.example.com. 5 IN A 192.168.0.70

;; Query time: 16 msec
;; SERVER: 192.168.0.253#53(192.168.0.253)
;; WHEN: Wed Mar 02 17:34:27 UTC 2022
;; MSG SIZE  rcvd: 75

$ dig -t any @192.168.0.253 alias.dummy.example.com alias.test.example.com
client1.test.example.com

; <<>> DiG 9.16.22-Debian <<>> -t any @192.168.0.253 alias.dummy.example.com
alias.test.example.com client1.test.example.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24227
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;alias.dummy.example.com. IN ANY

;; ANSWER SECTION:
alias.dummy.example.com. 0 IN CNAME client1.test.example.com.
client1.test.example.com. 0 IN A 192.168.0.70

;; Query time: 20 msec
;; SERVER: 192.168.0.253#53(192.168.0.253)
;; WHEN: Wed Mar 02 17:34:41 UTC 2022
;; MSG SIZE  rcvd: 114

;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12433
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;alias.test.example.com. IN ANY

;; ANSWER SECTION:
alias.test.example.com. 5 IN CNAME client1.test.example.com.

;; Query time: 20 msec
;; SERVER: 192.168.0.253#53(192.168.0.253)
;; WHEN: Wed Mar 02 17:34:41 UTC 2022
;; MSG SIZE  rcvd: 96

;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31132
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;client1.test.example.com. IN ANY

;; Query time: 20 msec
;; SERVER: 192.168.0.253#53(192.168.0.253)
;; WHEN: Wed Mar 02 17:34:41 UTC 2022
;; MSG SIZE  rcvd: 59
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20220302/a03727a6/attachment-0001.htm>


More information about the Dnsmasq-discuss mailing list