Install a local Bind Domain Name Server on a Pogoplug/Dockstar

There’s so much contradictory material on the Web about configuring bind it took me a long time to get one working. The first was on Ubuntu, but I wanted to move it to a Dockstar for reliability (not that my Ubuntu server is unreliable). The following steps
show what worked for me. I’m assuming you already have Optware installed on your Dockstar/Pogoplug. First, install bind from
Optware:

ipkg install bind

This will install a copy of bind9. Now to configure it.
The overview of the process is:
Create the required system config file:
named.conf
Create zone files:
db.localhost
db.localhost.rev
db.yourdomainname.com
db.192.168.1.rev

Write a file for lookups that cannot be internally resolved:
root.servers
All of the above files go into a directory called /opt/etc/named/. Check if it is there and create it if it isn’t by typing:
mkdir /opt/etc/named
Create an rndc.key file:
/opt/sbin/rndc-confgen -a
This should create a file called rndc.key in /opt/etc/named/. You may not need this if you are not going on to do dynamic DNS (which I am not). It’s part of the system that allows other applications – such as an rndc-enabled DHCP server – to update bind’s confiiguration files. I do not use dynamic DNS because my ISP requires that it’s gateway provide DHCP services for my network which means I cannot put the a DHCP server on my Dockstar.
Next create the configuration files based upon the examples below. I used the text editor nano but vim will also work. When all of the files are in place you can start the server for testing.
That’s the overview. Here are example configuration and zone files in more detail.
Named.conf

                    
# These files all belong in /opt/etc/named/named.conf
# you need to choose a local domain name and substitute for yourdomainname  
# below
# The example files assume your local IP network is 192.168.1.0/24, you 
# will need to change them accordingly if you are using something else
acl "home" { 192.168.1.0/24; 127.0.0.1; };
# The forwarders shown below are for Open DNS internet domain name servers 
# You could also use your ISPs servers or Google (8.8.8.8 & 8.8.4.4) etc.
options {
        directory "/opt/etc/named";
        allow-query { "home"; };
        allow-recursion { 192.168.1.0/24; 127.0.0.1; };
        forwarders {
        208.67.222.222;
        208.67.220.220; };
};

controls {
        inet 127.0.0.1 allow { localhost; } keys { rndc-key; };
};

// log to /var/log/named/yourdomainname.log all events from info UP in severity
//(no debug)
// defaults to use 3 files in rotation
// BIND 8.x logging MUST COME FIRST in this file
// BIND 9.x parses the whole file before using the log
// failure messages up to this point are in (syslog) /var/log/messages
//
logging {
//  channel yourdomainname_log {
//   file "/tmp/var/named/yourdomainname.log" versions 3 size 2m;
//   severity info;
//   print-severity yes;
//   print-time yes;
//   print-category yes;
//};
category default {
  default_syslog;
};
};

// Add local zone definitions here.
zone "localhost" {
        type master;
        file "db.localhost";
        allow-update { none; };
        notify no;
};


zone "0.0.127.in-addr.arpa" {
        type master;
        file "db.localhost.rev";
        allow-update { none; };
        notify no;
};
zone "yourdomainname.com" {
        type master;
        file "db.yourdomainname.com";
        allow-update { key "rndc-key"; };
        notify yes;
};
//note use of my ip address range again first in reverse for the zone name
//the forward direction as part of the filename substitute yours as needed
zone "1.168.192.in-addr.arpa" {
        type master;
        file "db.192.168.1.rev";
        allow-update { key "rndc-key"; };
        notify yes;
};

zone "." {
        type hint;
        file "root.servers";
};

include "/opt/etc/named/rndc.key";

root.servers
Note: No modifications needed use as is.

  GNU nano 2.2.5                    File: root.servers                                              

;       This file holds the information on root name servers needed to
;       initialize cache of Internet domain name servers
;       (e.g. reference this file in the "cache  .  "
;       configuration file of BIND domain name servers).
;
;       This file is made available by InterNIC
;       under anonymous FTP as
;           file                /domain/named.root
;           on server           FTP.INTERNIC.NET
;       -OR-                    RS.INTERNIC.NET
;
;       last update:    Dec 12, 2008
;       related version of root zone:   2008121200
;
; formerly NS.INTERNIC.NET
;
.                        3600000  IN  NS    A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET.      3600000      A     198.41.0.4
A.ROOT-SERVERS.NET.      3600000      AAAA  2001:503:BA3E::2:30
;
; FORMERLY NS1.ISI.EDU
;
.                        3600000      NS    B.ROOT-SERVERS.NET.
B.ROOT-SERVERS.NET.      3600000      A     192.228.79.201
;
; FORMERLY C.PSI.NET
;
; 
.                        3600000      NS    C.ROOT-SERVERS.NET.
C.ROOT-SERVERS.NET.      3600000      A     192.33.4.12
;
; FORMERLY TERP.UMD.EDU
;
.                        3600000      NS    D.ROOT-SERVERS.NET.
D.ROOT-SERVERS.NET.      3600000      A     128.8.10.90
;
; FORMERLY NS.NASA.GOV
;
.                        3600000      NS    E.ROOT-SERVERS.NET.
E.ROOT-SERVERS.NET.      3600000      A     192.203.230.10
; 
; FORMERLY NS.ISC.ORG
;
.                        3600000      NS    F.ROOT-SERVERS.NET.
F.ROOT-SERVERS.NET.      3600000      A     192.5.5.241
F.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:2F::F
; 
; FORMERLY NS.NIC.DDN.MIL
;
.                        3600000      NS    G.ROOT-SERVERS.NET.
G.ROOT-SERVERS.NET.      3600000      A     192.112.36.4
; 
; FORMERLY AOS.ARL.ARMY.MIL
;
.                        3600000      NS    H.ROOT-SERVERS.NET.
H.ROOT-SERVERS.NET.      3600000      A     128.63.2.53
H.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:1::803F:235
;
; FORMERLY NIC.NORDU.NET
;
.                        3600000      NS    I.ROOT-SERVERS.NET.
I.ROOT-SERVERS.NET.      3600000      A     192.36.148.17
;
; OPERATED BY VERISIGN, INC.
;
.                        3600000      NS    J.ROOT-SERVERS.NET.
J.ROOT-SERVERS.NET.      3600000      A     192.58.128.30
J.ROOT-SERVERS.NET.      3600000      AAAA  2001:503:C27::2:30
;
; OPERATED BY RIPE NCC
;
.                        3600000      NS    K.ROOT-SERVERS.NET.
K.ROOT-SERVERS.NET.      3600000      A     193.0.14.129
K.ROOT-SERVERS.NET.      3600000      AAAA  2001:7FD::1
;
; OPERATED BY ICANN
; 
.                        3600000      NS    L.ROOT-SERVERS.NET.
L.ROOT-SERVERS.NET.      3600000      A     199.7.83.42
L.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:3::42
;
; OPERATED BY WIDE
;
.                        3600000      NS    M.ROOT-SERVERS.NET.
M.ROOT-SERVERS.NET.      3600000      A     202.12.27.33
M.ROOT-SERVERS.NET.      3600000      AAAA  2001:DC3::35
; End of File

