Creating a DNS Server using Named
/var/named/named.boot
; tell what subdir has the lookup database files
directory /namedb
; type domain source host/file backup file
cache . root.cache
primary 0.0.127.IN-ADDR.ARPA localhost.rev
; example primary server config:
primary yewtopia.com yewtopia
primary 1.168.192.IN-ADDR.ARPA yewtopia.rev
/var/named/namedb/localhost.rev
; Reverse lookup for localhost interface
@ IN SOA nemo.yewtopia.com.
your_id.nemo.yewtopia.com. (
14 ; Serial
3600 ; Refresh
900 ; Retry
3600000 ; Expire
3600 ) ; Minimum
IN NS nemo.yewtopia.com.
1 IN PTR localhost.yewtopia.com.
/var/named/namedb/yewtopia
; yewtopia.com domain database
yewtopia.com. IN SOA nemo.yewtopia.com.
your_id.nemo.yewtopia.com. (
14 ; Serial
3600 ; Refresh
900 ; Retry
3600000 ; Expire
3600 ) ; Minimum
IN NS nemo.yewtopia.com.
; Addresses
localhost.yewtopia.com. IN A 127.0.0.1
crater.yewtopia.com. IN A 192.168.1.1
earhart.yewtopia.com. IN A 192.168.1.2
nemo.yewtopia.com. IN A 192.168.1.9
/var/named/namedb/yewtopia.rev
; yewtopia domain reverse lookup database
1.168.192.in-addr.arpa. IN SOA nemo.yewtopia.com.
your_id.nemo.yewtopia.com. (
14 ; Serial
3600 ; Refresh
900 ; Retry
3600000 ; Expire
3600 ) ; Minimum
1.168.192.in-addr.arpa. IN NS nemo.yewtopia.com.
; Addresses
1.1.168.192.in-addr.arpa. IN PTR crater.yewtopia.com.
2.1.168.192.in-addr.arpa. IN PTR earhart.yewtopia.com.
9.1.168.192.in-addr.arpa. IN PTR nemo.yewtopia.com.
Make sure /etc/resolv.conf now points to the domain of local machine
(instead of, for example, your ISP's name server) so that name resolution
requests actually get sent to the named you have configured!
#/etc/resolv.conf
domain yewtopia.com
lookup file bind
Starting DNS
The name daemon named is launched during system startup from /etc/rc if the
line installed by default in /etc/rc.conf.
named_flags=NO # for normal use: ""
is changed to
named_flags="" # for normal use: ""
Also, examine these lines in /etc/rc.conf:
named_user=named # Named should not run as root unless necessary
named_chroot=/var/named # Where to chroot named if not empty
To start named by hand, use the ndc(8) command. For example:
# ndc {start|restart|stop}
If this fails to work, find the process id of named and use the kill(1)
command to end that process. The PID for named while it is running is found
as the first line in the file /var/named/named.pid
# cat /var/named/named.pid
4608
named -t /var/named -u named
# kill -KILL 4608
Restarting DNS with an altered configuration
To cause a running instance of the name daemon to restart itself reloading
its configuration after you have made changes, send it a "hangup" signal:
# kill -HUP 4608
or by using the ndc(8) command. For example:
# ndc reload