Discussion:
[Dnsmasq-discuss] Dnsmasq as forwarder can't cache replies from multiple dns server
meenakshi sundaram
2018-03-05 15:37:23 UTC
Permalink
Hi All,         I would like to know the behavior of dnsmasq in the following scenario



PC --- Dnsmasq-as-Forwarder-------- |------ DNS-Server1 { abc.123.com ---- 1.1.1.1, abc.123.com ---- 1.1.1.2}                                                             |                                                             |                                                             |--------DNS-Server-2  { abc.123.com ---- 1.1.1.3, abc.123.com ---- 1.1.1.4}
When PC sends the query for abc.123.com, Dnsmasq forwards queries to both DNS-servers. Both servers sends the reply.PC  receives only one reply with answer from either DNS-Server1 or DNS-Server2.  it is expected as per design. 

I was expecting the dnsmasq-forwarder  to cache the replies/answers from both servers( Server1's reply {abc.123.com ---- 1.1.1.1, 1.1.1.2} Server2's reply {abc.123.com ---- 1.1.1.3, 1.1.1.4)} .

When i checked the cache of dnsmasq-forwarder, it only caches the first reply from either DNS-Server1 or DNS-Server2, NOT both. 
So wondering, how to do the RoudRobin Load balancing among four servers(1.1.1.1/2/3/4) which serves abc.123.com. 
 i checked the code. Looks like " the after  processing first reply, the frec is freed, so dnsmasq can't cache the entries."
Could you explain? 
thanksS.Meenakshisundaram
Simon Kelley
2018-03-06 23:24:30 UTC
Permalink
The DNS doesn't really work when different servers return different
answers to the same query.

To answer your question, have all the servers return the same answer,
which contains all four addresses for abc.123.com. Dnsmasq will cache
that answer and round-robin the addresses when queried.


Cheers,

Simon.
Post by meenakshi sundaram
Hi All,
   
      I would like to know the behavior of dnsmasq in the following scenario
PC --- Dnsmasq-as-Forwarder-------- |------ DNS-Server1 { abc.123.com
---- 1.1.1.1, abc.123.com ---- 1.1.1.2}
                                                             |
                                                             |
                                                           
 |--------DNS-Server-2  { abc.123.com ---- 1.1.1.3, abc.123.com ----
1.1.1.4}
When PC sends the query for abc.123.com, Dnsmasq forwards queries to
both DNS-servers. Both servers sends the reply.
PC  receives only one reply with answer from either DNS-Server1 or
DNS-Server2.  it is expected as per design. 
I was expecting the dnsmasq-forwarder  to cache the replies/answers from
both servers( Server1's reply {abc.123.com ---- 1.1.1.1, 1.1.1.2}
Server2's reply {abc.123.com ---- 1.1.1.3, 1.1.1.4)} .
When i checked the cache of dnsmasq-forwarder, it only caches the first
reply from either DNS-Server1 or DNS-Server2, NOT both. 
So wondering, how to do the RoudRobin Load balancing among four
servers(1.1.1.1/2/3/4) which serves abc.123.com. 
 i checked the code. Looks like " the after  processing first reply, the
frec is freed, so dnsmasq can't cache the entries."
Could you explain? 
thanks
S.Meenakshisundaram
_______________________________________________
Dnsmasq-discuss mailing list
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Loading...