34. Setting up A Domain Name Server.
Introduction to FreeBSD

First off you have to have a valid domain name to use. The place that your domain is registered with needs to point at the IP address of your primary DNS Machine. This should all be taken care of by INTERNIC or the DNS one level above you.

If you are setting up a sub-domain, you will need to create a mapping in your zone pointing to the primary DNS for that domain.

First:

In the /etc/sysconfig file, or in the new /etc/rc.conf, Add the line:

namedflags="-b /etc/namedb/named.boot"

This will start the ``Name Daemon'' at boot up and set it to read the file /etc/namedb/named.boot as the configuration file.

Now you need to cd to the /etc/namedb/ directory.

Now type:

sh make-localhost

This will create the localhost.rev in that directory. This file is necessary for all local traffic to be properly dealt with.

Now create or edit the file named.boot

++++++++++++++NAMED.BOOT EXAMPLE ++++++++++++++++++++

;semi colons comment out statments.

; sortlist 128.3.0.0

; The sort list gives higher priority to certain domains in the case
;of multi-homed hosts.

directory	/etc/namedb

; this denotes the directory that named should look to find all of the 
; source files.

; type    domain		source host/file		backup file

cache     .							named.root

; named keeps a cache of recently looked up hostname in the file mentioned.

primary   0.0.127.IN-ADDR.ARPA	localhost.rev

; this is the local host entry needs to be there. Usually automatic.

primary  Berkeley.EDU		your.domain.zone
primary  32.128.IN-ADDR.ARPA	your.domain.rev

; These lines are a pair.  They represent the primary domain you control
; The first one is your domain and the second is the reverse lookup table.
; You need to have each DNS entry entered in to both files.
; You will need a pair of primary lines for each primary domain that 
; you administer.

secondary Berkeley.EDU	        128.32.130.11 128.32.133.1	ucbhosts.bak
secondary 32.128.IN-ADDR.ARPA	128.32.130.11 128.32.133.1	ucbhosts.rev.bak

; These lines are a pair also.  They represent the domains that you are 
; interested in knowing about if their DNS goes down.  Or you may just be
; the back up DNS for them.

; Instead of source files, you specify the host that is the primary DNS
; for that domain.  You must also specify that filename that named will
; store the temporary table in.
; You need a pair of these lines for each of the Domains that you are
; a secondary DNS for.
++++++++++++++++++++++End Example Named.boot File++++++++++++++++++

If you had the domain ``my.domain.com'', the IP Address range 10.20.40.0 - 10.20.40.255, and wanted to be the primary DNS for it, you would put this line in your named.boot file:

primary my.domain.com my.domain.com.zone

primary 40.20.10.IN-ADDR.ARPA my.domain.com.rev

Now you have to make the primary source file. Create a file called /etc/named/your.domain.zone Substitute you actual domain name. It must match the filename specified in the primary entry of named.boot

Here is an example of such a file.

IN	soa	bbcc.ctc.edu.	root.bbcc.ctc.edu. (
				28	;serial
				10800  ;refresh every 3 hours
				900    ;retry every 15 minutes
				604800 ;expire after a week
				86400  ;minimum of a day
				)
			IN		NS	bbcc.ctc.edu.
			IN		NS	ctc.ctc.edu.
			IN		NS	bb.cc.wa.us.
bbcc.ctc.edu.		IN		A	134.39.180.254
mail			IN		CNAME	bbcc.ctc.edu.
www			IN		CNAME	bbcc.ctc.edu.
irc			IN		CNAME	bbcc.ctc.edu.
bigbend.ctc.edu.	IN		CNAME	bbcc.ctc.edu.
athena	        	IN	 	A     	134.39.180.5
                	IN       	HINFO	intel 586-133 winnt
proto			IN		A	134.39.180.6
aries			IN		CNAME	bb.cc.wa.us.
sal			IN		A	134.39.180.8
dialup3			IN		A	134.39.180.252
;end of file.

5) Now you have to make the primary reverse lookup file. Create a file called /etc/named/your.domain.rev

Substitute your actual domain name. It must match the filename specified in the primary entry of named.boot

Here is an example of such a file.

IN	soa	bbcc.ctc.edu.	root.bbcc.ctc.edu. (
				28	;serial
				10800  ;refresh every 3 hours
				900    ;retry every 15 minutes
				604800 ;expire after a week
				86400  ;minimum of a day
				)
8		IN		PTR	sal.bbcc.ctc.edu.
252		IN		PTR	dialup.bbcc.ctc.edu.

Return to Table of Contents

Visit the Gifcom