[Dnsmasq-discuss] load balancing using round robin dns

Simon Kelley simon at thekelleys.org.uk
Tue Sep 29 21:17:35 BST 2009

Melissa Lim wrote:
> Hello:
> I'm trying to get Round Robin DNS with dnsmasq working on my embedded system.  
> But it's not quite working.  I have 4 boards (1 controller and 3 web servers) in 
> my system each with a static IP address.  I have dnsmasq running on the 
> controller board and lighttpd (web server) running on the 3 web server boards.  
> In my /etc/hosts file I have:
>    controller.test.local
>    server.test.local
>    server.test.local
>    server.test.local
> I've added the controller board's IP address to my laptop's DNS adresses, so 
> when I access server.test.local from my web browser on my laptop, I see my test 
> web page.  
> Each time I access the web page, I'd like for dnsmasq to load balance the 
> request to the 3 web servers in a round robin fashion.  Is this supported?  How 
> do I know which web server is actually being used?  Is this information provided 
> in a certain mode?  I'm running in daemon mode and I see the following:
> dnsmasq: query[A] server.test.local from
> dnsmasq: /etc/hosts server.test.local is
> dnsmasq: /etc/hosts server.test.local is
> dnsmasq: /etc/hosts server.test.local is

That's expected: dnsmasq will supply all three addresses for
server.test.local each time it's queried. It implements round-robin by
shuffling the order in which the addresses appear in the reply - the
resolver library used by the web browser will always take the first one.
> This infomation is NOT provided everytime the web page is accessed - only when 
> it switches web server.  Round robin does appear to be working, but not for 
> every access.  How do I set it up so that it occurs for every access?  Is the 
> load balancing feature doing a redirect or is the data always going through the 
> controller board?  

Probably the the name->address mapping is being cached in the browser,
this is a limitation of DNS based load-balancing.

> Also, is there a way to have load balancing occur when I access the IP address 
> of the controller?  (i.e. have look like 
> http://server.test.local and access the web server boards).  Maybe via the 
> dnsmasq config file???

Dnsmasq can't help you here: it's only doing DNS, and can't influence
anything that doesn't do a DNS lookup. There are other ways of doing
load-balancing, via fancy switches or reverse-proxies, but I know
nothing about them, other than that they exist. There's probably an
O'Reilly book that will help......



More information about the Dnsmasq-discuss mailing list