Thursday, January 15, 2009

DNS Round Robin

Round robin DNS is a method of maintaining high-availability and fault tolerance with the help DNS server . RrD can also be thought as poor man's clustering in a very loose sense , though useful it has it's disadvantages also .For more on the topic refer to this wikipedia's page.

SCENARIO

Now please allow me to do some ASCII art

_
10.0.0.1 (web.example.com) | example.com
10.0.0.2 (web.example.com) |-------> DNS <<----->> Client
10.0.0.3 (web.example.com) |

(Wow what a magnificent piece of art )
As is depicted in the above diagram the DNS server has authority for example.com


I implemented Round robin DNS using bind9 and Ubuntu Server 8.10 but it can easily be implemented on any other Linux systems


IMPLEMENTATION

BEFORE

Before multiple duplicate servers for www.example.com we had just a single server for www.example.com and the zone file for example.com looked something like this.

Snippet from the zone file of example.com

www.example.com. IN A 10.0.0.1


AFTER


Now to share the load on the web server of example.com across three servers simply define the define multiple A records with the same name and different IPs in the zone file as in the example below.


www.example.com. IN A 10.0.0.1
www.example.com. IN A 10.0.0.2
www.example.com. IN A 10.0.0.3


The DNS will deliver all the IP addresses defined, the first IP address in the list will be in a default round robin (controlled by the rrset 'named.conf' directive). The WEB servers must all be exact replicas of each other in this scenario.


You can control the order of RR that BIND supplies in response to queries by use of a rrset-order option which works for any set of equal records. The default behaviour is defined to be random-cyclic - a random selection of the initial order thereafter cyclic (round-robin)




No comments: