Penguin
Blame: DNSBestPractices
EditPageHistoryDiffInfoLikePages
Annotated edit history of DNSBestPractices version 9, including all changes. View license author blame.
Rev Author # Line
6 MikeMachuidel 1 !!!SOA
2 It's very important to get your SOA ResourceRecord correct for a zone.
3
4 !!Serial
5 Use YYYYmmddHHxx as the serial for your zone. You will forget to update the serial sooner or later, and having a format where it's obvious that you've forgotten makes it easy to notice. This convention is very popular around the internet.
6
7 !! Refresh
8 The refresh value is how often secondaries will poll the primary to check to see if there are new changes. Values for this should be between 3600 (1 hour) to about 43200 seconds (12 hours). We recommend 3600. Secondaries refreshing causes a miniscule amount of traffic on the network, and thus the extra load of servers checking every hour is vanishingly small.
9
10 !! Retry
11 The retry value is how often secondaries will try again if a refresh failed. Values in about 120s to 7200s are reasonable. Depending on how important it is that your information is correct and up to date, I'd recommend either 600 (10 minutes) or 3600 (1 hour).
12
13 !! Expire
9 NickAndrew 14 The expire value is how long a secondary will continue to serve information if it has been unable to contact the primary name server. Once this time has expired the server will no longer return authoritative results and will be considered lame.
6 MikeMachuidel 15
16 A good value for this is about 1209600 (2 weeks) to 2419200 seconds (4 weeks). In general setting this too low will cause your secondary to become lame prematurely, and if your primary is down for an extended outage, you want your secondary to continue to server records, however if the secondary for some reason is unable to contact your primary you want the secondary to stop sending incorrect stale information to clients. We recommend a value of 2419200 seconds (4 weeks).
17
18 !! Negative cache TTL / Minimum TTL.
9 NickAndrew 19 The last value in the SOA is the minimum ttl. This was originally what the minimum TTL is for records returned from this zone, if no ttl was specified then this value was used, hence it is sometimes incorrectly referred to as the "Default TTL" for a zone. More recent [RFC]'s suggest you use the $TTL directive for this. Most modern bind implementations will moan if a $TTL is not there.
6 MikeMachuidel 20
21 Most modern DNS implementations are willing to give out replies with the TTL being lower than this value so it's use as it was originally defined is no longer that important.
22
23 However, name servers that support caching [NXDOMAIN] will use this value as the amount of time they will cache the result for. Hence it being called the "Negative cache TTL".
24
25 RFC:2308 recommends 3600s (1 hour) to 86400s (1 day). We suggest that you use 86400.
26
27 !!!Names
28 Try to have names for services, then if services are moved to another machine you can update the name for the service without having to reconfigure all the clients to point at another machine. If machines are configured to use a search path correctly then applications that search for a machine (such as "news"), will function without configuration.
29
30 Some often used names are:
31 |__Name__|__Service__
32 |cvs|cvs server (viewcvs available over http, pserver and ssh access)
33 |ftp|ftp server
34 |www|web server
35 |mail| Smarthost for internal clients/MX
36 |MX''n''|Machine for external reception of mail
37 |NS''n''|Nameserver. Note that DJBDNS prefers(?) nameservers be called a.ns and b.ns
38 |proxy|web proxy
39 |[wpad|WPAD]|Proxy autodiscovery
40 |pop|v server used for [MUA]'s to check mail on
41 |imap
42 |news| news server
43 |dhcp-''n''|[DHCP] assigned leases
44
9 NickAndrew 45 All IP addresses that you are authoritative for should be given reverse lookups, even DHCP ranges, where you can use the $GENERATE directive.
6 MikeMachuidel 46
47 All IP's that have a reverse lookup should have a forward lookup for the same name that returns the same IP.
48
49 !!! Names
50
51 Remember the . at the end of the domain name. Remember that the NS, MX, CNAME, DNAME records all require a name on the right hand side, and will not accept an IP address. Consider running a [script|http://www.wlug.org.nz/archive/validate_zones] from cron to check for blindingly obvious mistakes.
52
53 Avoid _ / and % in names. _ for instance is valid in [DNS] but is not valid as a hostnames.
54
55 Try to give a machine the least number of names possible. While this contracts the above where you should have one name per service (since one machine often has multiple services), at least reusing the name for a service is a good idea. For instance, if you host 5 domains, have them all use "ns.example.com" as their primary nameserver.
56
57 Try and add [SPF] records for as many names as possible. In particular if a domain will never send mail set it's SPF to
58 foo.example.com IN TXT "v=spf1 -all"
9 NickAndrew 59 so that no-one will ever accept mail that claims to be from that domain.
6 MikeMachuidel 60
9 NickAndrew 61 !!!Authoritative nameservers
62 If you are running a nameserver in authoritative mode, avoid using it as a nameserver for stub resolvers. (i.e, don't allow recursion for any host through it). This avoids problems where the nameserver configuration is out of date, and prevents issues with people intentionally (or unintentionally) poisoning your authoritative nameserver.
6 MikeMachuidel 63
64 For best performance out of a DNS server, try and use one name for it. ie, call your nameserver "ns1.example.com" in ALL of your zones. Also try to make sure that TTL's for the NS records, and A records on your nameserver, and any other related glue are at least 432000 seconds (5 days). This makes sure that if anything goes wrong higher up in the heirachy, your customers can still get to your site for approximately 2 days giving you time to get the issue fixed. Since queries will still flow directly to your nameserver, you will be able to return other names (such as "www") directly even if the higher up zones are having issues.
65
9 NickAndrew 66 You may want to use the same idea for MX records. Be aware that these make it difficult to migrate nameservers in the future, so remember to turn your TTL's down later.
7 StephenShirley 67
9 NickAndrew 68 If you want to check to see if a server thinks it's authoritative for a zone, simply do
7 StephenShirley 69 dig +norecurse -t ns domain.tld @nameserver
9 NickAndrew 70 If the flags line in the header of the output contains 'aa' (for authoritative answer), then the nameserver is authoritative for that domain.
6 MikeMachuidel 71
72 !!!Caching nameservers
8 DanielLawson 73 For nameservers that are supposed to handle recursive lookups for stub resolvers, limit the IP ranges that can issue requests aggressively. People who can do recursive queries through your nameservers can end up with bad entries being cached.
74
75 !!!Authoritative and Caching nameservers
76 The general consensus is "don't". You shouldn't run a recursive nameserver and an authoritative nameserver in the same process, due to the possibility of cache poisoning. DJB has a relatively clear [explanation|http://cr.yp.to/djbdns/separation.html].
77
6 MikeMachuidel 78
79 ----
80 See also: NamedNotes
81
82 ----
83 Part of CategoryDns, CategoryBestPractices
The following authors of this page have not agreed to the WlugWikiLicense. As such copyright to all content on this page is retained by the original authors.
  • MikeMachuidel
  • StephenShirley
The following authors of this page have agreed to the WlugWikiLicense.

PHP Warning

lib/plugin/WlugLicense.php (In template 'html'):99: Warning: Invalid argument supplied for foreach()

lib/plugin/WlugLicense.php (In template 'html'):111: Warning: in_array() [<a href='function.in-array'>function.in-array</a>]: Wrong datatype for second argument

lib/plugin/WlugLicense.php (In template 'html'):111: Notice: Undefined variable: ignore_authors