Remove lfs-uefi.txt symlink
[linux_from_scratch_hints.git] / PREVIOUS_FORMAT / djbdns.txt
blob8e55a7f1d069b3d10d33050a0d85d6bb65e9c8ab
1 TITLE:          djbdns DNS Server
2 LFS VERSION:    any
3 AUTHOR:         Richard Lightman <richard@reika.demon.co.uk>
5 SYNOPSIS:
6         djbdns is a collection of domain name service tools. These tools are a robust, secure and fast alternative to BIND.
8 HINT:
10 Limitation of this hint
11 =======================
13 I have a small local network using djbdns. Caching and reverse
14 resolution work fine inside it, but are not visible from the
15 outside. In this hint, I have explained how to set up local dns
16 servers. The instructions for setting up a name server that will
17 answer queries from the internet are in the full instructions,
18 but not in this HINT.
20 It looks simple enough, but as I cannot test it, I will not
21 write it up. If you are setting up a dns server with real
22 ip adresses then read:
24 The Full Documentation
25 http://cr.yp.to/daemontools.html
26 http://cr.yp.to/djbdns.html
28 The documentation for djbdns is available as a separate
29 tarball. See this installation notes below.
31 I have put the html documentation trees for daemon tools
32 (and ucpsi-tcp) into tarballs in the same style as the ones
33 for djbdns. I have found there would be trouble distributing
34 them. I am working on this, and a future version of this hint
35 will include a script to make these tarballs. (DJB wants the
36 modification dates to remain intact so it is easy to recognize
37 old documentation. My script modifies some of the hyperlinks
38 to point back to his site instead of non-existant files on
39 the local machine. This changes the dates and so would break
40 the terms of distribution.) A future version of this hint will
41 contain a script to prepare these documentation tarballs.
44 Selecting the software
45 ======================
47 You could use BIND. I had difficulty compiling it, had real
48 trouble understanding how it was configured, and I did not
49 like the frequency of security patches for it. It is possible
50 to reduce the chances of intrusion by running bind in a chroot
51 environment. Have fun working out how to do that. BIND also
52 has some exciting ideas about allowing spoofing.
54 There are several dns programs in djbdns. They are picky about
55 which external servers they use to reduce the ease of spoofing.
56 They all run chrooted. They are all set for high availability -
57 if one crashes, it will be restarted (at a limited rate to
58 prevent some DOS attacks). There is a prize for the first person
59 to publicly report a verifiable security hole in the latest
60 version of djbdns.
62 The djbdns package contains several types of dns server. If
63 you are doing something strange, check the full documentation.
64 For a single machine, the right answer is probably dnscache.
65 To handle more than one, at least one will need tinydns. Any
66 or all of them may benefit from dnscache as well.
68 dnscache:
69 Uses external servers to resolve dns queries, and keeps the
70 results to speed up future queries.
72 tinydns:
73 Can handle dns and reverse dns queries, for some local networks,
74 and query external servers for evrything else.
76 daemontools:
77 A collection of tools for managing UNIX services. They are
78 required for djbdns.
81 Installing daemontools
82 ======================
84 Unpack sources: http://cr.yp.to/daemontools/daemontools-0.70.tar.gz
86   echo /usr > conf-home
87   make
88   make setup check
89   mkdir -p -m 555 /var/service
91 Please do not delete the source tree yet. When you a confident
92 that things are working, please mail D. J. Bernstein's site
93 so that he will know what sort of systems can run his software:
95    ( echo 'First M. Last'; cat VERSION systype \
96    direntry.h fork.h hasflock.h hasmkffo.h hassgact.h \
97    hasshsgr.h haswaitp.h iopause.h select.h uint64.h ) \
98    | mail djb-sysdeps@cr.yp.to
101 Starting svscan (part of daemontools)
102 =====================================
104 svscan is started by init. If svscan is somehow killed, init will
105 restart it. Put the following line at the end of /etc/inittab:
107 SV:345:respawn:env - PATH=/usr/sbin:/usr/bin:/bin svscan /var/service
109 To start it up for the first time, without rebooting, type 'telinit Q'
112 Installing djbdns
113 =================
115 unpack sources: http://cr.yp.to/djbdns/djbdns-1.03.tar.gz
116   echo /usr > conf-home
117   make
118   make setup check
120 Please do not delete the source tree yet. When you a confident
121 that things are working, please mail D. J. Bernstein's site
122 so that he will know what sort of systems can run his software:
124      ( echo 'First M. Last'; cat `cat SYSDEPS` ) \
125      | mail djb-sysdeps@cr.yp.to
127 Also if you are running a dnsserver on the internet, please
128 add the web page as requested in the full documentation.
130 You do not have to, put I think you should install the documentation.
131 If you are even thinking use puting a dns server on the internet, you
132 should read it too.
133 download: http://cr.yp.to/djbdns/doc.tar.gz
135 gzip -cd < doc.tar.gz | (cd /usr/share; tar -xf -)
136 slashdoc-merge
138 This will create the following indexes:
139 packages.html   Index of DJB's software that has been installed, each
140                 line is a link to the documentation for that package on
141                 this system
142 cfunctions.html Links to the documentation for C library functions
143                 in alphabetical order for the above packages
144 commands.html   Links to commands in alphabetical order from the
145                 above packages
149 Setting up dnscache (part of djbdns)
150 ====================================
152 You will need two new groups. Look inside /etc/group and choose the lowest
153 two available group numbers (The number after the second colon on each line).
154 In my case 14 & 15.
156   groupadd -g 14 dnscache
157   groupadd -g 15 dnscachelog
159 You will need two new users. Look inside /etc/passwd and choose the lowest
160 two available user id's (The number after the second colon on each line).
161 In my case 11 & 12.
163   useradd -u 11 -g dnscache dnscache
164   useradd -u 12 -g dnscachelog dnscachelog
166 Use the automated installer:
167   dnscache-conf dnscache dnscachelog /var/dnscache 127.0.0.1
169 If you feel enthusiastic, use can pick some better random numbers:
170   dd if=/dev/random of=/var/dnscache/seed bs=128 count=1 &
172 Start ip up:
173   ln -s /var/dnscache /var/service/dnscache
175 To make sure it is used, add the following line to /etc/resolve.conf
177 nameserver 127.0.0.1
179 If you replace 127.0.0.1 by the ip address of an interface on the
180 machine running dnscache, then dnscache will answer queries sent
181 to that ip address, from ip addresses in networks you specify.
182 for example to allow queries from 192.168.1:
183   touch /var/dnscache/root/ip/192.168.1
185 If you want dnscache to use a local dns servers, with IP address of,
186 for example 192.168.1.2 and 192.168.1.3, put the following lines:
188 192.168.1.2
189 192.168.1.3
191 into /var/dnscache/root/servers/local.domain and
192 into /var/dnscache/root/servers/1.168.192.in-addr.arpa
193 Make these files readable by user dnscache
194 Make dnscache read the files:
195   svc -t /var/service/dnscache
198 Setting up tinydns (part of djbdns)
199 ===================================
201 You will need two new groups, and two new user id's, just like for
202 dnscache. Call them tinydns and tinydnslog
204 Use the automated installer. You will need the ip-address that
205 tinydns is runnig on eg for ip-address 192.168.1.2:
206   tinydns-conf tinydns tinydnslog /var/tinydns 192.168.1.2
208 Start it up:
209  ln -s /var/tinydns /var/service/tinydns
211 Make 192.168.1.2 responsible for this part of the network
212 cd /var/tinydns/root
213 ../add-ns local.domain 192.168.1.2
214 ../add-ns 1.168.192.in-addr.arpa 192.168.1.2
215 make
217 Add some hosts to your domain
218 cd /var/tinydns/root
219 ../add-host lum.local.domain 192.168.1.4
220 ../add-host ataru.local.domain 192.168.1.5
221 ../add-host shinobu.local.domain 192.168.1.6
222 make
224 To make moroboshi an alias for ataru:
225 cd /var/tinydns/root
226 ../add-alias moroboshi.local.domain 192.168.1.5
227 make
229 You can also set up mail exchangers handle delegation and all sorts
230 of unusual things that are not required on my little private network.
231 If you are interested, read the full instructions.