- Ubuntu 20.04
- Knot DNS, version 3.1.5
- To get rid of annoying error messages, add your hostname to the
hosts
file
sudo vi /etc/hosts
- 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)
- Change the hostname
sudo hostname ns1.labbX.examples.nu
- Log out and back in to get an updated command prompt
- Disable and stop the service
sudo systemctl disable systemd-resolved
sudo systemctl stop systemd-resolved
- Replace the symlink
/etc/resolv.conf
sudo rm /etc/resolv.conf
- Add a (new) default system resolver.
sudo vi /etc/resolv.conf
nameserver 89.32.32.32
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
sudo apt-get install mlocate net-tools -y
sudo updatedb
- 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>
- 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"
- Add zone statement
zone:
- domain: labbX.examples.nu
journal-content: all
zonefile-load: difference-no-serial
acl: acl_localhost
-
Save and exit
-
Check the configuration
sudo knotc conf-check
- Verify that the zone can be loaded
sudo knotc zone-check labbX.examples.nu
- Reload Knot
sudo knotc reload
- 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