InPraiseof ComputerNetworks:ASystems Approach...

31
In Praise of Computer Networks: A Systems Approach Fifth Edition I have known and used this book for years and I always found it very valu- able as a textbook for teaching computer networks as well as a reference book for networking professionals. This Fifth Edition maintains the core value of former editions and brings the clarity of explanation of network protocols in the introduction of the most up-to-date techniques, technolo- gies and requirements of networking. Beyond describing the details of past and current networks, this book successfully motivates the curiosity, and hopefully new research, for the networks of the future. Stefano Basagni Northeastern University Peterson and Davie have written an outstanding book for the computer networking world. It is a well-organized book that features a very helpful “big picture” systems approach. This book is a must have! Yonshik Choi Illinois Institute of Technology The Fifth Edition of Computer Networks: A Systems Approach is well- suited for the serious student of computer networks, though it remains accessible to the more casual reader as well. The authors’ enthusiasm for their subject is evident throughout; they have a thorough and current grasp of the interesting problems of the field. They explain not only how vari- ous protocols work, but also why they work the way they do, and even why certain protocols are the important and interesting ones. The book is also filled with little touches of historical background, from the main text to the “Where Are They Now” sidebars to the papers described in each chap- ter’s “Further Reading” section—these give the reader a perspective on how things came to be the way they are. All in all, this book provides a lucid and literate introduction to networking. Peter Dordal Loyola University Chicago I have used Computer Networks: A Systems Approach for over five years in an introductory course on communications networks aimed at upper-level undergraduates and first-year Masters students. I have gone through sev- eral editions and over the years the book has kept what from the beginning

Transcript of InPraiseof ComputerNetworks:ASystems Approach...

In Praise of Computer Networks: A SystemsApproach Fifth Edition

I have known and used this book for years and I always found it very valu-able as a textbook for teaching computer networks as well as a referencebook for networking professionals. This Fifth Edition maintains the corevalue of former editions and brings the clarity of explanation of networkprotocols in the introduction of the most up-to-date techniques, technolo-gies and requirements of networking. Beyond describing the details of pastand current networks, this book successfully motivates the curiosity, andhopefully new research, for the networks of the future.

Stefano BasagniNortheastern University

Peterson and Davie have written an outstanding book for the computernetworking world. It is a well-organized book that features a very helpful“big picture” systems approach. This book is a must have!

Yonshik ChoiIllinois Institute of Technology

The Fifth Edition of Computer Networks: A Systems Approach is well-suited for the serious student of computer networks, though it remainsaccessible to the more casual reader as well. The authors’ enthusiasm fortheir subject is evident throughout; they have a thorough and current graspof the interesting problems of the field. They explain not only how vari-ous protocols work, but also why they work the way they do, and even whycertain protocols are the important and interesting ones. The book is alsofilled with little touches of historical background, from the main text tothe “Where Are They Now” sidebars to the papers described in each chap-ter’s “Further Reading” section—these give the reader a perspective on howthings came to be the way they are. All in all, this book provides a lucid andliterate introduction to networking.

Peter DordalLoyola University Chicago

I have used Computer Networks: A Systems Approach for over five years inan introductory course on communications networks aimed at upper-levelundergraduates and first-year Masters students. I have gone through sev-eral editions and over the years the book has kept what from the beginning

had been its main strength, namely, that it not only describes the ‘how,’ butalso the ‘why’ and equally important, the ‘why not’ of things. It is a bookthat builds engineering intuition, and in this day and age of fast-pacedtechnology changes, this is critical to develop a student’s ability to makeinformed decisions on how to design or select the next generation systems.

Roch GuerinUniversity of Pennsylvania

This book is an outstanding introduction to computer networks that isclear, comprehensive, and chock-full of examples. Peterson and Davie havea gift for boiling networking down to simple and manageable conceptswithout compromising technical rigor. Computer Networks: A SystemsApproach strikes an excellent balance between the principles underlyingnetwork architecture design and the applications built on top. It shouldprove invaluable to students and teachers of advanced undergraduate andgraduate networking courses.

Arvind KrishnamurthyUniversity of Washington

Computer Networks: A Systems Approach has always been one of the bestresources available to gain an in-depth understanding of computer net-works. The latest edition covers recent developments in the field. Startingwith an overview in Chapter 1, the authors systematically explain the basicbuilding blocks of networks. Both hardware and software concepts are pre-sented. The material is capped with a final chapter on applications, whichbrings all the concepts together. Optional advanced topics are placed in aseparate chapter. The textbook also contains a set of exercises of varyingdifficulty at the end of each chapter which ensure that the students havemastered the material presented.

Karkal PrabhuDrexel University

Peterson and Davie provide a detailed yet clear description of the Internetprotocols at all layers. Students will find many study aids that will helpthem gain a full understanding of the technology that is transforming oursociety. The book gets better with each edition.

Jean WalrandUniversity of California at Berkeley

Fifth Edition

Computer Networksa systems approach

Recommended Reading ListFor students interested in furthering their understanding of ComputerNetworking, the content in the following books supplements thistextbook:

Network Analysis, Architecture, and Design, 3rd EditionBy James D. McCabeISBN: 9780123704801

The Illustrated NetworkHow TCP/IP Works in a Modern NetworkBy Walter GoralskiISBN: 9780123745415

Interconnecting Smart Objects with IPThe Next InternetBy Jean-Philippe Vasseur and Adam DunkelsISBN: 9780123751652

Network Quality of Service Know It AllEdited by Adrian FarrelISBN: 9780123745972

Optical Networks, 3rd EditionA Practical PerspectiveBy Rajiv Ramaswami, Kumar Sivarajan and Galen SasakiISBN: 9780123740922

Broadband Cable Access NetworksThe HFC PlantBy David Large and James FarmerISBN: 9780123744012

Deploying QoS for Cisco IP and Next Generation NetworksThe Definitive GuideBy Vinod Joseph and Brett ChapmanISBN: 9780123744616

mkp.com

Fifth Edition

Computer Networksa systems approach

Larry L. Peterson and Bruce S. Davie

AMSTERDAM • BOSTON • HEIDELBERG • LONDONNEW YORK • OXFORD • PARIS • SAN DIEGO

SAN FRANCISCO • SINGAPORE • SYDNEY • TOKYOMorgan Kaufmann Publishers is an imprint of Elsevier

Acquiring Editor: Rick AdamsDevelopment Editor: Nate McFaddenProject Manager: Paul GottehrerDesigner: Dennis Schaefer

Morgan Kaufmann is an imprint of Elsevier30 Corporate Drive, Suite 400, Burlington, MA 01803, USA

© 2012 Elsevier, Inc. All rights reserved.

No part of this publication may be reproduced or transmitted in any form or by any means, electronic or mechanical,including photocopying, recording, or any information storage and retrieval system, without permission in writingfrom the publisher. Details on how to seek permission, further information about the Publisher’s permissions policiesand our arrangements with organizations such as the Copyright Clearance Center and the Copyright LicensingAgency, can be found at our website: www.elsevier.com/permissions.

This book and the individual contributions contained in it are protected under copyright by the Publisher (other thanas may be noted herein).

NoticesKnowledge and best practice in this field are constantly changing. As new research and experience broaden ourunderstanding, changes in research methods or professional practices, may become necessary. Practitioners andresearchers must always rely on their own experience and knowledge in evaluating and using any information ormethods described herein. In using such information or methods they should be mindful of their own safety and thesafety of others, including parties for whom they have a professional responsibility.

To the fullest extent of the law, neither the Publisher nor the authors, contributors, or editors, assume any liability forany injury and/or damage to persons or property as a matter of products liability, negligence or otherwise, or fromany use or operation of any methods, products, instructions, or ideas contained in the material herein.

Library of Congress Cataloging-in-Publication DataPeterson, Larry L.

Computer networks : a systems approach / Larry L. Peterson and Bruce S. Davie. – 5th ed.p. cm. – (The Morgan Kaufmann series in networking)

Includes bibliographical references.ISBN 978-0-12-385059-1 (hardback)

1. Computer networks. I. Davie, Bruce S. II. Title.TK5105.5.P479 2011004.6–dc22

2011000786

British Library Cataloguing-in-Publication DataA catalogue record for this book is available from the British Library.

ISBN: 978-0-12-385059-1

For information on all Morgan Kaufmann publicationsvisit our website at www.mkp.com

Typeset by: diacriTech, India

Printed in the United States of America12 13 14 15 16 10 9 8 7 6 5 4 3 2 1

To Lee Peterson and Robert Davie

Foreword

Once again, this now-classic textbook has been revised to keep itup-to-date with our evolving field. While the Internet and its proto-

cols now dominate networking everywhere, we see continued evolutionin the technology used to support the Internet, with switching at “layer 2”providing rich functionality and powerful tools for network management.The previous edition dealt with switching and routing in two chapters,but a presentation based on layers is not always the best way to conveythe essentials of the material, since what we call switching and routingactually play similar and complementary roles. This edition of the booklooks at these topics in an integrated way, which brings out their func-tional similarities and differences. More advanced topics in routing havebeen moved to a second chapter that can be skipped, depending on theemphasis and level of the class.

I have never been a fan of teaching networking based on a purely layeredapproach, as my foreword to the first edition indicated (we’ve reprinted it inthis edition just for fun.) Some key issues in networking, including securityand performance, cannot be solved by assigning them to one layer—therecannot be a “performance” layer. These sorts of topics are both critical andcross-cutting, and the organization of this book continues to treat topics,as well as layers. The organization of this book reflects a great deal of expe-rience using it as a classroom textbook, and as well a preference for anapproach that brings out fundamentals as well as current practice.

Some moribund technologies are now missing or minimized, includingtoken ring (one of my old favorites, but clearly it was time to go) and ATM.This edition recognizes that we need to pay more attention to applicationdesign, and not just packet forwarding. Wireless and mobility gets moreattention as well.

The authors, once again, have worked hard to produce a revision thatconveys the essentials of the field in a way that is pedagogically effective.I am pleased to say that I think it is better than ever.

David ClarkNovember, 2010

ix

Foreword to theFirst Edition

The term spaghetti code is universally understood as an insult. All goodcomputer scientists worship the god of modularity, since modularity

brings many benefits, including the all-powerful benefit of not having tounderstand all parts of a problem at the same time in order to solve it.Modularity thus plays a role in presenting ideas in a book, as well as inwriting code. If a book’s material is organized effectively—modularly—the reader can start at the beginning and actually make it to the end.

The field of network protocols is perhaps unique in that the “proper”modularity has been handed down to us in the form of an internationalstandard: the seven-layer reference model of network protocols fromthe ISO. This model, which reflects a layered approach to modularity, isalmost universally used as a starting point for discussions of protocolorganization, whether the design in question conforms to the model ordeviates from it.

It seems obvious to organize a networking book around this layeredmodel. However, there is a peril to doing so, because the OSI modelis not really successful at organizing the core concepts of networking.Such basic requirements as reliability, flow control, or security can beaddressed at most, if not all, of the OSI layers. This fact has led togreat confusion in trying to understand the reference model. At times iteven requires a suspension of disbelief. Indeed, a book organized strictlyaccording to a layered model has some of the attributes of spaghetti code.

Which brings us to this book. Peterson and Davie follow the tradi-tional layered model, but they do not pretend that this model actuallyhelps in the understanding of the big issues in networking. Instead, theauthors organize discussion of fundamental concepts in a way that isindependent of layering. Thus, after reading the book, readers will under-stand flow control, congestion control, reliability enhancement, datarepresentation, and synchronization, and will separately understand the

xi

xii Foreword to the First Edition

implications of addressing these issues in one or another of the traditionallayers.

This is a timely book. It looks at the important protocols in use today—especially the Internet protocols. Peterson and Davie have a long involve-ment in and much experience with the Internet. Thus their book reflectsnot just the theoretical issues in protocol design, but the real factors thatmatter in practice. The book looks at some of the protocols that are justemerging now, so the reader can be assured of an up-to-date perspec-tive. But most importantly, the discussion of basic issues is presented ina way that derives from the fundamental nature of the problem, not theconstraints of the layered reference model or the details of today’s proto-cols. In this regard, what this book presents is both timely and timeless.The combination of real-world relevance, current examples, and carefulexplanation of fundamentals makes this book unique.

David D. ClarkMassachusetts Institute of Technology

Preface

When the first edition of this book was published in 1996, it was anovelty to be able to order merchandise on the Internet, and a com-

pany that advertised its domain name was considered cutting edge. Theprimary way for a household to connect to the Internet was via a dial-upmodem. Today, Internet commerce is a fact of life, and “.com” stocks havegone through an entire boom and bust cycle. Wireless networks are every-where and new Internet-capable devices such as smartphones and tabletsappear on the market at a dizzying pace. It seems the only predictablething about the Internet is constant change.

Despite these changes, the question we asked in the first edition is justas valid today: What are the underlying concepts and technologies thatmake the Internet work? The answer is that much of the TCP/IP architec-ture continues to function just as was envisioned by its creators more than30 years ago. This isn’t to say that the Internet architecture is uninterest-ing; quite the contrary. Understanding the design principles that underlyan architecture that has not only survived but fostered the kind of growthand change that the Internet has seen over the past 3 decades is preciselythe right place to start. Like the previous editions, the Fifth Edition makesthe “why” of the Internet architecture its cornerstone.

AudienceOur intent is that the book should serve as the text for a comprehensivenetworking class, at either the graduate or upper-division undergradu-ate level. We also believe that the book’s focus on core concepts shouldbe appealing to industry professionals who are retraining for network-related assignments, as well as current network practitioners who wantto understand the “whys” behind the protocols they work with every dayand to see the big picture of networking.

It is our experience that both students and professionals learning aboutnetworks for the first time often have the impression that network pro-tocols are some sort of edict handed down from on high, and that theirjob is to learn as many TLAs (Three-Letter Acronyms) as possible. In

xiii

xiv Preface

fact, protocols are the building blocks of a complex system developedthrough the application of engineering design principles. Moreover, theyare constantly being refined, extended, and replaced based on real-worldexperience. With this in mind, our goal with this book is to do more thansurvey the protocols in use today. Instead, we explain the underlyingprinciples of sound network design. We feel that this grasp of under-lying principles is the best tool for handling the rate of change in thenetworking field.

We also recognize that there are many different ways that peopleapproach networks. In contrast to when we wrote our first edition, mostpeople will pick up this book having considerable experience as users ofnetworks. Some will be looking to become designers of networking prod-ucts or protocols. Others may be interested in managing networks, whilean increasingly large number will be current or prospective applicationdevelopers for networked devices. Our focus has traditionally been onthe designers of future products and protocols, and that continues to bethe case, but in this edition we have tried to address the perspectives ofnetwork managers and application developers as well.

Changes in the Fifth EditionEven though our focus is on the underlying principles of networking, weillustrate these principles using examples from today’s working Internet.Therefore, we added a significant amount of new material to track manyof the important recent advances in networking. We also deleted, reorga-nized, and changed the focus of existing material to reflect changes thathave taken place over the past decade.

Perhaps the most significant change we have noticed since writing thefirst edition is that almost every reader is now familiar with networkedapplications such as the World Wide Web and email. For this reason, wehave increased the focus on applications, starting in the first chapter. Weuse applications as the motivation for the study of networking, and toderive a set of requirements that a useful network must meet if it is tosupport both current and future applications on a global scale. However,we retain the problem-solving approach of previous editions that startswith the problem of interconnecting hosts and works its way up the lay-ers to conclude with a detailed examination of application layer issues.We believe it is important to make the topics covered in the book rel-evant by starting with applications and their needs. At the same time,

Preface xv

we feel that higher layer issues, such as application layer and transportlayer protocols, are best understood after the basic problems of connect-ing hosts and switching packets have been explained. That said, we havemade it possible to approach the material in a more top-down manner, asdescribed below.

As in prior editions, we have added or increased coverage of impor-tant new topics, and brought other topics up to date. Major new orsubstantially updated topics in this edition are:

n Updated material on wireless technology, particularly the variousflavors of 802.11 (Wi-Fi) as well as cellular wireless technologiesincluding the third generation (3G) and emerging 4G standards.

n Updated coverage of congestion control mechanisms, particularlyfor high bandwidth-delay product networks and wireless networks.

n Updated material on Web Services, including the SOAP and REST(Representational State Transfer) architectures.

n Expanded and updated coverage of interdomain routing and theborder gateway protocol (BGP).

n Expanded coverage on protocols for multimedia applications suchas voice over IP (VOIP) and video streaming.

We also reduced coverage of some topics that are less relevant today.Protocols moving into the “historic” category for this edition includeasynchronous transfer mode (ATM) and token rings.

One of the most significant changes in this edition is the separation ofmaterial into “introductory” and “advanced” sections. We wanted to makethe book more accessible to people new to networking technologies andprotocols, without giving up the advanced material required for upper-level classes. The most apparent effect of this change is that Chapter 3now covers the basics of switching, routing, and Internetworking, whileChapter 4 covers the more advanced routing topics such as BGP, IP version6, and multicast. Similarly, transport protocol fundamentals are coveredin Chapter 5 with the more advanced material such as TCP congestioncontrol algorithms appearing in Chapter 6. We believe this will make it pos-sible for readers new to the field to grasp important foundational conceptswithout getting overwhelmed by more complex topics.

As in the last edition, we have included a number of “where are theynow?” sidebars. These short discussions, updated for this edition, focuson the success and failure of protocols in the real world. Sometimes they

xvi Preface

describe a protocol that most people have written off but which is actuallyenjoying unheralded success; other times they trace the fate of a proto-col that failed to thrive over the long run. The goal of these sidebars is tomake the material relevant by showing how technologies have fared in thecompetitive world of networking.

ApproachFor an area that’s as dynamic and changing as computer networks, themost important thing a textbook can offer is perspective—to distinguishbetween what’s important and what’s not, and between what’s lastingand what’s superficial. Based on our experience over the past 25-plusyears doing research that has led to new networking technology, teachingundergraduate and graduate students about the latest trends in net-working, and delivering advanced networking products to market, wehave developed a perspective—which we call the systems approach—that forms the soul of this book. The systems approach has severalimplications:

n First Principles. Rather than accept existing artifacts as gospel, westart with first principles and walk you through the thought processthat led to today’s networks. This allows us to explain whynetworks look like they do. It is our experience that once youunderstand the underlying concepts, any new protocol thatyou are confronted with will be relatively easy to digest.

n Non-layerist. Although the material is loosely organized around thetraditional network layers, starting at the bottom and moving upthe protocol stack, we do not adopt a rigidly layerist approach.Many topics—congestion control and security are goodexamples—have implications up and down the hierarchy, and sowe discuss them outside the traditional layered model. Similarly,routers and switches have so much in common (and are oftencombined as single products) that we discuss them in the samechapter. In short, we believe layering makes a good servant but apoor master; it’s more often useful to take an end-to-endperspective.

n Real-world examples. Rather than explain how protocols workin the abstract, we use the most important protocols in usetoday—most of them from the TCP/IP Internet—to illustrate hownetworks work in practice. This allows us to include real-worldexperiences in the discussion.

Preface xvii

n Software. Although at the lowest levels networks are constructedfrom commodity hardware that can be bought from computervendors and communication services that can be leased from thephone company, it is the software that allows networks to providenew services and adapt quickly to changing circumstances. It is forthis reason that we emphasize how network software isimplemented, rather than stopping with a description of theabstract algorithms involved. We also include code segments takenfrom a working protocol stack to illustrate how you mightimplement certain protocols and algorithms.

n End-to-end focus. Networks are constructed from manybuilding-block pieces, and while it is necessary to be able toabstract away uninteresting elements when solving a particularproblem, it is essential to understand how all the pieces fit togetherto form a functioning network. We therefore spend considerabletime explaining the overall end-to-end behavior of networks, notjust the individual components, so that it is possible to understandhow a complete network operates, all the way from the applicationto the hardware.

n Performance. The systems approach implies doing experimentalperformance studies, and then using the data you gather both toquantitatively analyze various design options and to guide you inoptimizing the implementation. This emphasis on empiricalanalysis pervades the book.

n Design Principles. Networks are like other computer systems—forexample, operating systems, processor architectures, distributedand parallel systems, and so on. They are all large and complex. Tohelp manage this complexity, system builders often draw on acollection of design principles. We highlight these design principlesas they are introduced throughout the book, illustrated, of course,with examples from computer networks.

Pedagogy and FeaturesThe Fifth Edition retains the key pedagogical features from prior editions,which we encourage you to take advantage of:

n Problem statements. At the start of each chapter, we describea problem that identifies the next set of issues that must beaddressed in the design of a network. This statement introducesand motivates the issues to be explored in the chapter.

xviii Preface

n Shaded sidebars. Throughout the text, shaded sidebars elaborateon the topic being discussed or introduce a related advanced topic.In many cases, these sidebars relate real-world anecdotes aboutnetworking.

n Where-are-they-now sidebars. These new elements, a distinctivelyformatted style of sidebar, trace the success and failure of protocolsin real-world deployment.

n Highlighted paragraphs. These paragraphs summarize animportant nugget of information that we want you to take awayfrom the discussion, such as a widely applicable system designprinciple.

n Real protocols. Even though the book’s focus is on core conceptsrather than existing protocol specifications, real protocols are usedto illustrate most of the important ideas. As a result, the book canbe used as a source of reference for many protocols. To help youfind the descriptions of the protocols, each applicable sectionheading parenthetically identifies the protocols described in thatsection. For example, Section 5.2, which describes the principles ofreliable end-to-end protocols, provides a detailed description ofTCP, the canonical example of such a protocol.

n What’s Next? discussions. We conclude the main body of eachchapter with an important issue that is currently unfolding in theresearch community, the commercial world, or society as a whole.We have found that discussing these forward-looking issues helpsto make the subject of networking more relevant and exciting.

n Recommended reading. These highly selective lists appear at theend of each chapter. Each list generally contains the seminalpapers on the topics just discussed. We strongly recommend thatadvanced readers (e.g., graduate students) study the papers in thisreading list to supplement the material covered in the chapter.

RoadMap and Course UseThe book is organized as follows:

n Chapter 1 introduces the set of core ideas that are used throughoutthe rest of the text. Motivated by wide-spread applications, itdiscusses what goes into a network architecture, provides an

Preface xix

introduction to protocol implementation issues, and defines thequantitative performance metrics that often drive network design.

n Chapter 2 surveys the many ways that a user can get connected to alarger network such as the Internet, thus introducing the conceptof links. It also describes many of the issues that all link-levelprotocols must address, including encoding, framing, and errordetection. The most important link technologies today—Ethernetand Wireless—are described here.

n Chapter 3 introduces the basic concepts of switching and routing,starting with the virtual circuit and datagram models. Bridging andLAN switching are covered, followed by an introduction tointernetworking, including the Internet Protocol (IP) and routingprotocols. The chapter concludes by discussing a range ofhardware- and software-based approaches to building routers andswitches.

n Chapter 4 covers advanced Internetworking topics. These includemulti-area routing protocols, interdomain routing and BGP, IPversion 6, multiprotocol label switching (MPLS) and multicast.

n Chapter 5 moves up to the transport level, describing both theInternet’s Transmission Control Protocol (TCP) and RemoteProcedure Call (RPC) used to build client-server applications indetail. The Real-time Transport Protocol (RTP), which supportsmultimedia applications, is also described.

n Chapter 6 discusses congestion control and resource allocation.The issues in this chapter cut across the link level (Chapter 2),the network level (Chapters 3 and 4) and the transport level(Chapter 5). Of particular note, this chapter describes howcongestion control works in TCP, and it introduces themechanisms used to provide quality of service in IP.

n Chapter 7 considers the data sent through a network. This includesboth the problems of presentation formatting and datacompression. XML is covered here, and the compression sectionincludes explanations of how MPEG video compression and MP3audio compression work.

n Chapter 8 discusses network security, beginning with an overviewof cryptographic tools, the problems of key distribution, and a

xx Preface

discussion of several authentication techniques using both publicand private keys. The main focus of this chapter is the building ofsecure systems, using examples including Pretty Good Privacy(PGP), Secure Shell (SSH), and the IP Security architecture (IPSEC).Firewalls are also covered here.

n Chapter 9 describes a representative sample of networkapplications, and the protocols they use, including traditionalapplications like email and the Web, multimedia applications suchas IP telephony and video streaming, and overlay networks likepeer-to-peer file sharing and content distribution networks.Infrastructure services—the Domain Name System (DNS) andnetwork management—are described. The Web Servicesarchitectures for developing new application protocols are alsopresented here.

For an undergraduate course, extra class time will most likely beneeded to help students digest the introductory material in the firstchapter, probably at the expense of the more advanced topics coveredin Chapters 4 and 6 through 8. Chapter 9 then returns to the populartopic of network applications. An undergraduate class might reason-ably skim the more advanced sections (e.g., Sections 5.3, 9.3.1, 9.3.2and 9.2.2.)

In contrast, the instructor for a graduate course should be able to coverthe first chapter in only a lecture or two—with students studying thematerial more carefully on their own—thereby freeing up additional classtime to cover Chapter 4 and the later chapters in depth.

For those of you using the book in self-study, we believe that the top-ics we have selected cover the core of computer networking, and so werecommend that the book be read sequentially, from front to back. Inaddition, we have included a liberal supply of references to help youlocate supplementary material that is relevant to your specific areas ofinterest, and we have included solutions to select exercises.

The book takes a unique approach to the topic of congestion controlby pulling all topics related to congestion control and resource allocationtogether in a single place—Chapter 6. We do this because the problemof congestion control cannot be solved at any one level, and we wantyou to consider the various design options at the same time. (This is

Preface xxi

consistent with our view that strict layering often obscures importantdesign trade-offs.) A more traditional treatment of congestion control ispossible, however, by studying Section 6.2 in the context of Chapter 3 andSection 6.3 in the context of Chapter 5.

A Top-Down PathwayBecause most students today come to a networking class familiar withnetworked applications, a number of classes take the application as theirstarting point. While we do cover applications at a high level in Chapter 1,it is not until Chapter 9 that application layer issues are discussed indetail. Recognizing that some professors or readers may wish to followa more top-down ordering, we suggest the following as a possible way toapproach the material in this book.

n Chapter 1. This describes applications and their requirements toset the stage for the rest of the material.

n Chapter 9. The sections on traditional applications (Section 9.1)and multimedia applications (Section 9.2) will introduce readersto the concepts of network protocols using the examples ofapplications with which they are already familiar. Section 9.3.1(DNS) could also be covered.

n Section 7.2 could be covered next to explain how the data that isgenerated by multimedia applications is encoded and compressed.

n Chapter 5. Transport protocol basics can now be covered,explaining how the data generated by the application layerprotocols can be reliably carried across a network.

n Chapter 3. Switching, Internetworking, and Routing can beunderstood as providing the infrastructure over which transportprotocols run.

n Chapter 2. Finally, the issues of how data is actually encoded andtransmitted on physical media such as Ethernets and wireless linkscan be covered.

Clearly we have skipped quite a few sections in this ordering. Fora more advanced course or comprehensive self-study, topics such asresource allocation (Chapter 6), security (Chapter 8), and the advancedtopics in Chapter 4 could be added in towards the end. Security could

xxii Preface

be covered almost stand-alone, but all these advanced topics will makemost sense after IP and TCP have been covered in Chapters 3 and 5respectively.

Note that the slides made available on our companion site include aset that follows this top-down ordering in addition to the set that followsthe order of the book.

ExercisesSignificant effort has gone into improving the exercises with each newedition. In the Second Edition we greatly increased the number of prob-lems and, based on class testing, dramatically improved their quality.In the Third Edition we made two other important changes, which weretained here:

n For those exercises that we felt are particularly challenging orrequire special knowledge not provided in the book (e.g.

probability expertise) we have added an icon to indicate theextra level of difficulty

n In each chapter we added some extra representative exercises forwhich worked solutions are provided in the back of the book. These

exercises, marked , are intended to provide some help intackling the other exercises in the book.

In this edition we have added new exercises to reflect the updatedcontent.

The current set of exercises are of several different styles:

n Analytical exercises that ask the student to do simple algebraiccalculations that demonstrate their understanding of fundamentalrelationships

n Design questions that ask the student to propose and evaluateprotocols for various circumstances

n Hands-on questions that ask the student to write a few lines of codeto test an idea or to experiment with an existing network utility

n Library research questions that ask the student to learn more abouta particular topic

Also, as described in more detail below, socket-based programmingassignments, as well as simulation labs, are available online.

Preface xxiii

Supplemental Materials and Online ResourcesTo assist instructors, we have prepared an instructor’s manual thatcontains solutions to selected exercises. The manual is available from thepublisher.

Additional support materials, including lecture slides, figures from thetext, socket-based programming assignments, and sample exams andprogramming assignments are available through the Morgan KaufmannWeb site at http://mkp.com/computer-networks.

And finally, as with the Fourth Edition, a set of laboratory experi-ments supplement the book. These labs, developed by Professor EmadAboelela from the University of Massachusetts Dartmouth, use simula-tion to explore the behavior, scalability, and performance of protocolscovered in the book. Sections that discuss material covered by the lab-oratory exercises are marked with the icon shown in the margin. Thesimulations use the OPNET simulation toolset, which is available for freeto any one using Computer Networks in their course.

AcknowledgmentsThis book would not have been possible without the help of many peo-ple. We would like to thank them for their efforts in improving the endresult. Before we do so, however, we should mention that we have doneour best to correct the mistakes that the reviewers have pointed out andto accurately describe the protocols and mechanisms that our colleagueshave explained to us. We alone are responsible for any remaining errors.If you should find any of these, please send an email to our publisher,Morgan Kaufmann, at [email protected], and we will endeavor tocorrect them in future printings of this book.

First, we would like to thank the many people who reviewed drafts ofall or parts of the manuscript. In addition to those who reviewed prioreditions, we wish to thank Peter Dordal, Stefano Basagni, Yonshik Choi,Wenbing Zhao, Sarvesh Kulkarni, James Menth, and John Doyle (and oneanonymous reviewer) for their thorough reviews. Thanks also to DinaKatabi and Hari Balakrishnan for their reviews of various sections. We alsowish to thank all those who provided feedback and input to help us decidewhat to do in this edition.

Several members of the Network Systems Group at Princeton con-tributed ideas, examples, corrections, data, and code to this book. In

xxiv Preface

particular, we would like to thank Andy Bavier, Tammo Spalink, MikeWawrzoniak, Stephen Soltesz, and KyoungSoo Park. Thanks also toShankar M. Banik for developing the two comprehensive sets of slides toaccompany the book.

Third, we would like to thank our series editor, David Clark, as well asall the people at Morgan Kaufmann who helped shepherd us through thebook-writing process. A special thanks is due to our original sponsoringeditor, Jennifer Young; our editor for this edition, Rick Adams; our devel-opmental editor, Nate McFadden; assistant editor David Bevans; and ourproduction editor, Paul Gottehrer. Thanks also to the publisher at MKP,Laura Colantoni, whose leadership inspired us to embark on this revision.

Contents

Foreword ixForeword to the First Edition xiPreface xiii

1 Foundation

Problem: Building a Network 11.1 Applications 2

1.1.1 Classes of Applications 31.2 Requirements 6

1.2.1 Perspectives 71.2.2 Scalable Connectivity 81.2.3 Cost-Effective Resource Sharing 131.2.4 Support for Common Services 181.2.5 Manageability 23

1.3 Network Architecture 241.3.1 Layering and Protocols 241.3.2 Internet Architecture 33

1.4 Implementing Network Software 361.4.1 Application Programming Interface

(Sockets) 371.4.2 Example Application 40

1.5 Performance 441.5.1 Bandwidth and Latency 441.5.2 Delay× Bandwidth Product 481.5.3 High-Speed Networks 511.5.4 Application Performance Needs 53

1.6 Summary 55What’s Next: Cloud Computing 57Further Reading 58Exercises 60

2 Getting Connected

Problem: Connecting to a Network 712.1 Perspectives on Connecting 72

2.1.1 Classes of Links 75

xxv

xxvi Contents

2.2 Encoding (NRZ, NRZI, Manchester, 4B/5B) 782.3 Framing 81

2.3.1 Byte-Oriented Protocols (BISYNC, PPP,DDCMP) 83

2.3.2 Bit-Oriented Protocols (HDLC) 852.3.3 Clock-Based Framing (SONET) 88

2.4 Error Detection 912.4.1 Two-Dimensional Parity 932.4.2 Internet Checksum Algorithm 942.4.3 Cyclic Redundancy Check 97

2.5 Reliable Transmission 1022.5.1 Stop-and-Wait 1032.5.2 Sliding Window 1062.5.3 Concurrent Logical Channels 118

2.6 Ethernet and Multiple Access Networks (802.3) 1192.6.1 Physical Properties 1202.6.2 Access Protocol 1222.6.3 Experience with Ethernet 127

2.7 Wireless 1282.7.1 802.11/Wi-Fi 1352.7.2 Bluetoothr(802.15.1) 1422.7.3 Cell Phone Technologies 144

2.8 Summary 148What’s Next: “The Internet of Things” 150Further Reading 151Exercises 153

3 Internetworking

Problem: Not All Networks are Directly Connected 1693.1 Switching and Bridging 170

3.1.1 Datagrams 1723.1.2 Virtual Circuit Switching 1743.1.3 Source Routing 1863.1.4 Bridges and LAN Switches 189

3.2 Basic Internetworking (IP) 2033.2.1 What Is an Internetwork? 2033.2.2 Service Model 2063.2.3 Global Addresses 2133.2.4 Datagram Forwarding in IP 2163.2.5 Subnetting and Classless Addressing 220

Contents xxvii

3.2.6 Address Translation (ARP) 2283.2.7 Host Configuration (DHCP) 2313.2.8 Error Reporting (ICMP) 2353.2.9 Virtual Networks and Tunnels 235

3.3 Routing 2403.3.1 Network as a Graph 2423.3.2 Distance Vector (RIP) 2433.3.3 Link State (OSPF) 2523.3.4 Metrics 262

3.4 Implementation and Performance 2663.4.1 Switch Basics 2673.4.2 Ports 2703.4.3 Fabrics 2733.4.4 Router Implementation 277

3.5 Summary 280What’s Next: The Future Internet 281Further Reading 282Exercises 284

4 Advanced Internetworking

Problem: Scaling to Billions 3074.1 The Global Internet 308

4.1.1 Routing Areas 3104.1.2 Interdomain Routing (BGP) 3134.1.3 IP Version 6 (IPv6) 324

4.2 Multicast 3384.2.1 Multicast Addresses 3404.2.2 Multicast Routing (DVMRP, PIM, MSDP) 341

4.3 Multiprotocol Label Switching (MPLS) 3544.3.1 Destination-Based Forwarding 3554.3.2 Explicit Routing 3624.3.3 Virtual Private Networks and Tunnels 364

4.4 Routing among Mobile Devices 3694.4.1 Challenges for Mobile Networking 3694.4.2 Routing to Mobile Hosts (Mobile IP) 372

4.5 Summary 379What’s Next: Deployment of IPv6 380Further Reading 381Exercises 382

xxviii Contents

5 End-to-End Protocols

Problem: Getting Process to Communicate 3915.1 Simple Demultiplexer (UDP) 3935.2 Reliable Byte Stream (TCP) 396

5.2.1 End-to-End Issues 3975.2.2 Segment Format 4005.2.3 Connection Establishment and

Termination 4025.2.4 Sliding Window Revisited 4075.2.5 Triggering Transmission 4145.2.6 Adaptive Retransmission 4185.2.7 Record Boundaries 4225.2.8 TCP Extensions 4235.2.9 Performance 4255.2.10 Alternative Design Choices 428

5.3 Remote Procedure Call 4315.3.1 RPC Fundamentals 4315.3.2 RPC Implementations (SunRPC, DCE) 440

5.4 Transport for Real-Time Applications (RTP) 4475.4.1 Requirements 4495.4.2 RTP Design 4525.4.3 Control Protocol 456

5.5 Summary 460What’s Next: Transport Protocol Diversity 461Further Reading 462Exercises 463

6 Congestion Control and ResourceAllocation

Problem: Allocating Resources 4796.1 Issues in Resource Allocation 480

6.1.1 Network Model 4816.1.2 Taxonomy 4856.1.3 Evaluation Criteria 488

6.2 Queuing Disciplines 4926.2.1 FIFO 4926.2.2 Fair Queuing 494

6.3 TCP Congestion Control 4996.3.1 Additive Increase/Multiplicative

Decrease 500

Contents xxix

6.3.2 Slow Start 5056.3.3 Fast Retransmit and Fast Recovery 510

6.4 Congestion-Avoidance Mechanisms 5146.4.1 DECbit 5156.4.2 Random Early Detection (RED) 5166.4.3 Source-Based Congestion Avoidance 523

6.5 Quality of Service 5306.5.1 Application Requirements 5316.5.2 Integrated Services (RSVP) 5376.5.3 Differentiated Services (EF, AF) 5496.5.4 Equation-Based Congestion Control 557

6.6 Summary 559What’s Next: Refactoring the Network 560Further Reading 561Exercises 563

7 End-to-End Data

Problem: What Do We Do with the Data? 5797.1 Presentation Formatting 581

7.1.1 Taxonomy 5837.1.2 Examples (XDR, ASN.1, NDR) 5877.1.3 Markup Languages (XML) 592

7.2 Multimedia Data 5967.2.1 Lossless Compression Techniques 5987.2.2 Image Representation and

Compression (GIF, JPEG) 6017.2.3 Video Compression (MPEG) 6097.2.4 Transmitting MPEG over a Network 6147.2.5 Audio Compression (MP3) 619

7.3 Summary 621What’s Next: Video Everywhere 622Further Reading 623Exercises 624

8 Network Security

Problem: Security Attacks 6338.1 Cryptographic Building Blocks 635

8.1.1 Principles of Ciphers 6358.1.2 Symmetric-Key Ciphers 638

xxx Contents

8.1.3 Public-Key Ciphers 6408.1.4 Authenticators 643

8.2 Key Predistribution 6478.2.1 Predistribution of Public Keys 6488.2.2 Predistribution of Symmetric Keys 653

8.3 Authentication Protocols 6548.3.1 Originality and Timeliness Techniques 6558.3.2 Public-Key Authentication Protocols 6568.3.3 Symmetric-Key Authentication

Protocols 6588.3.4 Diffie-Hellman Key Agreement 662

8.4 Example Systems 6648.4.1 Pretty Good Privacy (PGP) 6658.4.2 Secure Shell (SSH) 6678.4.3 Transport Layer Security

(TLS, SSL, HTTPS) 6708.4.4 IP Security (IPsec) 6758.4.5 Wireless Security (802.11i) 678

8.5 Firewalls 6818.5.1 Strengths and Weaknesses of Firewalls 684

8.6 Summary 686What’s Next: Coming to Grips with Security 688Further Reading 689Exercises 690

9 Applications

Problem: Applications Need their Own Protocols 6979.1 Traditional Applications 698

9.1.1 Electronic Mail (SMTP, MIME, IMAP) 7009.1.2 World Wide Web (HTTP) 7089.1.3 Web Services 718

9.2 Multimedia Applications 7279.2.1 Session Control and Call Control

(SDP, SIP, H.323) 7289.2.2 Resource Allocation for Multimedia

Applications 7399.3 Infrastructure Services 744

9.3.1 Name Service (DNS) 7459.3.2 Network Management (SNMP) 756

Contents xxxi

9.4 Overlay Networks 7599.4.1 Routing Overlays 7629.4.2 Peer-to-Peer Networks 7699.4.3 Content Distribution Networks 783

9.5 Summary 789What’s Next: New Network Architecture 790Further Reading 791Exercises 793

Solutions to Select Exercises 801

Glossary 815

Bibliography 837

Index 851