Configuring DNS Server Part 1
Notice that the program is called BIND9, but the service it runs is a name daemon. The system refers to this process as named.
For now, we need to make the localhost files and add the startup line to rc.conf and configure our resolver.
# cd /var/named/etc/namedb
# sh make-localhost
# echo 'named_enable="YES"' >> /etc/rc.conf
now, edit your resolv.conf file and put your server in as the first name serve
# nano /etc/resolv.conf
The first line should say your domain, if you have one. The second line should point to your loopback address which is 127.0.0.1 if your domain name is wwwpages.com (which yours is not, but mine is, your resolv.conf file would look like this.
domain wwwpages.com
nameserver 127.0.0.1
save the file (btw, use CTRL-X and then y to save in nano).
Let's check to be sure bind9 is up and running:
# ps -ax|grep named
should output like this:
574 ?? Ss 0:00.53 /usr/sbin/syslogd -l /var/run/log -l /var/named/var/run/log -s
642 ?? Is 0:01.85 /usr/sbin/named -t /var/named -u bind
23715 p0 D+ 0:00.00 grep named
If all you see is the last line (grep named) then your name server is not running, so time to troubleshoot what you did! Assuming it worked, lets give it a test.
# nslookup www.microsoft.com
should output something like this:
Server: 127.0.0.1
Address: 127.0.0.1#53
Non-authoritative answer:
Name: microsoft.com
Address: 207.46.197.32
Name: microsoft.com
Address: 207.46.232.182
The first line, Server: 127.0.0.1 means the lookup request was fulfilled by the local server!
Congratulations, you have a caching only name server!
Bind9 v5.3 has added the rndc command to help manage the named server. It is still under development but check out the # man rndc page for options. A short list can be viewed by issuing the command without any options (hint: # rndc reload causes named to re-read it's named.conf and zone files).
# rndc
rndc is supposed to allow you to restart the name server which in turn reloads the zone files in the event you made changes via the command
# rndc restart
but, as yet, is not functional. To restart named, you must first find the process id number the service is running on (called a PID).
# ps -ax|grep named
should output something like this :
574 ?? Ss 0:00.53 /usr/sbin/syslogd -l /var/run/log -l /var/named/var/run/log -s
642 ?? Is 0:01.85 /usr/sbin/named -t /var/named -u bind
23715 p0 D+ 0:00.00 grep named
the first line just means the name service is writing to a log file. The second line is where the named service is running. The first number is the process id (PID). In this example, it is 642. The last line just means we asked about what jobs were running that included NAMED in the process.
To kill our name server, we will tell the system to kill -9 the named pid. Remember, in this example, the pid is 642.
# kill -9 642
and issue the complete command line string to start it:
# /usr/sbin/named -u bind -t /var/namedThat's it for now! Keep reading the other articles, you are well on your way to being a FREEBSD admin!