Computer Networking: A Top-Down Approach Featuring The Internet
Computer Networking: A Top-Down Approach Featuring The Internet
S E C O N D
E D I T I O N
Computer Networking
A Top-Down Approach Featuring the Internet
James F. Kurose
University of Massachusetts, Amherst
Keith W. Ross
Eurcom Institute
Executive Editor Assistant Editor Executive Marketing Manager Production Supervisor Production Services Composition Art Art Development Text and Cover Design Prepress and Manufacturing Media Producer
Susan Hartman Sullivan Galia Shokry Michael Hirsch Kim Ellwood Pre-Press Company, Inc. Pre-Press Company, Inc. Pat Rossi Calkin and Pre-Press Company, Inc. Janet Theurer Joyce Cosentino Wells Caroline Fell Jennifer Pelland
Access the latest information about Addison-Wesley Computing titles from our World Wide Web site: http://www.aw.com/cs The programs and applications presented in this book have been included for their instructional value. They have been tested with care, but are not guaranteed for any particular purpose. The publisher does not offer any warranties or representations, nor does it accept any liabilities with respect to the programs or applications. Library of Congress Cataloging-in-Publication Data Kurose, James F Computer networking: a top-down approach featuring the Internet / James F. Kurose, Keith W. Ross.2nd ed. p. cm. Rosss name appears first on the earlier edition. Includes bibliographical references and index. ISBN 0-201-97699-4 1. Internet. 2. Computer networks I. Ross, Keith W., 1956- II. Title. TK5105.875.I57 K88 2002 004.67'8dc21 Copyright 2003 by Pearson Education, Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher. Printed in the United States of America. ISBN 0-201-97699-4 12345678910-CRW-04030201
2002071100
Keith Ross
Keith Ross is a professor in the Multimedia Communications Department at Eurcom Institute. From 1985 through 1997 he was a Professor at the University of Pennsylvania where he held appointments in both the Department of Systems Engineering and the Wharton School of Business. In 1999, he co-founded the Internet startup Wimba.com. Dr. Ross has published over 50 papers and written two books. He has served on editorial boards of five major journals, and has served on the program committees of major networking conferences., including IEEE Infocom and ACM SIGCOMM. He has supervised more than ten Ph.D. theses. His research and teaching interests included multimedia networking, asynchronous learning, Web caching, streaming audio and video, and traffic modeling. He received his Ph.D. from the University of Michigan.
iii
To Julie and our three precious onesChris, Charlie, and Nina JFK
To my wife, Vronique, and our trois petits pois, Ccile, Claire, and Katie KWR
Preface
Welcome to the second edition of Computer Networking: A Top-Down Approach Featuring the Internet. Since the publication of the first edition two years ago, our book has been adopted for use at hundreds of colleges and universities and used by tens of thousands of students and practitioners worldwide. Weve heard from many of these readers and have been overwhelmed by the positive response. We think one important reason for this success is that the book offers a fresh approach to computer networking instruction. Why is a fresh approach needed? In recent years we have witnessed two revolutionary changes in the field of networkingchanges that are not reflected in the networking texts published in the 1980s and 1990s. First, the Internet has taken over computer networking. Any serious discussion about computer networking today has to be done with the Internet in mind. Second, over the past ten years the biggest growth area has been in networking services and applications, which can be seen with the emergence of the Web, ubiquitous use of e-mail, audio and video streaming, Internet phone, instant messaging, peerto-peer applications, and online commerce.
Audience
This textbook is for a first course on computer networking. It can be used in both computer science and electrical engineering departments. In terms of programming languages, the book assumes only that the student has experience with C, C++, or Java. A student who has programmed only in C or C++ and not Java should not have any difficulty following the application programming material, even though this material is
Preface
presented in a Java context. Although this book is more precise and analytical than many other introductory computer networking texts, it rarely uses any mathematical concepts that are not taught in high school. We have made a deliberate effort to avoid using any advanced calculus, probability, or stochastic process concepts. The book is therefore appropriate for undergraduate courses and for first-year graduate courses. It should also be useful to practitioners in the telecommunications industry.
A Top-Down Approach
Unlike the other computer networking texts, this text is organized in a top-down mannerthat is, it begins at the application layer and works its way down toward the physical layer. The top-down approach has several important benefits. First, it places emphasis on the application layer, which has been the high growth area of computer networking. Indeed, many of the recent revolutions in computer networking including the Web, audio and video streaming, and content distributionhave taken place at the application layer. In preparing the first edition of this book, we believed that the application layer would remain the highest growth area in the field, both in terms of research and actual deployment. The intervening years have unquestionably shown this to be true! An early emphasis on application-layer issues differs from the approaches taken in most other texts, which have only a small (or nonexistent) amount of material on network applications, their requirements, application-layer paradigms (e.g., client/server), and the application programming interfaces. Second, our experience as instructors has been that teaching networking applications near the beginning of the course is a powerful motivational tool. Students are thrilled to learn about how networking applications workapplications such as email and the Web, which most students use on a daily basis. Once a student understands the applications, the student can then understand the network services needed
xii
Preface
Preface
xiii
We also expect to be constantly expanding the Web site, adding contributed material from instructors and readers as well as our own new features. Updates should occur about every three months. If you have any problems with the Web site, send mail to [email protected].
Pedagogical Features
We have each been teaching computer networking for almost 20 years. We bring to this text more than combined 30 years of teaching experience to over 3,000 students. We have also been active researchers in computer networking during this time. (In fact, Jim and Keith first met each other as masters students in a computer networking course taught by Mischa Schwartz in 1979 at Columbia University.) We think all this gives us a good perspective on where networking has been and where it is likely to go in the future. Nevertheless, we have resisted temptations to bias the material in this book towards our own pet research projects. We figure you can visit our personal Web sites if you are interested in our research. Thus, this book is about modern computer networkingit is about contemporary protocols and technologies as well as the underlying principles behind these protocols and technologies. We also believe that learning (and teaching!) about networking can be fun. A sense of humor, use of analogies, and real-world examples in this book will hopefully make this material more fun.
Interviews
We have included yet another original feature that should inspire and motivate studentsinterviews with renowned innovators in the field of networking. We provide
xiv
Preface
interviews with Len Kleinrock, Tim Berners-Lee, Sally Floyd, Vint Cerf, Bob Metcalfe, Henning Schulzrinne, Steven Bellovin, and Jeff Case.
Chapter Dependencies
The first chapter of this text presents a self-contained overview of computer networking. Introducing many key concepts and terminology, this chapter sets the stage for the rest of the book. All of the other chapters directly depend on this first chapter. We recommend that, after completing Chapter 1, instructors cover Chapters 2 through 5 in sequence, thereby teaching according to the top-down philosophy. Each of these five chapters leverages material from the preceding chapters. After completing the first five chapters, the instructor has quite a bit of flexibility. There are no interdependencies among the last three chapters, so they can be
Preface
xv
taught in any order. However, each of the last three chapters depends on the material in the first five chapters. Ideally, the instructor will have time to teach selected material from all three final chapters in a full semester course. We also note that the first chapter of the text, being comprehensive and selfcontained, can serve as the foundation of a short course on networking.
Acknowledgements
Since we began writing this book in 1996, many people have given us invaluable help and have been influential in shaping our thoughts on how to best organize and teach a networking course. We want to say A BIG THANKS to everyone who has helped. We are also very thankful to the hundreds of readers from around the world students, faculty, practitionerswho have sent us thoughts and comments on earlier editions of the book and suggestions for future editions of the book. Special thanks go out to: Al Aho (Lucent Bell Laboratories) Pratima Akkunoor (Arizona State University) Paul Amer (University of Delaware) Shamiul Azom (Arizona State University) Paul Barford (University of Wisconsin)
Steven Bellovin (AT&T Research) Shahid Bokhari (University of Engineering & Technology, Lahore) Ernst Biersack (Eurcom Institute) Daniel Brushteyn (former University of Pennsylvania student) Evandro Cantu (Federal University of Santa Catarina) Jeff Case (SNMP Research International) Vinton Cerf (MCI WorldCom) John Daigle (University of Mississippi) Edmundo hn DaiglMnsEv
Preface
xvii
Ken Reek (Rochester Institute of Technology) Martin Reisslein (Arizona State University) Jennifer Rexford (AT&T Research) Sumit Roy (University of Washington) Avi Rubin (Johns Hopkins University) Despina Saparilla (Lucent Bell Labs) Henning Schulzrinne (Columbia University) Mischa Schwartz (Columbia University) K. Sam Shanmugan (University of Kansas) Prashant Shenoy (University of Massachusetts) Clay Shields (Georgetown University) Subin Shrestra (University of Pennsylvania) Peter Steenkiste (Carnegie Mellon University) Tatsuya Suda (University of California at Irvine) Kin Sun Tam (State University of New York at Albany) Don Towsley (University of Massachusetts) David Turner (California State University, San Bernardino) Ira Winston (University of Pennsylvania) Raj Yavatkar (Intel) Yechiam Yemini (Columbia University) Ellen Zegura (Georgia Institute of Technology) Hui Zhang (Carnegie Mellon University) Lixia Zhang (University of California at Los Angeles) ZhiLi Zhang (University of Minnesota) Lixia Zhang (University of California at Los Angeles) Shuchun Zhang (former University of Pennsylvania student) Phil Zimmermann (independent consultant) We also want to thank the entire Addison-Wesley team, who have done an absolutely outstanding job (and who have put up with two very finicky authors!): Kim Ellwood, Susan Hartman Sullivan, Michael Hirsch, Patty Mahtani, Galia Shokry, and Joyce Wells. Thanks also to the artists, Janet Theurer and Patrice Rossi Calkin, for their work on the beautiful figures in the second edition. Special thanks go to Susan, our editor at Addison-Wesley. This book could not and would not have been completed without her management, encouragement, patience, and perseverance.
Table of Contents
Chapter 1 Computer Networks and the Internet
1.1 What Is the Internet? 1.1.1 A Nuts-and-Bolts Description 1.1.2 A Service Description 1.1.3 What Is a Protocol? 1.1.4 Some Good Hyperlinks The Network Edge 1.2.1 End Systems, Clients, and Servers 1.2.2 Connectionless and Connection-Oriented Service The Network Core 1.3.1 Circuit Switching and Packet Switching 1.3.2 Packet Forwarding in Computer Networks Network Access and Physical Media 1.4.1 Network Access 1.4.2 Physical Media ISPs and Internet Backbones Delay and Loss in Packet-Switched Networks 1.6.1 Types of Delay 1.6.2 Queuing Delay and Packet Loss 1.6.3 Delay and Routes in the Internet Protocol Layers and Their Service Models 1.7.1 Layered Architecture 1.7.2 The Internet Protocol Stack 1.7.3 Network Entities and Layers History of Computer Networking and the Internet 1.8.1 The Development of Packet Switching: 19611972 1.8.2 Proprietary Networks and Internetworking: 19721980 1.8.3 A Proliferation of Networks: 19801990 1.8.4 The Internet Explosion: The 1990s 1.8.5 Recent Developments
1
2 2 5 6 8 9 9 12 14 14 25 29 30 35 39 41 41 45 47 49 50 54 57 58 58 60 61 62 64
1.2
1.3
1.4
1.5 1.6
1.7
1.8
xix
xx
Table of Contents
1.9
Summary Homework Problems and Questions Problems Discussion Questions Interview: Leonard Kleinrock
65 67 68 73 74
76
77 78 83 85 87 88 89 91 94 99 101 103 103 105 106 108 111 112 117 121 122 124 129 131 133 134 136 143 151 151 155 156 162 165
2.2
2.3 2.4
2.5
2.6
Table of Contents
xxi
2.10
Summary Homework Problems and Questions Problems Discussion Questions Programming Assignments Interview: Tim Berners-Lee
184
185 185 188 190 196 199 200 201 203 214 217 222 228 228 230 235 238 246 248 253 253 259 260 262 268 271 280 281 282 290 291
xxii
Table of Contents
293
294 296 300 301 304 308 317 317 321 322 330 333 336 339 340 342 346 346 353 358 360 362 364 365 368 369 372 375 375 379 383 388 391 391 393 400 405 406 408 414 417
Table of Contents
xxiii
419
421 421 424 425 427 429 430 432 434 438 446 447 449 449 451 455 456 460 462 466 467 468 476 480 481 487 488 490 492 494 495 497 499 500 502 505 505 506 510 511 513 519 520
Table of Contents
xxv
6.10
Summary Homework Problems and Questions Problems Discussion Questions Programming Assignment Interview: Henning Schulzrinne
604
605 608 610 614 620 621 621 622 623 623 624 627 628 629 631 633 635 636 640 641 644 646 646 646 648 648 650 650 651 656 660 663
7.3
7.4
7.5
7.6
7.7
7.8
xxvi
Table of Contents
7.9
Summary Homework Problems and Questions Problems Discussion Questions Interview: Steven M. Bellovin
672
673 677 680 681 684 686 690 693 698 698 699 700 701 703 733
Computer Networking
A Top-Down Approach Featuring the Internet
Second Edition