This document contains sample files and explains many of the lines found in each file. This document also explains how to run and test the name server, how to set up clients, and how to change the hosts.awk script.
This document applies to AIX Versions 4.x.
Additional information can be found in:
http://www.rs6000.ibm.com/library/
The file /etc/named.boot is created manually, as described below. This file must be in /etc and must be called named.boot.
primary test.com /u/dns/named.data primary 5.7.10.in-addr.arpa /u/dns/named.rev.10.7.5 primary 155.10.in-addr.arpa /u/dns/named.rev.10.155 primary 0.0.127.in-addr.arpa /u/dns/named.local cache . /u/dns/named.ca
===================================== primary test.com /u/dns/named.data
This line indicates that this is a primary name server for the domain called test.com. The file to be checked when the name server is queried for a host name ending with test.com is /u/dns/named.data.
A name server is consulted, or "queried," to resolve a host name much like the /etc/hosts file can be queried. For example, the commands:
$ host mars.test.comor
$ host marswill reference the file /u/dns/named.data to find the IP address for the host name mars.
NOTE: If the name server will be accessible on the Internet, make sure the domain name and IP addresses are not already in use by another organization. Before making the name server accessible on the Internet, register with the Department of Defense Network Information Center (NIC).
===================================== primary 5.7.10.in-addr.arpa /u/dns/named.rev.10.7.5
This line indicates that this name server is primary for the domain called 5.7.10.in-addr.arpa. In other terms, the name server is primary for all IP addresses beginning with 10.7.5.
Whenever in-addr.arpa is appended to an IP address, the numbers should be interpreted in REVERSE ORDER. The file /u/dns/named.rev.10.7.5 will be checked when the name server is queried for an IP address beginning with 10.7.5. For example:
$ host 10.7.5.4will reference the file /u/dns/named.rev.10.7.5 to find the host name assigned to IP address 10.7.5.4.
===================================== primary 155.10.in-addr.arpa /u/dns/named.rev.10.155
This line indicates that this name server is primary for the domain called 155.10.in-addr.arpa. In other terms, the name server is primary for all IP addresses beginning with 10.155. The file /u/dns/named.rev.155.10 will be checked when the name server is queried for an IP address beginning with 10.155. For example:
$ host 10.155.200.5will reference the file /u/dns/named.rev.10.155 to find the host name assigned to IP address 10.155.200.5.
===================================== primary 0.0.127.in-addr.arpa /u/dns/named.local
This line is designed to handle the loopback address of 127.0.0.1. The file /u/dns/named.local will be checked when a query is received for 127.0.0.1 (or any other IP address beginning with 127.0.0). The loopback address is needed on every system.
===================================== cache . /u/dns/named.ca
This line is used in the event that a query is received outside of any of the domains specified. In the example case, if a query is received by the name server for any host name that is not in the test.com domain, or for any IP address that does not begin with 10.155, 10.7.5, or 127.0.0, the named.ca file is essential so that the name server can contact other name servers for assistance.
If the domain does not have access to the Internet, the cache line does not need to be added to the named.boot file. For example, if a firewall restricts external traffic from accessing your network, do not use a cache line. Instead, a forwarders line can be used.
===================================== forwarders 120.45.20.1
A forwarders line can be used to forward a query outside of any of the domains specified. In the example case, if a query is received by the name server for any host name that is not in the test.com domain, or for any IP address that does not begin with 10.155, 10.7.5, or 127.0.0, the forwarders line is necessary so that the query can be passed to another name server. For example, a request can be forwarded to the firewall, which may be acting as a name server that has a cache line, so that it can resolve queries for names on the Internet. More than one IP address can be listed here, separated by spaces.
===================================== slave
This line may follow the forwarders line. It forces the name server that is referenced in the forwarders line to take responsibility in resolving the query. Without a slave line, the name server in this example would query each of the name servers listed in the forwarders line, but those name servers would not forward their requests. So, in this example, at most two name servers would be queried.
To generate a named.data file, provide an /etc/hosts file with entries for all hosts to be serviced by this DNS server in this domain. In this example, the /etc/hosts file is:
127.0.0.1 loopback localhost 10.7.5.1 venus 10.7.5.2 jupiter 10.7.5.3 mars mailhost 10.7.5.4 neptune 10.155.39.5 pluto 10.155.200.5 mercury
The following command creates the named.data file:
# mkdir /u/dns # /usr/samples/tcpip/hosts.awk /etc/hosts > /u/dns/named.data
The base level version of AIX 4.1.4 requires a correction to hosts.awk before running it. See the section "Making Changes to hosts.awk for AIX 4.1.4" in this document.
The resulting file resembles the example below:
; nameserver data file ; (also see /etc/named.boot) ; ; NAME TTL CLASS TYPE RDATA ; ; setting default domain to "test.com" ; @ 9999999 IN SOA venus.test.com. root.venus.ibm.com. ( 1.1 ; Serial 3600 ; Refresh 300 ; Retry 3600000 ; Expire 86400 ) ; Minimum 9999999 IN NS venus 9999999INMX10mailhost venus 9999999 IN A 10.7.5.1 jupiter 9999999 IN A 10.7.5.2 mars 9999999 IN A 10.7.5.3 mailhost 9999999 IN CNAME mars neptune 9999999 IN A 10.7.5.4 pluto 9999999 IN A 10.155.39.5 mercury 9999999 IN A 10.155.200.5
After this step, the named.data file generally requires no further changes. (Sometimes the script will not generate the full names in the start of authority (SOA) record. For example, the script might generate venus... If this happens, edit the line to include the domain as shown in the example.)
===================================== ;
A semicolon indicates that the line is commented out.
The first uncommented line for this file begins at the SOA record. Do not modify this for now. For an explanation of the SOA record, see your online documentation.
===================================== 9999999 IN NS venus
This line is a name server (NS) record that indicates that venus is a name server. 9999999 is the timeout value and IN indicates that it is an Internet record (call them this regardless of whether or not they actually connect to the Internet).
===================================== 9999999INMX10mailhost
This line is a mail exchanger (MX) record. This line is not necessary and will not be created by the script. It is typically used when the name server is outside a firewall, or is queried by those outside your domain. When someone sends mail to user@test.com, this line indicates the mail is to be sent to mailhost for further processing. The file may have more than one MX record, and each may have different preferences (the higher the number, the lower the preference) and different machines to which they point.
The host names listed in the file are the "short" names. They do not have the domain name appended. This is because the domain name for this file is test.com and will be appended to each host name that is not followed by a "." (dot). In this case, none of the host names (pluto, mars, venus) are followed by a dot. They will be expanded to the fully qualified domain name. For example, the line:
jupiter 9999999 IN A 10.7.5.2is equal to
jupiter.test.com. 9999999 IN A 10.7.5.2NOTE: IP addresses are not subject to expansion.
===================================== neptune 9999999 IN A 10.7.5.4
This line shows an address record or "A record." The host neptune has the address 10.7.5.4. Each host in the domain has its own A record.
===================================== mailhost 9999999 IN CNAME mars
Since mailhost is an alias for mars, a CNAME is used to signify this.
The following command creates the named.rev file:
# /usr/samples/tcpip/addrs.awk /etc/hosts > /u/dns/named.rev.10.7.5 # /usr/samples/tcpip/addrs.awk /etc/hosts > /u/dns/named.rev.10.55
Both files will need some modification, but for now should look like:
; setting default domain to ... test.com @ 9999999 IN SOA venus.test.com. root.venus.test.com. ( 1.1 ; Serial 3600 ; Refresh 300 ; Retry 3600000 ; Expire 86400 ) ; Minimum 9999999 IN NS venus 1.0.0.127 IN PTR loopback.test.com. 1.5.7.10 IN PTR venus.test.com. 2.5.7.10 IN PTR jupiter.test.com. 3.5.7.10 IN PTR mars.test.com. 4.5.7.10 IN PTR neptune.test.com. 5.39.155.10 IN PTR pluto.test.com. 5.200.155.10 IN PTR mercury.test.com.
The named.rev.10.5.3 and named.rev.10.155 files will need to be modified now as described in Steps 1 and 2 below:
; setting default domain to ... test.com @ 9999999 IN SOA venus.test.com. root.venus.test.com. ( 1.1 ; Serial 3600 ; Refresh 300 ; Retry 3600000 ; Expire 86400 ) ; Minimum 9999999 IN NS venus 1 IN PTR venus.test.com. 2 IN PTR jupiter.test.com. 3 IN PTR mars.test.com. 4 IN PTR neptune.test.com.
NOTE: All hosts that do not begin with 10.7.5 were removed from this file . Only hosts that begin with 10.7.5 remain here. Also, 5.7.10 has been removed from the line. Just as test.com was appended to all of the host names not followed by a "." (dot) in the named.data file, all host names in the named.rev files not followed by a dot will have .5.7.10.in-addr.arpa appended to them. Be sure that each host name (such as jupiter.test.com.) in the named.rev files has a dot at the end. If the dot is omitted, commands such as:
$ host 10.7.5.4
will return
jupiter.5.7.10 is 10.7.5.4
Unlike the named.data file, the named.rev files are subject to expansion. In the following line:
3 IN PTR mars.test.com.
the 3 will be expanded to 3.5.7.10.in-addr.arpa. Interpreted in reverse order, this equals 10.7.5.3. This is a pointer record (PTR), which is used to map IP addresses to names.
; setting default domain to ... test.com @ 9999999 IN SOA venus.test.com. root.venus.test.com. ( 1.1 ; Serial 3600 ; Refresh 300 ; Retry 3600000 ; Expire 86400 ) ; Minimum 9999999 IN NS venus 5.39 IN PTR pluto.test.com. 5.200 IN PTR mercury.test.com.
The changes made to this file are similar to the changes made in named.rev.10.7.5.
The domain 155.10.in-addr.arpa will be appended to 5.39 and 5.200 when expanded.
NOTE: The expansion does not actually take place in the file. It only takes place when queried.
Create the named.local file manually. There is no script to create it.
@ IN SOA venus.test.com. root.venus.test.com. ( 1.1 ;serial 3600 ;refresh 600 ;retry 3600000 ;expire 86400) ;minimum
IN NS venus.test.com.
1 IN PTR localhost.
NOTE: If you are not connected to the Internet, do NOT create a named.ca file.
If you are connected to the Internet, put a list of root name servers in the named.ca file. This list is maintained by NIC and can be obtained through one of the two methods shown below:
A file similar to the following will result:
HOSTNAME NET ADDRESSES SERVER PROGRAM A.ROOT-SERVERS.NET 198.41.0.4 BIND (UNIX) B.ROOT-SERVERS.NET 128.9.0.107 BIND (UNIX) C.ROOT-SERVERS.NET 192.33.4.12 BIND (UNIX) D.ROOT-SERVERS.NET 128.8.10.90 BIND (UNIX) E.ROOT-SERVERS.NET 192.203.230.10 BIND (UNIX) F.ROOT-SERVERS.NET 192.5.5.241 BIND (UNIX) G.ROOT-SERVERS.NET 192.112.36.4 BIND (UNIX) H.ROOT-SERVERS.NET 128.63.2.53 BIND (UNIX) I.ROOT-SERVERS.NET 192.36.148.17 BIND (UNIX)
Modify the file to read:
. 9999999 IN NS A.ROOT-SERVERS.NET . 9999999 IN NS B.ROOT-SERVERS.NET . 9999999 IN NS C.ROOT-SERVERS.NET . 9999999 IN NS D.ROOT-SERVERS.NET . 9999999 IN NS E.ROOT-SERVERS.NET . 9999999 IN NS F.ROOT-SERVERS.NET . 9999999 IN NS G.ROOT-SERVERS.NET . 9999999 IN NS H.ROOT-SERVERS.NET . 9999999 IN NS I.ROOT-SERVERS.NET A.ROOT-SERVERS.NET IN A 198.41.0.4 B.ROOT-SERVERS.NET IN A 128.9.0.107 C.ROOT-SERVERS.NET IN A 192.33.4.12 D.ROOT-SERVERS.NET IN A 128.8.10.90 E.ROOT-SERVERS.NET IN A 192.203.230.10 F.ROOT-SERVERS.NET IN A 192.5.5.241 G.ROOT-SERVERS.NET IN A 192.112.36.4 H.ROOT-SERVERS.NET IN A 128.63.2.53 I.ROOT-SERVERS.NET IN A 192.36.148.17
domain test.com nameserver 10.7.5.1
10.7.5.1 is the IP address of venus, the name server.
startsrc -s named
mv /etc/hosts /etc/hosts.bak
If a host is not found by the name server, the /etc/hosts file will be checked next.
Select any host in the domain, for example, a machine called jupiter. Enter:
$ host jupiter jupiter.test.com is 10.7.5.2 $ host 10.7.5.2 jupiter.test.com is 10.7.5.2
If name resolution is working properly, the results should be similar to those shown above. The host jupiter command checks the named.data file for information and the host 10.7.5.2 command checks named.rev.10.7.5. If name resolution is not working properly, look for configuration errors in the appropriate files.
daemon.debug /tmp/syslog.out
Save the file.
# touch /tmp/syslog.out # stopsrc -s syslogd # startsrc -s syslogd # lssrc -s syslogd
The status of syslogd should be active. Enter:
# stopsrc -s named # startsrc -s named
When there are no more errors, see if the problem is resolved.
Additional help is available through your online documentation (search on "name resolution"), the System Management Guide for Communications and Networks (IBM Publication SC23-2526) and through the book DNS and Bind, published by O'Reilly.
On all clients that will use name resolution, create a file called /etc/resolv.conf with the following two lines:
nameserver 10.5.7.1 domain test.com
NOTE: These changes are NOT needed at AIX 3.2 or 4.2 and higher.
Make the following two changes to the hosts.awk script before running it at AIX base level 4.1.4.0:
awk 'BEGIN {
to
awk -v Domain=$DOMAIN -v hostname=$HOSTNAME 'BEGIN {
}' Domain=$DOMAIN hostname=$HOSTNAME $1
to
}' $1