Differences between revisions 34 and 54 (spanning 20 versions)
Revision 34 as of 2017-12-10 16:11:23
Size: 7040
Comment:
Revision 54 as of 2021-01-17 20:10:16
Size: 1001
Comment:
Deletions are marked like this. Additions are marked like this.
Line 9: Line 9:
 * 192.168.1.34 master
 * 192.168.1.35 slave
 * 192.168.1.36 master
 * 192.168.1.37 slave
Line 12: Line 12:
= DNS Master = Configure the [[DNS Master|master]], then the [[DNS Slave|slave]].
Line 14: Line 14:
== Network == == Maintenance ==
Line 16: Line 16:
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. === Zone Changes ===
Line 18: Line 18:
{{{
# The primary network interface
#allow-hotplug eth0
#iface eth0 inet dhcp

auto eth0
iface eth0 inet static
        address 192.168.1.34
        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 ==

=== Make BIND listen ===

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

{{{
listen-on { any; };
}}}

=== Get the DDNS update key ===

Get the key from the master and save it in `/etc/bind/ddns-update.dnskey`.

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

=== Create a new zone ===
`/etc/bind/named.conf.kallenberg.dk`
{{{
# Key used by DHCP servers for dynamic DNS updates
include "/etc/bind/ddns-update.dnskey";

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

zone "1.168.192.in-addr.arpa" {
        type slave;
        file "/var/lib/bind/1.168.192.zone";
        allow-transfer { 192.168.1.34; };
        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. (
                                20150427 ; serial
                                7200 ; refresh (2 hours)
                                300 ; retry (5 minutes)
                                604800 ; expire (1 week)
                                60 ; minimum (1 minute)
                                )
                        NS ns01.kallenberg.dk.
                        NS ns02.kallenberg.dk.
$ORIGIN kallenberg.dk.
$TTL 1800 ; 30 minutes
}}}

`/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. (
                                20150218 ; serial
                                7200 ; refresh (2 hours)
                                300 ; retry (5 minutes)
                                604800 ; expire (1 week)
                                60 ; minimum (1 minute)
                                )
                        NS ns01.kallenberg.dk.
                        NS ns02.kallenberg.dk.
$ORIGIN 1.168.192.in-addr.arpa.
}}}

= DNS Slave =


== Network ==

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.

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

auto eth0
iface eth0 inet static
        address 192.168.1.35
        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 ==

=== 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 ddns-update
}}}

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.

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

=== Create a new zone ===
`/etc/bind/named.conf.kallenberg.dk`
{{{
# Key used by DHCP servers for dynamic DNS updates
include "/etc/bind/ddns-update.dnskey";

zone "kallenberg.dk" {
        type master;
        file "/var/lib/bind/kallenberg.dk.zone";
        allow-transfer { 192.168.1.35; };
        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.35; };
        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. (
                                20150427 ; serial
                                7200 ; refresh (2 hours)
                                300 ; retry (5 minutes)
                                604800 ; expire (1 week)
                                60 ; minimum (1 minute)
                                )
                        NS ns01.kallenberg.dk.
                        NS ns02.kallenberg.dk.
$ORIGIN kallenberg.dk.
$TTL 1800 ; 30 minutes
}}}

`/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. (
                                20150218 ; serial
                                7200 ; refresh (2 hours)
                                300 ; retry (5 minutes)
                                604800 ; expire (1 week)
                                60 ; minimum (1 minute)
                                )
                        NS ns01.kallenberg.dk.
                        NS ns02.kallenberg.dk.
$ORIGIN 1.168.192.in-addr.arpa.
}}}
Once both servers are configured, it is vital to stop making changes to the zone files by hand. From now on manual [[DNS Updates|DNS updates]] has to be made with the `nsupdate` utility using the update key. If you try to edit the zone files manually, you may be screwing up your DNS.

DNS

The Domain Name System is really a must for any TCIP/IP network. It is a key component of the network. That is why it is the first service we will configure.

Here we will be using Bind, ISC's DNS server. Bind has a master/slave configuration, where the master gets the DNS changes and then updates the slave. It cannot run truly redundant, in the sense that only the master is allowed to get DNS changes, if the master is down, the slave cannot be updated.

In this setup we use the following IP-addresses for the master and slave:

  • 192.168.1.36 master
  • 192.168.1.37 slave

Configure the master, then the slave.

Maintenance

Zone Changes

Once both servers are configured, it is vital to stop making changes to the zone files by hand. From now on manual DNS updates has to be made with the nsupdate utility using the update key. If you try to edit the zone files manually, you may be screwing up your DNS.

None: DNS (last edited 2021-01-17 20:10:16 by Kristian Kallenberg)