This guide takes you through the setup of DNS (bind) on a FreeBSD machine.
This guide assumes you know some basics about DNS. If you don't have a clue what
DNS is about or how it operates please goto the library and get the book: 'Orielly:
DNS/Bind' book. It is the definitive guide that most DNS admins should be
A D V E R T I S E M E N T
FreeBSD DNS Concepts
It is important to understand DNS as it is core in a
system like FreeBSD. In fact, FreeBSD comes with a stock with full blown DNS
server and client. You don't need to install any 3rd party software to get it
going. Setting up DNS on FreeBSD is trivial and shouldn't take long to get
First off, let's get your FreeBSD box ready for setup.
This includes making sure your hostname is setup properly and running the
necessary make script. First off, set your hostname:
# hostname foo.bar.com
Now time to run the prepacked make shell script to install
the proper configuration files:
# cd /etc/namedb
# sh make-localhost
You'll notice that I cd'd into /etc/namedb. This is where
the name server config files sit on FreeBSD. The make-localhost script comes
with FreeBSD and should set everything up properly. By default, it sets up a
caching-only name server on your machine. The main config file is /etc/namedb/named.conf.
If you need to add zones or do any slave work set it up in that file.
FreeBSD also comes with some stock reload and restart
To reload the nameserver (without clearing cache):
To completely restart the nameserver:
Verify that it's running by using 'netstat -an' and 'sockstat':
From netstat -an:
tcp4 0 0 127.0.0.1.53 *.* LISTEN
tcp4 0 0 22.214.171.124.53 *.* LISTEN
udp4 0 0 127.0.0.1.53 *.*
udp4 0 0 126.96.36.199.53 *.*
Yep, something is listening on udp and tcp port 53. Lets look at sockstat to see
who it is:
root named 20693 20 udp4 188.8.131.52:53 *:*
root named 20693 21 tcp4 184.108.40.206:53 *:*
root named 20693 22 udp4 127.0.0.1:53 *:*
root named 20693 23 tcp4 127.0.0.1:53 *:*
Yep, named is running
That's all it takes to get it running!!! God bless
FreeBSD! Anyhow, we need to make it start up everytime you boot up the machine.
To do this, once again, edit /etc/rc.conf and add:
If you wish to use your nameserver for resolution on your
local box. You need to edit /etc/resolv.conf and add the following lines:
Now test it out:
Default Server: localhost.bar.com
WOW! It's actually working. How bout that! And that's all
she wrote. To add zones and other DNS information consult your favorite DNS book
and add your stuff to the files in /etc/namedb.