NDB(6)                                                     NDB(6)

     NAME
          ndb - Network database

     DESCRIPTION
          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
          tuple with attribute file identifies a file to be included
          in the database.  The files are searched in the order they
          appear.  For example:

               database=
                    file=/lib/ndb/common
                    file=/lib/ndb/local
                    file=/lib/ndb/global

          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 it's
          ip and ipmask attributes.  If the ipmask is missing, the
          relevant Class A, B or C one is used.  The network is sub-
          netted if one or more ipsubmask's are specified.  A search
          for an attribute associated with a network or host starts at
          the top-level Class A, B, or C network and works it's way
          down to the specific entry.  The attribute/value chosen is
          the one lowest down in the search, i.e, closest to the host.
          For example, consider at the following entries:

               ipnet=murray-hill ip=135.104.0.0 ipmask=255.255.0.0

     Page 1                       Plan 9             (printed 12/2/22)

     NDB(6)                                                     NDB(6)

                    ipsubmask=255.255.255.0
                    dns=135.104.10.1
                    ntp=ntp.cs.bell-labs.com
               ipnet=plan9 ip=135.104.9.0 ipmask=255.255.255.0
                    ntp=oncore.cs.bell-labs.com
                    smtp=smtp1.cs.bell-labs.com
               ip=135.104.9.6 sys=anna dom=anna.cs.bell-labs.com
                    smtp=smtp2.cs.bell-labs.com

          Here anna is on the subnet plan9 which is in turn on the
          class B net murray-hill.  If one were to search for anna's
          NTP and SMTP servers, one would get oncore.cs.bell-labs.com
          and smtp2.cs.bell-labs.com respectively.

          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
          smtp2.cs.bell-labs.com.

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

          sys         system name
          dom         Internet domain name
          ip          Internet address
          ether       Ethernet address
          bootf       file to download for initial bootstrap
          ipnet       Internet network name
          ipmask      Internet network mask
          ipsubmask   Internet network mask of this network's subnets
          ipgw        Internet gateway
          auth        authentication server to be used
          fs          file server to be used
          tcp         a TCP service name
          udp         a UDP service name
          il          an IL service name
          port        a TCP, UDP, or IL port number
          restricted  a TCP service that can be called only by ports
                      numbered less that 1024
          proto       a protocol supported by a host.  The pair
                      proto=il is needed by cs (see ndb(8)) in tuples
                      for hosts that support the IL protocol
          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)

     Page 2                       Plan 9             (printed 12/2/22)

     NDB(6)                                                     NDB(6)

          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)
          soa         start of area (for DNS)

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

     EXAMPLES
          A tuple for the CPU server, spindle.

          sys = spindle
               dom=spindle.research.bell-labs.com
               bootf=/mips/9powerboot
               ip=135.104.117.32 ether=080069020677
               proto=il

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

          ipnet=mh-astro-net ip=135.104.0.0 ipmask=255.255.255.0
               fs=bootes.research.bell-labs.com
               ipgw=r70.research.bell-labs.com
               auth=p9auth.research.bell-labs.com
          ipnet=unix-room ip=135.104.117.0
               ipgw=135.104.117.1
          ipnet=third-floor ip=135.104.51.0
               ipgw=135.104.51.1

          Mappings between TCP service names and port numbers.

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

     FILES
          /lib/ndb/local
               first database file searched

     SEE ALSO
          dial(2), ndb(2), ndb(8), dhcpd(8), ipconfig(8), con(1)

     Page 3                       Plan 9             (printed 12/2/22)