This week we dive back into the depths of DNS records and related esoterica.
A DNS record type that we haven't covered is the pointer, or PTR record. This record type reverse maps addresses to names, so for the network we've been talking about, the PTR records would be:
188.8.131.52.in-addr.arpa IN PTR alice.redqueen.com 184.108.40.206.in-addr.arpa IN PTR kitten.redqueen.com 220.127.116.11.in-addr.arpa IN PTR hatter.redqueen.com 18.104.22.168.in-addr.arpa IN PTR dormouse.redqueen.com 22.214.171.124.in-addr.arpa IN PTR dormouse.redqueen.com
As before, the addresses on the left side are reversed and the in-addr.arpa domain is added. This data goes in the database that resolves reverse lookups - 206.65.120.db (www.nwfusion. com, DocFinder: 3736).
Now we have the forward lookup database for our domain - redqueen.db, and our reverse lookup database - 206.65.120.db.
The final thing we need to do is set up a loopback network database. The loopback address - 127.0.0.1 - is used when a machine wants to send and receive packets to and from itself. In our example, this data is stored in the file 127.0.0.db and looks like this:
0.0.127.in-addr.arpa. IN SOA alice. redqueen.com. admin.redqueen.com. ( 200103051053 ; Serial 86400 ; 1 day refresh 3600 ; 1 hour retry 604800 ; 1 week expiration 86400 ) ; 1 day TTL 0.0.127.in-addr.arpa. IN NS alice.redqueen.com. 126.96.36.199.in-addr. IN PTR localhost.
That final line is how the name server knows that "localhost" is mapped to 127.0.0.1 (the reverse of the record "localhost.redqueen.com IN A 127.0. 0.1" in the database redqueen.db).
One thing we haven't discussed is how DNS works with e-mail. There's a special record type - the Mail Exchanger, or MX record - for specifying mail servers for a domain.
An MX record looks like this:
redqueen.com. IN MX 1 borogrove. com.
This means borogrove.com will accept or relay mail for the domain redqueen.com. The value "1" is used when there are multiple mail servers for a given name to determine the order servers should be used in. If we had several servers:
redqueen.com. IN MX 1 borogrove1. blackqueen.com. redqueen.com. IN MX 2 borogrove2. blackqueen.com. redqueen.com. IN MX 5 hatter.blackqueen.com.
The lowest-numbered server would be tried first and, failing that, the next-highest-numbered server, and so on. Again, there's a lot more behind the mechanisms of MX records and how mail servers interact with them that we will forgo due to space constraints.
Anyway, that should get you started with a DNS server.
We have considered producing a more-detailed online Gearhead Guide to DNS. Let us know if you'd find it useful. Anyone interested in sponsoring it should drop a line to GHG@gibbs.com
This story, "Gearhead: Wrapping up DNS" was originally published by Network World.