TCP/IP Illustrated TCP/IP Illustrated, Volume 1

Transcription

TCP/IP IllustratedTCP/IP Illustrated,Volume 1The ProtocolsW. Richard StevensContentsPrefaceChapter 1. Introduction1.1 Introduction1.2 Layering1.3 TCP/IP Layering1.4 Internet Addresses1.5 The Domain Name System1.6 Encapsulation1.7 Demultiplexing1.8 Client-Server Model1.9 Port Numbers1.10 Standardization Process1.11 RFCs1.12 Standard, Simple Services1.13 The Internet1.14 Implementations1.15 Application Programming Interfaces1.16 Test Network1.17 SummaryChapter 2. Link Layer2.1 Introduction2.2 Ethernet and IEEE 802 Encapsulation2.3 Trailer Encapsulationfile:///D et2run/tcpip/tcp-ip-illustrated/index.htm (1 of 9) [12/09/2001 14.46.27]

TCP/IP Illustrated2.4 SLIP: Serial Line IP2.5 Compressed SLIP2.6 PPP: Point-to-Point Protocol2.7 Loopback Interface2.8 MTU2.9 Path MTU2.10 Serial Line Throughput Calculations2.11 SummaryChapter 3. IP: Internet Protocol3.1 Introduction3.2 IP Header3.3 IP Routing3.4 Subnet Addressing3.5 Subnet Mask3.6 Special Case IP Address3.7 A Subnet Example3.8 ifconfig Command3.9 netstat Command3.10 IP Futures3.11 SummaryChapter 4. ARP: Address Resolution Protocol4.1 Introduction4.2 An Example4.3 ARP Cache4.4 ARP Packet Format4.5 ARP Examples4.6 Proxy ARP4.7 Gratuitous ARP4.8 arp Command4.9 SummaryChapter 5. RARP: Reverse Address Resolution Protocol5.1 Introduction5.2 RARP Packet Format5.3 RARP Examples5.4 RARP Server design5.5 Summaryfile:///D et2run/tcpip/tcp-ip-illustrated/index.htm (2 of 9) [12/09/2001 14.46.27]

TCP/IP IllustratedChapter 6. ICMP: Internet Control Message Protocol6.1 Introduction6.2 ICMP Message Types6.3 ICMP Address Mask Request and Reply6.4 ICMP Timestamp Request and Reply6.5 ICMP Port Unreachable Error6.6 4.4BSD Processing of ICMP Messages6.7 SummaryChapter 7. Ping Program7.1 Introduction7.2 Ping Program7.3 IP Record Route Option7.4 IP Timestamp Option7.5 SummaryChapter 8. Traceroute Program8.1 Introduction8.2 Traceroute Program operation8.3 LAN output8.4 WAN output8.5 IP Source Routing Option8.6 SummaryChapter 9. IP Routing9.1 Introduction9.2 Routing Principles9.3 ICMP Host and Network Unreachable Errors9.4 To Forward or Not to Forward9.5 ICMP Redirect Errors9.6 ICMP Router Discovery Messages9.7 SummaryChapter 10. Dynamic Routing Protocols10.1 Introduction10.2 Dynamic Routing10.3 Unix Routing Daemonsfile:///D et2run/tcpip/tcp-ip-illustrated/index.htm (3 of 9) [12/09/2001 14.46.27]

TCP/IP Illustrated10.4 RIP: Routing Information Protocol10.5 RIP Version 210.6 OSPF: Open Shortest Path First10.7 BGP: Border Gateway Protocol10.8 CIDR: Classless Interdomain Routing10.9 SummaryChapter 11. UDP: User Datagram Protocol11.1 Introduction11.2 UDP Header11.3 UDP Checksum11.4 A Simple Example11.5 IP Fragmentation11.6 ICMP Unreachable Error (Fragmentation Required)11.7 Determining the Path MTU Using Traceroute11.8 Path MTU Discovery with UDP11.9 Interaction Between UDP and ARP11.10 Maximum UDP Datagram Size11.11 ICMP Source Quench Error11.12 UDP Server Design11.13 SummaryChapter 12. Broadcasting and Multicasting12.1 Introduction12.2 Broadcasting12.3 Broadcasting Examples12.4 Multicasting12.5 SummaryChapter 13. IGMP: Internet Group Management Protocol13.1 Introduction13.2 IGMP Message13.3 IGMP Protocol13.4 An Example13.5 SummaryChapter 14. DNS: The Domain Name System14.1 Introduction14.2 DNS Basicsfile:///D et2run/tcpip/tcp-ip-illustrated/index.htm (4 of 9) [12/09/2001 14.46.27]

