include problem
[unix-history] / .ref-BSD-3 / usr / doc / berknet / masters2.n
CommitLineData
86b1eead
ES
1.if n .ds y +
2.if n .ds z ++
3.if t .ds y \(dg
4.if t .ds z \(dd
5.ds a ``An Introduction to the Berkeley Network''
6.ds b ``Network System Manual''
7.TL
8The Berkeley Network \-
9A Retrospective
10.AU
11Eric Schmidt
12.AI
13Computer Science Division
14Department of Electrical Engineering and Computer Science
15University of California, Berkeley
16Berkeley, California 94720
17.AB
18The Berkeley Network connects a number of
19.UX
20machines on the Berkeley campus.
21It provides facilities for file transfer, sending and reading mail,
22and remote printing.
23Operating in a batch mode, network requests are transferred one by one
24through an inter-connected network until they reach their final destination.
25.PP
26This document describes the history and goals of this project,
27the design decisions faced, discusses issues in portable software
28development in networks, and discusses the future of this project.
29.AE
30.SH
31.ce
32Introduction
33.sp .5
34.PP
35This document is intended for readers with an interest in networking
36who are familiar with two other documents about the network,
37\*a, and the \*b, by this author.
38It is not necessary to read this document to set up and maintain the network,
39although systems persons will benefit if they are familiar with the
40concepts presented here.
41.PP
42The sections are presented as follows:
43.DS
44Principals
45History
46Overall System Description
47Protocol Explanation
48Portability
49Security
50Future Plans
51Summary
52.DE
53.PP
54The most important section is the last,
55which details a set of principles the author
56has learned during this project.
57.SH
58.ce
59.sp 1
60Principals
61.sp .5
62.PP
63This project was a collaboration of many individuals.
64Dr. Robert S. Fabry participated in the initial design
65and has exerted the strongest influence on polishing the final product.
66Bill Joy and Ed Gould provided valuable technical expertise every step of
67the way, primarily about developing systems programs.
68The support staff of the EECS Department and the Computer Center
69(Bob Kridle, Jeff Schreibman, Vance Vaughan, Robyn Allsman, and Ricki Blau)
70were involved in setting up and administering this multi-domain project.
71The lowest-level concepts the author used came from experience
72at \s-2XEROX PARC\s0, primarily from discussions
73with David Boggs, one of the \s-2ETHERNET\s0\*y designers.
74.FS
75\*y ``Ethernet: Distributed Packet Switching for Local Computer Networks'', by Robert Metcalfe and David Boggs, CACM, July 1976.
76.FE
77.SH
78.ce
79.sp 1
80History
81.sp .5
82.PP
83The network project can be divided into two distinct phases.
84The first, from January 1978 to May 1978 (4\(12 months)
85involved designing and implementing the network facilities
86now available.
87The second, from October 1978 to March 1979 (5 months), saw the addition
88of many more machines to the network with emphasis on
89portability, security, and minor design changes.
90The network has been in almost continuous service to users since May 1, 1978.
91.SH
92First Phase
93.PP
94An initial design was worked out with Dr. Fabry in January 1978.
95A suitable connection was made between the Computer Center ``A'' and ``Q''
96machines (then called ``D'').
97.DS
98.cs R 24
99
100
101 A Q
102
103
104.cs R
105.DE
106.PP
107Development proceeded on two fronts \-
108a set of daemons were written to transfer files, using
109.UX
110pipes for debugging.
111The lowest-level protocols were designed and implemented of the terminal-type
112connection between A and Q.
113These were debugged using simple programs to send and receive packets,
114and a pair
115of programs to transfer a file from one to the other.
116This was the first experience with a distributed software development \-
117the Q machine is a DEC PDP-11/34 with no lineprinter, a non-standard
118tape drive, and terminal access only by telephone, so
119most development had to proceed on the A machine.
120.PP
121During this phase the goals of the project increased in scope.
122The implementor and only user had to use the network to transfer
123network source and worked out simple ways to automate this
124(the ``.netrc'' file is an example).
125.PP
126When it appeared usable by more than the implementor,
127the connection was changed to be between A and the Computer Center ``C''
128machine:
129.DS
130.cs R 24
131
132
133 A C
134
135
136.cs R
137.DE
138.PP
139Up until now, the network had required an account on both machines.
140It became clear this was a handicap since
141the A machine had too many accounts and the password file was immense.
142Certain ``free'' commands were allowed, without an account.
143.PP
144The Cory machine was soon added to the network:
145.DS
146.cs R 24
147
148
149 Cory A C
150
151
152.cs R
153.DE
154.PP
155This produced major changes in the design \-
156initially we had assumed network users would have accounts on all machines.
157This was unreasonably strict
158and a solution (kludge) was worked out where a request was
159examined and forwarded through the queue(s) on the intermediate machine.
160The network became table-driven
161to accomplish the routing, and distributed software
162development became more difficult because of the increased number of machines.
163The implementor quickly discovered only one solution:
164Always have a designated source machine for all changes.
165To this day, software changes are made only on this ``source'' machine,
166the others are guaranteed to have copies.
167This makes remote updating (copying new versions around the network)
168possible.
169.PP
170Documentation was written and sent off to about fifteen
171faculty, staff, and graduate student users.
172A few bugs were fixed and the system frozen from the end
173of May to October.
174End of Phase 1.
175.SH
176Second Phase
177.PP
178While the implementor was away at a summer job, the connection between
179the A and C machines was switched to reduce the loading on the A machine:
180.DS
181.cs R 24
182
183
184 Cory C A
185
186
187.cs R
188.DE
189.PP
190Unknown to the implementor, the network source was modified in
191divergent and incompatible ways, and the commands were moved to a different
192place.
193These changes invalidated certain assumptions about full pathnames and
194some commands such as inter-machine mail stopped working.
195.PP
196The Computer Center had also made absolutely incompatible changes
197to some system calls.
198This began a path of software divergence that became very painful
199and is still not completely solved.
200.PP
201Fortunately, the Computer Center placed Robyn Allsman in charge of maintaining
202the network on their machines \-
203to lighten that routine part of the load from the implementor.
204.PP
205The Computer Center acquired a ``D'' machine, and the EECS Division
206a DEC VAX 11/780, running an experimental Version 7
207.UX
208system.
209The implementor decided to use the (at this point) unused VAX
210to to do software development and incorporate the Version 7
211changes into the network code.
212By this time, the protocols were stable which made it possible
213to run a Version 7 network
214on the VAX connected to the old Version 6 code
215on the existing network, to facilitate debugging.
216Because of improved terminal availability and better machine
217response, many new ways were used to debug the network \-
218using pipes, using TTY lines wired together on the VAX and over the
219usual machine-to-machine link.
220A file was added (``initfile'') which allowed quick reconfiguration
221of the daemons when system parameters were changed.
222A temporary connection between the VAX and C machines was arranged.
223.DS
224.cs R 24
225
226
227 VAX
228
229
230
231
232
233
234
235
236 Cory C A
237
238
239.cs R
240.DE
241.PP
242The network code had to be able to run on three different types of
243machines \-
244the VAX running
245.UX
246Version 7, the Cory machine running Version 6, and the anomalous
247Computer Center machines.
248There was no conversion package available at the time,\*y
249.FS
250\*y The ``retrofit'' library, by Bill Joy, is now available.
251.FE
252and the old network code had not used any system header
253files, so after a great deal of experimentation, conditional
254compilation was used as much as possible and a procedural interface
255was used to elide system differences.
256.PP
257The new
258.UX
259command
260.I make
261(I) was used with a ``makefile'' to organize this regime.
262The old network code was used to bootstrap
263the D machine onto a network running the new network code exclusively.
264.DS
265.cs R 24
266
267
268 VAX
269
270
271
272
273
274
275
276
277 Cory C A
278
279
280
281
282
283
284
285
286 D
287
288
289.cs R
290.DE
291.PP
292Shortly thereafter, over the Christmas break, the VAX and Cory connections
293went down for security reasons (discussed in the ``Security'' section).
294After seven weeks, they reentered the network in a new configuration.
295.DS
296.cs R 24
297
298
299 Cory C D
300
301
302
303
304
305
306
307
308 VAX A
309
310
311
312.cs R
313.tr --
314.DE
315.PP
316Shortly after that, they were down again because of a lightning strike
317for another week but have been operational since then.
318During the last time period the network was made less Berkeley-specific
319and a copy was run on the Rand Corporation UNIX machines.
320Documentation was rewritten and prepared for release.
321The network queues were converted to send shortest-job first.
322Extensive monitoring of system load, network performance,
323and network use was added.
324The format of the
325.I netq
326command was changed to summarize more information on output.
327The E machine, and then later the Survey Research Center (SRC)
328machine, were added.
329.DS
330.cs R 24
331
332
333 A
334
335
336
337
338
339
340
341
342 Cory C D
343
344
345
346
347
348
349
350
351 VAX E SRC
352
353
354.cs R
355.DE
356.PP
357Tuning was still important \-
358serious overloading problems caused by sluggish response
359stopped the network between Cory and C for a week.
360Network parameters were tuned to help solve this problem.
361The complexity of software development and maintenance became too
362great for unstructured changes.
363Versions on all the machines except the VAX were frozen
364for a month at a time.
365The protocols were almost immutable.
366People were delegated responsibility to observe and straighten
367out, if necessary, problems with the net queues.
368.PP
369As this is written, the software is stable and the
370user-documentation is finished and being sold,
371and there is hope of adding more
372.UX
373machines to the network.
374.SH
375.ce
376.sp 1
377Overall System Description
378.sp .5
379.PP
380The Berkeley network operates in a batch/ request mode, and is similar
381in concept to a line printer queue.
382``Requests'' are queued up at the source, where they are sent in shortest
383job first order through an interconnected network of machines to
384their destination.
385At each intermediate node, they are queued as if they were originated locally.
386.PP
387The network consists of a set of user-executed commands,
388a queue of requests to be sent, and a continuously-running
389program called a
390.I daemon
391which transmits requests in the queue and listens for any request being sent
392to it.
393There are many network commands \-
394one to send mail, one to read mail, one to copy files, etc.
395They all use the
396.I net
397command to access the network.
398The
399.I net
400command takes a command, assorted parameters, with any input
401data, and puts a request in the queue.
402These requests are composed of a header, the command to be executed,
403and any data for input to the command.
404The header contains network information such
405as the destination machine, login name, and password.
406This request is stored in the queue as a normal ASCII
407file, owned by the invoker.
408This way
409.UX
410commands can be used to examine the file.
411.PP
412The daemon examines the queue to see if there is anything to send.
413If so, it begins sending to a remote daemon,
414using a protocol to establish this dialog,
415involving retransmissions and timeouts.
416The remote daemon accepts the requests,
417parses the header information, and takes any
418data for the command and puts it in a file.
419The main loop of the daemon then returns to a waiting state.
420.PP
421The command execution is done by `forking' a series of processes.
422One of these is the user's login shell,
423which is given the command to execute.
424Another is a process which waits for the command
425to be executed, then examines the output of the command.
426The output is typically sent back to the user, via a
427.I net
428command, executed by the daemon.
429.PP
430In the reverse transmission, the command is called ``mwrite'',
431and it is routed and handled exactly as in the forward mode,
432except no password is required.
433The ``mwrite'' command is executed on the original machine
434with input data which is a copy of the output of
435the remote command.
436The user is either ``written'' or ``mailed'' to,
437depending on certain options.
438If ``written'', the user's screen is filled with the output\*y
439.FS
440\*y Standard output and standard error files.
441.FE
442of the command executed remotely, just as if he had executed it locally.
443Otherwise, it is in his mailbox, as mail from the remote account he used.
444The user's terminal must be write-able (see the
445.I mesg
446(I) option), the originating user must still be logged in,
447and he must not have logged off and on again.
448.PP
449The output from the command is preceded by a line of information
450listing the command, the time it was sent, and the time elapsed.
451.PP
452Our design then tries to simulate local
453.UX
454commands as much as possible.
455With defaults set correctly\*y
456.FS
457\*y With a ``.netrc'' file, see below.
458.FE
459the user in principle need only precede the command he is executing
460with the command
461.I net.
462.SH
463Copying Remote Files
464.PP
465The most frequent use of the network is file-transfer using the
466.I netcp
467command.
468The
469.I netcp
470command is based on the
471.I cp
472(I) command.
473Its two arguments are a source and destination file, optionally with
474remote machine names prepended:
475.DS
476\fBnetcp\fI\ \ from\-file\ \ to\-file\fR
477.DE
478where the names are local or remote.
479Since
480.DS
481Cory:/usr/pascal/sh
482.DE
483is a file on the Cory machine,
484.DS
485% netcp\ \ junk\ \ Cory:/usr/pascal/sh
486.DE
487will transfer the file ``junk'' to the named file on the Cory machine\*z.
488.FS
489\*z For more examples, see the \*a document.
490.FE
491.PP
492The way the transfer is accomplished depends on the type of file copy:
493.IP 1.
494Copy local file to remote file \-
495.br
496On the remote machine a
497.I cat
498(I) command is executed on the remote file with the local
499file as standard input.
500.IP 2.
501Copy remote file to local file \-
502.br
503A
504.I cat
505command is executed on the remote machine from the remote file
506to standard output.
507This standard output is sent back to the local machine
508into a
509.I
510response file,
511.R
512instead of being written or mailed to the user.
513.IP 3.
514Copy remote file to another remote file \-
515.br
516If both are on the same machine, a
517.I cp
518command is sent.
519Otherwise, a
520.I netcp
521command is sent to the remote machine where the
522.I from\-file
523exists,
524to copy that file to the \fIto\-file\fP's machine.
525.PP
526This last case is experimental.
527Unfortunately, the system is structured only to carry one login
528name and password to a remote machine.
529Since the last option involves three machines,
530the second remote machine is handled imperfectly at best.
531.SH
532Sending Mail
533.PP
534The
535.I mail
536(I) command on the network machines has been modified to examine the names of
537the recipients of a particular message.
538If their names have a remote prefix,
539.I mail
540executes an internal command ``sendmail'',
541which in turn executes a
542.I net
543command.
544This net command sends a mail command to the remote machine,
545with the message as input.
546Since the recipient would like to know which machine
547the message came from, a simple program ``mmail''
548is executed to insert a pseudo-header indicating the real
549source of the mail.
550The net command logs in as user ``network'',
551so remote mail does not require an account on the destination machine.
552This facility has proven invaluable.
553.SH
554Reading Mail
555.PP
556The
557.I netmail
558command uses the
559.I net
560command to send a command to read mail for a specified user
561on a remote machine.
562Since the existing mail programs on different machines vary in their
563options, it was decided the only thing that would work on both
564.UX
565Version 6 and 7 systems was to copy the mail from the remote
566to the local machine.
567If the user subsequently logs in on the remote machine,
568his mail will be there, as if it were unread.
569An internal program ``prmail'' is used to copy the user's mail
570back to the local machine.
571It knows the location of the mailboxes and the user's name.
572.PP
573The mail programs at Berkeley are being modified to search a database
574to see whether a user would like to receive all his mail on
575another machine and automatically forward it.
576This will diminish the need for the
577.I netmail
578command.
579.SH
580Printing on remote lineprinters
581.PP
582The
583.I netlpr
584command takes a list of arguments as files to be printed on a remote
585lineprinter.
586Unfortunately, there can only be one standard input file for the remote
587command, so each file is sent as a
588.I net
589command executing the command
590.I lpr.
591.SH
592Other System Components
593.sp .5
594.LP
595The ``.netrc'' file.
596.PP
597A user must specify defaults for frequently repeated options
598on a per-machine basis.
599This is done in a file ``.netrc'' in the user's login directory,
600and is fully described in the \*a.
601.sp .5
602.LP
603The
604.I netq
605command.
606.PP
607To see the network queue, the user must type the
608.I netq
609command.
610It lists the queue for each directly-connected machine, in the order
611requests will be sent.
612Each request is listed, one per line, giving
613the local and remote machines, the destination machine, the time sent,
614and the command to be executed.
615Commands which are internal to the network are called ``responses''
616in the
617.I netq
618listing.
619.sp .5
620.LP
621The
622.I netrm
623command.
624.PP
625Requests may be removed from the send queue using the
626.I netrm
627command.
628Since the originator of the file owns the queue file, a simple user-id
629check suffices to validate permission.
630Unfortunately, this notion breaks down for queue files
631of requests on intermediate machines.
632On such a machine an appropriate user does not exist,
633and the files are owned by ``root''.
634There is an option to
635.I netrm
636to remove all the user's queue files, to make
637.I netrm
638easier to use.
639.sp .5
640.LP
641The
642.I netlog
643command and other information.
644.PP
645A number of log files are kept by the network.
646Users may execute a
647.I netlog
648command which prints the last few entries of a log of commands
649sent and received.
650Also listed is the user, the time of the entry,
651and the return code of the command.
652.PP
653A more unreadable logfile is `/usr/net/plogfile?'.
654This log file has all the information of
655.I netlog,
656in a more cryptic form, along with trace information
657about net errors.
658The beginning and ending of sending and receiving are noted.
659This way the exact state of the network can be determined.
660.PP
661Hourly and daily statistics in a file `/usr/net/netstat?'.
662The number of bytes transmitted, the number of commands, and a
663breakdown of their type, and system load is recorded.
664This information is recorded in both hourly and daily form
665to track the performance of the network under different system loads.
666.PP
667Every hour, a
668.I netq
669command is executed and the number of queue entries is recorded in a
670file `/usr/net/netqstats'.
671This gives an estimate of the queue length.
672.PP
673Finally, the login names of each local user are recorded
674in a file `/usr/net/usernames'.
675Periodically, these names are sorted and duplicates removed.
676This gives a complete listing of network users,
677useful for sending network-specific mail and for general interest.
678.SH
679.sp 1
680.ce
681Protocol Explanation
682.sp .5
683.PP
684The network uses three distinct levels of protocol.
685The highest level of protocol (the ``command'' protocol)
686refers to the organization of the information sent to the remote
687machine.
688An intermediate level splits such a stream into distinct numbered packets
689with a small header in each packet.
690The lowest level refers to the appearance of these packets on the hardware
691connection.
692At the present, this is a modified 6-bit ASCII code.
693Each of these layers is distinct, and presents the
694interface through procedure calls.
695.SH
696The Command Protocol
697.PP
698Each machine sends a request using a precise command protocol
699involving a header, the command, and any associated data.
700.TS
701center allbox;
702l l l l.
703length header command ... data ...
704.TE
705All but the length field is formatted by the
706.I net
707command before the file is queued for transmission.
708The length is used to detect abnormally short, and
709poorly-formed, requests.
710The header includes all the information to route and verify the
711request.
712It includes
713.RS
714.IP a)
715the origin and destination machines,
716.IP b)
717the login names on both machines,
718.IP c)
719a version stamp for this command protocol,
720.IP d)
721the time sent,
722.IP e)
723information about the originating terminal, and
724.IP f)
725the pseudo-command.
726.RE
727.PP
728The pseudo-command is read by
729.I netq,
730and instead of printing the actual command being
731executed, prints something more appropriate.
732All the commands which use
733.I net
734(e.g.
735.I netcp)
736use the pseudo-command to list themselves rather
737than the command they are executing on the remote machine.
738.PP
739In order to be able to print the data on a normal
740.UX
741terminal for debugging, the fields within the header are variable-length ASCII,
742separated by colons (`:').
743This forces the daemon to parse the header information and
744requires that literal colons (e.g. in the command being sent)
745be properly escaped within the protocol,
746but I felt the alternatives of using byte counts or fixed-length fields
747were too difficult to debug.
748The shortest header is approximately 85 bytes.
749Fortunately, this means the shortest command
750will fit into a single packet.\*y
751.FS
752\*y (less than 100 bytes, see below).
753.FE
754.SH
755The Packet Protocol
756.PP
757The above information is conveyed to each machine as a stream.
758This is done using subroutine calls to read and write data
759of arbitrary length over the link.
760The write procedure breaks the information into a set
761of numbered packets,
762with a length and exclusive-or check-sum in a header:
763.TS
764center allbox;
765l l l l l.
766length seqnum type chksum ... data ...
767.TE
768.PP
769The length, type and checksum are one byte each,
770and the sequence number is two bytes.
771Since the packets are variable length the checksum is in the
772header rather than at the end of the packet to avoid the extra computation
773required to access it.
774.PP
775Each packet is transmitted over a link to a listener.
776Normally an acknowledgement packet is sent back.
777If there is an error, nothing is sent back,
778and the sending end will retransmit after a certain number of seconds.
779.PP
780There are no windowing or piggyback acknowledgements for two reasons:
7811) this scheme is very simple to implement and
7822) the error rate if each packet were not acknowledged would be
783high because of the hardware involved.
784If the future, I hope that both hardware and kernel device drivers
785will allow this improvement.
786.PP
787The so-called ``rendezvous'' protocol, whereby two daemons agree to communicate,
788is a simple ``contention'' scheme.
789When one daemon wants to transmit,
790it sends a special packet ``reset'' to the possible receiver,
791then transmits his first packet.
792Normally a daemon able to receive listens for a ``reset''.
793If it receives one, it enters a section of code designed
794to receive a header command, and data, and ultimately will execute it.
795If not, after a prescribed time interval is checks to see if there are any
796requests to send.
797Should both send at once, the characters may be garbled,
798or both may receive resets at the same time.
799In each case they both will retransmit.
800Each has a randomizing factor to break any ties which might develop.
801.PP
802In retrospect, this protocol is very primitive.
803Now that the network is in production use,
804the extra acknowledgements and separate ``reset'' are too
805expensive.
806A redesign would modify the protocol to transmit
807more than one packet before acknowledging it (ACKs),
808use negative ACKs to indicate immediately that an error has occurred,
809and eliminate the separate ``reset'' entirely.
810.PP
811The ``rendezvous'' protocol consumes a fair amount of time
812when both daemons choose to send packets.
813The alternative of constantly sending status packets when
814the daemons would be idle was never seriously considered
815because it was felt that the daemon should have as light a system
816load as possible; it seems now the daemons are busy most of the time
817and thus the initial connection tradeoffs
818should have been studied more closely.
819.SH
820The Low-Level Protocol
821.PP
822The network transmits over TTY lines through terminal interfaces
823and system drivers which behave as if the characters coming from another
824machine are from a terminal.
825This mode was chosen because it is absolutely the simplest,
826cheapest interconnection scheme possible.
827Unfortunately, the
828.UX
829terminal drivers cannot accept 8-bit bytes unless they are in
830.I raw
831mode.
832This was judged to be a high system load, so the
833TTY lines operate in
834.I cooked,
835the reverse of
836.I raw,
837mode.
838In this mode certain bit combinations,
839e.g. ASCII newline and escape, do not
840transmit through the terminal driver to the user's program
841but rather are interpreted as control information.
842.PP
843After much experimentation, the following transmission method was chosen.
844Each 3 byte triple is viewed as 24 bits, and broken into 4 6-bit groups.
845Each 6-bit number is in the range 0-63, and is added to a constant
846representing the lowest acceptable character code (a blank)
847in the ASCII sequence.
848This is sent as an ASCII character to a receiver
849who gathers 4 bytes, subtracts the increment, and shifts the 4 6-bit groups
850into 3 bytes.
851This represents a 3 to 4 expansion of all characters over the
852link, or a 33% loss of bandwidth.
853.PP
854In retrospect, this expansion has a considerable cost.
855The most scarce resource in the network
856is the actual hardware speed of the links.
857The alternative of using raw mode was never seriously considered.
858.PP
859The implementor's hope is that better hardware will make better
860middle- and lower-level protocols easier.
861Until then, the difficulties of using TTY lines efficiently
862make further protocol improvements unlikely to yield big increases in speed.
863.SH
864A Note About Features this Protocol Lacks
865.PP
866In
867.UX
868a process may only read or write one I/O device at a time.
869A daemon approach requires a single process reading and writing on a link to
870another machine.
871This process must decide who will receive this packet.
872I judged (correctly) that this decision was hard to schedule using
873.UX
874pipes and signals,
875and only allow one kind of communication between daemons.
876This also makes it almost impossible
877to forward packets through intermediate machines.
878Thus intermediate machines copy whole requests before sending them again.
879.PP
880If the design specification required a simple packet-oriented driver
881within the system, the
882.UX
883kernel could decide which of several special files this was destined to,
884and allow much more intermixing of traffic than before.
885I did not realize the importance of this and, in retrospect,
886would have chosen the other of the two approaches.
887.SH
888.sp 1
889.ce
890Portability
891.sp .5
892.PP
893The acquisition of VAX/UNIX (Version 7) and the divergence of the Computer
894Center and Cory Hall Version 6 systems made the portability of the
895network source code important.
896Until then, the source code on all machines was identical.
897Fortunately, the
898.UX
899implementors encountered these same problems and developed a number of
900facilities the network now uses.
901.PP
902Since many system calls use machine and version dependent data fields,
903so-called ``include'' files are available to hide the system differences
904and help standardize the system interface.
905The conditional compilation feature of the C language was used to select
906which kinds of code to generate, when the ``include'' files were
907not sufficient.
908Roughly, the following command included at the beginning of each C module:
909.DS
910# include <whoami.h>
911.DE
912would define which system, by name, the code was run on.
913For example, the above defines ``VAX'' on the VAX machine,
914and then lines such as
915.DS
916# ifdef VAX
917 .
918 .
919# endif
920.DE
921control the code generated.
922In the network, sequences such as this in turn define other sequences,
923such as
924.DS
925# ifdef \s-2CORY\s0
926# define \s-2FUID\s0
927# define \s-2OLDTTY\s0
928# define \s-2PASSWDF\s0
929# endif
930.DE
931defines the unusual features of the Cory machine:
932the combined user-id and group-id returned by the
933.I getuid()
934system call, that it uses the old 1-character terminal names, and
935that it has a split password file for security reasons.
936Each of these symbols, e.g. ``FUID'', is tested
937in order to compile the correct code for that feature.
938.PP
939To help in isolating the changes, attempts were made to create a procedural
940interface to hide machines differences.
941These procedures are all in one file.
942Only one or two cases exist of conditional sections of code
943not in ``mach.c'' or ``mach.h'', its header file.
944.PP
945One problem these features pose is testing changes \-
946the conditional sections hide errors in inapplicable code.
947A regimen was adopted:
948Testing was first done on the VAX (Version 7),
949then, after it was stable for a few days,
950moved to Cory, where typically there was some Version 6-dependent
951error, and after that was fixed and stable, it was moved to the
952Computer Center machines.
953This notion of a ``testing'' machine is very important \-
954the VAX always has an up-to-date copy of the network
955source, even though other machines may lag in improvements.
956.PP
957There is now a ``retrofit library''
958that simulates many of the features ``mach.c'' provides.
959It was not stable enough when the network was converted to Version 7,
960otherwise I would have used it.
961.PP
962At this point, when the entire source for the software
963for the network is transferred between machines only the first five
964lines of the ``makefile'' need be changed.
965.SH
966.sp 1
967.ce
968.sp .5
969Security
970.PP
971Over Christmas vacation of 1978, a 15-year old high school student
972repeatedly broke into the Computer Center and Cory machines.
973He was able to use the network to gain access to privileged files on
974the VAX, and the fear of protection ``holes'' caused the staff to take
975the network down for seven weeks.
976.PP
977There were two security problems posed by the network:
978.RS
979.IP 1.
980The threat to the ``root'' account on another system.
981.IP 2.
982The threat to a user's remote accounts.
983.RE
984.NH 0
985Threat to ``root''
986.PP
987Originally the network would allow a user logged in as ``root''
988on one machine to execute any command as ``root'' on another network
989machine.
990As far as we know, this feature was never used to break into a system.
991However, the network has been changed to prevent a user from logging
992in as ``root'' on another machine, regardless of the password.
993This check is performed on the sending machine.
994Since ``root'' could conceivably circumvent this check by altering
995the command, the receiving end of a command checks the user-id
996of all commands being executed.
997If it is zero (i.e. ``root'') only a set of five commands is allowed,
998all needed by the network internally, and believed ``safe''.
999.PP
1000We believe this makes the network ``safer'' than many local machine
1001features such as the use of dial-up lines.
1002.NH
1003Threat to user's remote accounts.
1004.PP
1005If a user places remote passwords in his ``.netrc'' file,
1006an illicit superuser could get the password to all the user's remote
1007accounts.
1008Even if the user does not care, system managers dislike this because
1009the illicit superuser could now use a legal account on another system
1010to break into it.
1011.PP
1012We have no good solutions to this.
1013Users are now warned of this danger in the documentation,
1014and a ``.netrc'' file with passwords must be
1015readable only by the owner of the file.
1016.PP
1017Various solutions have been proposed:
1018.RS
1019.IP a)
1020Disallow passwords in ``.netrc'' files.
1021.br
1022Unfortunately, heavy network users would have to repeatedly
1023type their password.
1024.IP b)
1025Encrypt the ``.netrc'' file.
1026.br
1027A program would have to exist to decrypt the file.
1028A superuser could get access to whatever key technique that program used,
1029if it were on the local machine.
1030A public-key encryption scheme would make this option possible.
1031We decided it was too much work to implement this.
1032.IP c)
1033Once-a-session passwords.
1034.br
1035In this scheme, a user would register his password when he logged in,
1036then use the network without needing to type in a password.
1037When he logged off, the password would be removed.
1038We discarded this because we could not guarantee the password would
1039disappear unless we wrote a daemon, which itself could be compromised.
1040The best solution along this line uses the ``alias'' feature
1041of the C shell.
1042Each net command is aliased with itself and the
1043\fB\-l\fP, \fB\-p\fP options.
1044When the user logs in,
1045he sets a shell variable to his password.
1046When he logs off, his shell dies and the passwords are forgotten.
1047.RE
1048.PP
1049I believe the current alternatives are sufficient for a conscientious
1050user to protect himself and still have an easy-to-use network interface.
1051.SH
1052.sp 1
1053.ce
1054Future Plans
1055.sp .5
1056.NH 0
1057Hardware
1058.PP
1059The net has suffered with low speed hardware.
1060Short-term plans include speeding up the current terminal
1061interface hardware from 1200 Baud to 9600 Baud and writing a driver
1062for the device to bypass the internal
1063.UX
1064character queues.
1065This driver will improve the reliability of transmission and decrease the character
1066interrupt overhead.
1067The speedup from 1200 Baud to 9600 Baud may overload the systems due
1068to the number of hardware interrupts it causes.
1069.PP
1070In the longer term, the EECS Department is considering acquiring
1071direct-memory-access (DMA) devices such as the Logical Network Interface (LNI)
1072or the Digital Corp. DMC-11 links for high-speed transmission.
1073These devices are capable of over 1-megabit speeds, and
1074would increase the speed of the current network by factors of hundreds.
1075.NH
1076Adding More Machines to the Network
1077.PP
1078The \s-2INGRES\s0 Research group and various other research units within
1079the EECS department have expressed interest in being added to the network.
1080.NH
1081Remote Use of the Typesetter Facilities
1082.PP
1083The Computer Center A machine has a Graphics Systems phototypesetter
1084and the VAX Research machine has a Versatec 36'' dot-matrix plotter
1085with a
1086.I troff
1087simulator.
1088Software now being debugged will allow remote use of the typesetter
1089by running the
1090.I troff
1091program locally and sending the typesetter device codes to the remote
1092machine.
1093.PP
1094This will distribute the typesetting load and help overloading on
1095the A and VAX machines.
1096It will also allow the use of
1097.I troff
1098macro packages only available on some machines.
1099.NH
1100Remote Mail Forwarding
1101.PP
1102The
1103.UX
1104mail programs will be modified to forward mail to another account on another
1105machine, allowing a user with accounts on many machines to read it all on one
1106designated machine.
1107.SH
1108.sp 1
1109.ce
1110Summary Points
1111.sp .5
1112.PP
1113The author would like to stress these points about his experience:
1114.IP 1.
1115Success in building networking software depends on having ready access
1116to the correct hardware.
1117The minimum is two terminals connected to two usable machines with two
1118magnetic tape drives or some other existing means of software transfer.
1119.IP 2.
1120Design in portability and security.
1121More careful attention to machine dependence and security
1122in the first phase would have saved much later re-programming.
1123.IP 3.
1124Develop good local debugging techniques.
1125The ``self-loop'' trick for network debugging depends on the accuracy
1126of that simulation.
1127.UX
1128pipes, for example, were not sufficient to simulate TTY lines
1129because TTY lines are 7-bits with a restricted ASCII range.
1130.IP 4.
1131Encourage users to use the system.
1132Their feed back is important.
1133However, it is necessary to have an unused network link for new
1134protocol development, etc.
1135.IP 5.
1136There is a fine line between support of an existing network and research.
1137In the best of all possible worlds, support of research-developed
1138software would be the responsibility of the systems staff
1139for the machines it runs on.
1140This is seldom the case.
1141.IP 6.
1142The concept of layers of networks was very helpful in this project.
1143There appear to be these levels:
1144.DS L
1145.ce 99
1146.ls 2
1147.sp 2
1148user interface
1149queues and daemons
1150command protocol
1151packet protocol
1152transmission protocol
1153teletype lines
1154.sp 2
1155.ls 1
1156.ce 0
1157.DE
1158These levels are quite distinct.
1159If a new, better network not involving queues is built, the transfer of files
1160could still be by
1161.I netcp.
1162If state-of-the-art link hardware is used, perhaps all of the levels
1163below the command protocol could be discarded.
1164.IP 7.
1165The chief virtue of the current system is its extreme flexibility
1166and low start-up costs.
1167No modifications to the
1168.UX
1169kernel are required and all local features are conditionally
1170specified in a header file.
1171.IP 8.
1172Networks are hard to build because
1173.RS
1174.IP a)
1175They involve mutually-cooperating copies of software on (usually)
1176differing computers.
1177.IP b)
1178Many options are not practical because of compatibility considerations \-
1179new networks need drivers in unchangeable systems, and new protocols have to
1180accept the old protocols until the old protocols are extinct.
1181.RE