man(1) Manual page archive


     NDB(8)                                                     NDB(8)

     NAME
          query, mkhash, mkdb, cs, csquery, dns, dnsquery, ipquery,
          dnsdebug, mkhosts, mobile, ccs - network database

     SYNOPSIS
          ndb/query [ -f dbfile ] attr value [ rattr ]
          ndb/ipquery attr value rattr...
          ndb/mkhash file attr
          ndb/cs [ -n ] [ -f dbfile ] [ -x netmtpt ]
          ndb/csquery [ -s ] [ server [ addr... ] ]
          ndb/dns [ -rRsn ] [ -f dbfile ] [ -x netmtpt ] [ -z program
          ]
          ndb/dnsquery
          ndb/dnsdebug [ -rx ] [ [ @server ] domain-name [ type ] ]
          ndb/mkdb
          ndb/mobile
          ndb/ccs [ -d ] [ -s srv ] [ -m mnt ] [ cssrv ]

     DESCRIPTION
          The network database holds administrative information used
          by network programs such as dhcpd(8), ipconfig(8), con(1),
          etc.

          Ndb/query searches the database for an attribute of type
          attr and value value. If rattr is not specified, all entries
          matched by the search are returned.  If rattr is specified,
          the value of the first pair with attribute rattr of all the
          matched entries is returned.

          Ndb/ipquery uses ndbipinfo (see ndb(2)) to search for the
          values of the attributes rattr corresponding to the system
          with entries of attribute type attr and value value.

          Ndb/mkhash creates a hash file for all entries with
          attribute attr in database file file. The hash files are
          used by ndb/query and by the ndb library routines.

          Ndb/cs is a server used by dial(2) to translate network
          names.  It is started at boot time.  It finds out what net-
          works are configured by looking for /net/*/clone when it
          starts.  It can also be told about networks by writing to
          /net/cs a message of the form:

               add net1 net2 ...

          Ndb/cs also sets the system name in /dev/sysname if it can
          figure it out.  The options are:

          -f   supplies the name of the data base file to use, default
               /lib/ndb/local.

     NDB(8)                                                     NDB(8)

          -x   specifies the mount point of the network.

          -n   causes cs to do nothing but set the system name.

          Ndb/csquery can be used to query ndb/cs to see how it
          resolves addresses.  Ndb/csquery prompts for addresses and
          prints out what ndb/cs returns.  Server defaults to /net/cs.
          If any addrs are specified, ndb/csquery prints their trans-
          lations and immediately exits.  The exit status will be nil
          only if all addresses were successfully translated The -s
          flag sets exit status without printing any results.

          Ndb/dns is a server used by ndb/cs and by remote systems to
          translate Internet domain names.  Ndb/dns is started at boot
          time.  By default dns serves only requests written to
          /net/dns.  The options are:

          -f   supplies the name of the data base file to use, default
               /lib/ndb/local.

          -x   specifies the mount point of the network.

          -s   also answer domain requests sent to UDP port 53.

          -n   whenever a zone that we serve changes, send UDP NOTIFY
               messages to any dns slaves for that zone.

          -z   whenever we receive a UDP NOTIFY message, run program
               with the domain name of the area as its argument.

          -r   send `recursive' queries, asking the other servers to
               complete lookups.

          -R   ignore the `recursive' bit on incoming requests.  do
               not complete lookups on behalf of remote systems.

          When the -r option is specified, the servers used come from
          the dns attribute in the database.  For example, to specify
          a set of dns servers that will resolve requests for systems
          on the network mh-net:

          ipnet=mh-net ip=135.104.0.0 ipmask=255.255.0.0
               dns=ns1.cs.bell-labs.com
               dns=ns2.cs.bell-labs.com
          dom=ns1.cs.bell-labs.com ip=135.104.1.11
          dom=ns2.cs.bell-labs.com ip=135.104.1.12

          The server for a domain is indicated by a database entry
          containing both a dom and a ns attribute.  For example, the
          entry for the Internet root is:

          dom=

     NDB(8)                                                     NDB(8)

               ns=A.ROOT-SERVERS.NET
               ns=B.ROOT-SERVERS.NET
               ns=C.ROOT-SERVERS.NET
          dom=A.ROOT-SERVERS.NET ip=198.41.0.4
          dom=B.ROOT-SERVERS.NET ip=128.9.0.107
          dom=C.ROOT-SERVERS.NET ip=192.33.4.12

          The last three lines provide a mapping for the server names
          to their ip addresses.  This is only a hint and will be
          superseded from whatever is learned from servers owning the
          domain.

          You can also serve a subtree of the domain name space from
          the local database.  You indicate subtrees that you'ld like
          to serve by adding an soa= attribute to the root entry.  For
          example, the Bell Labs CS research domain is:

          dom=cs.bell-labs.com soa=
               refresh=3600 ttl=3600
               ns=plan9.bell-labs.com
               ns=ns1.cs.bell-labs.com
               ns=ns2.cs.bell-labs.com
               mb=presotto@plan9.bell-labs.com
               mx=mail.research.bell-labs.com pref=20
               mx=plan9.bell-labs.com pref=10
               dnsslave=nslocum.cs.bell-labs.com
               dnsslave=vex.cs.bell-labs.com

          Here, the mb entry is the mail address of the person respon-
          sible for the domain (default postmaster).  The mx entries
          list mail exchangers for the domain name and refresh and ttl
          define the area refresh interval and the minimum TTL for
          records in this domain.  The dnsslave entries specify slave
          DNS servers that should be notified when the domain changes.
          The notification also requires the -n flag.

          You can also serve reverse lookups (returning the name that
          goes with an IP address) by adding an soa= attribute to the
          entry defining the root of the reverse space.  For example,
          to provide reverse lookup for all addresses in starting with
          135.104 you must have a record like:

          dom=104.135.in-addr.arpa soa=
               refresh=3600 ttl=3600
               ns=plan9.bell-labs.com
               ns=ns1.cs.bell-labs.com
               ns=ns2.cs.bell-labs.com
          Notice the form of the reverse address, i.e., it's the bytes
          of the address range you are serving reversed and with
          .in-addr.arpa appended.  This is a standard form for a
          domain name in an IPv4 PTR record.

     NDB(8)                                                     NDB(8)

          If such an entry exists in the database, reverse addresses
          will automatically be generated from any IP addresses in the
          database that are under this root.  For example

          dom=ns1.cs.bell-labs.com ip=135.104.1.11
          will automaticly create both forward and reverse entries for
          ns1.cs.bell-labs.com . Unlike other DNS servers, there's no
          way to generate inconsistent forward and reverse entries.

          Delegation of a further subtree to another set of name
          servers is indicated by an soa=delegated attribute.

          dom=bignose.cs.research.bell-labs.com
               soa=delegated
               ns=anna.cs.research.bell-labs.com
               ns=dj.cs.research.bell-labs.com

          Nameservers within the delegated domain (as in this example)
          must have their IP addresses listed elsewhere in ndb files.

          Wild-carded domain names can also be used.  For example, to
          specify a mail forwarder for all Bell Labs research systems:

          dom=*.research.bell-labs.com
               mx=research.bell-labs.com

          `Cname' aliases may be established by adding a cname
          attribute giving the real domain name; the name attached to
          the dom attribute is the alias.  `Cname' aliases are
          severely restricted; the aliases may have no other
          attributes than dom and are daily further restricted in
          their use by new RFCs.

          cname=anna.cs.research.bell-labs.com dom=www.cs.research.bell-labs.com

          Ndb/dnsquery can be used to query ndb/dns to see how it
          resolves requests.  Ndb/dnsquery prompts for commands of the
          form

               domain-name request-type

          where request-type can be ip, mx, ns, cname, ptr....  In the
          case of the inverse query type, ptr, dnsquery will reverse
          the ip address and tack on the .in-addr.arpa for you.

          Ndb/dnsdebug is like ndb/dnsquery but bypasses the local
          server.  It communicates via UDP with the domain name
          servers in the same way that the local resolver would and
          displays all packets received.  The query can be specified
          on the command line or can be prompted for.  The queries
          look like those of ndb/dnsquery with one addition.
          Ndb/dnsdebug can be directed to query a particular name

     NDB(8)                                                     NDB(8)

          server by the command @name-server.  From that point on, all
          queries go to that name server rather than being resolved by
          dnsdebug. The @ command returns query resolution to
          dnsdebug. Finally, any command preceded by a @name-server
          sets the name server only for that command.

          Normally dnsdebug uses the /net interface and the database
          file /lib/ndb/local.  The -x option directs dnsdebug to use
          the /net.alt interface and /lib/ndb/external file.  The -r
          option is the same as for ndb/dns.

          Ndb/mkdb is used in concert with awk(1) scripts to convert
          uucp systems files and IP host files into database files.
          It is very specific to the situation at Murray Hill.

          When the database files change underfoot, ndb/cs and ndb/dns
          track them properly.  Nonetheless, to keep the database
          searches efficient it is necessary to run ndb/mkhash when-
          ever the files are modified.  It may be profitable to con-
          trol this by a frequent cron(8) job.

          Ndb/mkhosts generates a BSD style hosts, hosts.txt, and
          hosts.equiv files from an ndb data base file specified on
          the command line (default /lib/ndb/local).  For local rea-
          sons the files are called hosts.1127, astro.txt, and
          hosts.equiv.

          Ndb/mobile overrides the IP address translation for $sysname
          when the IP in use is not the official one as found in the
          ndb database. It removes the override otherwise. The over-
          ride is made by including a line for the system in the file
          /lib/ndb/mobile/machine because this file is included in
          Plan B before other ones.  The address is taken from the
          configuration of the first IP interface, unless specified as
          a parameter.

          Ndb/ccs is a cache for the ndb/cs program. The Plan B start
          script, brc(8) starts cs to serve clients at #s/cs_net and
          then starts ccs to behave as the connection server. All the
          replies seen are cached, even the ones that mean no-match.
          This is needed because when the root volume is lost, bns is
          still able to recover. However, to do so, it needs to trans-
          late addresses (and also factotum). Because all the neces-
          sary addresses and queries had to be seen while first mount-
          ing the volumes, caching them suffices.

          To flush the cache, write flush to /net/cs.  Flags are like
          in the real cs program. The optional argument specifies
          where to reach that program.

     EXAMPLES
          % ndb/query sys helix

     NDB(8)                                                     NDB(8)

          sys=helix dom=helix.research.bell-labs.com bootf=/mips/9powerboot
               ip=135.104.117.31 ether=080069020427
               proto=il
          % ndb/dnsquery
          > plan9.bell-labs.com ip
          plan9.bell-labs.com ip   204.178.31.2
          > 204.178.31.2 ptr
          2.31.178.204.in-addr.arpa ptr plan9.bell-labs.com
          2.31.178.204.in-addr.arpa ptr ampl.com
          >

     FILES
          /lib/ndb/local       first database file searched
          /lib/ndb/local.*     hash files for /lib/ndb/local
          /srv/cs              service file for ndb/cs
          /net/cs              where /srv/cs gets mounted
          /srv/dns             service file for ndb/dns
          /net/dns             where /srv/dns gets mounted

     SOURCE
          /sys/src/cmd/ndb

     SEE ALSO
          ndb(2) ndb(6)

     BUGS
          Ndb databases are case-sensitive; ethernet addresses must be
          in lower-case hexadecimal.