TCP/IP Illustrated14.3 DNS Message Format14.4 A Simple Example14.5 Pointer Quiries14.6 Resourse Records14.7 Caching14.8 UDP or TCP14.9 Another Example14.10 SummaryChapter 15. TFTP: Trivial File Transfer Protocol15.1 Introduction15.2 Protocol15.3 An Example15.4 Security15.5 SummaryChapter 16. BOOTP: Bootstrap Protocol16.1 Introduction16.2 BOOTP Packet Format16.3 An Example16.4 BOOTP Server Design16.5 BOOTP Through a Router16.6 Vendor-Specific Information16.7 SummaryChapter 17. TCP: Transmission Control Protocol17.1 Introduction17.2 TCP Services17.3 TCP Header17.4 SummaryChapter 18. TCP Connection Establishment and Termination18.1 Introduction18.2 Connection Establishment and Termination18.3 Timeout of Connection Establishment18.4 Maximum Segment Size18.5 TCP Half-Close18.6 TCP State Transition Diagram18.7 Reset Segmentsfile:///D et2run/tcpip/tcp-ip-illustrated/index.htm (5 of 9) [12/09/2001 14.46.27]

TCP/IP Illustrated18.8 Simultaneous Open18.9 Simultaneous Close18.10 TCP Options18.11 TCP Server Design18.12 SummaryChapter 19. TCP Interactive Data Flow19.1 Introduction19.2 Interactive Input19.3 Delayed Acknoledgements19.4 Nagle Algorithm19.5 Windows Size Advertisments19.6 SummaryChapter 20. TCP Bulk Data Flow20.1 Introduction20.2 Normal Data Flow20.3 Sliding Windows20.4 Window Size20.5 PUSH Flag20.6 Slow Start20.7 Bulk Data Throughput20.8 Urgent Mode20.9 SummaryChapter 21. TCP Timeout and Retransmission21.1 Introduction21.2 Simple Timeout and Retransmission Example21.3 Round-Trip Time Measurement21.4 An RTT Example21.5 Congestion Example21.6 Congestion Avoidance Algorithm21.7 Fast Retransmit and Fast Recovery Algorithm21.8 Congestion Example (Continued)21.9 Per-Route Metrics21.10 ICMP Errors21.11 Repacketization21.12 Summaryfile:///D et2run/tcpip/tcp-ip-illustrated/index.htm (6 of 9) [12/09/2001 14.46.27]

TCP/IP IllustratedChapter 22. TCP Persist Timer22.1 Introduction22.2 An Example22.3 Silly Windows Syndrome22.4 SummaryChapter 23. TCP Keepalive Timer23.1 Introduction23.2 Description23.3 Keepalive Examples23.4 SummaryChapter 24. TCP Futures and Performance24.1 Introduction24.2 Path MTU Discovery24.3 Long Fat Pipes24.4 Windows Scale Option24.5 Timestamp Option24.6 PAWS: Protection Against Wrapped Sequence Numbers24.7 T/TCP: A TCP Extension for Transactions24.8 TCP Performance24.9 SummaryChapter 25. SNMP: Simple Network Management Protocol25.1 Introduction25.2 Protocol25.3 Structure of Management Information25.4 Object Identifiers25.5 Introduction to the Management Information Base25.6 Instance Identification25.7 Simple Examples25.8 Management Information Base (Continued)25.9 Additional Examples25.10 Traps25.11 ASN.1 and BER25.12 SNMP Version 225.13 Summaryfile:///D et2run/tcpip/tcp-ip-illustrated/index.htm (7 of 9) [12/09/2001 14.46.27]

