[Dnsmasq-discuss] How to use bogus-nxdomain in conjunction with addn-hosts

Alexander Huemer eiloarae8Phe at xx.vu
Mon Jul 22 17:37:16 BST 2019


I have added a hosts(5)-style file to dnsmasq with 'addn-hosts='.
All entries point to the same IP address.
This works as expected, querying this dnsmasq instance for any of the 
entries results in a response with said IP address.
Actually I'd like queries for any of these hosts to result in an 
NXDOMAIN response.
According to my understanding the bogus-nxdomain option serves exactly 
this purpose, though setting bogus-nxdomain=<my special IP address> 
doesn't work. I still get the IP address instead of NXDOMAIN.
I suspected that maybe bogus-nxdomain does not work in concjunction with 
'addn-hosts'-supplied data but wasn't sure.
To validate that I am actually using the feature correctly I have added 
another bogus-nxdomain entry with an IP address of a well-known host on 
the internet and got an NXDOMAIN response from dnsmasq, as expected so I 
guess bogus-nxdomain and addn-hosts don't work in conjunction with each 

(1) Is this known/expected behavior?
(2) Can I somehow achieve what I desire?

I guess a workaround for my issue is to work with two instances of 
dnsmasq. One serves the content of the addn-hosts file to the other over 
DNS, the second instance then does bogus-nxdomain on those. Even though 
I guess this would work (I haven't tried yet) I'd like to avoid that 
approach if anybody has a good idea what else i could do.


More information about the Dnsmasq-discuss mailing list