FluxTuna 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,943 @@
1
+ [h1 Lab 3: Understanding the Domain Name System]
2
+
3
+ [h2 Aim]
4
+
5
+ From this lab you should gain a comprehensive understanding of the [ac DNS], and how [ac DNS] servers are configured. We will be using a particular [ac DNS] server called [sc nsd] (Name Server Daemon), which you can read about in more detail on the module site.
6
+
7
+ However, this lab is not about the configuration of a particular name server. Instead we focus on the basic principles of operation in the [ac DNS]: delegation of zones, how top-level and root severs work, and forward and reverse [ac IPv4] lookups.
8
+
9
+ To help you understand the operation of the [ac DNS], the core lab problems are relatively simple --- if you just copy from the notes the lab will take about 10 minutes. However, if you do this you will probably gain very little understanding of what's going on. Instead you are encouraged to take your time, look though the supporting material, and understand what the core tasks are doing. Once you have understood what is going on, try to work through as many of the extended tasks as you can.
10
+
11
+ [h2 Objectives]
12
+
13
+ [ol]
14
+ [item To understand the basic operation of the [ac DNS], in both forward and reverse lookups]
15
+ [item To understand the distinction between [ac DNS] resolvers and [ac DNS] caches, and how these might be set-up and used in typical network scenarios.]
16
+ [item To understand the difference between recursive and non-recursive resolvers, and the role of each in common network operations.]
17
+ [item To gain some familiarity with the [sc bind]-style zone files commonly used to illustrate the operation of the [ac DNS].]
18
+ [end]
19
+
20
+ [h2 Pre-Requisites]
21
+
22
+ [ol]
23
+ [item You will need a copy of the [tt FreeBSD DNS 03] client image, which contains everything you will need for this lab. Ask the tutor for details if you are unsure.]
24
+ [item You should be familiar with running an operating system image under VMWare in the labs.]
25
+ [end]
26
+
27
+ [h2 Equipment]
28
+
29
+ [ol]
30
+
31
+ [item 1 $\times$ computers capable of running VMWare 6.5]
32
+
33
+ [end]
34
+
35
+ [h2 Scenario]
36
+
37
+ Like all companies, Myertor relies on the correct operation of the
38
+ [ac DNS] on the local and global Internet for mapping between IP
39
+ addresses and host names. Also like most companies, Myertor provides
40
+ services to the global Internet; for instance the company web-server
41
+ known as [tt www]. Nearly all users also expect to access these services through a convenient hostname such as [tt www.myertor.com], made accessible through the [ac DNS].
42
+
43
+ Myertor must therefore provide both its own servers to host the company
44
+ [ac DNS] data, and must integrate those servers into the global [ac DNS].
45
+
46
+ [h2 Lab Setup]
47
+
48
+ Although we nearly always configure only a small portion of the [ac DNS], understanding how the [ac DNS] works requires familiarity with a significant portion of the system: from the root-servers, through the Top-Level Domains ([ac TLD])), and so-on to the server we have to configure. This presents several problems on real-systems, as most of these servers are beyond our administrative control.
49
+
50
+ In this lab we have set-up a FreeBSD image, which runs several [ac DNS] servers simultaneously using a technique called [e jailing][fn See the module site for more detail of FreeBSD jails.]. Although every jail shares a single kernel, each jail has it's own IP address and hostname; and acts very much as an independent system.
51
+
52
+ You task will be to configure the jails to mirror the actual [ac DNS] set-up of [tt www.myertor.com]. One of the jails will act as the [tt .com] [ac TLD] server, and you will have to configure another jail to reflect the [ac DNS] set-up used at Myertor. We have also provided a [tt root] ([tt .]) server, which has been configured to delegate to your [tt .com] [ac TLD].
53
+
54
+ Once all the jails have been set-up, you should be able to [man:8 ping] [tt www.myertor.com]: and to connect to the web-server running on that IP.
55
+
56
+ [h2 Core Tasks]
57
+
58
+ [h3 Setting up the FreeBSD Image]
59
+
60
+ You will only need one image for this lab: [tt FreeBSD DNS 03]. FreeBSD is arguably one of the most advanced open source operating systems, tracing its heritage to the Berkley Unix Distribution used in the development of the original [ac TCPIP] protocols and services. We have already seen a close relative of FreeBSD (OpenBSD) before, as it forms the foundation to Lab 1. For this lab we have chosen to use FreeBSD because it offers a simple way of running multiple host environments on the same kernel. This allows us to configure, and test, a network with multiple virtual hosts in a single VMWare image.
61
+
62
+ To set-up the [tt FreeBSD DNS] image, download a copy of the [tt FreeBSD DNS 03] image from the module site. By default Internet Explorer will try to save the image on your [tt F:] --- and will probably fail. Instead, right-click on the link shown in the module web-page, and click [tt Save As] to put the file on [tt D:\]. When the download finishes, open [tt D:\] and right-click on the file '[tt FreeBSD_DNS_03.7z]' and select [tt 7-zip] $\rightarrow$ [tt Extract Here] to open the archive. When 7-zip finishes, you should see a folder called '[tt FreeBSD DNS]' in
63
+ [tt D:\]. Open the [tt FreeBSD DNS] folder, and double-click on the file '[tt FreeBSD DNS.vmx]' to open VMWare.
64
+
65
+ Your image will have two network cards: one configured for the [e Host Only] network, and one set to bridged mode. We won't be using the bridged interface in this lab, and the [e Host Only] interface should be fully configured.
66
+
67
+ [note]
68
+ When VMWare asks you whether you have 'moved or copied' the [tt FreeBSD
69
+ DNS 03] image, you should select '[e copied]'. If you later connect images
70
+ using the bridged interface, the [sc mac] address should then be unique. For
71
+ the purpose of this lab, however, it doesn't matter whether you select 'moved'
72
+ or 'copied'.
73
+ [end]
74
+
75
+ [medskip]
76
+
77
+ Start the FreeBSD image, and wait for the [tt login:] prompt to appear. Login to the FreeBSD image using the user name [tt root] and the password [tt gold]. Once you have a prompt for the '[tt root]' user, you should be ready to go: everything else has been set-up for you.
78
+
79
+ [h3 Preparing the Environment]
80
+
81
+ Your FreeBSD image will be running three jails, each with its own hostname and [ac IP] address. Together with the jail host (the environment you have just logged into), this gives you four environments to play with.
82
+
83
+ You can see the basic configuration of the jails by using the command
84
+
85
+ [command]
86
+ ezjail-admin list
87
+ [end]
88
+
89
+ at the command prompt in the jail host. This command should give you the following output[fn Ignoring the [ac IPv6] addresses for a moment.]
90
+
91
+ [medskip]
92
+
93
+ [output]
94
+ STA JID IP Hostname Root Directory
95
+ --- ----- --------------- ---------------------------- -------------------------
96
+ DR 1 10.10.10.1 thalia /usr/jails/thalia
97
+ DR 2 10.10.0.1 euphrosyne /usr/jails/euphrosyne
98
+ DR 3 10.0.0.1 aglaea /usr/jails/aglaea
99
+ [end]
100
+
101
+ [medskip]
102
+
103
+ The first column ([tt STA]) indicates the [e status] of the jail, in this case the type of jail and that it's running. The next column ([tt JID]) gives the [e jail [sc id]], which you will use to tell FreeBSD which jail you want. The jail [sc id] number is [s important]. We will soon be using this number to login to the jails: getting the number wrong will log you into the [e wrong] jail.
104
+
105
+ After the jail [sc id], we then have the [ac IP] address and the hostname of the jail. We won't be using the hostname much, but you will have to know the [ac IP] address of the jail to configure the [ac DNS] properly.
106
+
107
+ Finally the [tt ezjail-admin](1) command tells you which directory on the jail host is holding the jail. You could change to this directory and edit the configuration of the jail directly. However, you will usually find it much easier to treat each jail as an independent host and log into the jail to configure it.
108
+
109
+ [medskip]
110
+
111
+ Once we know the [ac IP] addresses of all the jails, we can start to configure them. You jail host already has a root server running, on the [ac IP] address [tt 127.0.0.1]. We have also placed an entry in the [tt /etc/hosts] file to map [tt 127.0.0.1] to the hostname [tt root]. We will come back to the configuration of [tt root] shortly, but for the moment we will leave it as it is.
112
+
113
+ Like nearly all [e authoritative] name servers, [tt root] only answers [e non-recursive] [ac DNS] queries. If [tt root] can't provide the answer, it will tell you where to go next --- but it won't do the next look-up for you[fn We will come to the role of recursive [ac DNS] resolvers later in the lab.]. For instance, if we use the standard [man:1 dig] tool to ask the server [tt root] the address of [tt www.myertor.com][fn Note the use of the [tt @] argument to tell [man:1 dig] which server we want to query. If we omitted this parameter, [man:1 dig] would use the default name sever --- which won't work because we haven't configured things yet.]
114
+
115
+ [command]
116
+ dig @root www.myertor.com
117
+ [end]
118
+
119
+ we get
120
+
121
+ [output]
122
+ ; <<>> DiG 9.6.0-P1 <<>> @root www.myertor.com
123
+ ; (1 server found)
124
+ ;; global options: +cmd
125
+ ;; Got answer:
126
+ ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57173
127
+ ;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
128
+ ;; WARNING: recursion requested but not available
129
+
130
+ ;; QUESTION SECTION:
131
+ ;www.myertor.com. IN A
132
+
133
+ ;; AUTHORITY SECTION:
134
+ com. 86400 IN NS a.ns.com.
135
+
136
+ ;; ADDITIONAL SECTION:
137
+ a.ns.com. 86400 IN A 10.0.0.1
138
+
139
+ ;; Query time: 0 msec
140
+ ;; SERVER: 127.0.0.1#53(127.0.0.1)
141
+ ;; WHEN: Tue Apr 10 17:19:55 2011
142
+ ;; MSG SIZE rcvd: 68
143
+ [end]
144
+
145
+ When [man:1 dig] has finished querying the [tt root] server, it lays out the response in the [sc bind] standard syntax. We won't go into the details of the syntax just yet, but you should see three sections: a [e question] section, an [e authority] section, and an [e additional] section. Each section has the response given as a record in a [sc bind] zone.
146
+
147
+ The question section is essentially exactly what we asked the server: for the address or [tt A] record of [tt www.myertor.com.], or in [sc bind] syntax
148
+
149
+ [output]
150
+ ;www.myertor.com. IN A
151
+ [end]
152
+
153
+ Note two details of the response, though. Firstly, [man:1 dig] has added a dot, [tt .], to the end of '[tt www.myertor.com]'. This dot turns the hostname into a [e fully qualified hostname]; in other words, the hostname now specifies a complete path from the host ([tt www]) to the root server ([tt .]). [sc bind] [s only] allows fully qualified hostnames in zone files --- which will become significant when we write our own. Secondly, [man:1 dig] has added a semi-colon, '[tt :]' in front of the question. In [sc bind] syntax, a semi-colon means a [e comment]; and will be ignored by the parser of the zone files.
154
+
155
+ After the question section comes the [e authority] section. In this section the name server replies with [e either] the details of the host(s) is has authority over, or a link to namesevers for sub-domains over which it has authority. In our reponse, [tt root] isn't giving us a hostname ([tt A] record), but is telling us that it has authority over the [tt com.] domain. Since [tt com] is the next part of our question[fn Remember that while domain names are [e read] left-to-right, hosts [e parse] right-to-left. So '[tt com]' is the next domain after '[tt .]': hence '[tt com.]'.], it makes sense that we should be able to ask this server as the next link in the chain. This gives us a [e name server], [tt NS], record telling us the relevant name server for the [tt com] domain is [tt a.ns.com.].
156
+
157
+ However, while we now know the [e name] of the next [ac DNS] server ([tt a.ns.com.]) we [e don't] know the [ac IP] address of this server. Nor can we easily look it up --- as the server which should know the [ac IP] address of [tt a.ns.com.] is in fact [tt a.ns.com.] itself. And while [tt .] has authority over [tt com], [tt .] has also delegated responsiblity for all hosts in [tt com.]: including the responsbility for the name server.
158
+
159
+ This circular resolution of name server hostnames is very common in the [ac DNS]. To break the circle we need to use a [e glue record], which adds 'extra' information to the parent zone telling resolvers the [ac IP] address of the relevant name server.
160
+
161
+ The glue record for the [tt com.] domain is returned in the final [e additional] section of the output from [man:1 dig]. This section states
162
+
163
+ [output]
164
+ ;; ADDITIONAL SECTION:
165
+ a.ns.com. 86400 IN A 10.0.0.1
166
+ [end]
167
+
168
+ giving us the [tt A] (address) record for [tt a.ns.com.], and the [ac IP] address we need: [tt 10.0.0.1]. With this record, we can now ask [tt a.ns.com.] for the next link: which nameserver is authoritative for the [tt myertor] domain in the [tt com] domain.
169
+
170
+ [medskip]
171
+
172
+ Once you know what you're looking out, the output from [man:1 dig]
173
+ should be relatively straightforward. Other tools will give you much the
174
+ same information, but usually in a different format. For instance, our jail host uses MaraDNS for the recursive caching [ac DNS] resolver[fn Which we will talk about later, once we have everything running.]. MaraDNS provides the tool [tt askmara](1), which has a slightly odd query syntax and needs the [ac IP] address of the [ac DNS] server we're asking. Our previous query of who has the address for [tt www.myertor.com] looks like
175
+
176
+ [command]
177
+ askmara Awww.myertor.com. 127.0.0.1
178
+ [end]
179
+
180
+ Much like [man:1 dig], [tt askmara](1) gives us the reply in three sections: a question, a response, and additional information
181
+
182
+ [output]
183
+ # Querying the server with the IP 127.0.0.1
184
+ # Question: Awww.myertor.com.
185
+ # NS replies:
186
+ #com. +86400 ns a.ns.com.
187
+ # AR replies:
188
+ #a.ns.com. +86400 a 10.0.0.1
189
+ [end]
190
+
191
+ Although the syntax is a little different, you should be able to pick out the same information we had before.
192
+
193
+ [medskip]
194
+
195
+ When following the chain of [ac DNS] lookups, we could do the work ourselves. Now we know the address of the next server is [tt 10.0.0.1], we can simply ask that server the same question
196
+
197
+ [command]
198
+ dig @10.0.0.1 www.myertor.com
199
+ [end]
200
+
201
+ At the moment, though, the server replies with
202
+
203
+ [output]
204
+ ; <<>> DiG 9.6.0-P1 <<>> @10.0.0.1 www.myertor.com
205
+ ; (1 server found)
206
+ ;; global options: +cmd
207
+ ;; Got answer:
208
+ ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 57265
209
+ ;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
210
+ ;; WARNING: recursion requested but not available
211
+
212
+ ;; QUESTION SECTION:
213
+ ;www.myertor.com. IN A
214
+
215
+ ;; Query time: 0 msec
216
+ ;; SERVER: 10.0.0.1#53(10.0.0.1)
217
+ ;; WHEN: Tue Apr 10 19:02:46 2011
218
+ ;; MSG SIZE rcvd: 33
219
+ [end]
220
+
221
+ indicating the server doesn't know the answer to the question (since the [tt status] field in the response header is set to [tt SERVFAIL]). At this point we have a problem: this server should be able to tell us where to go next. Since it can't, we have a broken [ac DNS]. Fixing this problem is the next objective.
222
+
223
+ [medskip]
224
+
225
+ Before we start fixing things, though, we will quickly introduce a tool that helps cut out much of the leg-work involved in following a [ac DNS] query through various servers. We could simply use [man:1 dig] as we have before[fn And being able to sort out [ac DNS] problems using [man:1 dig] is a valuable skill. Nearly every modern Unix-like system has the [man:1 dig] tool installed, so if you can use it to find and fix [ac DNS] problems, you stand a good chance of applying your skills on most platforms.]. Running multiple [man:1 dig] queries, though, quickly become a little tedious. In addition the output from [man:1 dig] is a little verbose.
226
+
227
+ In this lab we will therefore use a tool called [tt dnstracer](1), which automates the [ac DNS] lookups and gives an easy to understand display of the output. If you give [tt dnstracer](1) a server, it will use that server as the [tt .] server: and keep following responses until it finds the [ac IP] address of the host you want (or the [ac DNS] chain breaks). For example, we want to know the [ac IP] adddress of [tt www.myertor.com] starting at the [tt .] server [tt root]. This means using the '[tt -s]' parameter and telling[tt dnstracer](1) the name (or [ac IP] address) of the [tt .] server you want to start from. We also need to tell [tt dnstracer](1) the hostname we want, so the final [tt dnstracer](1) command is
228
+
229
+ [command]
230
+ dnstracer -4 -s root www.myertor.com
231
+ [end]
232
+
233
+ From this command we get
234
+
235
+ [output]
236
+ Tracing to www.myertor.com[a] via root, maximum of 3 retries
237
+ root (127.0.0.1)
238
+ ___ a.ns.com [com] (10.0.0.1)
239
+ [end]
240
+
241
+ We can see from this output the [ac IP] address of the [tt root] server ([tt 127.0.0.1]), and the next server in the chain ([tt 10.0.0.1]). In addition, we know this next server is called [tt a.ns.com] and that it has authority over the [tt com] domain. Finally the line linking the two shows that [tt root] is delegating authority to [tt a.ns.com].
242
+
243
+ Again, though, we can't get any further. Currently [tt a.ns.com] is broken, and isn't returning the correct information for us to find the next server. The next task, then, is to fix [tt a.ns.com]
244
+
245
+ [h3 Questions]
246
+
247
+ [ol]
248
+ [item What is the difference between a fully and a partially qualified host name?
249
+ [item What does a name server claim if it has [e authority] in the [ac DNS]?
250
+ [item Why does [man:1 dig] give the address of the name server in the [tt ADDITIONAL] section?
251
+
252
+ [end]
253
+
254
+ [h3 Understanding the Bind Zone Syntax]
255
+
256
+ All the authoritative [ac DNS] servers in this lab use the [sc nsd] (Name Server Daemon) application. [sc nsd] is a modern, non-recursive and authoritative-only domain name server; developed to add diversity to the pool of root servers making up the Internet [ac DNS][fn You can read more about [sc nsd] (and [sc bind]) on the module site.]. For many years the Internet root servers used only the [sc bind] application package, which has a long and horrible security history. Part of the rational for [sc nsd] is making sure a fatal [sc bind] problem doesn't wipe out the core Internet [ac DNS] servers, but [sc nsd] also serves a test-bed for new [ac DNS] standards. Currently [sc nsd] is used exclusively for the [tt k] root server cluster, but also finds a secondary role in other root clusters.
257
+
258
+ Both [sc nsd] and [sc bind] share the same syntax for the zone records holding
259
+ information about [ac DNS] domains. Setting up the two applications is very
260
+ different, but you will gain experience in the configuration of the most
261
+ popular ([sc bind]) and second most popular ([sc nsd]) [ac DNS] servers on the
262
+ Internet[fn We will meet the third most popular [ac DNS] server, Microsoft's
263
+ [ac DNS] service used by Active Directory, in a later lab.]. As you have seen
264
+ from tools like [man:1 dig], the [sc bind] zone syntax is commonly used as [e
265
+ the] representation of [ac DNS] domains (especially in the various [ac DNS]
266
+ RFC's). Even if you never configure a [sc bind]-like server again, having at
267
+ least some idea of the zone syntax is therefore useful.
268
+
269
+ [medskip]
270
+
271
+ With [sc nsd] in all the jails should be up and running, and partly configured
272
+ for you. What we haven't done is set-up the zone records that tell [sc nsd]
273
+ how the [ac DNS] domain is configured. We won't go over the set-up of [sc
274
+ nsd][fn Again, links can be found on the module site.], and instead move
275
+ straight into the configuration of the zones.
276
+
277
+ All the zone files you need to configure should live in [tt /etc/nsd/primary]:
278
+ a directory holding the primary[fn Some [ac DNS] servers act as
279
+ non-authoritative sources of zones, usually to provide a back-up to the
280
+ authoritative servers. Authoritative servers are called [e primary] severs,
281
+ hence these non-authoritative servers are usually called [e secondary]
282
+ servers. Configuration and management of secondary [ac DNS] servers is a large
283
+ topic in itself, and is beyond the scope of this lab.] zone records for the
284
+ domains the [sc nsd] server is authoritative for. Everything you need to alter
285
+ in the first part of the lab will live in this directory on one of the hosts.
286
+
287
+ Before we start writing a new zone file, you should also have a look at the
288
+ file holding the root zone, [tt /etc/nsd/primary/root.zone], in the jail host.
289
+ This file is the zone file on our [tt root] server: the same one we have just
290
+ queried using the normal [ac DNS] protocols.
291
+
292
+ Open the zone files using the command
293
+
294
+ [command]
295
+ less /etc/nsd/primary/root.zone
296
+ [end]
297
+
298
+ and you should see something like
299
+
300
+ [code bind]
301
+ ;;;
302
+ ;;; Configuration file for the Fake Internet Root Server
303
+ ;;;
304
+
305
+ ;; Set the default Time To Live for records served from
306
+ ;; this server
307
+ $TTL 1d
308
+
309
+ ;; Set the authority of this server over the [ac DNS] root
310
+ . IN SOA fake.root.net. hostmaster.root. (
311
+ 1 ; serial
312
+ 3h ; refresh
313
+ 1h ; retry
314
+ 1w ; expire
315
+ 1h ; negative caching TTL
316
+ )
317
+
318
+ ;; List of core nameservers authoritative over this zone
319
+ IN NS fake.root.net.
320
+
321
+ ;; Address records for the core nameservers
322
+ fake.root.net. IN A 127.0.0.1
323
+
324
+ ;;;
325
+ ;;; Records for Delegated Zones
326
+ ;;;
327
+
328
+ ;; Name Server Authority Records
329
+ com. IN NS a.ns.com.
330
+ org. IN NS a.ns.org.
331
+
332
+ ;; Address Records for Delegated Name Servers
333
+ a.ns.com. IN A 10.0.0.1
334
+ a.ns.org. IN A 10.0.0.1
335
+ [end]
336
+
337
+ Use the up and down arrow keys to move around the file, and press '[tt q]' to quit and return to command line.
338
+
339
+ [medskip]
340
+
341
+ If we look at the end of this zone file, you should see the same information we obtained using the [man:1 dig] command[fn As we said before, comments are indicated by lines beginning with [tt ;]. Strictly these are optional, but most real zone files are heavily commented to indicate the relevant sections and different types of hosts and services being configured.]
342
+
343
+
344
+ [code bind|24]
345
+ ;;;
346
+ ;;; Records for Delegated Zones
347
+ ;;;
348
+
349
+ ;; Name Server Authority Records
350
+ com. IN NS a.ns.com.
351
+ org. IN NS a.ns.org.
352
+
353
+ ;; Address Records for Delegated Name Servers
354
+ a.ns.com. IN A 10.0.0.1
355
+ a.ns.org. IN A 10.0.0.1
356
+ [end]
357
+
358
+ The name server authority records are listed (in the same format), stating for instance the [tt a.ns.com] server is authoritative for the [tt com] domain. Note this root server also has the authority to delegate the [tt org] domain as well, which it does to the server [tt a.ns.org]. We will have a look at this zone later in the lab.
359
+
360
+ Right at the end of the file we have our glue records, telling other [ac DNS] resolvers the [ac IP] addresses of the delegated name servers. At the moment, both the configured name servers are delegated to the same nameserver, running on the host [tt 10.0.0.1].
361
+
362
+ [medskip]
363
+
364
+ In the middle of the zone file, we have a similar set of records for the zone itself
365
+
366
+ [code bind|18]
367
+ ;; List of core nameservers authoritative over this zone
368
+ IN NS fake.root.net.
369
+
370
+ ;; Address records for the core nameservers
371
+ fake.root.net. IN A 127.0.0.1
372
+ [end]
373
+
374
+ This set of records states the name server for the [tt .] domain is called [tt
375
+ fake.root.net], and that [tt fake.root.net] server can be found on the address
376
+ [tt 127.0.0.1]. Note the space, though, in the [tt NS] record. This space
377
+ [s must] be present, because we are inheriting the zone name from the
378
+ authority section (discussed next). Hence this line is equivalent to
379
+
380
+ [code bind|18]
381
+ ;; List of core nameservers authoritative over this zone
382
+ . IN NS fake.root.net.
383
+ [end]
384
+
385
+ which is similar to the delegated zones we have seen before.
386
+
387
+ [medskip]
388
+
389
+ Before we get to the delegated and zone records, however, we need to state our authority over the zone: and hence our authority to delegate to other servers. At the start of the zone file, we find the most critical record in the entire zone. This record is called the [e Start of Authority] (or [tt SOA]) record, and for our zone looks like
390
+
391
+ [code bind|9]
392
+ ;; Set the authority of this server over the [ac DNS] root
393
+ . IN SOA fake.root.net. hostmaster.root. (
394
+ 1 ; serial
395
+ 3h ; refresh
396
+ 1h ; retry
397
+ 1w ; expire
398
+ 1h ; negative caching TTL
399
+ )
400
+ [end]
401
+
402
+ Reading from left to right in Line [tt 10], the [tt SOA] records states we have authority over the [tt .] (root) domain. This means we have the authority to define any host (or service) in this domain, or to delegate any portion of this domain to create another [e sub-domain]. The [tt IN SOA] states this record is a Start of Authority record, and the next argument states this authority rests in the server [tt fake.root.net]. Exactly who '[tt fake.root.net]' is will be defined later, but this nameserver is the designated master for the domain.
403
+
404
+ We then get the e-mail address of a human contact for this domain, with the '[tt @]' in the e-mail address replaced by '[tt .]'. On Internet facing domain this address [s must] point to the mailbox of a real person --- people will get very annoyed if you break something and they can't find you.
405
+
406
+ After the [tt SOA] record, we get a series of numbers in brackets. The most important number in this series is the first one, which defines the [e serial number] of the zone file. Most nameservers are set-up in master/slave arrangements, and the slaves know to up-date their zone file by checking the serial number of that zone file with the one on the master. Whenever we edit a zone file, we therefore need to update the serial number to tell the slaves to refresh their copy[fn Our lab doesn't have slave nameservers, but getting into the habit of updating the serial number after any edit will make you life easier in the long run. Making an edit and then forgetting to update the serial number will usually mean your domain becomes inconsistent as different hosts may be using different versions of the 'same' zone file.].
407
+
408
+ Following the serial number are three numbers used by secondary nameservers. The first number specifies the number of seconds that should elapse before a secondary servers queries the master to check for changes to the zone file (indicated by a change in the serial number of the [tt SOA] record). When a secondary detects a change, it will try to transfer the zone data from the master; if this fails the next number states the number of seconds a secondary should wait before retrying. Finally if a secondary keeps failing to transfer the data, it should answer using old data up to the expire limit (one week ([tt 1w]) in our case).
409
+
410
+ We won't say much more about these numbers in this lab[fn Look in the documentation linked in the site for more information.]. However, the final number in the [tt SOA] record is important. The last number in the [tt SOA] record gives the minimum time other nameservers should cache the zone information supplied by this server. In a very stable domain, these values might say caches can hold zone data for days ([tt d]) or even weeks ([tt w]). Our [tt SOA] says that nameservers should expire cached data after 1 hour ([tt 1h]), which is typical for a reasonably volatile domain.
411
+
412
+ [medskip]
413
+
414
+ Hopefully by this point you have a basic understanding of the [ac DNS] system, and of the syntax use in [sc bind]-style zone files to configure nameservers. We can now put this understanding to good use, and fix the [tt a.ns.com] server holding the zone data for the [tt com] domain.
415
+
416
+ [h3 Questions]
417
+
418
+ [ol]
419
+ [item Why do we give both [tt NS] and [tt A] records for our name server in the zone file?]
420
+ [item What is the purpose of the glue records in the zone specifying the delegation?]
421
+ [item What do the last three entries in the [tt SOA] record do, and how are they used by [ac DNS] clients?]
422
+ [end]
423
+
424
+ [h3 Fixing a.ns.com]
425
+
426
+ We know from our previous experiments that [tt a.ns.com] has the [ac IP] address [tt 10.0.0.1]. If we look at the output from the [tt ezjail-admin](1) command at the start of the lab, we can see the host for [tt 10.0.0.1] lives in jail [tt 3]
427
+
428
+ [output]
429
+ STA JID IP Hostname Root Directory
430
+ --- ----- --------------- ---------------------------- -------------------------
431
+ DR 1 10.10.10.1 thalia /usr/jails/thalia
432
+ DR 2 10.10.0.1 euphrosyne /usr/jails/euphrosyne
433
+ DR 3 10.0.0.1 aglaea /usr/jails/aglaea
434
+ [end]
435
+
436
+ We will start fixing [tt a.ns.com] by logging into jail [tt 3] using the command[fn The [tt jexec](8) command executes a command in the specified jail. In our case, we are asking for the Z Shell, [tt zsh](1), to be executed; giving us a root prompt in the jail.]
437
+
438
+ [command]
439
+ jexec 3 zsh
440
+ [end]
441
+
442
+ When this command finishes, we should have a new prompt indicating we have become the '[tt root]' user inside the jail
443
+
444
+ [output]
445
+ [root@aglaea / (128)]
446
+ [end]
447
+
448
+ [note]
449
+ Pay attention to the command prompt: it will tell you both which user you are
450
+ [e and] which host you are currently logged into. Remember that [tt nyx] is
451
+ the jail host --- anything else is a jail. It is easy to get lost and
452
+ configure the wrong host, but the command prompt should give you a hint where
453
+ you are.
454
+ [end]
455
+
456
+ [medskip]
457
+
458
+ If we look at the contents of the [tt /etc/nsd/primary] directory on [tt aglaea]
459
+
460
+ [command]
461
+ ls /etc/nsd/primary
462
+ [end]
463
+
464
+ we should see a number of zone files
465
+
466
+ [output]
467
+ 10.in-addr.arpa.zone com.zone com.zone.example org.zone
468
+ [end]
469
+
470
+ The first zone file, [tt 10.in-addr.arpa.zone], is used for reverse [ac DNS] lookups: those mapping [ac IP] addresses to names. We will look at this file in the additional problems later on. Our focus will instead be on the [tt com.zone] file, which we will use to configure the [tt com.] domain. You might, though, want to look at [tt com.zone.example] which shows you what the [tt com.zone] file should look like at the end of this lab[fn Use the command [tt nano /etc/nsd/primary/com.zone.example] to have a look at this file.].
471
+
472
+ Open the [tt com.zone] file using nano
473
+
474
+ [command]
475
+ nano /etc/nsd/primary/com.zone
476
+ [end]
477
+
478
+ Start creating the zone file by defining the [tt SOA] record. This needs to state our authority over the [tt com] domain, and this authority should be invested in the [tt a.ns.com] nameserver. The other details are less critical: but they must be present in a valid the zone file. We will more or less copy the defaults used before, giving
479
+
480
+ [code bind]
481
+ ;; Set the authority of this server over the com domain
482
+ com. IN SOA a.ns.com. hostmaster.com. (
483
+ 1 ; serial
484
+ 3h ; refresh
485
+ 1h ; retry
486
+ 1w ; expire
487
+ 1h ; negative caching TTL
488
+ )
489
+ [end]
490
+
491
+ Next we need to define the [tt a.ns.com] host as an authoritative nameserver for this domain. Remember we also need to define the glue record for this nameserver, so that other nameservers can find it. Add the lines
492
+
493
+ [code bind]
494
+ ;; List of core nameservers authoritative over this zone
495
+ IN NS a.ns.com.
496
+
497
+ ;; Address records for the core nameservers
498
+ a.ns.com. IN A 10.0.0.1
499
+ [end]
500
+
501
+ In the last section, we need to use our new authority to delegate to the next nameserver in the chain. This nameserver will be authoritative over the [tt myertor] sub-domain of [tt com], and will live in jail [tt 2]. We will call the authoratative nameserver for [tt myertor.com], [tt a.ns.myertor.com] and use the jail [tt 2] [ac IP] address [tt 10.10.0.1]. Our last section therefore looks like
502
+
503
+ [code bind]
504
+ ;;;
505
+ ;;; Records for Delegated Zones
506
+ ;;;
507
+
508
+ ;; Name Server Authority Records
509
+ myertor.com. IN NS a.ns.myertor.com.
510
+
511
+ ;; Address Records for Delegated Name Servers
512
+ a.ns.myertor.com. IN A 10.10.0.1
513
+ [end]
514
+
515
+ [medskip]
516
+
517
+ Putting everything together, the final [tt com.zone] file should therefore look something like
518
+
519
+ [code bind]
520
+ ;; Set the authority of this server over the com domain
521
+ com. IN SOA a.ns.com. hostmaster.com. (
522
+ 1 ; serial
523
+ 3h ; refresh
524
+ 1h ; retry
525
+ 1w ; expire
526
+ 1h ; negative caching TTL
527
+ )
528
+
529
+ ;; List of core nameservers authoritative over this zone
530
+ IN NS a.ns.com.
531
+
532
+ ;; Address records for the core nameservers
533
+ a.ns.com. IN A 10.0.0.1
534
+
535
+ ;;;
536
+ ;;; Records for Delegated Zones
537
+ ;;;
538
+
539
+ ;; Name Server Authority Records
540
+ myertor.com. IN NS a.ns.myertor.com.
541
+
542
+ ;; Address Records for Delegated Name Servers
543
+ a.ns.myertor.com. IN A 10.10.0.1
544
+ [end]
545
+
546
+ [medskip]
547
+
548
+ Save the file using [tt Ctrl+O], and exit [tt nano](1) using [tt Ctrl]+[tt X].
549
+
550
+ With the zone file in place, we need to tell our [sc nsd] nameserver to read the zone file and publish the data.
551
+
552
+ Unlike [sc bind], [sc nsd] does not publish the zone file directly. Instead [sc nsd] uses a complied binary database, which makes things both faster and more secure (since the zone file you've just edited is never directly exposed to the Internet). Using an intermediate database also gives [sc nsd] a chance to check your zone file for errors, and report any necessary corrections before publishing the data.
553
+
554
+ Once the zone file has been created, we use the [sc nsd] control utility, [tt nsdc](1), to both create the binary database and publish the data.
555
+
556
+ The first step is for [sc nsd] to check the zone file and create the database. Type
557
+
558
+ [command]
559
+ nsdc rebuild
560
+ [end]
561
+
562
+ and [tt nsdc](1) should reply with something like
563
+
564
+ [output]
565
+ zonec: reading zone "10.in-addr.arpa".
566
+ zonec: processed 1 RRs in "10.in-addr.arpa".
567
+ zonec: reading zone "com".
568
+ zonec: processed 5 RRs in "com".
569
+ zonec: reading zone "org".
570
+ zonec: processed 0 RRs in "org".
571
+
572
+ zonec: done with 0 errors.
573
+ [end]
574
+
575
+ If [tt nsdc](1) reports [s any] errors you [s must] go back an correct the zone file. Usually [tt nsdc](1) will tell you where the error is, and what the problem is. Unless you zone file is free from errors, [tt nsdc](1) will refuse to rebuild the binary database. And until the binary database is rebuilt, your zone data will [s not be published][fn Not publishing invalid zones is a deliberate safety feature. On live nameservers, this means [sc nsd] can always publish valid (if incorrect) data. If it doesn't like you new zone file, [sc nsd] will just keep using the old data until you fix the problem. Unlike [sc bind], you can't silently break things by using an invalid zone file.].
576
+
577
+ Assuming your zone file is error free, you can tell [sc nsd] to publish the new zone data using the command
578
+
579
+ [command]
580
+ nsdc reload
581
+ [end]
582
+
583
+ and you new zone data should be ready for use.
584
+
585
+ [medskip]
586
+
587
+ We will test the new zone file from the jail host, so type
588
+
589
+ [command]
590
+ exit
591
+ [end]
592
+
593
+ to break from the jail and return to the host[fn Note the change in command prompt!].
594
+
595
+ If we now ask the nameserver [tt 10.0.0.1] for the [ac IP] address of [tt www.myertor.com]
596
+
597
+ [command]
598
+ dig @10.0.0.1 www.myertor.com
599
+ [end]
600
+
601
+ we should get
602
+
603
+ [output]
604
+ ; <<>> DiG 9.6.0-P1 <<>> @10.0.0.1 www.myertor.com
605
+ ; (1 server found)
606
+ ;; global options: +cmd
607
+ ;; Got answer:
608
+ ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28625
609
+ ;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
610
+ ;; WARNING: recursion requested but not available
611
+
612
+ ;; QUESTION SECTION:
613
+ ;www.myertor.com. IN A
614
+
615
+ ;; AUTHORITY SECTION:
616
+ myertor.com. 3600 IN NS a.ns.myertor.com.
617
+
618
+ ;; ADDITIONAL SECTION:
619
+ a.ns.myertor.com. 3600 IN A 10.10.0.1
620
+
621
+ ;; Query time: 0 msec
622
+ ;; SERVER: 10.0.0.1#53(10.0.0.1)
623
+ ;; WHEN: Mon Apr 11 00:14:16 2011
624
+ ;; MSG SIZE rcvd: 68
625
+ [end]
626
+
627
+
628
+ This time we have an authority section, indicating the nameserver at [tt 10.0.0.1] now knows it is authoritative for the [tt com] domain. We also have the glue record and the name of the next server in the chain: [tt a.ns.myertor.com].
629
+
630
+ [medskip]
631
+
632
+ Using [tt dnstracer](1) we can present this growing chain more clearly, as
633
+
634
+ [command]
635
+ dnstracer -4 -s root www.myertor.com
636
+ [end]
637
+
638
+ now shows
639
+
640
+
641
+ [output]
642
+ Tracing to www.myertor.com[a] via root, maximum of 3 retries
643
+ root (127.0.0.1)
644
+ ___ a.ns.com [com] (10.0.0.1)
645
+ ___ a.ns.myertor.com [myertor.com] (10.10.0.1)
646
+ [end]
647
+
648
+
649
+ Of course this still doesn't give us the actual address of [tt www.myertor.com]. That requires configuring the [tt a.ns.myertor.com] nameserver, which we will now do.
650
+
651
+ [h3 Questions]
652
+
653
+ [ol]
654
+ [item In a real zone, we would usually have to supply at least two nameservers, e.g.\ [tt a.ns.myertor.com] and [tt b.ns.myertor.com]. Why do we have to duplicate the data stored at nodes in the [tt dns]?]
655
+ [item Describe in outline the standard process for syncronising the data held at multiple name servers. What additional configuration does this require of the name servers? How does a slave name server tell if the zone data on the master has been updated?]
656
+ [item What happens if the data between the slave and masters is not synronised correctly? Can client detect this condition? How do clients try to avoid problems caused in this case?]
657
+ [end]
658
+
659
+ [h3 Configuring tt a.ns.myertor.com]
660
+
661
+ Much of this step is simply a repetition of the last one. We need to login to the jail with the [ac IP] address [tt 10.10.0.1], setup an authoritative zone record for [tt myertor.com], and publish this information using [sc nsd].
662
+
663
+ [medskip]
664
+
665
+ The jail with the [ac IP] address [tt 10.10.0.1] is jail [tt 2], so type
666
+
667
+ [command]
668
+ jexec 2 zsh
669
+ [end]
670
+
671
+ to login.
672
+
673
+ [medskip]
674
+
675
+ Once inside the jail, create the file [tt /etc/nsd/primary/myertor.com.zone] using the command
676
+
677
+ [command]
678
+ nano /etc/nsd/primary/myertor.com.zone
679
+ [end]
680
+
681
+ The first section of the zone file should now be familiar: create the [tt SOA] record stating the domain authority, and then set the details of the authoritative nameservers
682
+
683
+ [code bind]
684
+ ;; Set the authority of this server over the [ac DNS] root
685
+ myertor.com. IN SOA a.ns.myertor.com. hostmaster.myertor.com. (
686
+ 1 ; serial
687
+ 3h ; refresh
688
+ 1h ; retry
689
+ 1w ; expire
690
+ 1h ; negative caching TTL
691
+ )
692
+
693
+ ;; List of core nameservers authoritative over this zone
694
+ IN NS a.ns.myertor.com.
695
+
696
+ ;; Address records for the core nameservers
697
+ a.ns.myertor.com. IN A 10.10.0.1
698
+ [end]
699
+
700
+ However, this time we won't delegate authority to anyone else. Instead we will define the host [tt www], using the authority we already have: meaning the host will end up in the [tt myertor.com] domain.
701
+
702
+ We could define the [tt www] host the long way, in much the same we
703
+ we have already defined the glue records for the nameservers. Like the nameservers glue records, hosts also use [tt A] records; so we could define our host with the line
704
+
705
+ [code bind]
706
+ ; Host Records
707
+ www.myertor.com. IN A 10.10.10.10
708
+ [end]
709
+
710
+ Typing the fully-qualified domain out every time, though, quickly become tedious. So we will use a [e macro] which [sc nsd] (or [sc bind]) will automatically add to each hostname to produce the fully-qualified host name. This macro is called [tt \$ORIGIN], and means our host section looks like
711
+
712
+ [code bind]
713
+ ;; Set the domain suffix for hosts in this domain
714
+ $ORIGIN myertor.com.
715
+
716
+ ; Host Records
717
+ www IN A 10.10.10.10
718
+ [end]
719
+
720
+ For a single host this approach is probably overkill, but once you have more than a handful of hosts it quickly becomes much easier. Using macros also means zone files also look neater, which helps to prevent errors.
721
+
722
+ Our full zone file now looks like
723
+
724
+ [code bind]
725
+ ;; Set the authority of this server over the [ac DNS] root
726
+ myertor.com. IN SOA a.ns.myertor.com. hostmaster.myertor.com. (
727
+ 1 ; serial
728
+ 3h ; refresh
729
+ 1h ; retry
730
+ 1w ; expire
731
+ 1h ; negative caching TTL
732
+ )
733
+
734
+ ;; List of core nameservers authoritative over this zone
735
+ IN NS a.ns.myertor.com.
736
+
737
+ ;; Address records for the core nameservers
738
+ a.ns.myertor.com. IN A 10.10.0.1
739
+
740
+ ;; Set the domain suffix for hosts in this domain
741
+ $ORIGIN myertor.com.
742
+
743
+ ; Host Records
744
+ www IN A 10.10.10.10
745
+ [end]
746
+
747
+ [medskip]
748
+
749
+ Build the zone file database using the command
750
+
751
+ [command]
752
+ nsdc rebuild
753
+ [end]
754
+
755
+ Again, if you have errors you [s must] correct them before continuing. Assuming everything is OK, type
756
+
757
+ [command]
758
+ nsdc reload
759
+ [end]
760
+
761
+ and you new zone data should be published and ready for use.
762
+
763
+ [medskip]
764
+
765
+ Exit the jail and return to the jail host, by typing
766
+
767
+ [command]
768
+ exit
769
+ [end]
770
+
771
+ [medskip]
772
+
773
+ Once back in the jail host, confirm everything is working using [man:1 dig]
774
+
775
+ [command]
776
+ dig @10.10.0.1 www.myertor.com
777
+ [end]
778
+
779
+ producing
780
+
781
+ [output]
782
+ ; <<>> DiG 9.6.0-P1 <<>> @10.10.0.1 www.myertor.com
783
+ ; (1 server found)
784
+ ;; global options: +cmd
785
+ ;; Got answer:
786
+ ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43980
787
+ ;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
788
+ ;; WARNING: recursion requested but not available
789
+
790
+ ;; QUESTION SECTION:
791
+ ;www.myertor.com. IN A
792
+
793
+ ;; ANSWER SECTION:
794
+ www.myertor.com. 3600 IN A 10.10.10.10
795
+
796
+ ;; AUTHORITY SECTION:
797
+ myertor.com. 3600 IN NS a.ns.myertor.com.
798
+
799
+ ;; ADDITIONAL SECTION:
800
+ a.ns.myertor.com. 3600 IN A 10.10.0.1
801
+
802
+ ;; Query time: 0 msec
803
+ ;; SERVER: 10.10.0.1#53(10.10.0.1)
804
+ ;; WHEN: Mon Apr 11 00:58:31 2011
805
+ ;; MSG SIZE rcvd: 84
806
+ [end]
807
+
808
+
809
+ Again we get the authority and additional sections, telling you who the authoritative nameserver is for the domain and the [ac IP] address of that server (or servers). This should be the same as the information given by our parent.
810
+
811
+ However, we have a new section: [tt ANSWER]. This section does exactly what it says --- it provides the direct answer to the question we asked. Once we see this section, we know we have reached the end of the chain. We asked what the [ac IP] address of [tt www.myertor.com] is, and we have received the answer [tt 10.10.10.10].
812
+
813
+ Using [tt dnstracer](1) we should now be able to see this complete chain
814
+
815
+ [command]
816
+ dnstracer -4 -s root www.myertor.com
817
+ [end]
818
+
819
+ showing
820
+
821
+ [output]
822
+ Tracing to www.myertor.com[a] via root, maximum of 3 retries
823
+ root (127.0.0.1)
824
+ ___ a.ns.com [com] (10.0.0.1)
825
+ ___ a.ns.myertor.com [myertor.com] (10.10.0.1) Got authoritative answer
826
+ [end]
827
+
828
+ [h3 Questions]
829
+
830
+ [ol]
831
+ [item How do clients tell when they have reached the end of the query process, i.e. that [tt www.myertor.com] is a leaf node in the [ac DNS] tree?]
832
+ [item When updating the [ac DNS] data, [sc nsd] requires an explicit [tt reload] of the data. Why do we have to tell [sc nsd] to reload the data, and what data does [sc nsd] serve before issuing the [tt reload]?]
833
+ [item Describe the outline of the process used to add sub-zones to [tt myertor.com], e.g. [tt admin.myertor.com].]
834
+ [end]
835
+
836
+ [h2 Making Clients Work]
837
+
838
+ At this point we have a fully working [ac DNS]. Our root server and [ac TLD] are both delegating correctly, and the nameserver for [tt myertor.com] is able to accept this delegation and hand out records for hosts within that domain.
839
+
840
+ However, we are assuming that clients are able to handle the various lookup steps for themselves (remember each server only hand out the next step in the chain). Nearly all clients will be able to do this, but in doing so many clients will be asking the same questions. In our very simple [ac DNS], all clients will be asking the same root server for the [ac TLD] nameservers. Some domains are likely to be very popular, so again, many clients are likely to be asking the same questions about sub-domains in the [ac TLD]s.
841
+
842
+ In the [tt SOA] records, we told resolvers looking up the domain
843
+ records how long they could hold onto the data for. In most cases this
844
+ data is valid for at least hours, and usually days (or even weeks).
845
+ Caching this data could therefore reduce both the load on our network, and speed up the response to the clients by storing commonly used data. If we asked the caches to do the recursive lookups on behalf of the clients, this would also speed things up (and reduce the need for clients to do the work themselves).
846
+
847
+ Recursive [ac DNS] caches are very common on most networks, and are essential for the correct operation of most clients. Instead of pointing the clients to the global root servers and expecting them to do the hard work, we point clients at the nearest recursive cache and delegate most of the work to the cache.
848
+
849
+ In our simple [ac DNS] environment, the host jail is configured to use MaraDNS[fn More information on MaraDNS is available on the module site.] as the recursive cache via the file [tt /etc/resolv.conf]. This file tells the operating system which nameserver to use for lookups, and the domain name for 'short' hostnames: how [tt www] should be interpreted, for instance.
850
+
851
+ MaraDNS is, in turn, configured to work with the root servers specified in the file [tt /etc/mararc]. In our case we have just one root server, so that's all MaraDNS can see.
852
+
853
+ Pulling everything together now means we can do
854
+
855
+ [command]
856
+ lynx www.myertor.com
857
+ [end]
858
+
859
+ The text web browser [tt lynx](1) should find the recursive caching nameserver, which find the root of the [ac DNS]. From the root we follow the chain of delegations, until we reach the [ac IP] address of the host [tt www] in the domain [tt myertor.com]. With the [ac IP] address, we can then open a [sc tcp] connection to the web server, and display the home page.
860
+
861
+ [h3 Questions]
862
+
863
+ [ol]
864
+ [item What is the difference between an authoritative name server and a recursive name server cache?]
865
+ [item Do name servers have to be authoritative?]
866
+ [item Can clients tell if a response is authoritative or not?]
867
+ [end]
868
+
869
+ [h2 Extended Tasks]
870
+
871
+ [h3 Adding a Record for tt www.myertor.org]
872
+
873
+ In the delegation records of the root server in our [ac DNS], we also had space for the [tt .org] [ac TLD]. Configure jails [tt 2] and [tt 3] so the command
874
+
875
+ [command]
876
+ lynx www.myertor.org
877
+ [end]
878
+
879
+ executed in the jail root will also display the target web page. You should be able to do this by modifying the existing zone records, in much the same way as you did for the [tt .com] domain.
880
+
881
+ [h3 Questions]
882
+
883
+ [ol]
884
+ [item Do we have to make any special configuration changes to the name server to allow the serving of multiple zones?]
885
+ [item Assuming the name server is configured, describe the process of adding new zones to the name server.]
886
+ [item How is delegation affected by the additional zones? What do you have to do to correct any issues in the delegation authority?]
887
+ [end]
888
+
889
+ [h2 Reversing the Flow]
890
+
891
+ Once you understand the normal domain name lookup process, you should be able to add records for the reverse direction: mapping [ac IP] addresses to hostnames. Reverse lookups are very common in most networks, for instance displaying the hostnames in a packet trace, or verifying the hostname of an [tt ssh](1) client.
892
+
893
+ The major difference between forward and reverse lookups is that reverse lookups are [e always] done in the special domain [tt in-addr.arpa][fn At least for version 4 [ac IP] addresses. Version 6 addresses use a different domain]. Delegations work the same way, but the [ac IP] addresses are given in reverse: i.e. we assume the left-most byte has the highest significance and the right-most the least. Hence the [ac IP] address [tt 10.10.0.1] lives in the domain [tt 1.0.10.10.in-addr.arpa].
894
+
895
+ Start by defining the [tt SOA] records and authority for the [tt 10.in-addr.arpa] zone in the jail host, and then work through the delegation in jails [tt 3] and [tt 2].
896
+
897
+ [h3 Questions]
898
+
899
+ [ol]
900
+ [item Compare the forward and reverse lookups for the web server. Where is the lookup process similar, and at what points does it differ?]
901
+ [item How would we handle a host with multiple [ac IPv4] addresses listed in the forward zone?]
902
+ [item How would we handle a host with multiple [e names] in the forward zone?]
903
+ [end]
904
+
905
+ [h3 Adding Mail]
906
+
907
+ You can download a ready-to-run mail server with a web interface using the [tt FreeBSD Console 03] image, available at [tt ftp://download.myertor.com/Images/FreeBSD_Console_03.7z] (and linked through the module site). Extract the image and set VMWare running as before.
908
+
909
+ The [tt FreeBSD Console] image uses [sc dhcp] to assign an [sc ip] address, so you will have to first change the image to use the static address [tt 10.10.10.20]. This is essentially the same process as we went through in the last lab, but changes have to be stored in the file [tt /etc/rc.conf]. Read through the [e FreeBSD Handbook] for details of statically configuring networking in FreeBSD.
910
+
911
+ Once you have a mail server running, change the [tt myertor.com.] zone to direct [sc smtp] traffic to the new mail server. Once the zone is re-started you should be able to send e-mails via the new server. A good tool for testing your mail setup is [tt swaks](1): search the module site for more details.
912
+
913
+ [h3 Questions]
914
+
915
+ [ol]
916
+ [item Describe the sequence of [ac DNS] lookups used during delivery of a mail message (a diagram may help).]
917
+ [item If the primary mail server were unavailable, how would this sequence be modified so that a host could still deliver to a secondary mail server with priority [tt 20].]
918
+ [end]
919
+
920
+ [h3 IPv6]
921
+
922
+ If log into the [tt FreeBSD DNS] image and run the command
923
+
924
+ [command]
925
+ ezjail-admin list
926
+ [end]
927
+
928
+ You should see that every jail also has an [ac IPv6] address, in addition to the [ac IPv4] address. The [ac DNS] in [ac IPv6] is essentially the same as the one for [ac IPv4]: apart from the use of [tt AAAA] records in place of [tt A] records. The reverse domain is also slightly different as you will soon discover.
929
+
930
+ You don't need to understand [ac IPv6] routing to complete this problem: you just need to understand how an [ac IPv6] works, and how this fits into the [ac DNS].
931
+
932
+ The first problem is getting [ac DNS] working; just as we have done before for [ac IPv4] addresses. The easiest way to start is just to modify the zone files. You will then have to force [ac IPv6] clients to use [ac IPv4] to look-up [ac IPv6] names: this should happen automatically.
933
+
934
+ A better solution is to use a 'full' [ac IPv6] network, where [sc nsd] responds to both [ac IPv4] and [ac IPv6] queries on both [ac IPv4] and [ac IPv6] addresses. Although the jails are all fully set-up for [ac IPv6], you will need to tell [sc nsd] to bind to the relevant [ac IPv6] address. This will require modifying the relevant [tt /etc/nsd/nsd.conf] file in the jail, and restarting [sc nsd]. You should then be able to get [sc nsd] to respond to [ac IPv6] queries using [ac IPv6].
935
+
936
+ [h3 Questions]
937
+
938
+ [ol]
939
+ [item Look at the [ac IPv6] addresses used for the jails. How do these correspond to the [ac IPv4] addresses used earlier? What is this addressing scheme called?]
940
+ [item How does the reverse name-lookup work in [ac IPv6]? What are the key differences between this process and the one used for [ac IPv4]?]
941
+ [item Describe the sequence of [ac DNS] requests made during mail delivery for an [ac IPv6] mail host on a fully [ac IPv6] enabled network (including an [ac IPv6] cache and name server) delivering mail to an [ac IPv4] only network (including only an [ac IPv4] name server).]
942
+ [end]
943
+