Skip to content

Latest commit

 

History

History
161 lines (119 loc) · 2.58 KB

KNOT-install.md

File metadata and controls

161 lines (119 loc) · 2.58 KB

Knot DNS setup.

Notes - Instructions written using

  • Ubuntu 20.04
  • Knot DNS, version 3.1.5

Preparation

Change the servers hostname

  1. To get rid of annoying error messages, add your hostname to the hosts file
sudo vi /etc/hosts
  1. Add the following row, where Y.Y.Y.Y is your public IP address
Y.Y.Y.Y ns1.labbX.examples.nu

Note: If runnning on an AWS EC2, also add assigned hostname to /etc/hosts (one-liner for convenience)

  1. Change the hostname
sudo hostname ns1.labbX.examples.nu
  1. Log out and back in to get an updated command prompt

Disable systemd-resolved(8) as it might interfer with Knot:

  1. Disable and stop the service
sudo systemctl disable systemd-resolved
sudo systemctl stop systemd-resolved
  1. Replace the symlink /etc/resolv.conf
sudo rm /etc/resolv.conf
  1. Add a (new) default system resolver.
sudo vi /etc/resolv.conf
nameserver 89.32.32.32

Install Knot

sudo add-apt-repository ppa:cz.nic-labs/knot-dns-latest -y
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install knot knot-dnsutils -y

For troubleshooting purposes, you might also want to install some additional packages

sudo apt-get install mlocate net-tools -y
sudo updatedb

Publlish a zone

  1. Create zone file
sudo vi /var/lib/knot/labbX.examples.nu

Example:

$ORIGIN labbX.examples.nu.
$TTL 120
@       SOA     ns1.labbX.examples.nu. hostmaster.examples.nu. 1618586094 14400 3600 1814400 120

@       NS      ns1.labbX.examples.nu.
ns1     A       <your public IP>
  1. Add configuration in /etc/knot/knot.conf
sudo vi /etc/knot/knot.conf
server:
    rundir: "/run/knot"
    user: knot:knot
    listen: [ 0.0.0.0@53, ::@53 ]

log:
  - target: syslog
    any: info

database:
    storage: "/var/lib/knot"

acl:
  - id: acl_localhost
    address: 127.0.0.1
    action: transfer

template:
  - id: default
    storage: "/var/lib/knot"
    file: "%s"
  1. Add zone statement
zone:
  - domain: labbX.examples.nu
    journal-content: all
    zonefile-load: difference-no-serial
    acl: acl_localhost
  1. Save and exit

  2. Check the configuration

sudo knotc conf-check
  1. Verify that the zone can be loaded
sudo knotc zone-check labbX.examples.nu
  1. Reload Knot
sudo knotc reload
  1. Verify that the server answers correctly
dig @127.0.0.1 labbX.examples.nu soa
dig @127.0.0.1 labbX.examples.nu ns

Next Section: Knot DNSSEC lab