Imported Debian patch 1:1.05-8
[hcoop/zz_old/debian/djbdns.git] / debian / djbdns-man / tinydns-data.8
CommitLineData
b4588d5c
GP
1.TH tinydns-data 8
2
3.SH NAME
4tinydns-data \- data tool for tinydns
5
6.SH DESCRIPTION
7This is a reference page.
8For tutorial information, see the instructions for
9.br
10.B running a DNS server
11(http://cr.yp.to/djbdns/run-server.html).
12
13.B tinydns-data
14reads local DNS information
15from a file named
16.I data
17in the current directory.
18It creates
19.I data.cdb
20in a binary format designed for
21fast access by
22.BR tinydns (8).
23It may also create some other files
24with names beginning with
25.IR data .
26
27.B tinydns-data
28updates
29.I data.cdb
30atomically,
31so you can use it safely while
32.BR tinydns (8)
33is running.
34If anything goes wrong with the creation of
35.IR data.cdb ,
36.B tinydns-data
37stops and leaves the old
38.I data.cdb
39in place.
40
41.SH Data format
42The DNS information in
43.I data
44is a series of lines.
45There are several types of lines, as shown below.
46
47Each line starts with a special character
48and continues with a series of colon-separated fields.
49In some cases the fields may be omitted;
50however, all colons must be included except at the end of the line.
51Spaces and tabs at the end of a line are ignored.
52Blank lines are ignored.
53
54Each line contains a
55.I ttl
56(``time to live'')
57specifying the number of seconds that the line's DNS records may be cached.
58Beware that cache times below 300 seconds
59will be treated as 300 by some clients,
60and NS cache times below 2 seconds can cause lookup failures.
61You may omit
62.IR ttl ;
63.B tinydns-data
64will use default cache times,
65carefully selected to work well in normal situations.
66
67You may include a timestamp on each line.
68If
69.I ttl
70is nonzero (or omitted),
71the timestamp is a starting time
72for the information in the line;
73the line will be ignored before that time.
74If
75.I ttl
76is zero,
77the timestamp is an ending time (``time to die'')
78for the information in the line;
79.BR tinydns (8)
80dynamically adjusts
81.I ttl
82so that the line's DNS records are not cached for more than a few seconds
83past the ending time.
84A timestamp is an
85external TAI64 timestamp,
86printed as 16 lowercase hexadecimal characters.
87For example, the lines
88
89+www.heaven.af.mil:1.2.3.4:0:4000000038af1379
90+www.heaven.af.mil:1.2.3.7::4000000038af1379
91
92specify that
93.I www.heaven.af.mil
94will have address
95.I 1.2.3.4
96until time
97.I 4000000038af1379
98(2000-02-19 22:04:31 UTC)
99and will then switch to IP address
100.IR 1.2.3.7 .
101
102For versions 1.04 and above:
103You may include a client location on each line.
104The line is ignored for clients outside that location.
105Client locations are specified by
106.B %
107lines:
108
109%\fIlo\fR:\fIipprefix\fR
110
111means that IP addresses starting with
112.I ipprefix
113are in location
114.IR lo .
115.I lo
116is a sequence of one or two ASCII letters.
117A client is in only one location;
118longer prefixes override shorter prefixes.
119For example,
120
121 %in:192.168
122 %ex
123 +jupiter.heaven.af.mil:192.168.1.2:::in
124 +jupiter.heaven.af.mil:1.2.3.4:::ex
125
126specifies that
127.I jupiter.heaven.af.mil
128has address
129.I 192.168.1.2
130for clients in the
131.I 192.168.*
132network
133and address
134.I 1.2.3.4
135for everyone else.
136
137.SH Common data lines
138
139.RI \. fqdn\fR:\fIip\fR:\fIx\fR:\fIttl\fR:\fItimestamp\fR:\fIlo\fR
140
141Name server for our domain
142.IR fqdn .
143
144.B tinydns-data
145creates
146.IP
147an NS (``name server'') record
148showing
149.IR x .ns.\fIfqdn\fR
150as a name server for
151.IR fqdn ;
152.P
153.IP
154an A (``address'') record showing
155.I ip
156as the IP address
157of
158.IR x\fR.ns.\fIfqdn ;
159and
160.P
161.IP
162an SOA (``start of authority'') record for
163.I fqdn
164listing
165.IR x\fR.ns.\fIfqdn
166as the primary name server
167and hostmaster@\fIfqdn\fR
168as the contact address.
169.P
170
171You may have several name servers for one domain,
172with a different
173.I x
174for each server.
175
176.BR tinydns (8)
177will return only one SOA record per domain.
178
179If
180.I x
181contains a dot
182then
183.B tinydns-data
184will use
185.I x
186as the server name
187rather than
188.IR x\fR.ns.\fIfqdn .
189This feature is provided only for compatibility reasons;
190names not ending with
191.I fqdn
192will force clients to contact parent servers
193much more often than they otherwise would,
194and will reduce the overall reliability of DNS.
195You should omit
196.I ip
197if
198.I x
199has IP addresses assigned elsewhere in
200.IR data ;
201in this case,
202.B tinydns-data
203will omit the A record.
204.P
205Examples:
206
207 .panic.mil:1.8.7.55:a
208
209creates an NS record showing
210.I a.ns.panic.mil
211as a name server for
212.IR panic.mil ,
213an A record showing
214.I 1.8.7.55
215as the IP address of
216.IR a.ns.panic.mil ,
217and an SOA record for
218.IR panic.mil .
219
220 .panic.mil:1.8.7.56:dns2.panic.mil
221
222creates an NS record showing
223.I dns2.panic.mil
224as a name server for
225.IR panic.mil ,
226an A record showing
227.I 1.8.7.56
228as the IP address of
229.IR dns2.panic.mil ,
230and an SOA record for
231.IR panic.mil .
232
233 .panic.mil::a.ns.heaven.af.mil
234
235creates an NS record showing
236.I a.ns.heaven.af.mil
237as a name server for
238.IR panic.mil ,
239and an SOA record for
240.IR panic.mil .
241
242.RI & fqdn\fR:\fIip\fR:\fIx\fR:\fIttl\fR:\fItimestamp\fR:\fIlo\fR
243
244Name server for domain
245.IR fqdn .
246
247.B tinydns-data
248creates
249.IP
250an NS record
251showing
252.IR x\fR.ns.\fIfqdn
253as a name server for
254.IR fqdn
255and
256.P
257.IP
258an A record showing
259.I ip
260as the IP address
261of
262.IR x\fR.ns.\fIfqdn .
263.P
264
265If
266.I x
267contains a dot
268then it is treated specially; see above.
269
270You may have several name servers for one domain,
271with a different
272.I x
273for each server.
274
275Normally
276.I &
277is used
278for domains delegated by this server to child servers,
279while
280.I .
281is used for domains delegated to this server.
282.P
283Examples:
284
285 &serious.panic.mil:1.8.248.6:a
286
287creates an NS record showing
288.I a.ns.serious.panic.mil
289as a name server for
290.IR serious.panic.mil ,
291and an A record showing
292.I 1.8.248.6
293as the IP address of
294.IR a.ns.serious.panic.mil .
295
296 &serious.panic.mil:1.8.248.7:ns7.panic.mil
297
298creates an NS record showing
299.I ns7.panic.mil
300as a name server for
301.IR serious.panic.mil ,
302and an A record showing
303.I 1.8.248.7
304as the IP address of
305.IR ns7.panic.mil .
306
307.RI = fqdn\fR:\fIip\fR:\fIttl\fR:\fItimestamp\fR:\fIlo\fR
308
309Host
310.I fqdn
311with IP address
312.IR ip .
313
314.B tinydns-data
315creates
316.IP
317an A record showing
318.I ip
319as
320the IP address of
321.IR fqdn
322and
323.P
324.IP
325a PTR (``pointer'') record showing
326.I fqdn
327as
328the name of
329.IR d.c.b.a .in-addr.arpa
330if
331.I ip
332is
333.IR a.b.c.d .
334.P
335
336Remember to specify name servers for some suffix of
337.IR fqdn ;
338otherwise
339.BR tinydns (8)
340will not respond
341to queries about
342.IR fqdn .
343The same comment applies to other records described below.
344Similarly, remember to specify name servers for some suffix of
345.IR d.c.b.a .in-addr.arpa,
346if that domain has been delegated to you.
347.P
348Example:
349
350 =button.panic.mil:1.8.7.108
351
352creates an A record showing
353.I 1.8.7.108
354as the IP address of
355.IR button.panic.mil ,
356and a PTR record showing
357.I button.panic.mil
358as the name of
359.IR 108.7.8.1.in-addr.arpa .
360
361.RI + fqdn\fR:\fIip\fR:\fIttl\fR:\fItimestamp\fR:\fIlo\fR
362
363Alias
364.I fqdn
365with IP address
366.IR ip .
367This is just like
368.RI = fqdn\fR:\fIip\fR:\fIttl\fR
369except that
370.B tinydns-data
371does not create the PTR record.
372
373For versions 1.04 and above:
374.BR tinydns (8)
375returns addresses
376(from
377.I +
378or
379.I =
380or
381.I @
382or
383.I .
384or
385.I &
386lines)
387in a random order in the answer section.
388If there are more than 8 records,
389it returns a random set of 8.
390.P
391Example:
392
393 +button.panic.mil:1.8.7.109
394
395creates an A record showing
396.I 1.8.7.109
397as another IP address for
398.IR button.panic.mil .
399
400.RI @ fqdn\fR:\fIip\fR:\fIx\fR:\fIdist\fR:\fIttl\fR:\fItimestamp\fR:\fIlo\fR
401
402Mail exchanger for
403.IR fqdn .
404
405.B tinydns-data
406creates
407.IP
408an MX (``mail exchanger'') record
409showing
410.IR x\fR.mx.\fIfqdn
411as a mail exchanger for
412.I fqdn
413at distance
414.I dist
415and
416.P
417.IP
418an A record showing
419.I ip
420as the IP address
421of
422.IR x\fR.mx.\fIfqdn .
423.P
424You may omit
425.IR dist ;
426the default distance is 0.
427
428If
429.I x
430contains a dot
431then it is treated specially; see above.
432
433You may create several MX records for
434.IR fqdn ,
435with a different
436.I x
437for each server.
438Make sure to arrange for the SMTP server on each IP address
439to accept mail for
440.IR fqdn .
441.P
442Example:
443
444 @panic.mil:1.8.7.88:mail.panic.mil
445
446creates an MX record showing
447.I mail.panic.mil
448as a mail exchanger for
449.I panic.mil
450at distance 0, and an A record showing
451.I 1.8.7.88
452as the IP address of
453.IR mail.panic.mil .
454
455.RI # comment
456
457Comment line. The line is ignored.
458
459.SH Uncommon data lines
460
461.RI - fqdn\fR:\fIs\fR:\fIttl\fR:\fItimestamp\fR:\fIlo\fR
462
463For versions 1.04 and above:
464This type of line is used by
465programs that automatically edit
466.B +
467lines in
468.I data
469to temporarily exclude addresses of overloaded or dead machines.
470The line is ignored.
471
472.RI ' fqdn\fR:\fIs\fR:\fIttl\fR:\fItimestamp\fR:\fIlo\fR
473
474TXT (``text'') record for
475.IR fqdn .
476.B tinydns-data
477creates a TXT record for
478.I fqdn
479containing the string
480.IR s .
481You may use octal
482.RI \ nnn
483codes
484to include arbitrary bytes inside
485.IR s ;
486for example,
487.RI \ 072
488is a colon.
489
490.RI ^ fqdn\fR:\fIp\fR:\fIttl\fR:\fItimestamp\fR:\fIlo\fR
491
492PTR record for
493.IR fqdn .
494.B tinydns-data
495creates a PTR record for
496.I fqdn
497pointing to the domain name
498.IR p .
499
500.RI C fqdn\fR:\fIp\fR:\fIttl\fR:\fItimestamp\fR:\fIlo\fR
501
502CNAME (``canonical name'') record for
503.IR fqdn .
504.B tinydns-data
505creates a CNAME record for
506.I fqdn
507pointing to the domain name
508.IR p .
509
510Don't use
511.RI C fqdn
512if there are any other records for
513.I fqdn
514Don't use
515.RI C fqdn
516for common aliases;
517use
518.RI + fqdn
519instead.
520Remember the wise words of Inigo Montoya:
521``You keep using CNAME records.
522I do not think they mean what you think they mean.''
523
524.RI Z fqdn\fR:\fImname\fR:\fIrname\fR:\fIser\fR:\fIref\fR:\fIret\fR:\fIexp\fR:\fImin\fR:\fIttl\fR:\fItimestamp\fR:\fIlo\fR
525
526SOA record for
527.I fqdn
528showing
529.I mname
530as the primary name server,
531.I rname
532(with the first
533.I .
534converted to
535.IR @ )
536as the contact address,
537.I ser
538as the serial number,
539.I ref
540as the refresh time,
541.I ret
542as the retry time,
543.I exp
544as the expire time, and
545.I min
546as the minimum time.
547.IR ser ,
548.IR ref ,
549.IR ret ,
550.IR exp ,
551and
552.I min
553may be omitted;
554they default to, respectively,
555the modification time of the
556.I data
557file,
55816384 seconds,
5592048 seconds,
5601048576 seconds, and
5612560 seconds.
562
563.RI : fqdn\fR:\fIn\fR:\fIrdata\fR:\fIttl\fR:\fItimestamp\fR:\fIlo\fR
564
565Generic record for
566.IR fqdn .
567.B tinydns-data
568creates a record of type
569.I n
570for
571.I fqdn
572showing
573.IR rdata .
574.I n
575must be an integer between 1 and 65535;
576it must not be 2 (NS), 5 (CNAME), 6 (SOA), 12 (PTR), 15 (MX), or 252 (AXFR).
577The proper format of
578.I rdata
579depends on
580.IR n .
581You may use octal
582.RI \ nnn
583codes
584to include arbitrary bytes inside
585.IR rdata .
586
587.SH Wildcards
588
589.I tinydns
590supports wildcards of the form
591.IR *.fqdn .
592Information for
593.I *.fqdn
594is provided for every name ending with
595.IR .fqdn ,
596.I except
597names that have their own records
598and names that are covered by more specific wildcards.
599
600For example, the lines
601
602 +pink.floyd.u.heaven.af.mil:1.2.3.4
603 +*.u.heaven.af.mil:1.2.3.200
604
605have the same effect as
606
607 +pink.floyd.u.heaven.af.mil:1.2.3.4
608 +joe.u.heaven.af.mil:1.2.3.200
609 +bill.u.heaven.af.mil:1.2.3.200
610 +floyd.u.heaven.af.mil:1.2.3.200
611 +ishtar.u.heaven.af.mil:1.2.3.200
612 +joe.bob.u.heaven.af.mil:1.2.3.200
613 +sally.floyd.u.heaven.af.mil:1.2.3.200
614 +post.pink.floyd.u.heaven.af.mil:1.2.3.200
615
616and so on.
617
618As another example, the lines
619
620 +pink.floyd.u.heaven.af.mil:1.2.3.4
621 @*.u.heaven.af.mil::mail.heaven.af.mil
622
623have the same effect as
624
625 +pink.floyd.u.heaven.af.mil:1.2.3.4
626 @joe.u.heaven.af.mil::mail.heaven.af.mil
627 @bill.u.heaven.af.mil::mail.heaven.af.mil
628 @floyd.u.heaven.af.mil::mail.heaven.af.mil
629 @ishtar.u.heaven.af.mil::mail.heaven.af.mil
630 @joe.bob.u.heaven.af.mil::mail.heaven.af.mil
631 @sally.floyd.u.heaven.af.mil::mail.heaven.af.mil
632 @post.pink.floyd.u.heaven.af.mil::mail.heaven.af.mil
633
634and so on.
635Notice that the wildcard does not apply to
636.IR pink.floyd.u.heaven.af.mil ,
637because that name has its own records.
638
639.SH A typical data file:
640
641 =lion.heaven.af.mil:1.2.3.4
642 @heaven.af.mil:1.2.3.4
643 @3.2.1.in-addr.arpa:1.2.3.4
644
645 =tiger.heaven.af.mil:1.2.3.5
646 \.heaven.af.mil:1.2.3.5:a
647 \.3.2.1.in-addr.arpa:1.2.3.5:a
648
649 =bear.heaven.af.mil:1.2.3.6
650 \.heaven.af.mil:1.2.3.6:b
651 \.3.2.1.in-addr.arpa:1.2.3.6:b
652
653 =cheetah.heaven.af.mil:1.2.3.248
654 =panther.heaven.af.mil:1.2.3.249
655
656Here is the same information in BIND zone-file format
657with the two zones merged:
658
659 heaven.af.mil. 2560 IN SOA a.ns.heaven.af.mil. hostmaster.heaven.af.mil. ...
660 heaven.af.mil. 259200 IN NS a.ns.heaven.af.mil.
661 heaven.af.mil. 259200 IN NS b.ns.heaven.af.mil.
662 heaven.af.mil. 86400 IN MX mx.heaven.af.mil.
663
664 3.2.1.in-addr.arpa. 2560 IN SOA a.ns.3.2.1.in-addr.arpa. hostmaster.3.2.1.in-addr.arpa. ...
665 3.2.1.in-addr.arpa. 259200 IN NS a.ns.3.2.1.in-addr.arpa.
666 3.2.1.in-addr.arpa. 259200 IN NS b.ns.3.2.1.in-addr.arpa.
667 3.2.1.in-addr.arpa. 86400 IN MX mx.3.2.1.in-addr.arpa.
668
669 4.3.2.1.in-addr.arpa. 86400 IN PTR lion.heaven.af.mil.
670 lion.heaven.af.mil. 86400 IN A 1.2.3.4
671 mx.heaven.af.mil. 86400 IN A 1.2.3.4
672 mx.3.2.1.in-addr.arpa. 86400 IN A 1.2.3.4
673
674 5.3.2.1.in-addr.arpa. 86400 IN PTR tiger.heaven.af.mil.
675 tiger.heaven.af.mil. 86400 IN A 1.2.3.5
676 a.ns.heaven.af.mil. 259200 IN A 1.2.3.5
677 a.ns.3.2.1.in-addr.arpa. 259200 IN A 1.2.3.5
678
679 6.3.2.1.in-addr.arpa. 86400 IN PTR bear.heaven.af.mil.
680 bear.heaven.af.mil. 86400 IN A 1.2.3.6
681 b.ns.heaven.af.mil. 259200 IN A 1.2.3.6
682 b.ns.3.2.1.in-addr.arpa. 259200 IN A 1.2.3.6
683
684 248.3.2.1.in-addr.arpa. 86400 IN PTR cheetah.heaven.af.mil.
685 cheetah.heaven.af.mil. 86400 IN A 1.2.3.248
686
687 249.3.2.1.in-addr.arpa. 86400 IN PTR panther.heaven.af.mil.
688 panther.heaven.af.mil. 86400 IN A 1.2.3.249
689
690.SH Design notes
691The
692.I data
693format is very easy for programs to edit,
694and reasonably easy for humans to edit,
695unlike the traditional zone-file format.
696
697.B tinydns-data
698could support a name wherever an IP address is required;
699it would look up the name in DNS and use the resulting address.
700This would reliably track changes in offsite IP addresses
701if the database were rebuilt periodically.
702
703.SH SEE ALSO
704tinydns(8)
705
706http://cr.yp.to/djbdns.html