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