Now we're ready to create the files for the master server. There are many recommendations about how these should be named and stored. Our domain has a simple layout, as it isn't large enough to be split into numerous zones, which means that the files will consist of one zone and so will be easier to work through. For this reason, the layout we'll use here is to store all the master files in a directory named master, all the slave files in a directory named slave, and the root server information in the top-level directory. Let's now create the master directory then move on to the configuration file:
antimony# cd /var/named antimony# mkdir master antimony#
Since most systems by now will be using at least Solaris 7, their version of DNS will be based on BIND Version 8 and so will use the newer named.conf file format. Therefore, we'll also use the same file format, so let's first define it and then work through the values to see what we've done.
The main changes we have made to the example files shown previously are to isolate each particular type of file by creating a hierarchy under the main named area where we can store the relevant files. The boot file we've defined for the master doesn't contain any secondary server information, as we don't act as a slave for any other domain yet:
antimony# cat /etc/named.conf // // named.conf file // options { directory "/var/named"; }; // root servers zone "." in { type hint; file "named.root"; }; // master forward file for the main domain zone "solarisbootcamp.com" in { type master; file "master/solarisbootcamp.com"; }; // master reverse file for the arpa domain zone "44.168.192.in-addr.arpa" in { type master; file "master/solarisbootcamp.rev"; }; // reverse file for the loopback interface zone "0.0.127.in-addr.arpa" in { type master; file "master/local.rev"; }; antimony#
This file contains the list of servers that are authoritative for the root domain and is a standard file that is available from ftp.rs.internic.net, where it is named domain/named.root (to download this, we can use a browser and connect to ftp://ftp.rs.internic.net/domain/named.root). Although this doesn't change very often, it ought to be checked/upgraded regularly; once a month should be adequate and easy enough to carry out.
The example below shows our downloaded file (we have removed any comments to conserve space). Looking at it, we can see it contains two entries for each machine: one that specifies the machine is a name server (the NS record), and a second that specifies its IP address (the A record):
antimony# cat named.root . 3600000 IN NS A.ROOT-SERVERS.NET. A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4 . 3600000 NS B.ROOT-SERVERS.NET. B.ROOT-SERVERS.NET. 3600000 A 128.9.0.107 . 3600000 NS C.ROOT-SERVERS.NET. C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12 . 3600000 NS D.ROOT-SERVERS.NET. D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90 . 3600000 NS E.ROOT-SERVERS.NET. E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10 . 3600000 NS F.ROOT-SERVERS.NET. F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241 . 3600000 NS G.ROOT-SERVERS.NET. G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4 . 3600000 NS H.ROOT-SERVERS.NET. H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53 . 3600000 NS I.ROOT-SERVERS.NET. I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17 . 3600000 NS J.ROOT-SERVERS.NET. J.ROOT-SERVERS.NET. 3600000 A 198.41.0.10 . 3600000 NS K.ROOT-SERVERS.NET. K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129 . 3600000 NS L.ROOT-SERVERS.NET. L.ROOT-SERVERS.NET. 3600000 A 198.32.64.12 . 3600000 NS M.ROOT-SERVERS.NET. M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33 antimony#
Next we'll create the reverse file for the loopback interface, as it's probably the easiest one to do. This is used so that the server can translate the address 127.0.0.1 back to “localhost.” The forward address for translating “localhost” to 127.0.0.1 will be in the primary forward file for the domain:
antimony# cat master/local.rev ; ; local reverse file ; @ IN SOA solarisbootcamp.com. root.solarisbootcamp.com. ( 2001043001 ; Serial num - <yyyymmddxx> 86400 ; Refresh every 24 hours 7200 ; Retry every 2 hours 3600000 ; Expire in 1000 hours 172800) ; TTL is 2 days ; ; name server definitions ; IN NS antimony.solarisbootcamp.com. IN NS tellurium.solarisbootcamp.com. ; ; localhost ; 1 IN PTR localhost. antimony#
Looking at the file, we can see that after we have added the standard SOA and NS records that we defined earlier, the only other entry we have is a PTR record for “localhost.”
This is the forward file for the primary domain, which, as explained earlier, is used when performing standard (forward) lookups where we query a name and the IP address is returned:
antimony# cat master/solarisbootcamp.com ; ; named forward file for 192.168.44 ; @ IN SOA solarisbootcamp.com. root.solarisbootcamp.com. ( 2001043001 ; Serial num - <yyyymmddxx> 86400 ; Refresh every 24 hours 7200 ; Retry every 2 hours 3600000 ; Expire in 1000 hours 172800) ; TTL is 2 days ; ; name server definitions ; IN NS antimony.solarisbootcamp.com. IN NS tellurium.solarisbootcamp.com. ; ; definition for localhost ; localhost IN A 127.0.0.1 ; ; definitions for the remaining hosts ; tin IN A 192.168.44.50 antimony IN A 192.168.44.51 tellurium IN A 192.168.44.52 iodine IN A 192.168.44.53 xenon IN A 192.168.44.54 cesium IN A 192.168.44.55 ; ; host aliases ; sn IN CNAME tin sb IN CNAME antimony te IN CNAME tellurium i IN CNAME iodine xe IN CNAME xenon cs IN CNAME cesium antimony#
Again, we first define the SOA and NS records for the zone. Next we have the IP addresses of all the systems (the A records), including one for “localhost,” that we want to be seen under DNS. Following these we have the alias definitions (the CNAME records) for the machines, which, for this purpose, we can think of as providing a similar functionality to the alias entry in /etc/hosts.
Finally, here's the file that provides the reverse lookups for the domain. Once again, we use the same SOA and NS records, followed by a series of pointers to the hosts themselves (the PTR records). Note the trailing dots again on the records:
antimony# cat master/solarisbootcamp.rev ; ; named reverse file for 192.168.44 ; @ IN SOA solarisbootcamp.com. root.solarisbootcamp.com. ( 2001043001 ; Serial num - <yyyymmddxx> 86400 ; Refresh every 24 hours 7200 ; Retry every 2 hours 3600000 ; Expire in 1000 hours 172800) ; TTL is 2 days ; ; name server definitions ; IN NS antimony.solarisbootcamp.com. IN NS tellurium.solarisbootcamp.com. ; ; individual hosts ; 50 IN PTR tin.solarisbootcamp.com. 51 IN PTR antimony.solarisbootcamp.com. 52 IN PTR tellurium.solarisbootcamp.com. 53 IN PTR iodine.solarisbootcamp.com. 54 IN PTR xenon.solarisbootcamp.com. 55 IN PTR cesium.solarisbootcamp.com. antimony#