`Network
`Programming
`
`W. Richard Stevens
`Health Systems International
`
`PTR Prentice Hall
`Englewood Cliffs, New Jersey 07632
`
`Apple Inc.
`Ex. 1013 - Page 1
`
`
`
`Library of Congress Cataloging—in—Publication Data
`
`Stevens, W. Richard.
`UNIX network programming / W. Richard Stevens.
`P. cm.
`Includes bibliographical references.
`ISBN 0-13-949876-1
`1. UNIX (Computer operating system) 2. Computer networks.
`I. Title.
`0A76.76.063S755 1990
`005.7'1--dc20
`
`89-25576
`CIP
`
`To Sally, Bill, and Ellen.
`
`Editorial/production supervision: Brendan M. Stewart
`Cover design: Lundgren Graphics Ltd.
`Manufacturing buyer: Ray Sintel
`
`Prentice Hall Software Series
`Brian W. Kernighan, Advisor
`
`© 1990 by P T R Prentice Hall
`Prentice-Hall, Inc.
`A Simon & Schuster Company
`Englewood Cliffs, New Jersey 07632
`
`UNIX® is a registered trademark of AT&T.
`
`All rights reserved. No part of this book may be
`reproduced, in any form or by any means,
`without permission in writing from the publisher.
`
`Printed in the United States of America
`20 19 18 17 16 15 14 13 12 11
`
`ISBN 0-13-949876- 1
`
`Prentice-Hall International (UK) Limited, London
`Prentice-Hall of Australia Pty. Limited, Sydney
`Prentice-Hall Canada Inc., Toronto
`Prentice-Hall Hispanoamericana, S.A., Mexico
`Prentice-Hall of India Private Limited, New Delhi
`Prentice-Hall of Japan, Inc., Tokyo
`Simon & Schuster Asia Pte. Ltd., Singapore
`Editora Prentice-Hall do Brasil, Ltda., Rio de Janeiro
`
`Apple Inc.
`Ex. 1013 - Page 2
`
`
`
`1
`
`Introduction
`
`1.1 History
`
`Computer networks have revolutionized our use of computers. They pervade our every-
`day life, from automated teller machines, to airline reservation systems, to electronic mail
`services, to electronic bulletin boards. There are many reasons for the explosive growth
`in computer networks.
`
`• The proliferation of personal computers and workstations during the 1980s helped
`fuel the interest and need for networks.
`• Computer networks used to be expensive and were restricted to large universities,
`government research sites, and large corporations. Technology has greatly
`reduced the cost of establishing computer networks, and networks are now found
`in organizations of every size.
`• Many computer manufacturers now package networking software as part of the
`basic operating system. Networking software is no longer regarded as an add-on
`that only a few customers will want. It is now considered as essential as a text
`editor.
`• We are in an information age and computer networks are becoming an integral
`part in the dissemination of information.
`
`Computer systems used to be stand-alone entities. Each computer was self-
`contained and had all the peripherals and software required to do a particular job. If a
`particular feature was needed, such as line printer output, a line printer was attached to
`
`1
`
`Apple Inc.
`Ex. 1013 - Page 3
`
`
`
`2
`
`Introduction
`
`Chapter 1
`
`the system. If large amounts of disk storage were needed, disks were added to the sys-
`tem. What helped change this is the realization that computers and their users need to
`share information and resources.
`Information sharing can be electronic mail or file transfer. Resource sharing can
`involve accessing a peripheral on another system. Twenty years ago this type of sharing
`took place by exchanging magnetic tapes, decks of punched cards, and line printer list-
`ings. Today computers can be connected together using various electronic techniques
`called networks. A network can be as simple as two personal computers connected
`together using a 1200 baud modem, or as complex as the TCP/IP Internet, which con-
`nects over 150,000 systems together. The number of ways to connect a computer to a
`network are many, as are the various things we can do once connected to a network.
`Some typical network applications are
`
`• Exchange electronic mail with users on other computers. It is commonplace these
`days for people to communicate regularly using electronic mail.
`• Exchange files between systems. For many applications it is just as easy to dis-
`tribute the application electronically, instead of mailing diskettes or magnetic
`tapes. File transfer across a network also provides faster delivery.
`• Share peripheral devices. Examples range from the sharing of line printers to the
`sharing of magnetic tape drives. A large push towards the sharing of peripheral
`devices has come from the personal computer and workstation market, since often
`the cost of a peripheral can exceed the cost of the computer. In an organization
`with many personal computers or workstations, sharing peripherals makes sense.
`• Execute a program on another computer. There are cases where some other com-
`puter is better suited to run a particular program. For example, a time-sharing
`system or a workstation with good program development tools might be the best
`system on which to edit and debug a program. Another system, however, might
`be better equipped to run the program. This is often the case with programs that
`require special features, such as parallel processing or vast amounts of storage.
`The National Science Foundation (NSF) has connected the six NSF super-
`computer centers using a network, allowing scientists to access these computers
`electronically. Years ago, access to facilities such as this would have required
`mailing decks of punched cards or tapes.
`• Remote login. If two computers are connected using a network, we should be
`able to login to one from the other (assuming we have an account on both sys-
`tems). It is usually easier to connect computers together using a network, and
`provide a remote login application, than to connect every terminal in an organiza-
`tion to every computer.
`
`We'll consider each of these applications in more detail in the later chapters of this text.
`
`Apple Inc.
`Ex. 1013 - Page 4
`
`
`
`Section 1.3
`
`1.2
`
`Layering
`
`OSI Model
`
`3
`
`Given a particular task that we want to solve, such as providing a way to exchange files
`between two computers that are connected with a network, we divide the task into pieces
`and solve each piece. In the end we connect the pieces back together to form the final
`solution. We could write a single monolithic system to solve the problem, but experience
`has shown that solving the problem in pieces leads to a better, and more extensible, solu-
`tion.
`It is possible that part of the solution developed for a file transfer program can also
`be used for a remote printing program. Also, if we're writing the file transfer program
`assuming the computers are connected with an Ethernet, it could turn out that part of this
`program is usable for computers connected with a leased telephone line.
`In the context of networking, this is called layering. We divide the communication
`problem into pieces (layers) and let each layer concentrate on providing a particular func-
`tion. Well-defined interfaces are provided between layers.
`
`1.3 OSI Model
`
`The starting point for describing the layers in a network is the International Standards
`Organization (ISO) open systems interconnection model (OSI) for computer communica-
`tions. This is a 7-layer model shown in Figure 1.1.
`
`7
`
`6
`
`5
`
`4
`
`3
`
`2
`
`1
`
`Application
`
`Presentation
`
`Session
`
`Transport
`
`Network
`
`Data Link
`
`Physical
`
`Figure 1.1 OSI 7-layer model.
`
`The OSI model provides a detailed standard for describing a network. Most computer
`networks today are described using the OSI model. In Chapter 5, each of the networks
`we describe is shown against the OSI model.
`
`Apple Inc.
`Ex. 1013 - Page 5
`
`
`
`4
`
`Introduction
`
`Chapter 1
`
`The transport layer is important because it is the lowest of the seven layers that pro-
`vides reliable data transfer between two systems. The layers above the transport layer
`can assume they have an error-free communications path. Details such as sequence con-
`trol, error detection, retransmission and flow control are handled by the transport layer
`and the layers below it.
`
`1.4 Processes
`
`A fundamental entity in a computer network is a process. A process is a program that is
`being executed by the computer's operating system. When we say that two computers
`are communicating with each other, we mean that two processes, one running on each
`computer, are in communication with each other.
`We describe processes in the Unix operating system in detail in Chapter 2. In Chap-
`ter 3 we describe the various forms of interprocess communication (IPC) provided by
`Unix to allow processes on a single computer to exchange infaunation. In Chapters 6
`and 7 we expand the interprocess communication to include processes on different sys-
`tems that are connected by a network.
`
`1.5 A Simplified Model
`
`This book is mainly concerned with the top three layers of the OSI model—the session,
`presentation, and application layers—along with the interface between these three layers
`and the transport layer beneath them. We'll often combine these three layers into one
`and call it the process layer. Additionally, we'll usually combine the bottom two layers
`into a single layer and call it the data-link layer. We'll use a simplified, 4-layer version
`of the OSI model, illustrated in Figure 1.2.
`In Figure 1.2 we show two systems that are connected with a network. The actual
`connection between the two systems is between the two data-link layers, the solid hor-
`izontal line. Although it appears to the two processes that they are communicating with
`each other (the dashed horizontal line between the two process layers), the actual data
`flows from the process layer, down to the transport layer, down to the network layer,
`down to the data-link layer, across the physical network to the other data-link layer, up
`through the network layer, then the transport layer to the other process.
`Layering leads to the definitions of protocols at each layer. Even though physical
`communication takes place at the lowest layer (the physical layer in the OSI model),
`protocols exist at every layer. The protocols that are used at a given layer, the four hor-
`izontal lines in Figure 1.2, are also called peer-to-peer protocols to reiterate that they are
`used between two entities at the same layer. We'll discuss various protocols at the data-
`link, network, and transport layers, in Chapter 5. The later chapters, which describe
`specific applications, present various application-specific protocols at the process layer.
`Since the data always flows between a given layer and the layer immediately above
`it or immediately below it, the interfaces between the layers are also important for
`
`Apple Inc.
`Ex. 1013 - Page 6
`
`
`
`Section 1.6
`
`Client—Server Model
`
`5
`
`Process
`
`V
`Transport
`
`Network
`
`A
`
`process layer protocols
`
`transport layer protocols
`
`network layer protocols
`
`Data Link
`
`<
`
`data-link layer protocols
`(physical connection)
`
`Process
`
`Transport
`
`A
`
`Network
`
`A
`V
`Data Link
`
`L
`
`J
`
`L
`
`J
`
`Figure 1.2 Simplified 4-layer model.
`
`network programming. Chapters 6 and 7 provide detailed descriptions of two interfaces
`between the transport layer and the layer above it: Berkeley sockets and the AT&T
`Transport Layer Interface (TLI). The Berkeley socket interface is then used in the
`remaining chapters for most of the examples.
`Another feature of the model shown in Figure 1.2 is that often the layers up through
`and including the transport layer (layers 1 through 4 of the OSI model) are included in
`the host operating system. This is the case for 4.3BSD and System V, the two examples
`used in this text.
`
`1.6 Client—Server Model
`
`The standard model for network applications is the client—server model. A server is a
`process that is waiting to be contacted by a client process so that the server can do some-
`thing for the client. A typical (but not mandatory) scenario is as follows:
`
`o The server process is started on some computer system. It initializes itself, then
`goes to sleep waiting for a client process to contact it requesting some service.
`o A client process is started, either on the same system or on another system that is
`connected to the server's system with a network. Client processes are often ini-
`tiated by an interactive user entering a command to a time-sharing system. The
`client process sends a request across the network to the server requesting service
`of some form. Some examples of the type of service that a server can provide are
`
`Apple Inc.
`Ex. 1013 - Page 7
`
`
`
`6
`
`Introduction
`
`Chapter 1
`
`o return the time-of-day to the client,
`o print a file on a printer for the client,
`o read or write a file on the server's system for the client,
`o allow the client to login to the server's system,
`o execute a command for the client on the server's system.
`
`o When the server process has finished providing its service to the client, the server
`goes back to sleep, waiting for the next client request to arrive.
`
`We can further divide the server processes into two types.
`
`1. When a client's request can be handled by the server in a known, short amount
`of time, the server process handles the request itself. We call these iterative
`servers. A time-of-day service is typically handled in an iterative fashion by the
`server.
`2. When the amount of time to service a request depends on the request itself (so
`that the server doesn't know ahead of time how much effort it takes to handle
`each request), the server typically handles it in a concurrent fashion. These are
`called concurrent servers. A concurrent server invokes another process to han-
`dle each client request, so that the original server process can go back to sleep,
`waiting for the next client request. Naturally, this type of server requires an
`operating system that allows multiple processes to run at the same time. (More
`on this in the next chapter.) Most client requests that deal with a file of informa-
`tion (print a file, read or write a file, for example) are handled in a concurrent
`fashion by the server, as the amount of processing required to handle each
`request depends on the size of the file.
`
`We'll see examples of both types of servers in later chapters.
`
`1.7 Plan of the Book
`
`The goal of the book is to develop and present examples of processes that are used for
`communication between different computer systems. In Figure 1.3, the chapters in this
`book are compared to the OSI model.
`To develop applications at the process layer, a thorough understanding of a process
`is required. Chapter 2 develops the process terminology for the Unix system. The
`emphasis is on process control and signals. Chapter 3 describes methods by which multi-
`ple processes on a single computer can communicate with each other—interprocess com-
`munication, or IPC. Understanding how independent processes communicate on a single
`computer system is a requisite to understanding IPC between processes on different sys-
`tems. Chapter 3 also describes file locking and record locking under Unix, as these are
`often required when multiple processes are used for a task.
`
`Apple Inc.
`Ex. 1013 - Page 8
`
`
`
`Section 1.7
`
`Plan of the Book
`
`7
`
`7
`
`6
`
`5
`
`4
`
`3
`
`2
`
`1
`
`Application
`
`Presentation
`
`Chapters 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18
`
`I
`
` Chapters 6 and 7
`
`Chapters 4 and 5
`
`Session
`
`Transport
`
`Network
`
`Data Link
`
`Physical
`
`Figure 1.3 Outline of book compared to 7-layer OSI model.
`
`Chapter 4 provides an overview of networking and the terminology used to describe
`the services provided by a network. Various communication protocol suites are
`described in Chapter 5. The emphasis is on the services provided to an application pro-
`cess by the protocol suite. We concentrate on the TCP/IP and Xerox NS (XNS) protocol
`suites, since they are used in the examples in the later chapters. We also cover the fol-
`lowing protocol suites: IBM's SNA, NetBIOS, the OSI protocols, and UUCP. SNA is
`important since most Unix vendors today provide support for SNA. NetBIOS is used in
`many personal computer networks, which Unix systems need to communicate with. The
`OSI protocols, while still in their infancy, will be more important in the coming decade.
`An overview of UUCP is provided since it is the oldest of the Unix networking solutions,
`and is still widely used. An understanding of where these different protocol suites fit
`with regard to each other is important.
`Chapters 6 and 7 describe the two predominant interfaces provided by Unix today,
`between the transport layer and an application process: Berkeley sockets and System V
`TLI. The Berkeley socket interface is then used for most of the examples in the later
`chapters.
`The final eleven chapters contain detailed examples of actual process-level applica-
`tion programs. Chapter 8 describes various utility functions that are used in the remain-
`ing chapters. This includes converting network names into addresses, and timeout and
`retransmission algorithms for unreliable protocols.
`Security is an issue we'll encounter in almost every application, and we cover it in
`Chapter 9. We describe the security techniques currently used by the 4.3BSD system
`along with the newer Kerberos system.
`Chapter 10 is the first chapter describing a specific network application: obtaining
`the time and date from another computer on the network. Chapter 11 describes the ubiq-
`uitous Internet "ping" program, which has become an everyday tool on most TCP/IP
`networks. We also present a similar application using the Xerox NS protocols.
`
`Apple Inc.
`Ex. 1013 - Page 9
`
`
`
`8
`
`Introduction
`
`Chapter 1
`
`Chapter 12 is a complete presentation of a file transfer program—the TCP/IP Trivial
`File Transfer Protocol (TFTP). File transfer is an important network application and
`TFTP is one of the simpler protocols.
`Line printer spoolers are covered in Chapter 13, both the Berkeley and System V
`print spoolers. Print spoolers are interesting from a process control viewpoint, in addi-
`tion to the network printing option provided by 4.3BSD.
`Chapter 14 covers the execution of commands on another system. We concentrate
`on the rcmd function provided by 4.3BSD. This function is central to what are called
`the Berkeley "r" commands: rcp, rdump, rlogin, and the like. These programs are
`often provided by third-party TCP/IP vendors for systems other than 4.3BSD, and have
`become de facto standards for Unix networking applications.
`Remote login across a network is the topic of Chapter 15. This chapter also con-
`cerns itself with details of terminal handling and pseudo-terminals, both important
`features in remote login programs. This chapter concludes with a complete presentation
`of the 4.3BSD rlogin client and server.
`In Chapter 16 we describe the use of a tape drive across a network, specifically the
`4.3BSD rmt protocol. This has become an important topic with workstations and per-
`sonal computers that have disks but not tape drives.
`Chapter 17 is concerned with performance. This includes the performance of the
`various IPC techniques from Chapter 3, along with the performance of a network. Since
`a network is often used for file transfer and tape drive access, typical performance figures
`for disk drives and tape drives are also covered.
`Chapter 18 covers remote procedure calls (RPC), a technique used to simplify the
`programming of network applications. We cover three RPC implementations: Sun RPC,
`Xerox Courier, and Apollo NCA.
`
`1.8 A History of Unix Networking
`
`The first Unix network application was UUCP, the Unix-to-Unix copy program, and all
`its associated commands. UUCP was developed around 1976 [Redman 1989] and its first
`major release outside AT&T was with Version 7 Unix in 1978. UUCP is a batch-
`oriented system that is typically used between systems with dial-up telephone lines or
`systems that are directly connected. Its major uses are for distributing software (file
`transfer) and electronic mail. We'll say more about the programs that comprise UUCP in
`Section 5.7. It is interesting that the first Unix networking application is still in wide use
`today.
`The program cu was also distributed with Version 7 Unix in 1978, and has been
`available with almost every Unix system since then. Although not strictly part of a
`specific networking package, it provides a remote login capability to another computer
`system. The cu program was typically used to connect to another system using a dial-up
`telephone line. A rewritten version of cu was distributed with 4.2BSD where it was
`called tip.
`
`Apple Inc.
`Ex. 1013 - Page 10
`
`
`
`Section 1.8
`
`A History of Unix Networking
`
`9
`
`In 1978 Eric Schmidt developed a network application for Unix as part of his Mas-
`ters degree at Berkeley. This network was called "Berknet" and was first distributed
`with the Berkeley release of Version 7 Unix for the PDP-11—the 2.xBSD systems. It
`provided file transfer, electronic mail, and remote printing. It was widely used on the
`Berkeley campus. Typically the systems were directly connected with 9600 baud
`RS-232 lines. This software moved to the VAX with the 4.xBSD releases, then it was
`slowly replaced with the faster Ethernet-based local area networks that started with the
`4.2BSD system.
`In September 1980 Bolt, Beranek, and Newman (BBN) was contracted by the
`Defense Advanced Research Projects Agency (DARPA) of the Department of Defense
`(DoD) to develop an implementation of the TCP/IP protocols for Berkeley Unix on the
`VAX [Walsh and Gurwitz 1984]. A version for the 4.1BSD system was turned over to
`Berkeley in the Fall of 1981. This was then integrated by Berkeley into the 4.2BSD sys-
`tem that was being developed. The 4.2BSD system was released in August 1983 and
`with it the growth of local area networks, based mainly on Ethernet technology, grew
`rapidly. These 4.2BSD systems also allowed the computers to connect to the
`ARPANET, which also saw enormous growth in the early 1980s. With the 4.2BSD sys-
`tem the socket interface was provided, which we describe in Chapter 6 and use for most
`of the examples in the remainder of the text.
`Networking development during this period was also underway at AT&T, however,
`other than UUCP, the results usually did not propagate outside AT&T. This is in contrast
`to the networking developments at Berkeley, which were widely disseminated. Fritz,
`Hefner, and Raleigh [1984] describe a network based on a HYPERchannel high-speed
`local network. Its development started around 1980 and it connected various types of
`systems running different versions of Unix: VAX 780, PDP-11/70, IBM 370, and AT&T
`3B205. The versions of Unix were the AT&T versions of System III and System V. The
`network was batch-oriented and supported file transfer, remote command execution,
`remote printing, and electronic mail.
`Various third-party networking packages appeared for System V in the mid-1980s.
`These typically supported the TCP/IP protocol suite and were often developed by the
`vendor who developed the interface hardware.
`The streams I/O facility was first described in Ritchie [1984b]. It did not get widely
`distributed outside the Bell Labs research environment, however, until System V
`Release 3.0 in 1986. The Transport Layer Interface (TLI), which we describe in Chap-
`ter 7, was provided with this release of System V [Olander, McGrath, and Israel 1986].
`Various third-party networking packages (mainly for the TCP/IP protocol suite) based on
`'ILI started to appear around 1988.
`
`Apple Inc.
`Ex. 1013 - Page 11
`
`
`
`4
`
`A Network Primer
`
`We have to define some basic networking terms and concepts before they are used in
`later chapters. When necessary, we jump ahead and use specific examples from the next
`chapter, to provide actual network examples, instead of trying to describe everything in a
`generic, abstract sense. Tanenbaum [1989] provides additional details on many of the
`networking topics discussed in this chapter.
`
`Internetworking
`
`A computer network is a communication system for connecting end-systems. We often
`refer to the end-systems as hosts. The hosts can range in size from small microcomputers
`to the largest supercomputers. Some hosts on a computer network are dedicated systems,
`such as print servers or file servers, without any capabilities for interactive users. Other
`hosts might be single-user personal computers, while others might be general purpose
`time-sharing systems.
`A local area network, or LAN, connects computer systems that are close together—
`typically within a single building, but possibly up to a few kilometers apart. Popular
`technologies today for LANs are Ethernet and token ring. LANs typically operate at high
`speeds—an Ethernet operates at 10 Mbps (million bits per second) while IBM's token
`ring operates at both 4 and 16 Mbps. Newer LAN technologies, such as FDDI (Fiber
`Distributed Data Interface), use fiber optics and have a data rate of 100 Mbps. Each
`computer on a LAN has an interface card of some form that connects it to the actual net-
`work hardware. (Be aware that these raw network speeds are usually not realized in
`actual data transfers. In Chapter 17 we'll discuss some actual performance measure-
`ments.)
`
`171
`
`Apple Inc.
`Ex. 1013 - Page 12
`
`
`
`172
`
`A Network Primer
`
`Chapter 4
`
`A wide area network or WAN connects computers in different cities or countries.
`These networks are sometimes referred to as long haul networks. A common technology
`for WANs is leased telephone lines operating between 9600 bps (bits per second) and
`1.544 Mbps (million bits per second).
`Between the LAN and WAN is the metropolitan area network or MAN. These cover
`an entire city or metropolitan area and frequently operate at LAN speeds. Common tech-
`nologies are coaxial cable (similar to cable TV) and microwave.
`An internet or internetwork is the connection of two or more distinct networks so
`that computers on one network are able to communicate with computers on another net-
`work. The goal of internetworking is to hide the details of what might be different physi-
`cal networks, so that the internet functions as a coordinated unit. One way to connect
`two distinct physical networks is to have a gateway that is attached to both networks.
`This gateway must pass infamiation from one network to the other. It is sometimes
`called a router. As an example, Figure 4.1 shows an internet fomied from two distinct
`networks.
`
`H2
`
`H1
`
`toke-ri
`ring
`network
`
`H3
`
`H4
`
`H5
`
`gateway
`
`Ethernet
`
`Figure 4.1 Internet example with two networks joined by a gateway.
`
`There are three hosts on the token ring, H1, H2, and H3, and two hosts on the Ethernet,
`H4 and H5. There is a gateway between the two physical networks, and it must contain
`an interface card to attach to the token ring network and another interface card to attach
`to the Ethernet. It must also detemiine when infomiation arriving on the Ethernet is des-
`tined for a host on the token ring (and vice versa), and handle it appropriately.
`There are more ways to connect networks together. The teiiii we use to describe the
`interconnection depends on the layer in the OSI model at which the connection takes
`place.
`
`• Repeaters operate at the physical layer (layer 1) and typically just copy electrical
`signals (including noise) from one segment of a network to the next. Repeaters
`are often used with Ethernets, for example, to connect two cable segments
`together to fomi a single network.
`
`Apple Inc.
`Ex. 1013 - Page 13
`
`
`
`Chapter 4
`
`A Network Primer
`
`173
`
`• Bridges often operate at the data-link layer (layer 2) and they copy frames from
`one network to the next. Bridges often contain logic so that they only copy a sub-
`set of the frames they receive.
`• Routers operate at the network layer (layer 3). The term router implies that this
`entity not only moves information (packets) from one network to another, but it
`can also make decisions about what route the information should take. (We talk
`more about routing later in this chapter.)
`• Gateway is a generic term that refers to an entity used to interconnect two or more
`networks. In the TCP/IP community, for example, the term gateway refers to a
`network level router. The term gateway is sometimes used to describe software
`that performs specific conversions at layers above the network layer. For exam-
`ple, there are various mail gateways that convert electronic mail from one format
`to another. We mention an application-gateway in Section 5.6 that converts file
`transfer requests between the OSI FTAM protocol and the TCP/IP FTP protocol.
`We'll use the term gateway to describe a network level router, unless stated other-
`wise.
`
`Repeaters are usually hardware devices, while bridges and routers can be implemented in
`either hardware or software. A router (gateway) is usually a dedicated system that only
`does this function. 4.2BSD, however, was the first general-purpose system that could
`also operate as a gateway.
`A host is said to be multihomed if it has more than one network interface. For exam-
`ple, a host with an Ethernet interface and a token ring interface would be multihomed.
`Looking at the different levels of abstraction, we go from a user sitting at a terminal
`to an internet.
`
`• Users login to a host computer.
`• Host computers are connected to a network.
`• Networks are connected together to form an internet.
`
`An internet of computer networks is similar in principle to the international long distance
`telephone service that is available today. Telephones are connected to a local phone
`company, which in turn is connected into a national long distance network, which is then
`connected into an international network. When you direct dial an international call, this
`"telephone internet" hides all the details and connects all the telephones into a coordi-
`nated unit. This is the goal of an internet of computer networks.
`
`OSI Model, Protocols, and Layering
`
`The computers in a network use well-defined protocols to communicate. A protocol is a
`set of rules and conventions between the communicating participants. Since these proto-
`cols can be complex, they are designed in layers, to make their implementation more
`
`Apple Inc.
`Ex. 1013 - Page 14
`
`
`
`174
`
`A Network Primer
`
`Chapter 4
`
`manageable. Figure 4.2 shows the OSI model that was introduced in Section 1.3.
`
`7
`
`6
`
`5
`
`4
`
`3
`
`2
`
`Application
`
`Presentation
`
`Session
`
`Transport
`
`Network
`
`Data Link
`
`1
`
`Physical
`
`Figure 4.2 OSI model.
`
`This model, developed between 1977 and 1984, is a guide, not a specification. It pro-
`vides a framework in which standards can be developed for the services and protocols at
`each layer. Indeed, the networks that we consider in this text (TCP/IP, XNS, and SNA)
`were developed before the OSI model. We will compare the layers for these actual net-
`works against the OSI model, but realize that no network is implemented exactly as the
`OSI model shows.
`One advantage of layering is to provide well-defined interfaces between the layers,
`so that a change in one layer doesn't affect an adjacent layer. It is important to under-
`stand that protocols exist at each layer. A protocol suite is a collection of protocols from
`more than one layer that Rums the basis of a useful network. This collection is also
`referred to as a protocol family. The protocol suites that we describe in Chapter 5 are
`
`• the TCP/IP protocol suite (the DARPA Internet protocols),
`• Xerox Network Systems (Xerox NS or XNS),
`• IBM's Systems Network Architecture (SNA),
`• IBM's NetBIOS,
`•
`the OSI protocols,
`• UUCP.
`
`Each of these protocol suites define different protocols at different layers, as we see in
`the next chapter.
`
`Apple Inc.
`Ex. 1013 - Page 15
`
`
`
`Chapter 4
`
`A Network Primer
`
`175
`
`Recall from Section 1.5 that we simplified the OSI model into a 4-layer model that
`we use in the text. Figure 4.3 shows this model for two systems that are connected with a
`network.
`
`r
`
`L
`
`Process
`
`A
`
`Transport
`
`V
`Network
`
`A
`
`Data Link
`
`Process
`
`Transport
`
`A
`
`Network
`
`A
`
`V
`
`Data Link
`
`_J
`
`Physical
`Network
`
`Figure 4.3 Simplified 4-layer model connecting two systems.
`
`The layers that define a protocol suite are the two boxes called the transport layer and the
`network layer. The multiple layers that define the network and hardware characteristics
`(Ethernet, token ring, etc.) are grouped together into our data-link layer. Application
`programs exist at the process layer. It is the interface between the transport layer and the
`process layer that we describe in Chapters 6 and 7.
`Let's jump ahead to provide a concrete example for layering and some of the other
`concepts described in this chapter. Figure 4.4 shows the layering used by the TCP/IP
`protocol suite.
`Consider one