To use round robin, each web server must have its own public IP address. A common scenario is to use network address translation and port forwarding at the firewall to assign each web server a public IP address while internally using a private address.
This example from the DNS zone definition for foo.com assigns the same name to each of the three web servers, but uses different IP addresses for each:
;
; Domain database for foo.com
;
foo.com. IN SOA ns1.foo.com. hostmaster.foo.com. (
2006032801 ; serial
10800 ; refresh
3600 ; retry
86400 ; expire
86400 ; default_ttl
)
;
; Name servers
;
foo.com. IN NS ns1.foo.com.
foo.com. IN NS ns2.foo.com.
;
; Web servers
; (private IPs shown, but public IPs are required)
;
www IN A 10.1.1.11
www IN A 10.1.1.12
www IN A 10.1.1.13
When DNS gets a request to resolve the name www.foo.com, it will return one IP address, then a different address for the next request and so on. Theoretically, each web server will get one third of the web traffic. Due to DNS caching and because some requests may use more resources that others, the load will not be shared equally. However, over time it will come close.
This is a very good example of Load balancing using DNS server (Round Robin)
2 comments:
Found this howto which I think will be useful for someone.
http://jackal777.wordpress.com/2011/03/05/ubuntu-10-10-bind-round-robin-howto/
Really good article
Post a Comment