HOWTO SET UP DNS "hopefully the easy way" =========================================== (related files in this directory: dnstools.shar) This short guide explains how to setup a DNS server using a tool called h2n which greatly simplifies the process - h2n is part of the set of tools from ftp.ora.com:/pub/examples/nutshell/dnsbind that accompany the O'Reilly book DNS and Bind - this is ESSENTIAL reading if you want to really understand what's going on or do more advanced DNS setup. PLEASE NOTE THIS IS NOT INTENDED TO BE AN IN-DEPTH DESCRIPTION OF HOW DNS WORKS, BUT IS INTENDED TO GET DNS WORKING AS SIMPLY AS POSSIBLE. The following multi-point plan will get DNS running on your machine. Before you start please make a note of the following: (a) Your IP network number, i.e. 192.9.200 (b) Your Domain address, i.e. mydom.com (note this can be a three level one if you like, for example mydom.biggerdom.com, just replace mydom.com with the mydom.biggerdom.com in the examples below). (c) Your internet providers domain and address 1a. Edit /etc/inet/rc.inet (for UnixWare 1.x) To enable starting of the named daemon on your machine uncomment the following section of the file /etc/inet/rc.inet # # Run the DNS server if a configuration file is present # #if [ -f /etc/inet/named.boot -a -x /usr/sbin/in.named ] #then # /usr/sbin/in.named #fi 1b. For UnixWare 2.0 /etc/inet/rc.inet is no longer used, but the file /etc/inet/config, which has by default an entry: 5:/usr/sbin/in.named::y:/etc/inet/named.boot:: This state line means that when the file /etc/inet/named.boot exists then the system should auto start the in.named process if it exists and is executable 2. Obtain the dnstools file from the mail-server@novell.co.uk send the following message begin send dnstools.shar.Z end 3. Make a directory to contain the DNS setup files, and chown that directory to yourself su mkdir /var/named chown andrew /var/named 4. Unwind dnstools.shar.Z file in /var/named directory cd /var/named compress -d dns_tools.shar sh dns_tools.shar 5. Make sure that the h2n file is executable chmod +rx h2n (note that h2n is written in perl and assumes that perl is in /usr/gnu/bin/perl. If its not, then obtain perl from the mail-server and edit the first line of h2n to the correct location for perl). 6. Edit the file file named.boot and edit in your Domain & IP address ; The following example is for domain mydom.com ; (1) Change mydom.com to your domain address, and change the db file ; so that its the first word before a . for example, ; novtest.demon.co.uk , has a db file of db.novtest. ; (2) Change the IP address of 192.9.200 (replace this with your real addr) ; note the first number in the IN-ADDR.ARPA line has the addr in reverse directory /var/named primary 0.0.127.IN-ADDR.ARPA db.127.0.0 primary mydom.com db.mydom primary 200.9.192.IN-ADDR.ARPA db.192.9.200 cache . db.cache Optionally, you may also want to add a Forwarders line. Typically you'd do this if you were behind a firewall, and would forward to a machine that is a firewall gateway, for example forwarders 137.65.1.1 147.2.200.5 128.110.124.120 This would go before the cache entry. You may also want to consider moving the cache line to be the first entry in the file after the directory entry, some sites can get improved performance from this - for our site behind a firewall we don't. 7. ln /var/named/named.boot to /etc/inet/named.boot su cd /etc/inet ln -s /var/named/named.boot named.boot 8. Edit h2n.script - this file is a shell script that calls the h2n perl script to generate DNS data files from the hosts file entry. Change the following parameters: DOMAIN=mydom.com IPADDR=192.9.200 NETMASK=255.255.255.0 PRIMARY=`uname -n` SECONDARY=myprovider.com CONTACT=andrew.${PRIMARY}.${DOMAIN} The values for DOMAIN and IPADDR should be the same as those used in /var/named. The CONTACT is for the SOA field and should be a valid email address except that the "@" sign has been replaced by a ".". If you decide you want to have your contact address as a two level domain address (i.e. user@mccc.edu rather than user@tecoma.mccc.edu) then change the CONTACT line to CONTACT=user.mccc.edu 9. Edit /etc/hosts and setup hosts for the network. 192.9.200.1 prime prime.mydom.com ns 192.9.200.2 another # [no smtp] Note that the comment # [no smtp] indicates to h2n not to generate an MX record for that host. 10. Run the shell script h2n.script in /var/named to generate the DNS data files based on the host file. sh h2n.script At this time answer N to restart the named process sh h2n.script root 12686 1 0 07:30:44 ? 0:00 /usr/sbin/in.named root 12749 12743 2 07:46:25 pts/4 0:00 grep named do a kill -HUP to the named process, then an nslookup to check: kill -HUP 12686? [y] n (after you've got DNS running the first time, further updates can be made to the host file, and then the h2n.script rerun, each time saying Y will then restart in.named and automatically run nslookup so you can check the configuration). 11. Start the in.named daemon by hand su /usr/sbin/in.named 12. Edit the file /etc/resolv.conf Resolv.conf domain mydom.com nameserver 127.0.0.1 # this is the localhost 13. Test the named using nslookup nslookup Default Server: localhost Address: 127.0.0.1 > ns.novell.com Server: localhost Address: 127.0.0.1 Name: ns.novell.com Addresses: 137.65.4.1, 137.65.1.1 14. Do you just want a cacheonly DNS server? Just copy boot.cacheonly to named.boot and restart the in.named with a kill -HUP. 15. What do you need for other clients in your cluster just edit /etc/resolv.conf ; sample /etc/resolv.conf for client domain mydom.com nameserver 192.9.200.1 Troubleshooting --------------- Firstly: PLEASE CONSIDER getting the O'Reilly book DNS and Bind ISBN 1-56592-010-4. It's essential reading and explains fully how best to use the h2n tool and much much more. Symptom: in.named refuses to start. Resolution: check that the symlink to /etc/inet/named.boot is in place ================================================================= Starting and Stopping the in.named Your DNS is now setup. To start your DNS, you will need to stop and start the in.named process. Once restarted, in.named will automatically detect the named.boot file in the /etc/inet directory and start your DNS. To stop the in.named process execute the following commands as root: ps -ef | grep in.named The PID# will be found in column two. Kill the process with the following command. Replace PID# with the number you saw in column two. kill -1 PID# To start the in.named process type "/usr/sbin/in.named". This process will start automatically when you reboot. Once in.named is running with the new configuration you will need to test your DNS. Use the ping and nslookup commands to test your DNS. Both of these programs are found in /usr/sbin.