Dnsmasq address=/ ip gets replaced with cname ip

ok , this is a bit complicated and weird situation.

I have set in openwrt dnsmasq config:

address=/feeds2.feedburner.com/192.168.1.20

for it to use a proxy.

and when I restart dnsmasq and do 'drill feeds2.feedburner.com' I get 192.168.1.20 at first.
and in logs I see this

Mon Dec 19 14:10:40 2022 syslog.info dnsmasq[1]: query[A] feeds2.feedburner.com from 192.168.1.10
Mon Dec 19 14:10:40 2022 syslog.info dnsmasq[1]: config feeds2.feedburner.com is 192.168.1.20

but a bit later I get 142.250.181.14.
and in logs I see

Mon Dec 19 14:15:02 2022 syslog.info dnsmasq[1]: query[A] feeds2.feedburner.com from 192.168.1.20
Mon Dec 19 14:15:02 2022 syslog.info dnsmasq[1]: config feeds2.feedburner.com is 192.168.1.20
Mon Dec 19 14:15:12 2022 syslog.info dnsmasq[1]: query[A] feeds2.feedburner.com from 192.168.1.10
Mon Dec 19 14:15:12 2022 syslog.info dnsmasq[1]: config feeds2.feedburner.com is 192.168.1.20
Mon Dec 19 14:15:28 2022 syslog.info dnsmasq[1]: query[AAAA] feeds2.feedburner.com from 192.168.1.20
Mon Dec 19 14:15:28 2022 syslog.info dnsmasq[1]: forwarded feeds2.feedburner.com to 172.20.11.11
Mon Dec 19 14:15:28 2022 syslog.info dnsmasq[1]: query[A] feeds2.feedburner.com from 192.168.1.20
Mon Dec 19 14:15:28 2022 syslog.info dnsmasq[1]: config feeds2.feedburner.com is 192.168.1.20
Mon Dec 19 14:15:29 2022 syslog.info dnsmasq[1]: reply feeds2.feedburner.com is <CNAME>
Mon Dec 19 14:15:29 2022 syslog.info dnsmasq[1]: reply www4.l.google.com is 2a00:1450:4019:80b::200e
Mon Dec 19 14:15:29 2022 syslog.info dnsmasq[1]: query[A] www4.l.google.com from 192.168.1.20
Mon Dec 19 14:15:29 2022 syslog.info dnsmasq[1]: forwarded www4.l.google.com to 172.20.11.11
Mon Dec 19 14:15:29 2022 syslog.info dnsmasq[1]: reply www4.l.google.com is 142.250.181.110

when I furthur check I see that curl on my odroid device (which is on thte device 192.168.1.20, I dont know if the is important) will always get the 142.250.181.14 even though drill on odroid gets the 192.168.1.20.

and after awhile all the device get 142.250.181.14 answer. but in between these times my laptop get the 192.168.1.20 answer from openwrt as I see in logs

Mon Dec 19 14:21:06 2022 syslog.info dnsmasq[1]: query[A] feeds2.feedburner.com from 192.168.1.10
Mon Dec 19 14:21:06 2022 syslog.info dnsmasq[1]: cached feeds2.feedburner.com is <CNAME>
Mon Dec 19 14:21:06 2022 syslog.info dnsmasq[1]: config feeds2.feedburner.com is 192.168.1.20

and I get

curl -v https://feeds2.feedburner.com/\
*   Trying 192.168.1.20:443...

on latop

but at the same time I get these on odroid

alarm% drill feeds2.feedburner.com                      
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 42061
;; flags: qr aa rd ra ; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 
;; QUESTION SECTION:
;; feeds2.feedburner.com.       IN      A

;; ANSWER SECTION:
feeds2.feedburner.com.  0       IN      A       192.168.1.20

;; AUTHORITY SECTION:

;; ADDITIONAL SECTION:

;; Query time: 0 msec
;; SERVER: 192.168.1.1
;; WHEN: Mon Dec 19 10:52:39 2022
;; MSG SIZE  rcvd: 55
alarm% curl -v https://feeds2.feedburner.com/=
*   Trying 142.250.181.78:443...

what can I change for curl on odroid not to get the wrong answer (seen in curl response) in the first place and the later not mess the dnsmasq answer for all devices after a while (which is seen in drill response)

???

???

Have you tried:

# in /etc/config/dhcp

config domain
        option name 'feeds2.feedburner.com'
        option ip '192.168.1.20'

I have used /etc/dnsmasq.d/ folder to store domains which I map to 192.168.1.20 lan ip to use a proxy to bypass national-filter block.
like this
address=/feeds2.feedburner.com/192.168.1.20

which works.
but later the 192.168.1.20 later gets replaced.
that is my issue.

When you have cname you need to a cname rewrite rule .

This is the syntax for uci ( file /etc/config/dhcp )

UCI support cname but not luci ( web interface ) , a P.R. is available look at this comment
https://github.com/openwrt/openwrt/issues/11210#issuecomment-1657013880

config cname
       option cname 'feeds2.feedburner.com'
       option target 'feeds2.feedburner.com.notuseful.lan'

config domain
       option name 'feeds2.feedburner.com.notuseful.lan'
       option ip '192.168.1.20'

so this syntax must work for dnsmsaq

cname=feeds2.feedburner.com,feeds2.feedburner.com.notuseful.lan
address=feeds2.feedburner.com.notuseful.lan,192.168.1.20
1 Like