NDB: A brief introduction

NDB is one of the most crucial parts of configuring a set of networked plan9 machines. NDB serves as the central file for all network and service definitions in the system.

The NDB configuration file itself is ‘/lib/ndb/local’, a system of networked plan9 machines will typically have only one ndb file used(as they usually only have a single fs server). The file is organized as a series of ‘key=value’ entries per line, generally with one line per machine.

A typical configuration for a terminal/fs hybrid laptop machine would be:

   sys=laptop ether=00a0989e96e7 ip=

This defines the sysname of the computer with the MAC address 00:a0:98:9e:96:e7. Without setting an ip and ipmask, this will instruct the system that the computer is meant to fetch these values from a DHCP server.

For a static IP configuration we just need to add the ip and ipmask values to the line:

   sys=laptop ether=00a0989e96e7 ip= ipmask= ipgw=

Setting this will allow tell the system to not only it’s own IP if the MAC address matches, but can also be used to define what IP address is given out if plan9 is serving as your DHCP server. The ipgw key here tells the system to use that address(or sysname) as the default route.

NDB also is used to define what other systems act as a service provider(fs, cpu, auth) as well as used to define what machines are part of which authdom. We set these properties like we do ip and ipmask, using ‘key=value’ entries where the value points to another system:

   sys=terminal ether=00a0982bf765 ip= ipmask= ipgw= fs=kiri cpu=chiri auth=chiri authdom=ufo
   sys=chiri ether=00a0986505c0 ip= ipmask= ipgw= fs=kiri cpu=chiri auth=chiri authdom=ufo
   sys=kiri ether=00a09813037d ip= ipmask= ipgw= fs=kiri cpu=chiri auth=chiri authdom=ufo

This defines a terminal, cpu/auth hybrid and fs server. The fs, cpu, and auth key values are set to the sysnames for machines that fill that role. The authdom is used to set the authentication domain that these machines belong to.

As you can imagine, repeating these key tuples for each machine within a network can be a bit tedious, so NDB gives us the ability to define an ipnet:

   # New lines with a tab are treated as part of the previous line
   ipnet=space ip= ipmask=

This defines the ipnet ‘space’ which acts for the network We can define shared tuples here that will be applied to machines that have an ip set within the network. Using this ipnet we can redo our previous machine configuration like so:

   sys=terminal ether=00a0982bf765 ip= ipmask=
   sys=chiri ether=00a0986505c0 ip= ipmask=
   sys=kiri ether=00a09813037d ip= ipmask=

As mentioned a bit, NDB is not only used for setting networking settings but is also the file used by the plan9 DHCP and DNS servers to lookup entries. A DHCP request from MAC address ‘00:a0:98:2b:f7:65’ will cause the DHCP server to look it up in the NDB file and will reply with its configured address ‘’.

For DNS some additional configuration is needed:

   dom=local soa= ns=chiri
   sys=kiri ether=00a09813037d ip= ipmask= dom=kiri.local

This will set ‘chiri’ as the authorative DNS server for the domain ‘*.local’ and define kiri with a domain name of ‘kiri.local’.