ndb 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. .TH NDB 6
  2. .SH NAME
  3. ndb \- Network database
  4. .SH DESCRIPTION
  5. .PP
  6. The network database consists of files
  7. describing machines known to the local
  8. installation and machines known publicly.
  9. The files comprise multi-line tuples made up of
  10. attribute/value pairs of the form
  11. .IB attr = value
  12. or sometimes just
  13. .IR attr .
  14. Each line starting without white space starts a new tuple.
  15. Lines starting with
  16. .B #
  17. are comments.
  18. .PP
  19. The file
  20. .B /lib/ndb/local
  21. is the root of the database.
  22. Other files are included in the
  23. database if a tuple with an
  24. attribute-value pair of attribute
  25. .B database
  26. and no value exists in
  27. .BR /lib/ndb/local .
  28. Within the
  29. .B database
  30. tuple,
  31. each pair with attribute
  32. .B file
  33. identifies a file to be included in the database. The files are searched
  34. in the order they appear.
  35. For example:
  36. .IP
  37. .EX
  38. database=
  39. file=/lib/ndb/common
  40. file=/lib/ndb/local
  41. file=/lib/ndb/global
  42. .EE
  43. .PP
  44. declares the database to be composed of the three files
  45. .BR /lib/ndb/common ,
  46. .BR /lib/ndb/local ,
  47. and
  48. .BR /lib/ndb/global .
  49. By default,
  50. .B /lib/ndb/local
  51. is searched before the others.
  52. However,
  53. .B /lib/ndb/local
  54. may be included in the
  55. .B database
  56. to redefine its ordering.
  57. .PP
  58. Within tuples, pairs on the same line bind tighter than
  59. pairs on different lines.
  60. .PP
  61. Programs search the database directly using the routines in
  62. .IR ndb (2)
  63. or indirectly using
  64. .B ndb/cs
  65. and
  66. .B ndb/dns
  67. (see
  68. .IR ndb (8)).
  69. Both
  70. .B ndb/cs
  71. and the routine
  72. .I ndbipinfo
  73. impose structure on the otherwise flat database by using
  74. knowledge specific to the network.
  75. The internet is made up of networks which can be subnetted
  76. multiple times. A network must have an
  77. .B ipnet
  78. attribute and is uniquely identified by the values of its
  79. .B ip
  80. and
  81. .B ipmask
  82. attributes. If the
  83. .B ipmask
  84. is missing, the relevant Class A, B or C one is used.
  85. .LP
  86. A search for an attribute associated with a network or host starts
  87. at the lowest level, the entry for the host or network itself,
  88. and works its way up, bit by bit, looking at entries for nets/subnets
  89. that include the network or host. The search ends when the attribute
  90. is found.
  91. For example, consider at the following entries:
  92. .IP
  93. .EX
  94. ipnet=murray-hill ip=135.104.0.0 ipmask=255.255.0.0
  95. dns=135.104.10.1
  96. ntp=ntp.cs.bell-labs.com
  97. ipnet=plan9 ip=135.104.9.0 ipmask=255.255.255.0
  98. ntp=oncore.cs.bell-labs.com
  99. smtp=smtp1.cs.bell-labs.com
  100. ip=135.104.9.6 sys=anna dom=anna.cs.bell-labs.com
  101. smtp=smtp2.cs.bell-labs.com
  102. .EE
  103. .LP
  104. Here
  105. .B anna
  106. is on the subnet
  107. .B plan9
  108. which is in turn on the class B net
  109. .BR murray-hill .
  110. Assume that we're searching for
  111. .BR anna 's
  112. .B NTP
  113. and
  114. .B SMTP
  115. servers.
  116. The search starts by looking for an entry with
  117. .BR sys=anna .
  118. We find the anna entry. Since it has an
  119. .B smtp=smtp2.cs.bell-labs.com
  120. pair,
  121. we're done looking for that attribute.
  122. To fulfill the NTP request, we continue by looking for networks
  123. that include anna's IP address.
  124. We lop off the right most one bit from anna's address and
  125. look for an
  126. .B ipnet=
  127. entry with
  128. .BR ip=135.104.9.4 .
  129. Not finding one, we drop another bit and look for an
  130. .B ipnet=
  131. entry with
  132. .BR ip=135.104.9.0 .
  133. There is
  134. such an entry and it has the pair,
  135. .BR ntp=oncore.cs.bell-labs.com ,
  136. ending our search.
  137. .PP
  138. .I Ndb/cs
  139. can be made to perform such network aware
  140. searches by using metanames in the dialstring.
  141. A metaname is a
  142. .I $
  143. followed by an attribute name.
  144. .I Ndb/cs
  145. looks up the attribute relative to the system it is running
  146. on. Thus, with the above example, if a program called
  147. .IP
  148. .EX
  149. dial("tcp!$smtp!smtp", 0, 0, 0);
  150. .EE
  151. .LP
  152. the dial would connect to the SMTP port of
  153. .BR smtp2.cs.bell-labs.com .
  154. .PP
  155. A number of attributes are meaningful to programs and thus
  156. reserved.
  157. They are:
  158. .TF restricted
  159. .TP
  160. .B sys
  161. system name
  162. .TP
  163. .B dom
  164. Internet domain name
  165. .TP
  166. .B ip
  167. Internet address
  168. .TP
  169. .B ether
  170. Ethernet address
  171. (must be lower-case hexadecimal)
  172. .TP
  173. .B bootf
  174. file to download for initial bootstrap
  175. .TP
  176. .B ipnet
  177. Internet network name
  178. .TP
  179. .B ipmask
  180. Internet network mask
  181. .TP
  182. .B ipgw
  183. Internet gateway
  184. .TP
  185. .B auth
  186. authentication server to be used
  187. .TP
  188. .B authdom
  189. authentication domain. Plan 9 supports multiple authentication
  190. domains. To specify an authentication server for a particular domain,
  191. add a tuple containing both
  192. .B auth
  193. and
  194. .B authdom
  195. attributes and values.
  196. .TP
  197. .B fs
  198. file server to be used
  199. .TP
  200. .B tcp
  201. a TCP service name
  202. .TP
  203. .B udp
  204. a UDP service name
  205. .TP
  206. .B il
  207. an IL service name
  208. .TP
  209. .B port
  210. a TCP, UDP, or IL port number
  211. .TP
  212. .B restricted
  213. a TCP service that can be called only by ports numbered
  214. less that 1024
  215. .TP
  216. .B proto
  217. a protocol supported by a host.
  218. The pair
  219. .B proto=il
  220. is needed by
  221. .I cs
  222. (see
  223. .IR ndb (8))
  224. in tuples for hosts that support the IL protocol
  225. .TP
  226. .B dnsdomain
  227. a domain name that
  228. .I ndb/dns
  229. adds onto any unrooted names when doing a search
  230. There may be multiple
  231. .B dnsdomain
  232. pairs.
  233. .TP
  234. .B dns
  235. a DNS server to use (for DNS and DHCP)
  236. .TP
  237. .B ntp
  238. an NTP server to use (for DHCP)
  239. .TP
  240. .B smtp
  241. an SMTP server to use (for DHCP)
  242. .TP
  243. .B time
  244. a time server to use (for DHCP)
  245. .TP
  246. .B wins
  247. a Windows name server (for DHCP)
  248. .TP
  249. .B mx
  250. mail exchanger (for DNS and DHCP)
  251. .TP
  252. .B soa
  253. start of area (for DNS)
  254. .sp
  255. .PD
  256. .PP
  257. .I Cs
  258. defers to
  259. .I dns
  260. to translate dotted names to IP addresses,
  261. only consulting the database files if
  262. .I dns
  263. cannot translate the name.
  264. .PP
  265. .I Cs
  266. allows network entries with
  267. .B sys
  268. and
  269. .B dom
  270. attributes but no
  271. .B ip
  272. attribute.
  273. Searches for the system name are resolved
  274. by looking up the domain name with
  275. .IR dns .
  276. .PP
  277. The file
  278. .B /lib/ndb/auth
  279. is used during authentication to decide who has the power to `speak for' other
  280. users; see
  281. .IR authsrv (6).
  282. .SH EXAMPLES
  283. .LP
  284. A tuple for the CPU server, spindle.
  285. .LP
  286. .EX
  287. sys=spindle
  288. dom=spindle.research.bell-labs.com
  289. bootf=/mips/9powerboot
  290. ip=135.104.117.32 ether=080069020677
  291. proto=il
  292. .EE
  293. .LP
  294. Entries for the network
  295. .B mh-astro-net
  296. and its subnets.
  297. .LP
  298. .EX
  299. ipnet=mh-astro-net ip=135.104.0.0 ipmask=255.255.255.0
  300. fs=bootes.research.bell-labs.com
  301. ipgw=r70.research.bell-labs.com
  302. auth=p9auth.research.bell-labs.com
  303. ipnet=unix-room ip=135.104.117.0
  304. ipgw=135.104.117.1
  305. ipnet=third-floor ip=135.104.51.0
  306. ipgw=135.104.51.1
  307. .EE
  308. .LP
  309. Mappings between TCP service names and port numbers.
  310. .LP
  311. .EX
  312. .ta \w'\fLtcp=sysmonxxxxx'u \w'\fLtcp=sysmonxxxxxport=512xxx'u
  313. tcp=sysmon port=401
  314. tcp=rexec port=512 restricted
  315. tcp=9fs port=564
  316. .EE
  317. .SH FILES
  318. .TP
  319. .B /lib/ndb/local
  320. first database file searched
  321. .SH "SEE ALSO"
  322. .IR dial (2),
  323. .IR ndb (2),
  324. .IR ndb (8),
  325. .IR dhcpd (8),
  326. .IR ipconfig (8),
  327. .IR con (1)