[Dnsmasq-discuss] load balancing using round robin dns

AJ Weber aweber at comcast.net
Tue Sep 29 22:46:07 BST 2009

Yeah, you're probably better installing something like pen or another 
readily-available load-balancer.  Some of them are very lightweight, but 
would require you to send all traffic back to your controller (set 
server.test.local as an alias of controller.test.local), and then the 
load-balancer would redirect to the individual servers that are available.

It would also solve the problem you might run into if one of the embedded 
servers is down, dnsmasq (or any pure DNS round-robin implementation) will 
still reply to every 3rd client's request with the down server's address. 
And as Simon says (no pun intended), that client's browser or OS may cache 
the resolution and not try any of the other servers...they'll just think the 
website is completely down.

Not a lot of work to change-around and should be much more robust.

I love dnsmasq, and have used it on various platforms for a long time, but 
you should look to a different solution for this kind of load-balancing.


----- Original Message ----- 
From: "Simon Kelley" <simon at thekelleys.org.uk>
To: "Melissa Lim" <mlim at bbn.com>
Cc: <dnsmasq-discuss at lists.thekelleys.org.uk>
Sent: Tuesday, September 29, 2009 4:17 PM
Subject: Re: [Dnsmasq-discuss] load balancing using round robin dns

> 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......
> Cheers,
> Simon.
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss

More information about the Dnsmasq-discuss mailing list