I would like to set up load balancing for my website using DNS round robin.

My DNS is managed by my own CentOS 6 server running bind.

I added the following into my zone file:

@                               IN      NS              ns1.mydns.ch.
@                               IN      NS              ns2.mydns.ch. 
@                               IN      MX      10      mail1.mydomain.ch.
@                               IN      A     
                                IN      A     
www                             IN      CNAME           mydomain.ch.

However, when I run nslookup mydomain.ch I still only get the first IP.

What I would like to see is both IPs, with the order randomized.

How can I modify my zone file to accomplish this?

  • So the records are correct, the issue was I was editing the wrong file, I had to edit the signed file since we got DNSSEC. – user788171 Nov 21 '14 at 18:48

The two A-records seem to be correct. That's the way to do rounud-robin.

Have you increased the SOA serial number, reloaded the zone and has it propagated to the slave? For testing it's best to avoid any intermediate nameservers and query the primary NS directly:

dig a mydomain.ch. @ns1.mydns.ch.

That will talk directly to your nameserver. If you use just a plan nslookup or dig without specifying the NS it will probably talk to your local NS that may do caching and not return the most recent data.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.