[Dnsmasq-discuss] Need help on configuring dnsmasq

Gary R. Schmidt grschmidt at acm.org
Mon May 8 14:57:01 UTC 2023


On 09/05/2023 00:10, Buck Horn wrote:
> On 08.05.2023 15:00:22, "public1020" wrote:
> 
>> Thanks, dnsmasq does not support this feature. 
> 
> Why would you think so when you have been pointed to the correct answer 
> from the docs?
> 
> Matus UHLAR even quoted the decisive sentence for you:
> 
> 
>>> it does and the answer is listed in dnsmasq manual page, just where you
>>> would search for it:
>>> -A, --address=/<domain>[/<domain>...]/[<ipaddr>]
>>> ... Note that /etc/hosts and DHCP leases override this for individual 
>>> name
> 
> 
> 'address' would specify an IP address to return for any host in the 
> given domains, i.e. including subdomains, so its not fit to satisfy your 
> original request about an individual host name, e.g. for shadowing only 
> example.com, but none of its subdomains.
> 
> As the docs quoted by Matus UHLAR**state, you may use entries in 
> /etc/hosts to that purpose:
> Just add some lines with the desired IP and hostname associations to 
> that file.
> 
> Of course, that may only work if you wouldn't prevent dnsmasq from 
> reading /etc/hosts.
> So if your dnsmasq configuration would use the 'no-hosts' option (or if 
> you'd just like to keep things separated), you could configure 
> 'addn-hosts' to point dnsmasq to a separate file with your custom host 
> definitions.
> 
I will re-state all of this, to see if I have it right:

The OP wants example.com to return 1.2.3.4, but *.example.com to go up 
the DNS tree and return the actual IP address.

Using -A/--address doesn't do this, it replies with 1.2.3.4 for 
*.example.com as well as example.com, as documented (and presumably as 
intended).

Setting example.com to be 1.2.3.4 in /etc/hosts or similar, and not 
fiddling around with -A/--address should give the OP the required behaviour.

Is that an accurate summation?

	Cheers,
		Gary	B-)





More information about the Dnsmasq-discuss mailing list