Beruflich Dokumente
Kultur Dokumente
FreeBSD DNS
Nick Rogness nick@rogness.net
Introduction
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 familiar with.
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 going.
Enabling DNS
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 scripts:
Yep, something is listening on udp and tcp port 53. Lets look at sockstat
who it is:
That's all it takes to get it running!!! God bless FreeBSD! Anyhow, we need to make it start up everytime
boot up the machine. To do this, once again, edit /etc/rc.conf and add:
named_enable="YES"
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:
search bar.com
nameserver 127.0.0.1
# nslookup
Default Server: localhost.bar.com
Address: 127.0.0.1
> yahoo.com.
Server: localhost.bar.com
Address: 127.0.0.1
Name: yahoo.com
Address: 66.218.71.198
> exit
#
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.