db.localhost
Note: no modifications needed, use as is.

$TTL    86400 ; 24 hours could have been written as 24h
$ORIGIN localhost.
; line below = localhost 1D IN SOA localhost root.localhost
@  1D  IN        SOA @  root (
                              2006080801 ; serial
                              3H ; refresh
                              15 ; retry
                              1w ; expire
                              3h ; minimum
                             )
@  1D  IN  NS @
   1D  IN  A  127.0.0.1

db.localhost.rev
Note: no modifications needed, use as is.

$TTL    86400 ;
; could use $ORIGIN 0.0.127.IN-ADDR.ARPA.
@       IN      SOA     localhost. root.localhost.  (
                        2006080801 ; Serial
                        3h      ; Refresh
                        15      ; Retry
                        1w      ; Expire
                        3h )    ; Minimum
        IN      NS      localhost.
1       IN      PTR     localhost.

db.yourdomainname.com
This is where you tell the bind servers how to find local server IP addresses from domain names. Note:
it needs to be modified for your local network. Specifically change the filename, match your local domain
name. Add/change addresses and names for the servers on your network thathave fixed IP addresses,
the ones included below are examples from my network. Also, be aware the periods at the ends of the
domain names are important.

$TTL 86400;
yourdomainname.com. IN SOA yourdomainservername.yourdomainname.com. root.yourdomainname.com. (
                        2011041601
                        21600
                        3600
                        604800
                        86400 )
      IN     NS     yourdomainservername.yourdomainname.com.
      IN     MX     10     root.yourdomainname.com.
yourdomainservername.yourdomainname.com.  IN   A  192.168.1.xx
anotherapachevirtualhostname.yourdomainname.com.     IN      A       192.168.1.y
myaptmirrorservername.yourdomainname.com.  IN      A       192.168.1.y
myrouter.yourdomainname.com.       IN      A       192.168.1.254
mywebdavservername.turriehome.com. IN     A       192.168.1.zz
mywebleryservername.yourdomainname.com.  IN     A       192.168.1.zz

db.192.168.1.rev
This is where you tell the bind servers how to find local domain names from IP addresses .Note:
it needs to be modified for your local network. Specifically change the filenames and addresses to
match your local domain name. Add addresses and names for the servers on your network that
have fixed IP addresses, the ones included below are examples from my network. Also, be aware
the periods at the ends of the domain names are important.

$TTL 86400;
1.168.192.in-addr.arpa. IN SOA yourdomainservername.yourdomainname.com. root.yourdomainname.com. (
                        2010091232
                        21600
                        3600
                        604800
                        86400 )
    IN     NS     yourdomainservername.yourdomainname.com.
xx.1.168.192.in-addr.arpa.      IN      PTR     yourdomainservername.yourdomainname.com.
y.1.168.192.in-addr.arpa.      IN      PTR anotherapachevirtualhostname.yourdomainname.com
y.1.168.192.in-addr.arpa.       IN      PTR     myaptmirrorservername.yourdomainname.com.
254.1.168.192.in-addr.arpa.     IN      PTR myrouter.yourdomainname.com.  
zz.1.168.192.in-addr.arpa.      IN      PTR     mywebdavservername.turriehome.com.
zz.1.168.192.in-addr.arpa.      IN      PTR
mywebleryservername.yourdomainname.com.

After you have your files in place, it’s time to restart bind.

/opt/etc/init.d/S09named restart

Testing your nameserver

dig @192.168.1.xx

where 192.168.1.xx is the ip address of your nameserver

  1. Hmm it appears like your site ate my first comment (it was super long) so I
    guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog.
    I as well am an aspiring blog blogger but I’m still new
    to everything. Do you have any suggestions for rookie blog writers?
    I’d certainly appreciate it.

  2. I don’t know if it’s just me or if perhaps everybody else encountering issues
    with your blog. It appears like some of the written text within your posts are running off the screen. Can somebody else please comment and let me know
    if this is happening to them too? This might be a problem with my browser because I’ve had this happen before.
    Kudos

    • I’ve tried it in win 7 win 8.1 as well as ubuntu 12.04 and 14.04. I’ve used both chrome and firefox. I’ve tried several different screen resolutions including 1024×768, 1650×1080 and 1920×1080 all without issue.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: