dns load balancing config (SRV)

David De Maeyer bioman226 at yahoo.fr
Mon Apr 24 13:32:09 UTC 2006

Hi *,

I have a question related to DNS load balancing / round-robin. I just installed Bind 9 on one of our FreeBSD boxes (FreeBSD 6.x). This topic is -I know- discussed on regular basis on this mailing-list but a few things still remain unclear to me. I am currently configuring Bind and have a few questions.

Our domain, say, mydomain.com, is presently registered at our net provider on their DNS server, say, ns.myprovider.com.

We have the following server, already registered at ns.mydomain.com and on which I have installed Bind 9:

ns.mydomain.com (

And some web servers, not yet registered:

www1.mydomain.com (
www2.mydomain.com (
www3.mydomain.com (

The web servers www1, www2 and www3 are destinated to serve the same content. That said, I of course planned on sharing the load between www1, www2 and www3 through www.mydomain.com with some sort of load balancing system (DNS load balancing, NAT, software like PLB, etc.)

DNS load balancing being relatively easy to implement, I chose to go for that solution.3 Unfortunately, our provider's DNS doesn't support DNS load balancing. However a solution -I hope- would consist in registering the subdomain www.mydomain.com at our provider. They could then forward any request on www.mydomain.com to our "local" DNS server; the one I am trying to set up. Correct me if I am wrong.

Assuming that the above is correct...

Despite googling quite a lot and reading (some of the) Bind docs, I am still quite unsure about my configuration. I would start with the following configuration files:


options {
        directory       "/etc/namedb";
        pid-file        "/var/run/named/pid";
        dump-file       "/var/dump/named_dump.db";
        statistics-file "/var/stats/named.stats";
        listen-on       {; };
zone "." {
        type hint;
        file "named.root";
zone "0.0.127.IN-ADDR.ARPA" {
        type master;
        file "master/localhost.rev";
zone "" {
        type master;
        file "master/localhost-v6.rev";
zone "www.mydomain.com" {
        type master;
         file "master/zone.www.mydomain.com.db";

Then master/zone.www.mydomain.com.db:

$TTL 14400
 @ SOA     IN ns.mydomain.com. me.mymail.com.  (
  www.mydomain.com.   14400   IN      NS      ns.mydomain.com.

www.mydomain.com. 60 IN A
www.mydomain.com. 60 IN A 
www.mydomain.com. 60 IN A

This however won't be flexible enough as I would like to be able to define some weights in order to efficiently balance the load on an heterogenous set of servers. So I looked at the services record (SRV) and was wondering if the following configuration would then do the trick.

master/zone.www.mydomain.com.db (named.conf remains the same as above):

$origin mydomain.com.
@ SOA ns.mydomain.com me.mymail.com. ( // no IN ?
NS ns.mydomain.com
NS ns.myprovider.com
_http._tcp. SRV 0 1 80 www1.mydomain.com.
SRV 0 1 80 www2.mydomain.com.   // 25 % load
SRV 0 1 80 www2.mydomain.com.    // 25 % load
SRV 0 2 80 www3.mydomain.com.    // 50 % load
SRV 1 0 80 failover.mydomain.com.    // for the example...
ns A
www1 A
 www2 A
www3 A
failover A    // there for the example...
*._tcp          SRV  0 0 0 .
*._udp          SRV  0 0 0 .

Now this looks almost too simple to be 100% correct and I kind of have the idea that I might have mixed a couple of things here. For example, do I need to have a reverse zone file for www.mydomain.com? So I would appreciate any comments and corrections before I go for the real test... ;-))

In advance, thank you.


More information about the bind-users mailing list