Randomize DNS servers

Glenn Satchell glenn.satchell at uniq.com.au
Wed Jun 9 00:22:29 UTC 2010


On 06/09/10 07:32, Alan Buxey wrote:
> Hi,
>
>> I have several DNS servers that are lower performance than I would
>> like.  Until such time as I can afford to replace them, is there a way
>> in DNS (serving around 2000 clients) that I can assign a group of DNS
>> servers, and assign them randomly?  I.E., one user gets DNS1&  DNS2,
>> another clent gets DNS3&  DNS1, and the next gets DNS3&  DNS2.
>
> regarding basic client stuff, you could do this with DHCP classes...so
> different networks or bits of network get told to use different addresses.
>
> if doing this purely in DNS and dealing with masters etc you could use
> views in BIND.   not sure how low spec the servers are but 2000 clients
> doesnt sound like much.  what else are these servers doing? what
> version of BIND are you running on them? is there some other issue such
> as lookups?
>
> alan

Here's one way to do it using classes, and selecting on the last byte of 
the MAC address. This should give a reasonable distribution:

# default list of dns servers for mac ending in 6, 7, 8, 9
option domain-name-servers
     dns1.example.com, dns2.example.com;

class "dns-group-1" {
     match if suffix(hardware, 1) = 0
           or suffix(hardware, 1) = 1
           or suffix(hardware, 1) = 2;
     option domain-name-servers
         dns2.example.com, dns3.example.com;
}

class "dns-group-2" {
     match if suffix(hardware, 1) = 3
           or suffix(hardware, 1) = 4
           or suffix(hardware, 1) = 5;
     option domain-name-servers
         dns3.example.com, dns1.example.com;
}

Note however that some (most Linux/Unix?) DNS clients are smarter than 
this and will query all configured dns servers and tend to use the one 
that gives the fastest response. They can also switch to a different dns 
server if the one they were using gets too slow. So with a large enough 
client base (and 2000 clients looks to be well and truly large enough) 
they will tend to distribute themselves across the servers anyway. So, 
just setting a default of all three might still be the best way to do it.

-- 
regards,
-glenn




More information about the dhcp-users mailing list