Is it expected behavior to NOT do subsequent DNS requests for CNAME to eventually resolve to an IP?

Posted by Teacup91@reddit | linuxadmin | View on Reddit | 1 comments

Here is the nslookup:

lhtadmin@deb12-docker1:~$ nslookup 
Server:172.16.100.4
Address:172.16.100.4#53

nc.domain.com  canonical name = lb2.local.domain.com.
lb2.local.domain.com  canonical name = deb12-docker2.local.domain.com.nc.domain.com

When I tried to do curl nc.domain.com, I got the message "could not resolve". Here is the log from my DNS server (Pihole)

Oct 16 14:08:25: query[A] nc.lhtran.com from 172.16.100.20
Oct 16 14:08:25: config nc.lhtran.com is <CNAME>
Oct 16 14:08:25: config lb2.local.lhtran.com is <CNAME>

However, if I try the same curl command on a macOS, it do another lookup for deb12-docker2.local.domain.com to resolve to an IP

Oct 16 14:03:33: query[A] nc.lhtran.com from 172.16.110.251
Oct 16 14:03:33: config nc.lhtran.com is <CNAME>
Oct 16 14:03:33: config lb2.local.lhtran.com is <CNAME>
Oct 16 14:03:33: query[A] deb12-docker2.local.lhtran.com from 172.16.110.251
Oct 16 14:03:33: forwarded deb12-docker2.local.lhtran.com to 192.168.1.1
Oct 16 14:03:33: reply deb12-docker2.local.lhtran.com is 172.16.100.128

deb12-docker2.local.domain.com is forwarded. However, it will work fine, If I have deb12-docker2.local.domain.com A record directly (not forwarded)

Is there a way to tell Linux to do another lookup for CNAME record that will need to be forwarded?