dns (as of Tue Mar 3 06:13:05 PST 2026)

NDB/DNS

ndb/dns(8) can provide an authoritative name server.

To run the server at bootup, add this line to either /cfg/$sysname/termrc or /cfg/$sysname/cpurc:

ndb/dns -nsR

Note: Networking must be configured before running ndb/dns(8). Otherwise, you might see the following errors:

ndb/dns: can't read my ip address

Next, add records to /lib/ndb/local, similar to the following:

sys=example dom=example.com
	ether=f2b2b3daeb89
	ip=198.51.100.2 ipmask=255.255.255.0 ipgw=198.51.100.1
	ntp=pool.ntp.org
	dns=198.51.100.1
	auth=198.51.100.1
	authdom=example.com

dom=example.com soa=
	refresh=300 ttl=300
	ns=ns1.example.com
	ns=ns2.example.com
	ip=198.51.100.2
	dnsslave=ns2.example.com
	mb=postmaster@example.com
	mx=mail.example.com pref=5
	txtrr="v=spf1 mx -all"

dom=ns1.example.com ip=198.51.100.2
dom=ns2.example.com ip=198.51.100.2
dom=mail.example.com ip=198.51.100.2
dom=_dmarc.example.com txtrr="v=DMARC1; p=none"
dom=p9auth.example.com cname=example.com

dom=2.100.51.198.in-addr.arpa soa=
	refresh=300 ttl=300
	ns=ns1.example.com
	ns=ns2.example.com

Replace 198.51.100.1, 198.51.100.2, example.com, postmaster@example.com, and 2.100.51.198 with your actual values.

Note: ndb may be sensitive to poorly formatted whitespace. If ndb is not recognizing your tuples properly, double check your whitespace.

Note: Make sure to define your tuple for sys=example.com in /lib/ndb/local right after the definition for localhost, before other tuples. Otherwise, the system might use the wrong subnet mask, causing routing issues.

Note: ndb(6) in Plan 9 4th Edition does not document how to handle TXT records, but they can be created with attr txtrr.

To refresh cs and dns after an update to /lib/ndb/local:

; echo -n refresh > /net/cs
; echo -n refresh > /net/dns

DELEGATION

Suppose you run dns(8) for the server example.com, and you want to delegate subdomain.example.com to another nameserver. Here is a sample snippet to add to /lib/ndb/local for example.com:

dom=subdomain.example.com soa=delegated
	ns=ns1.subdomain.example.com
	ns=ns2.subdomain.example.com
	dom=ns1.subdomain.example.com ip=198.51.100.3
	dom=ns2.subdomain.example.com ip=198.51.100.4

Then, in subdomain.example.com, add this to /lib/ndb/local:

dom=ns1.subdomain.example.com ip=198.51.100.3
dom=ns2.subdomain.example.com ip=198.51.100.4

dom=subdomain.example.com soa=
	refresh=300 ttl=300
	ns=ns1.subdomain.example.com
	ns=ns2.subdomain.example.com
	ip=198.51.100.3
	dnsslave=ns2.subdomain.example.com
	mb=username@subdomain.example.com
	mx=mail.subdomain.example.com
	txtrr="v=spf1 mx -all"

dom=3.100.51.198.in-addr.arpa soa=
	refresh=300 ttl=300
	ns=ns1.subdomain.example.com
	ns=ns2.subdomain.example.com

DNS ERRORS

Occasionally, this error may occur:

dns: file does not exist: /fd/0:3: < can't open: $user: '$user' directory entry not found
/fd/0:4: /net/net/clone: '/net/net/clone' dns: file does not exist

This may mean either cs or ndb is dead. Both can be restarted with:

; ndb/cs
; kill dns | rc
; ndb/dns

Last modified Tue Mar 3 06:13:05 PST 2026 [ Current version | Changelog | Create a new page ] About the server | Powered by Plan 9