From: Dnsmasq-discuss <dnsmasq-discuss-boun...@lists.thekelleys.org.uk> On Behalf Of Frank Liu Sent: Wednesday, March 2, 2022 12:46 PM To: Matus UHLAR - fantomas <uh...@fantomas.sk>; dnsmasq-discuss@lists.thekelleys.org.uk Subject: Re: [Dnsmasq-discuss] Does dnsmasq support cname within same domain?
On Wed, Mar 2, 2022 at 7:14 AM Matus UHLAR - fantomas via Dnsmasq-discuss <mailto:dnsmasq-discuss@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: >> > > > http://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 >> > > > http://client1.test.example.com to get >> > > > its IP. >> > > > >> > > > When I add a cname in the same domain, eg: >> > > > cname=http://alias.test.example.com,http://client1.test.example.com >> > > > >> > > > dig/nslookup of http://alias.test.example.com only returns name >> > > > http://client1.test.example.com, not the actual IP of >> > > > http://client1.test.example.com >> > > > >> > > > It's interesting that if I add the cname for a different domain, eg: >> > > > cname=http://alias.dummy.example.com,http://client1.test.example.com >> > > > >> > > > dig/nslookup of http://alias.dummy.example.com will return both name >> > > > http://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 > <mailto:dnsmasq-discuss@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 http://alias.dummy.example.com works, but ping >http://alias.test.example.com gives >unknown host error. >(even though both names cname to the same http://client1.test.example.com in >dnsmasq). What do there result in? dig http://alias.dummy.example.com http://alias.test.example.com http://client1.test.example.com dig -t any http://alias.dummy.example.com http://alias.test.example.com http://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=http://alias.test.example.com,http://client1.test.example.com cname=http://alias.dummy.example.com,http://client1.test.example.com Test client is another Debian11 box $ dig -v DiG 9.16.22-Debian $ dig @http://192.168.0.253 http://alias.dummy.example.com http://alias.test.example.com http://client1.test.example.com ; <<>> DiG 9.16.22-Debian <<>> @http://192.168.0.253 http://alias.dummy.example.com http://alias.test.example.com http://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: ;http://alias.dummy.example.com. IN A ;; ANSWER SECTION: http://alias.dummy.example.com. 0 IN CNAME http://client1.test.example.com. http://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: ;http://alias.test.example.com. IN A ;; ANSWER SECTION: http://alias.test.example.com. 5 IN CNAME http://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: ;http://client1.test.example.com. IN A ;; ANSWER SECTION: http://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 @http://192.168.0.253 http://alias.dummy.example.com http://alias.test.example.com http://client1.test.example.com ; <<>> DiG 9.16.22-Debian <<>> -t any @http://192.168.0.253 http://alias.dummy.example.com http://alias.test.example.com http://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: ;http://alias.dummy.example.com. IN ANY ;; ANSWER SECTION: http://alias.dummy.example.com. 0 IN CNAME http://client1.test.example.com. http://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: ;http://alias.test.example.com. IN ANY ;; ANSWER SECTION: http://alias.test.example.com. 5 IN CNAME http://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: ;http://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 What if you try cname=alias.test.example.com,client1.test.example.com,alias.dummy.example.com,client1.test.example.com Does it work? _______________________________________________ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss