ndb 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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 dnsdomain
  159. .TP
  160. .B sys
  161. system name (a short name)
  162. .TP
  163. .B dom
  164. Internet fully-qualified domain name
  165. .TP
  166. .B ip
  167. Internet address,
  168. v4 or v6.
  169. .TP
  170. .B ipv6
  171. IPv6 Internet address.
  172. For DNS, an
  173. .L AAAA
  174. record.
  175. .TP
  176. .B ether
  177. Ethernet address
  178. (must be lower-case hexadecimal).
  179. Beware that for machines with multiple
  180. .B ether
  181. attributes,
  182. .I dhcpd
  183. may expect requests to come from the address in the first
  184. .B ether
  185. attribute.
  186. .TP
  187. .B bootf
  188. file to download for initial bootstrap
  189. .TP
  190. .B ipnet
  191. Internet network name
  192. .TP
  193. .B ipmask
  194. Internet network mask
  195. .TP
  196. .B ipgw
  197. Internet gateway
  198. .TP
  199. .B auth
  200. authentication server to be used
  201. .TP
  202. .B authdom
  203. authentication domain. Plan 9 supports multiple authentication
  204. domains. To specify an authentication server for a particular domain,
  205. add a tuple containing both
  206. .B auth
  207. and
  208. .B authdom
  209. attributes and values.
  210. .TP
  211. .B fs
  212. file server to be used
  213. .TP
  214. .B tcp
  215. a TCP service name
  216. .TP
  217. .B udp
  218. a UDP service name
  219. .TP
  220. .B port
  221. a TCP or UDP port number
  222. .TP
  223. .B restricted
  224. a TCP service that can be called only by ports numbered
  225. less that 1024
  226. .TP
  227. .B proto
  228. a protocol supported by a host.
  229. The pair
  230. .B proto=il
  231. was needed by
  232. .I cs
  233. (see
  234. .IR ndb (8))
  235. in tuples for hosts that supported the IL protocol
  236. .TP
  237. .B dnsdomain
  238. a domain name that
  239. .I ndb/dns
  240. adds onto any unrooted names when doing a search.
  241. There may be multiple
  242. .B dnsdomain
  243. pairs.
  244. .TP
  245. .B dns
  246. a DNS server to use (for DNS and DHCP)
  247. .TP
  248. .B ntp
  249. an NTP server to use (for DHCP)
  250. .TP
  251. .B smtp
  252. an SMTP server to use (for DHCP)
  253. .TP
  254. .B time
  255. a time server to use (for DHCP)
  256. .TP
  257. .B wins
  258. a Windows name server (for DHCP)
  259. .TP
  260. .B mx
  261. mail exchanger (for DNS and DHCP);
  262. also
  263. .BR pref .
  264. .TP
  265. .B srv
  266. service location (for DNS);
  267. also
  268. .BR pri ,
  269. .B weight
  270. and
  271. .BR port .
  272. .TP
  273. .B soa
  274. start of area (for DNS)
  275. .PD
  276. .PP
  277. .I Cs
  278. defers to
  279. .I dns
  280. to translate dotted names to IP addresses,
  281. only consulting the database files if
  282. .I dns
  283. cannot translate the name.
  284. .PP
  285. .I Cs
  286. allows network entries with
  287. .B sys
  288. and
  289. .B dom
  290. attributes but no
  291. .B ip
  292. attribute.
  293. Searches for the system name are resolved
  294. by looking up the domain name with
  295. .IR dns .
  296. .PP
  297. The file
  298. .B /lib/ndb/auth
  299. is used during authentication to decide who has the power to `speak for' other
  300. users; see
  301. .IR authsrv (6).
  302. .SH EXAMPLES
  303. .LP
  304. A tuple for the CPU server, spindle.
  305. .LP
  306. .EX
  307. sys=spindle
  308. dom=spindle.research.bell-labs.com
  309. bootf=/mips/9powerboot
  310. ip=135.104.117.32 ether=080069020677
  311. .EE
  312. .LP
  313. Entries for the network
  314. .B mh-astro-net
  315. and its subnets.
  316. .LP
  317. .EX
  318. ipnet=mh-astro-net ip=135.104.0.0 ipmask=255.255.255.0
  319. fs=bootes.research.bell-labs.com
  320. ipgw=r70.research.bell-labs.com
  321. auth=p9auth.research.bell-labs.com
  322. ipnet=unix-room ip=135.104.117.0
  323. ipgw=135.104.117.1
  324. ipnet=third-floor ip=135.104.51.0
  325. ipgw=135.104.51.1
  326. .EE
  327. .LP
  328. Mappings between TCP service names and port numbers.
  329. .LP
  330. .EX
  331. .ta \w'\fLtcp=sysmonxxxxx'u \w'\fLtcp=sysmonxxxxxport=512xxx'u
  332. tcp=sysmon port=401
  333. tcp=rexec port=512 restricted
  334. tcp=9fs port=564
  335. .EE
  336. .SH FILES
  337. .TP
  338. .B /lib/ndb/local
  339. first database file searched
  340. .SH "SEE ALSO"
  341. .IR dial (2),
  342. .IR ndb (2),
  343. .IR ndb (8),
  344. .IR dhcpd (8),
  345. .IR ipconfig (8),
  346. .IR con (1)