DEV Community

IPYE
IPYE

Posted on

Knot DNS Authoritative Server on Addresses from a Free /48

Disclosure up front: I run IPYE, a company that leases IP space. Most of this article is practical how-to; IPYE appears where a free /48, LOA, or ROA helps you try the work, with a short call to action at the end.

Knot DNS is a fast authoritative name server from CZ.NIC with automatic DNSSEC signing built in and a configuration format that stays readable as the number of zones grows. Running your own authoritative servers on dedicated addresses from your own prefix gives you stable name server addresses that move with you, whichever host or provider runs the software. This guide sets up Knot on a server numbered from a free IPv6 /48 from IPYE, listening on 2001:db8:100:53::1 and serving example.net.

Plan the addresses

Name server addresses end up in glue records at the registry and in other operators' configurations, so pick them carefully and keep them stable. A dedicated /64 for DNS, such as 2001:db8:100:53::/64, makes the purpose obvious and lets you run a second server at ::2 on a different host, ideally at a different site. Add each address persistently to its host before configuring Knot.

Install

Knot is packaged by most distributions, and CZ.NIC publishes current packages for Debian, Ubuntu and RHEL-family systems. The daemon is knotd; knotc controls it, kzonecheck validates zone files and keymgr handles DNSSEC keys.

Configuration

# /etc/knot/knot.conf
server:
    listen: 2001:db8:100:53::1@53
    listen: 192.0.2.53@53
    identity: ""
    version: ""

log:
  - target: syslog
    any: info

database:
    storage: /var/lib/knot

template:
  - id: default
    storage: /var/lib/knot/zones
    file: "%s.zone"
    semantic-checks: on

zone:
  - domain: example.net
    dnssec-signing: on
Enter fullscreen mode Exit fullscreen mode

Each listen line names an address and port with @, which avoids the bracket rules needed elsewhere for IPv6 literals. Listening on specific addresses rather than on all of them keeps Knot off the host's management address. Empty identity and version stop the server from revealing its hostname and software version to anyone who asks.

semantic-checks: on makes Knot refuse to load a zone with structural errors, such as a CNAME beside other records at the same name. dnssec-signing: on turns on automatic signing with the default policy: Knot creates keys, signs the zone and re-signs it as signatures approach expiry.

The zone file

$ORIGIN example.net.
$TTL 3600
@     SOA  ns1.example.net. hostmaster.example.net. 2026112401 7200 3600 1209600 3600
@     NS   ns1.example.net.
@     NS   ns2.example.net.
ns1   AAAA 2001:db8:100:53::1
ns1   A    192.0.2.53
ns2   AAAA 2001:db8:100:53::2
www   AAAA 2001:db8:100:10::20
Enter fullscreen mode Exit fullscreen mode

Check it before loading:

kzonecheck -o example.net /var/lib/knot/zones/example.net.zone
knotc conf-check
Enter fullscreen mode Exit fullscreen mode

Start and test

systemctl enable --now knot
knotc zone-status example.net
dig @2001:db8:100:53::1 example.net SOA +dnssec
dig @2001:db8:100:53::1 www.example.net AAAA
Enter fullscreen mode Exit fullscreen mode

zone-status shows whether the zone is loaded and when it will next be re-signed. The +dnssec query should return RRSIG records alongside the SOA once signing has run.

Publish DNSSEC to the parent

Signing is only useful once the parent zone holds a DS record for your key:

keymgr example.net ds
Enter fullscreen mode Exit fullscreen mode

This prints DS records for the key-signing key. Give one to your registrar, usually the SHA-256 variant. Only add the DS after confirming that the zone validates from an outside resolver, and never remove keys from the server while a DS that references them is still published at the parent.

A secondary on ns2

Configure the second server as a secondary with a remote and an ACL for transfers and notifications. Protect zone transfers with TSIG keys rather than relying on source addresses alone. Knot's documentation has complete examples; the essential parts are a remote pointing at the primary's IPv6 address, an acl allowing notify from it, and master: on the zone.

Glue records

Because the name servers are inside the zone they serve, the registry needs glue: the AAAA and A records for ns1 and ns2 published in the parent zone. Set them in your registrar's interface with exactly the addresses Knot listens on. A mismatch between glue and the actual listener is one of the most common reasons a new zone fails to resolve.

Firewall

Allow UDP and TCP port 53 to the name server addresses. TCP is not optional: large DNSSEC responses and zone transfers use it. Rate limiting responses helps against reflection abuse; Knot includes a response rate limiting module that you can enable once the basics work.

Routing for the name servers

Name servers must be reachable from the whole Internet, so the announcement matters. The upstream needs the LOA from the IPYE customer portal, and the ROA that IPYE creates keeps the route valid on networks that filter RPKI-invalid prefixes.

Next step

Claim your free /48 and give your name servers stable addresses, then run kzonecheck and knotc conf-check before every change. Questions: ipye@turnel.com.

About IPYE

IPYE (https://ipye.com) leases IPv4, IPv6 and ASN space with instant setup. Your first IPv6 /48 is free for the first year, a real allocation you can announce on your own ASN, with a LOA from the portal and the ROA created automatically. ASN and region changes apply automatically. IPv4 /24 to /22 leases include LOA, ROA and per-/24 rDNS; WHOIS is editable on IPv6 /44 and larger. Locations: Los Angeles, New York, Ashburn, Salt Lake City, London, Amsterdam, Frankfurt. Claim your free /48: https://my.ipye.com/products/ipv6-rental. Questions: ipye@turnel.com.

Disclosure: I run IPYE

Top comments (0)