Differences between revisions 2 and 21 (spanning 19 versions)
Revision 2 as of 2017-12-10 19:40:11
Size: 3511
Comment:
Revision 21 as of 2021-01-17 20:09:35
Size: 3929
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= DNS Master =
Line 7: Line 5:
Since looking up the DNS servers IP-address does not make any sense, we will give the DNS server a statc IP-address. Edit `/etc/networking/interfaces` and make the following changes. We will give the DNS master a static IP-address. Edit `/etc/networking/interfaces` and make the following changes.
Line 16: Line 14:
        address 192.168.1.34         address 192.168.1.36
Line 24: Line 22:
Line 30: Line 27:

=== Stop BIND ===
{{{
service bind9 stop
}}}
Line 44: Line 46:
dnssec-keygen -a HMAC-SHA512 -b 512 -n HOST ddns-update dnssec-keygen -a HMAC-SHA512 -b 512 -n HOST kallenberg.dk
Line 47: Line 49:
This will create two files with filenames equivalent to `Kddns-update.+157+18646.private` and `Kddns-update.+157+18646.key`. The latter is your public key, which will be used by the DCHP server to update BIND. Create the file `/etc/bind/ddns-update.dnskey` and put your key inside it. This will create two files with filenames equivalent to `Kkallenberg.dk.+165+38700.private` and `Kkallenberg.dk.+165+38700.key`. The latter is your public key, which will be used by the DCHP server to update BIND. Create the file `/etc/bind/ddns-update.kallenberg.dk` and put your key inside it.
Line 56: Line 58:
Make sure BIND can read `/etc/bind/ddns-update.kallenberg.dk`.
{{{
chown root:bind /etc/bind/ddns-update.kallenberg.dk
}}}
Line 60: Line 67:
include "/etc/bind/ddns-update.dnskey"; include "/etc/bind/ddns-update.kallenberg.dk";
Line 65: Line 72:
        allow-transfer { 192.168.1.35; };         allow-transfer { 192.168.1.37; };
Line 72: Line 79:
        allow-transfer { 192.168.1.35; };         allow-transfer { 192.168.1.37; };
Line 87: Line 94:
                                20150427 ; serial                                 20171210 ; serial
Line 93: Line 100:
                        NS ns01.kallenberg.dk.
                        NS ns02.kallenberg.dk.
                        IN NS ns01.kallenberg.dk.
                        IN NS ns02.kallenberg.dk.
                        A 2.107.246.10
Line 96: Line 104:
$TTL 1800 ; 30 minutes $TTL 86400 ; 1 day
ns01 IN A 192.168.1.36
ns02 IN A 192.168.1.37
Line 104: Line 114:
                                20150218 ; serial                                 20171210 ; serial
Line 110: Line 120:
                        NS ns01.kallenberg.dk.
                        NS ns02.kallenberg.dk.
                        IN NS ns01.kallenberg.dk.
                        IN NS ns02.kallenberg.dk.
Line 113: Line 123:
36 IN PTR ns01.kallenberg.dk
37 IN PTR ns02.kallenberg.dk
Line 114: Line 126:

=== Start BIND ===
Finally start the service again
{{{
service bind9 start
}}}

DNS Master

Network

We will give the DNS master a static IP-address. Edit /etc/networking/interfaces and make the following changes.

# The primary network interface
#allow-hotplug eth0
#iface eth0 inet dhcp

auto eth0
iface eth0 inet static
        address 192.168.1.36
        network 192.168.1.0
        netmask 255.255.255.0
        broadcast 192.168.1.255
        gateway 192.168.1.1

Install BIND

apt-get install bind9

Configure BIND

Stop BIND

service bind9 stop 

Make BIND listen

edit /etc/bind/named.conf.options and add

listen-on { any; };

Make a DDNS update key

We are going to let the DHCP server update BIND. For this we need an update key. Create it with the following command. Remember that entrophy must be available for the key to be generated, you can check available entrophy in /proc/sys/kernel/random/entropy_avail.

dnssec-keygen -a HMAC-SHA512 -b 512 -n HOST kallenberg.dk

This will create two files with filenames equivalent to Kkallenberg.dk.+165+38700.private and Kkallenberg.dk.+165+38700.key. The latter is your public key, which will be used by the DCHP server to update BIND. Create the file /etc/bind/ddns-update.kallenberg.dk and put your key inside it.

key "ddns-update" {
        algorithm hmac-sha512;
        secret "yYFzfibvlpS33+vsngV2jF5tGkTiVSjhYoFuV0T7bnCVfFGx3Mu05SW+LakImdofkNM00LxHCLuvD1W1vSWMmA==";
};

Make sure BIND can read /etc/bind/ddns-update.kallenberg.dk.

chown root:bind /etc/bind/ddns-update.kallenberg.dk

Create a new zone

/etc/bind/named.conf.kallenberg.dk

# Key used by DHCP servers for dynamic DNS updates
include "/etc/bind/ddns-update.kallenberg.dk";

zone "kallenberg.dk" {
        type master;
        file "/var/lib/bind/kallenberg.dk.zone";
        allow-transfer { 192.168.1.37; };
        allow-update { key "ddns-update"; };
};

zone "1.168.192.in-addr.arpa" {
        type master;
        file "/var/lib/bind/1.168.192.zone";
        allow-transfer { 192.168.1.37; };
        allow-update { key "ddns-update"; };
};

Add the new zone file to /etc/bind/named.conf.local

include "/etc/bind/named.conf.kallenberg.dk";

/var/lib/bind/kallenberg.dk.zone

$ORIGIN .
$TTL 86400      ; 1 day
kallenberg.dk           IN SOA  ns01.kallenberg.dk. ns02.kallenberg.dk. (
                                20171210   ; serial
                                7200       ; refresh (2 hours)
                                300        ; retry (5 minutes)
                                604800     ; expire (1 week)
                                60         ; minimum (1 minute)
                                )
                        IN      NS      ns01.kallenberg.dk.
                        IN      NS      ns02.kallenberg.dk.
                        A       2.107.246.10
$ORIGIN kallenberg.dk.
$TTL 86400      ; 1 day
ns01    IN      A       192.168.1.36
ns02    IN      A       192.168.1.37

/var/lib/bind/1.168.192.zone

$ORIGIN .
$TTL 86400      ; 1 day
1.168.192.in-addr.arpa  IN SOA  ns01.kallenberg.dk. ns02.kallenberg.dk. (
                                20171210   ; serial
                                7200       ; refresh (2 hours)
                                300        ; retry (5 minutes)
                                604800     ; expire (1 week)
                                60         ; minimum (1 minute)
                                )
                        IN      NS      ns01.kallenberg.dk.
                        IN      NS      ns02.kallenberg.dk.
$ORIGIN 1.168.192.in-addr.arpa.
36      IN PTR ns01.kallenberg.dk
37      IN PTR ns02.kallenberg.dk

Start BIND

Finally start the service again

service bind9 start

None: DNS Master (last edited 2021-02-19 17:39:13 by Kristian Kallenberg)