#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    2
    Rep Power
    0

    DNS Listerd Order


    I have 2 webservers on 2 different networks. Each is runing a webserver on the same box. I am trying to setup one a primary and one as a secondary. I want to use the name servers to do this. I have a domain name that has both of the nameservers listed in this order.

    ns1.serverone.com
    ns1.servertwo.com

    I have a zone file for the domain name on each nameserver. The first name server zone file has a TTL of 30 min and the second nameserver zone file has a TTL of 15 min. This way the primary will only be down for 30 min before the entry expires and the clients machine does another lookup. If the primary is down (nameserverone) then it will go to nameservertwo and be running on the backup.

    This is working fine except that the domain name wants to default on the ns1.servertwo.com instead of ns1.serverone.com when they are both up. If servertwo is down it will choose serverone fine.

    I am wondering if I just need to change the order on the domain name or if there may be another reason why it defaults to servertwo.

    thanks in advance
    cwilli
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,638
    Rep Power
    4247
    One point to clarify here, there is NO priority when doing DNS lookups. The name resolver will pick a nameserver at random and query it first. This means, it could pick either primary or secondary NS and query it first. If it doesn't respond, then will it try another one and so on. In your case, since you only have two nameservers, this means it'll try the other one, only if the first one that it picked at random fails.

    >> I am wondering if I just need to change the order on the domain name or if there may be another reason why it defaults to servertwo.
    You can't do a thing about it, because of the above explanation. That's how DNS works.
    Last edited by Scorpions4ever; July 13th, 2003 at 03:35 AM.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    2
    Rep Power
    0
    I have it figured out. The ns1.nameserverone.com was not setup correctly and sometimes would not give out info when queried. I found this out when I shut off nameserver2 for a long period of time.

    I have done 3-4 failover tests by shutting off the 1st server and allowing the query to fail to the 1st server then gets picked up by the second. After it has failed over I only had to restart the 1st server again and after the TTL expires it chooses the first name server again.

    Every network I have tested this on queried them in the listed order I have setup on the domain name. Even with other domain names that I have setup normally I have never seen choose the nameserver in 'random'. It always go for the first listed and then the second. Has anyone else known this to not be true?
  6. #4
  7. Full Access
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jun 2000
    Location
    London, UK
    Posts
    2,019
    Rep Power
    17
    Even with other domain names that I have setup normally I have never seen choose the nameserver in 'random'. It always go for the first listed and then the second. Has anyone else known this to not be true?
    When resolving DNS queries, clients will pick one of the authorative servers for a domain at random and send it their query. The notion of "primary" and "secondary" DNS servers is misleading - the sense of priority that exists, for example, with MX records, does not exist with regards to authorative servers.

    An example - my two nameservers (running djbdns) have logfiles roughly the same sizes. This is one machine with two IP addresses. If the primary/secondary priority notion were true, then the secondary would not have any log entries at all, since the machine always has those two IP addresses assigned to it - i.e. the "primary" has never been unavailable.
    Alex
    (http://www.alex-greg.com)

IMN logo majestic logo threadwatch logo seochat tools logo