NDB(6)                                                     NDB(6)

          ndb - Network database

          The network database consists of files describing machines
          known to the local installation and machines known publicly.
          The files comprise multi-line tuples made up of
          attribute/value pairs of the form attr=value or sometimes
          just attr. Each line starting without white space starts a
          new tuple.  Lines starting with # are comments.

          The file /lib/ndb/local is the root of the database.  Other
          files are included in the database if a tuple with an
          attribute-value pair of attribute database and no value
          exists in /lib/ndb/local.  Within the database tuple, each
          pair with attribute file identifies a file to be included in
          the database.  The files are searched in the order they
          appear.  For example:


          declares the database to be composed of the three files
          /lib/ndb/common, /lib/ndb/local, and /lib/ndb/global.  By
          default, /lib/ndb/local is searched before the others.  How-
          ever, /lib/ndb/local may be included in the database to
          redefine its ordering.

          Within tuples, pairs on the same line bind tighter than
          pairs on different lines.

          Programs search the database directly using the routines in
          ndb(2) or indirectly using ndb/cs and ndb/dns (see ndb(8)).
          Both ndb/cs and the routine ndbipinfo impose structure on
          the otherwise flat database by using knowledge specific to
          the network.  The internet is made up of networks which can
          be subnetted multiple times.  A network must have an ipnet
          attribute and is uniquely identified by the values of its ip
          and ipmask attributes.  If the ipmask is missing, the rele-
          vant Class A, B or C one is used.

          A search for an attribute associated with a network or host
          starts at the lowest level, the entry for the host or net-
          work itself, and works its way up, bit by bit, looking at
          entries for nets/subnets that include the network or host.
          The search ends when the attribute is found.  For example,
          consider the following entries:

     Page 1                       Plan 9             (printed 7/22/24)

     NDB(6)                                                     NDB(6)

               ipnet=murray-hill ip= ipmask=
               ipnet=plan9 ip= ipmask=
               ip= sys=anna dom=anna.cs.bell-labs.com

          Here anna is on the subnet plan9 which is in turn on the
          class B net murray-hill.  Assume that we're searching for
          anna's NTP and SMTP servers.  The search starts by looking
          for an entry with sys=anna.  We find the anna entry.  Since
          it has an smtp=smtp2.cs.bell-labs.com pair, we're done look-
          ing for that attribute.  To fulfill the NTP request, we con-
          tinue by looking for networks that include anna's IP
          address.  We lop off the right most one bit from anna's
          address and look for an ipnet= entry with ip=
          Not finding one, we drop another bit and look for an ipnet=
          entry with ip=  There is such an entry and it
          has the pair, ntp=oncore.cs.bell-labs.com, ending our

          Ndb/cs can be made to perform such network aware searches by
          using metanames in the dialstring.  A metaname is a $ fol-
          lowed by an attribute name.  Ndb/cs looks up the attribute
          relative to the system it is running on.  Thus, with the
          above example, if a program called

                    dial("tcp!$smtp!smtp", 0, 0, 0);

          the dial would connect to the SMTP port of

          A number of attributes are meaningful to programs and thus
          reserved.  They are:

          sys         system name (a short name)
          dom         Internet fully-qualified domain name
          ip          Internet address, v4 or v6.
          ipv6        IPv6 Internet address.  For DNS, an `AAAA'
          ipnet       Internet network name
          ipmask      Internet network mask
          ipgw        Internet gateway (ip address)
          ether       Ethernet address (must be lower-case hex)
          vendor      Specific vendor attribute for dhcp and bootp
          bootf       file to download for initial bootstrap;
                      /386/9bootpxe to boot a PC via PXE.
          tftp        an TFTP server to use for PXE bootstrap
          fs          Plan 9 file server to be used
          auth        Plan 9 authentication server to be used

     Page 2                       Plan 9             (printed 7/22/24)

     NDB(6)                                                     NDB(6)

          authdom     Plan 9 authentication domain.  To specify an
                      authentication server for a particular domain,
                      add a tuple containing both auth and authdom
                      attributes and values.
          rootpath    the NFS root for unix machines
          rootserver  the NFS server used with rootpath
          dnsdomain   a domain name that ndb/dns adds onto any
                      unrooted names when doing a search.  There may
                      be multiple dnsdomain pairs.
          dns         a DNS server to use (for DNS and DHCP)
          ntp         an NTP server to use (for DHCP)
          smtp        an SMTP server to use (for DHCP)
          time        a time server to use (for DHCP)
          wins        a Windows name server (for DHCP)
          mx          mail exchanger (for DNS and DHCP); also pref.
          srv         service location (for DNS); also pri, weight and
          soa         start of area (for DNS)
          tcp         a TCP service name
          udp         a UDP service name
          port        a TCP or UDP port number
          restricted  a TCP service that can be called only by ports
                      numbered less than 1024
          proto       a protocol supported by a host.  The pair
                      proto=il was needed by cs (see ndb(8)) in tuples
                      for hosts that supported the IL protocol

          Cs defers to dns to translate dotted names to IP addresses,
          only consulting the database files if dns cannot translate
          the name.

          Cs allows network entries with sys and dom attributes but no
          ip attribute.  Searches for the system name are resolved by
          looking up the domain name with dns.

          The file /lib/ndb/auth is used during authentication to
          decide who has the power to `speak for' other users; see

          A tuple for the CPU server, spindle.

               ip= ether=080069020677

          Entries for the network mh-astro-net and its subnets.

          ipnet=mh-astro-net ip= ipmask=

     Page 3                       Plan 9             (printed 7/22/24)

     NDB(6)                                                     NDB(6)

          ipnet=unix-room ip=
          ipnet=third-floor ip=

          Mappings between TCP service names and port numbers.

          tcp=sysmon     port=401
          tcp=rexec      port=512   restricted
          tcp=9fs        port=564

          /lib/ndb/local  first database file searched

          con(1), dial(2), ndb(2), booting(8), dhcpd(8), ipconfig(8),

     Page 4                       Plan 9             (printed 7/22/24)