TCP/IP IllustratedChapter 26. Telnet and Rlogin: Remote Login26.1 Introduction26.2 Rlogin Protocol26.3 Rlogin Examples26.4 Telnet Protocol26.5 Telnet Examples26.6 SummaryChapter 27. FTP: File Transfer Protocol27.1 Introduction27.2 FTP Protocol27.3 FTP Examples27.4 SummaryChapter 28. SMTP: Simple Mail Transfer Protocol28.1 Introduction28.2 SMTP Protocol28.3 SMTP Examples28.4 SMTP Futures28.5 SummaryChapter 29. NFS: Network File System29.1 Introduction29.2 Sun Remote Procedure Call29.3 XDR: External Data Representation29.4 Port Mapper29.5 NFS Protocol29.6 NFS Examples29.7 NFS Version 329.8 SummaryChapter 30. Other TCP/IP Applications30.1 Introduction30.2 Finger Protocol30.3 Whois Protocol30.4 Archie, WAIS, Gopher, Veronica and WWW30.5 X Window System30.6 Summaryfile:///D et2run/tcpip/tcp-ip-illustrated/index.htm (8 of 9) [12/09/2001 14.46.27]

TCP/IP IllustratedAppendix A. The tcpdump ProgramA.1 BSD Packet FilterA.2 SunOS Network Interface TapA.3 SVR4 Data Link Provider InterfaceA.4 tcpdump OutputA.5 Security ConsiderationsA.6 Socket Debug OptionAppendix B. Computer ClocksAppendix C. The sock ProgramAppendix D. Solutions to Selected ExercisesAppendix E. Configurable OptionsE.1 BSD/386 version 1.0E.2 SunOS 4.1.3E.3 System V Release 4E.4 Solaris 2.2E.5 AIX 3.2.2E.6 4.4BSDAppendix F. Source Code AvailabilityAcronymsYou can write to the designer of this page. All critics are welcome.file:///D et2run/tcpip/tcp-ip-illustrated/index.htm (9 of 9) [12/09/2001 14.46.27]

PrefacePrefaceIntroductionThis book describes the TCP/IP protocol suite, but from a different perspective than othertexts on TCP/IP. Instead of just describing the protocols and what they do, we'll use apopular diagnostic tool to watch the protocols in action. Seeing how the protocols operate invarying circumstances provides a greater understanding of how they work and why certaindesign decisions were made. It also provides a look into the implementation of the protocols,without having to wade through thousands of lines of source code.When networking protocols were being developed in the 1960s through the 1980s,expensive, dedicated hardware was required to see the packets going "across the wire."Extreme familiarity with the protocols was also required to comprehend the packetsdisplayed by the hardware. Functionality of the hardware analyzers was limited to that builtin by the hardware designers.Today this has changed dramatically with the ability of the ubiquitous workstation tomonitor a local area network [Mogul 1990]. Just attach a workstation to your network, runsome publicly available software (described in Appendix A), and watch what goes by on thewire. While many people consider this a tool to be used for diagnosing network problems, itis also a powerful tool for understanding how the network protocols operate, which is thegoal of this book.This book is intended for anyone wishing to understand how the TCP/IP protocols operate:programmers writing network applications, system administrators responsible formaintaining computer systems and networks utilizing TCP/IP, and users who deal withTCP/IP applications on a daily basis.Organization of the BookThe following figure shows the various protocols and applications that are covered. Theitalic number by each box indicates the chapter in which that protocol or application isdescribed.file:///D 2run/tcpip/tcp-ip-illustrated/preface.htm (1 of 6) [12/09/2001 14.46.28]

Preface(Numerous fine points are missing from this figure that will be discussed in the appropriatechapter. For example, both the DNS and RPC use TCP, which we don't show.)We take a bottom-up approach to the TCP/IP protocol suite. After providing a basicintroduction to TCP/IP in Chapter 1, we will start at the link layer in Chapter 2 and work ourway up the protocol stack. This provides the required background for later chapters forreaders who aren't familiar with TCP/IP or networking in general.This book also uses a functional approach instead of following a strict bottom-to-top order.For example, Chapter 3 describes the IP layer and the IP header. But there are numerousfields in the IP header that are best described in the context of an application that uses or isaffected by a particular field. Fragmentation, for example, is best understood in terms ofUDP (Chapter 11), the protocol often affected by it. The time-to-live field is fully describedwhen we look at the Traceroute program in Chapter 8, because this field is the basis for theoperation of the program. Similarly, many features of ICMP are described in the laterchapters, in terms of how a particular ICMP message is used by a protocol or an application.We also don't want to save all the good stuff until the end, so we describe TCP/IPapplications as soon as we have the foundation to understand them. Ping and Trace-route aredescribed after IP and ICMP have been discussed. The applications built on UDP(multicasting, the DNS, TFTP, and BOOTP) are described after UDP has been examined.The TCP applications, however, along with network management, must be saved until theend, after we've thoroughly described TCP. This text focuses on how these applications usethe TCP/IP protocols. We do not provide all the details on running these applications.file:///D 2run/tcpip/tcp-ip-illustrated/preface.htm (2 of 6) [12/09/2001 14.46.28]

PrefaceReadersThis book is self-contained and assumes no specific knowledge of networking or TCP/IP.Numerous references are provided for readers interested in additional details on specifictopics.This book can be used in many ways. It can be used as a self-study reference and coveredfrom start to finish by someone interested in all the details on the TCP/IP protocol suite.Readers with some TCP/IP background might want to skip ahead and start with Chapter 7,and then focus on the specific chapters in which they're interested. Exercises are provided atthe end of the chapters, and most solutions are in Appendix D. This is to maximize theusefulness of the text as a self-study reference.When used as part of a one- or two-semester course in computer networking, the focusshould be on IP (Chapters 3 and 9), UDP (Chapter 11), and TCP (Chapters 17-24), alongwith some of the application chapters.Many forward and backward references are provided throughout the text, along with athorough index, to allow individual chapters to be studied by themselves. A list of all theacronyms used throughout the text, along with the compound term for the acronym, appearson the inside back covers.If you have access to a network you are encouraged to obtain the software used in this book(Appendix F) and experiment on your own. Hands-on experimentation with the protocolswill provide the greatest knowledge (and make it more fun).Systems Used for TestingEvery example in the book was run on an actual network and the resulting output saved in afile for inclusion in the text. Figure 1.11 shows a diagram of the different hosts, routers, andnetworks that are used. (This figure is also duplicated on the inside front cover for easyreference while reading the book.) This collection of networks is simple enough that thetopology doesn't confuse the examples, and with four systems acting as routers, we can seethe error messages generated by routers.Most of the systems have a name that indicates the type of software being used: bsdi,svr4, sun, solaris, aix, slip, and so on. In this way we can identify the type ofsoftware that we're dealing with by looking at the system name in the printed output.A wide range of different operating systems and TCP/IP implementations are used: BSD/386 Version 1.0 from Berkeley Software Design, Inc., on the hosts namedbsdi and slip. This system is derived from the BSD Networking Software,Release 2.0. (We show the lineage of the various BSD releases in Figure 1.10.)file:///D 2run/tcpip/tcp-ip-illustrated/preface.htm (3 of 6) [12/09/2001 14.46.28]

Preface Unix System V/386 Release 4.0 Version 2.0 from U.H. Corporation, on the hostnamed svr4. This is vanilla SVR4 and contains the standard implementation ofTCP/IP from Lachman Associates used with most versions of SVR4.SunOS 4.1.3 from Sun Microsystems, on the host named sun. The SunOS 4.1.xsystems are probably the most widely used TCP/IP implementations. The TCP/IPcode is derived from 4.2BSD and 4.3BSD.Solaris 2.2 from Sun Microsystems, on the host named solaris. The Solaris 2.xsystems have a different implementation of TCP/IP from the earlier SunOS 4.1.xsystems, and from SVR4. (This operating system is really SunOS 5.2, but iscommonly called Solaris 2.2.)AIX 3.2.2 from IBM on the host named aix. The TCP/IP implementation is based onthe 4.3BSD Reno release.4.4BSD from the Computer Systems Research Group at the University of Californiaat Berkeley, on the host vangogh. cs.berkeley.edu. This system has thelatest release of TCP/IP from Berkeley. (This system isn't shown in the figure on theinside front cover, but is reachable across the Internet.)Although these are all Unix systems, TCP/IP is operating system independent, and isavailable on almost every popular non-Unix system. Most of this text also applies to thesenon-Unix implementations, although some programs (such as Traceroute) may not beprovided on all systems.Typographical ConventionsWhen we display interactive input and output we'll show our typed input in a bold font,and the computer output like this. Comments are added in italics.bsdi % telnet svr4 discardconnect to the discard serverTrying 140.252.13.34.this line and next output by Telnet clientConnected to svr4.Also, we always include the name of the system as part of the shell prompt (bsdi in thisexample) to show on which host the command was run.Throughout the text we'll use indented, parenthetical notes such as this to describe historical points orimplementation details.We sometimes refer to the complete description of a command in the Unix manual as inifconfig(8). This notation, the name of the command followed by a number inparentheses, is the normal way of referring to Unix commands. The number in parentheses isthe section number in the Unix manual of the "manual page" for the command, whereadditional information can be located. Unfortunately not all Unix systems organize theirmanuals the same, with regard to the section numbers used for various groupings ofcommands. We'll use the BSD-style section numbers (which is the same for BSD-derivedsystems such as SunOS 4.1.3), but your manuals may be organized differently.Acknowledgmentsfile:///D 2run/tcpip/tcp-ip-illustrated/preface.htm (4 of 6) [12/09/2001 14.46.28]

PrefaceAlthough the author's name is the only one to appear on the cover, the combined effort ofmany people is required to produce a quality text book. First and foremost is the author'sfamily, who put up with the long and weird hours that go into writing a book. Thank youonce again, Sally, Bill, Ellen, and David.The consulting editor, Brian Kernighan, is undoubtedly the best in the business. He was thefirst one to read various drafts of the manuscript and mark it up with his infinite supply ofred pens. His attention to detail, his continual prodding for readable prose, and his thoroughreviews of the manuscript are an immense resource to a writer.Technical reviewers provide a different point of view and keep the author honest by catchingtechnical mistakes. Their comments, suggestions, and (most importantly) criticisms addgreatly to the final product. My thanks to Steve Bellovin, Jon Crowcroft, Pete Haverlock,and Doug Schmidt for comments on the entire manuscript. Equally valuable comments wereprovided on portions of the manuscript by Dave Borman, Tony DeSimone, Bob Gilligan,Jeff Gitlin, John Gulbenkian, Tom Herbert, Mukesh Kacker, Barry Margolin, PaulMockapetris, Burr Nelson, Steve Rago, James Risner, Chris Walquist, Phil Winterbottom,and Gary Wright. A special thanks to Dave Borman for his thorough review of all the TCPchapters, and to Bob Gilligan who should be listed as a coauthor for Appendix E.An author cannot work in isolation, so I would like to thank the following persons for lots ofsmall favors, especially by answering my numerous e-mail questions: Joe Godsil, JimHogue, Mike Karels, Paul Lucchina, Craig Partridge, Thomas Skibo, and Jerry Toporek.This book is the result of my being asked lots of questions on TCP/IP for which I could findno quick, immediate answer. It was then that I realized that the easiest way to obtain theanswers was to run small tests, forcing certain conditions to occur, and just watch whathappens. I thank Pete Haverlock for asking the probing questions and Van Jacobson forproviding so much of the publicly available software that is used in this book to answer thequestions.A book on networking needs a real network to work with along with access to the Internet.My thanks to the National Optical Astronomy Observatories (NOAO), especially SidneyWolff, Richard Wolff, and Steve Grandi, for providing access to their networks and hosts. Aspecial thanks to Steve Grandi for answering lots of questions and providing accounts onvarious hosts. My thanks also to Keith Bostic and Kirk McKu-sick at the U.C. BerkeleyCSRG for access to the latest 4.4BSD system.Finally, it is the publisher that pulls everything together and does whatever is required todeliver the final product to the readers. This all revolves around the editor, and John Wait issimply the best there is. Working with John and the rest of the professionals at AddisonWesley is a pleasure. Their professionalism and attention to detail show in the end result.Camera-ready copy of the book was produced by the author, a Troff die-hard, using thefile:///D 2run/tcpip/tcp-ip-illustrated/preface.htm (5 of 6) [12/09/2001 14.46.28]

PrefaceGroff package written by James Clark. I welcome electronic mail from any readers withcomments, suggestions, or bug fixes.Tucson, ArizonaOctober 1993W. Richard Stevensrstevens@noao.eduhttp://www.noao.edu/ rstevensfile:///D 2run/tcpip/tcp-ip-illustrated/preface.htm (6 of 6) [12/09/2001 14.46.28]

Chapter 1. IntroductionIntroduction1.1 IntroductionThe TCP/IP protocol suite allows computers of all sizes, from many different computer vendors,running totally different operating systems, to communicate with each other. It is quite amazingbecause its use has far exceeded its original estimates. What started in the late 1960s as agovernment-financed research project into packet switching networks has, in the 1990s, turnedinto the most widely used form of networking between computerrs. It is truly an open system inthat the definition of the protocol suite and many of its implementations are publicly available atlittle or no charge. It forms the basis for what is called the worldwide Internet, or the Internet, awide area network (WAN) of more than one million computers that literally spans the globe.This chapter provides an overview of the TCP/IP protocol suite, to establish an adequatebackground for the remaining chapters. For a historical perspective on the early development ofTCP/IP see [Lynch 1993].1.2 LayeringNetworking protocols are normally developed in layers, with each layer responsible for adifferent facet of the communications. A protocol suite, such as TCP/IP, is the combination ofdifferent protocols at various layers. TCP/IP is normally considered to be a 4-layer system, asshown in Figure 1.1.ApplicationTelnet, FTP, e-mail, etc.TransportTCP, UDPNetworkIP, ICMP, IGMPLinkdevice driver and interface cardFigure 1.1 The four layers of the TCP/IP protocol suite.Each layer has a different responsibility.1. The link layer, sometimes called the data-link layer or network interface layer, normallyincludes the device driver in the operating system and the corresponding networkinterface card in the computer. Together they handle all the hardware details of physicallyinterfacing with the cable (or whatever type of media is being used).2. The network layer (sometimes called the internet layer) handles the movement of packetsaround the network. Routing of packets, for example, takes place here. IP (InternetProtocol), ICMP (Internet Control Message Protocol), and IGMP (Internet GroupManagement Protocol) provide the network layer in the TCP/IP protocol suite.3. The transport layer provides a flow of data between two hosts, for the application layerabove. In the TCP/IP protocol suite there are two vastly different transport protocols:TCP (Transmission Control Protocol) and UDP (User Datagram Protocol).file:///D n/tcpip/tcp-ip-illustrated/introduc.htm (1 of 20) [12/09/2001 14.46.31]

Chapter 1. IntroductionTCP provides a reliable flow of data between two hosts. It is concerned with things suchas dividing the data passed to it from the application into appropriately sized chunks forthe network layer below, acknowledging received packets, setting timeouts to makecertain the other end acknowledges packets that are sent, and so on. Because this reliableflow of data is provided by the transport layer, the application layer can ignore all thesedetails.UDP, on the other hand, provides a much simpler service to the application layer. It justsends packets of data called datagrams from one host to the other, but there is noguarantee that the datagrams reach the other end. Any desired reliability must be addedby the application layer.There is a use for each type of transport protocol, which we'll see when we look at thedifferent applications that use TCP and UDP.4. The application layer handles the details of the particular application. There are manycommon TCP/IP applications that almost every implementation provides: Telnet for remote login, FTP, the File Transfer Protocol, SMTP, the Simple Mail Transfer protocol, for electronic mail, SNMP, the Simple Network Management Protocol,and many more, some of which we cover in later chapters.If we have two hosts on a local area network (LAN) such as an Ethernet, both running FTP,Figure 1.2 shows the protocols involved.Figure 1.2 Two hosts on a LAN running FTP.We have labeled one application box the FTP client and the other the FTP server. Most networkfile:///D n/tcpip/tcp-ip-illustrated/introduc.htm (2 of 20) [12/09/2001 14.46.31]

Chapter 1. Introductionapplications are designed so that one end is the client and the other side the server. The serverprovides some type of service to clients, in this case access to files on the server host. In theremote login application, Telnet, the service provided to the client is the ability to login to theserver's host.Each layer has one or more protocols for communicating with its peer at the same layer. Oneprotocol, for example, allows the two TCP layers to communicate, and another protocol lets thetwo IP layers communicate.On the right side of Figure 1.2 we have noted that normally the application layer is a userprocess while the lower three layers are usually implemented in the kernel (the operatingsystem). Although this isn't a requirement, it's typical and this is the way it's done under Unix.There is another critical difference between the top layer in Figure 1.2 and the lower threelayers. The application layer is concerned with the details of the application and not with themovement of data across the network. The lower three layers know nothing about the applicationbut handle all the communication details.We show four protocols in Figure 1.2, each at a different layer. FTP is an application layerprotocol, TCP is a transport layer protocol, IP is a network layer protocol, and the Ethernetprotocols operate at the link layer. The TCP/IP protocol suite is a combination of manyprotocols. Although the commonly used name for the entire protocol suite is TCP/IP, TCP andIP are only two of the protocols. (An alternative name is the Internet Protocol Suite.)The purpose of the network interface layer and the application layer are obvious-the formerhandles the details of the communication media (Ethernet, token ring, etc.) while the latterhandles one specific user application (FTP, Telnet, etc.). But on first glance the differencebetween the network layer and the transport layer is somewhat hazy. Why is there a distinctionbetween the two? To understand the reason, we have to expand our perspective from a singlenetwork to a collection of networks.One of the reasons for the phenomenal growth in networking during the 1980s was therealization that an island consisting of a stand-alone computer made little sense. A few standalone systems were collected together into a network. While this was progress, during the 1990swe have come to realize that this new, bigger island consisting of a single network doesn't makesense either. People are combining multiple networks together into an internetwork, or aninternet. An internet is a collection of networks that all use the same protocol suite.The easiest way to build an internet is to connect two or more networks with a router. This isoften a special-purpose hardware box for connecting networks. The nice thing about routers isthat they provide connections to many different types of physical networks: Ethernet, token ring,point-to-point links, FDDI (Fiber Distributed Data Interface), and so on.These boxes are also called IP routers, but we'll use the term router.Historically these boxes were called gateways, and this term is used throughout much of the TCP/IP literature.Today the term gateway is used for an application gateway: a process that connects two different protocol suitesfile:///D n/tcpip/tcp-ip-illustrated/introduc.htm (3 of 20) [12/09/2001 14.46.31]

Chapter 1. Introduction(say, TCP/IP and IBM's SNA) for one particular application (often electronic mail or file transfer).Figure 1.3 shows an internet consisting of two networks: an Ethernet and a token ring, connectedwith a router. Although we show only two hosts communicating, with the router connecting thetwo networks, any host on the Ethernet can communicate with any host on the token ring.In Figure 1.3 we can differentiate between an end system (the two hosts on either side) and anintermediate system (the router in the middle). The application layer and the transport layer useend-to-end protocols. In our picture these two layers are needed only on the end systems. Thenetwork layer, however, provides a hop-by-hop protocol and is used on the two end systems andevery intermediate system.Figure 1.3 Two networks connected with a router.In the TCP/IP protocol suite the network layer, IP, provides an unreliable service. That is, it doesits best job of moving a packet from its source to its final destination, but there are noguarantees. TCP, on the other hand, provides a reliable transport layer using the unreliableservice of IP To provide this service, TCP performs timeout and retransmission, sends andreceives end-to-end acknowledgments, and so on. The transport layer and the

We take a bottom-up approach to the TCP/IP protocol suite. After providing a basic introduction to TCP/IP in Chapter 1, we will start at the link layer in Chapter 2 and work our way up the protocol stack. This provides the required background for later chapters for readers who aren't familiar with T