[Dnsmasq-discuss] partial hostname match

Simon Kelley simon at thekelleys.org.uk
Fri Jul 2 16:31:26 UTC 2021


On 28/06/2021 16:50, Basin Ilya wrote:
> Hi.
> I want to configure a DNS server that forwards 3rd level domain matching a certain pattern to a certain upstream server. 
> (That dedicated upstream DNS server is supposed to convert domains of the form "192-168-10-10-the-sub.example.com" into their corresponding ip addresses like 192.168.10.10)
> 
> Unfortunately, the following line does not work in dnsmasq.conf:
> 
>     server=*-the-sub.example.com/192.168.1.1
> 
> It will not treat the asterisk char as a wildcard and will just check that the requested domain is equal to '*-the-sub.example.com'
> 
That matching in --server=/<domain>/..... has always been on whole
labels, since that's by far the most useful, in general. So you're right
that server=/-the-sub.example.com/  (with an implied wildcard on the
left, as always) won't match in you case: it would match

192-168-10-10.-the-sub.example.com

but not

192-168-10-10-the-sub.example.com

It may not be of immediate help to you, but the code which implements
this has been getting some attention recently, and partly prompted by
your suggestion, I have implemented a way to turn off whol-label
matching, using a * on the left. In the new code,

server=/*-the-sub.example.com/192.168.1.1

works as you expect. It's still in test, but if you want to try it, you
can download from the dnsmasq git repository.

https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=summary

Cheers,

Simon.



More information about the Dnsmasq-discuss mailing list