[Dnsmasq-discuss] Is is possible to configure dnsmasq to query multiple DNS servers for a single request, and return the nearest IP?

Simon Kelley simon at thekelleys.org.uk
Wed Nov 28 21:11:41 GMT 2012


On 28/11/12 03:45, 石骁毅 wrote:
> Hi all,
>
> When using a public DNS, there is huge catch for not playing so well with
> CDN.
> Is there a way to preserve the CDN by asking dnsmasq to send multiple
> resolve
> request to a few server instead of one, and return the IP with shorter
> route path.
>
> It doesn't have to return immediately, but query the second one in another
> thread
> (just saying,) and after the other is proved nearer then update the entry
> in the
> cache. So that the client will get a better resolve result when the cache
> expires.
>
> I knew this could be done by using `--server` option to assign DNS server
> for a list
> of domains, but when there are thousands of domains need to be set this is
> a little
> painful. So I'm seeking for a better solution.
>
> Thanks,
> Xiaoyi
>
>
> PS:
> I don't have much options other than using a public DNS, since internet
> in China
> is highly censored, domains like google.com, twitter.com will be
> hijacked using
> ISP provided DNS. For example:
>
> root at OpenWrt:~# nslookup twitter.com 202.106.196.115
> Server:    202.106.196.115
> Address 1: 202.106.196.115 linedns.bta.net.cn
>
> Name:      twitter.com
> Address 1: 59.24.3.173
> root at OpenWrt:~# nslookup twitter.com 8.8.8.8
> Server:    8.8.8.8
> Address 1: 8.8.8.8 google-public-dns-a.google.com
>
> Name:      twitter.com
> Address 1: 199.59.150.7 r-199-59-150-7.twttr.com
> Address 2: 199.59.149.230 www4.twitter.com
> Address 3: 199.59.150.39 r-199-59-150-39.twttr.com
>

It's an interesting problem, but I'm not sure in dnsmasq is the best 
place to do it, or even the DNS. I tried your twitter example, and 
Google DNS always returns answers, but on each query it returns three 
different addresses from a much bigger pool. Trying to second-guess the 
Google servers is going to be difficult if you can't even find all the 
possible twitter servers in one query.


Simon.



More information about the Dnsmasq-discuss mailing list