Taking DNS to Synology Diskstation

A day ago I used a linux mint box to setup dns. The next day, the simple thought (but late) was to avoid burning watts by separate PC, when Synology NAS is already up all the time.

The configuration was similar/simpler. Nas already had a dhcp reservation / static ip. This link helped, but I tried with even minimal configuration and it worked fine.

The Steps:
1. Install bind
2. Create named.conf*
3. Create forward db.mydom.test & reverse db.192*
4. Create root.servers
5. Start service
6. Set dns on your router*
7. Remove after effects of old dns (optional).

* You will need to modify these steps according to the names & ip in your network.

The steps:

1. Install bind
Logged in to nas as root and install bind. If you haven’t installed ipkg already, see steps on this earlier post.

~ # ipkg install bind

Screenshot from 2012-12-02 02:26:38

2. Create named.conf

For all files below, use the directory /opt/etc/named.  Used vi to create named.conf with the following content:

options {
 directory "/opt/etc/named";
 forwarders {
 8.8.8.8; // I used dyndns
 };
 };
zone "mydom.test" in {
 type master;
 file "db.mydom.test";
 notify no;
 };
zone "1.168.192.in-addr.arpa" {
 type master;
 file "db.192";
 notify no;
 };

3. Created forward and reverse zone files

vi db.mydom.test

$TTL    604800
@    IN    SOA    mynas.mydom.test. admin.mydom.test. (
       1             ; Serial
       604800        ; Refresh
       86400         ; Retry
       2419200       ; Expire
       604800 )      ; Negative Cache TTL
;
@    IN    NS    mynas.mydom.test.
@    IN    A    127.0.0.1
@    IN    AAAA    ::1

; A records
mynas        IN    A    192.168.1.222
server1        IN    A    192.168.1.223
server2        IN    A    192.168.1.227

; CNAME records
wordpress.mydom.test    IN    CNAME    mynas.mydom.test.

vi db.192:

 $TTL    604800
 @    IN    SOA    mynas.mydom.test. admin.mydom.test. (
         1                ; Serial
         604800           ; Refresh
         86400            ; Retry
         2419200          ; Expire
         604800 )         ; Negative Cache TTL
 ;
 @    IN    NS    mynas.mydom.test.

4. Create root.servers file:

.                        3600000  IN  NS    A.ROOT-SERVERS.NET.
 A.ROOT-SERVERS.NET.      3600000      A     198.41.0.4
.                        3600000      NS    B.ROOT-SERVERS.NET.
 B.ROOT-SERVERS.NET.      3600000      A     192.228.79.201
.                        3600000      NS    C.ROOT-SERVERS.NET.
 C.ROOT-SERVERS.NET.      3600000      A     192.33.4.12
.                        3600000      NS    D.ROOT-SERVERS.NET.
 D.ROOT-SERVERS.NET.      3600000      A     128.8.10.90
.                        3600000      NS    E.ROOT-SERVERS.NET.
 E.ROOT-SERVERS.NET.      3600000      A     192.203.230.10
.                        3600000      NS    F.ROOT-SERVERS.NET.
 F.ROOT-SERVERS.NET.      3600000      A     192.5.5.241
.                        3600000      NS    G.ROOT-SERVERS.NET.
 G.ROOT-SERVERS.NET.      3600000      A     192.112.36.4
.                        3600000      NS    H.ROOT-SERVERS.NET.
 H.ROOT-SERVERS.NET.      3600000      A     128.63.2.53
.                        3600000      NS    I.ROOT-SERVERS.NET.
 I.ROOT-SERVERS.NET.      3600000      A     192.36.148.17
.                        3600000      NS    J.ROOT-SERVERS.NET.
 J.ROOT-SERVERS.NET.      3600000      A     192.58.128.30
.                        3600000      NS    K.ROOT-SERVERS.NET.
 K.ROOT-SERVERS.NET.      3600000      A     193.0.14.129
.                        3600000      NS    L.ROOT-SERVERS.NET.
 L.ROOT-SERVERS.NET.      3600000      A     198.32.64.12
.                        3600000      NS    M.ROOT-SERVERS.NET.
 M.ROOT-SERVERS.NET.      3600000      A     202.12.27.33

5. Start Service

/opt/etc/init.d/S09named start

6. Set dns on your router
Set ip address of your nas (dns server) in the router.
Also, if possible, set the domain in router to your domain (e.g. mydom.test)
Reboot router.

Screenshot from 2012-12-02 02:01:59

7. Remove after effects of old dns (optional)

In my case, all hosts got the new configuration except linux mint 14. I already had removed the bind9 installation from it. On trying to dig a local name, it kept on resolving via external dns server. The cat /etc/resolv.conf also returned 127.0.0.1 as nameserver (which was incorrect). The fix was here with one simple change on the same linux host.

 sudo nano /etc/NetworkManager/NetworkManager.conf

And comment the line dns=dnsmasq; as in screenshot below.

Screenshot from 2012-12-02 01:55:02

Thats it!

===================================Edit (1/9/2013):

I noticed that synology dsm has a packaged dns server (beta) available. I didn’t try, but this could be even simpler and quicker to get things up and running.

dns

 

Advertisements

3 Responses to Taking DNS to Synology Diskstation

  1. Johan says:

    I did try the DNSServer Beta, and it work like a charm, directly. 🙂
    Got one question do regarding DNS server in general.

    I like to configure my home DNS server due to two reasons.

    1.
    My own local DNS server would give me fast DNS respons and also the internet provider or who every I use for DNS, can’t logg my surf habbit anymore. 🙂

    2.
    I like to setup my own zone to point so that I can use the same dns name at home as well over internet to access my NAS.

    Here comes one problem.
    I did setup a new zone. Did configure A record to my NAS.
    nas01.xyxyxy.com 192.168.1.4

    Working fine to find from my laptop when using my NAS as a DNS server. 🙂

    My problem is that xyxyxy.com is a domain on internet and I like all request to first be solved in my local DNS server and if he can’t find it then he will ask the master DNS server on internet.
    As it is now I got nas01.xyxyxy.com in local DNS, but when I search for mail.xyxyxy.com that is only on the internet DNS, well then I can’t find it. 😦

    Is it even possibly to do what I wish for?

    Br.

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: