BIND: A Basic DNS Server

Updated: Sep 23, 2026

When I teach, I try to use software that is not only Free or Open Source but also is the Reference Standard and has stood the test of time. In DNS, BIND (Berkley Internet Name Domain) is just that software. With few exceptions, if there are new and emergeing standards, BIND will be one of the first to implement those standards. It is often the case that they (ISC - Internet Systems Consortium) are the primary author of most DNS RFCs.

BIND runs the majority of the Root Servers and ISC is the operator of F Root. Thus, I find it the best software to learn DNS regardless if you choose another such as Microsoft DNS, PowerDNS, Knot DNS, NSD or other popular DNS Servers. Different DNS software have different uses and features, but by learning BIND first you are bound to be more knowledgable and productive in whatever you use. DNS is DNS is DNS.

 
pkg search bind

pkg install bind-tools-9.20.27 bind920-9.20.27

pkg info | grep bind

pkg list bind920-9.20.27 | more

man named

mv /usr/local/etc/namedb/named.conf /usr/local/etc/namedb/named.conf.orig

touch /usr/local/etc/namedb/named.conf

ln -s /usr/local/etc/namedb/named.conf /etc/named.conf

mkdir /var/named
chown bind:bind /var/named
 

Configuration items are grouped into blocks. The main configuration blocks are:

  • acl { }; - Access Control Lists
  • controls { }; - Sets up a listener for the RNDC utility
  • dnssec-policy { }; - Defines DNSSEC signing key policess
  • key { }; - Declares TSIG keys
  • logging { }; - What, how and where logs go
  • options { }; - The global configuration options
  • remote-servers { }; - Declares naming group for servers for which we may communication in masters and notify statements
  • server { }; - Sets per server configuarion statements
  • statistics-channels { }; - Special listener for statsics web page
  • tls { }; - Used for setting up Encrypted listeners
  • view { }; - Creates virtual DNS Servers that can give different query results based on source IP
  • zone { }; - This contains the information to asnwer queries for defined domain names
For this lesson we'll only be woking within the options { }; block.

You can learn more by reading the BIND 9 Administrator Reference Manual.

 
options {
        directory "/var/named";
        pid-file "/var/run/named/pid";
	};
 
 
named-checkconf -c /etc/named.conf

# Will only print message if something is wrong.

named -4 -c /etc/named.conf -u bind

cd /var/named
file managed-keys.bind
file managed-keys.bind.jnl

cat managed-keys.bind
 

At this point, you should have a functioning DNS Server.

Now, we can use the command dig to query our DNS Server

With any new command you use, I always recommend reading the manual before you use it.

 
man dig
 
 
dig -4 @127.0.0.1 -t soa google.com

; <<>> DiG 9.20.27 <<>> -r -4 @127.0.0.1 -t soa google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10964
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 3a0ce8e83e9be8d0010000006ab3a959b6f67a390bb8af0c (good)
;; QUESTION SECTION:
;google.com.			IN	SOA

;; ANSWER SECTION:
google.com.		34	IN	SOA	ns1.google.com. dns-admin.google.com. 985880970 900 900 1800 60

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1) (UDP)
;; WHEN: Wed Sep 23 10:26:33 UTC 2026
;; MSG SIZE  rcvd: 117

 

This Concludes this lesson you can shut down your server with the kill command

 
cat /var/run/named/pid

ps auxwww | grep named

kill `cat /var/run/named/pid`
 

PREV HOME NEXT