COMPUTER FIFTH EDITION NETWORKING JAMES F. KUROSE University of Massachusetts, Amherst KEITH W. ROSS Polytechnic Institute of NYU Addison-Wesley New York Boston San Francisco London Toronto Sydney Tokyo Singapore Madrid Mexico City Munich Paris Cape Town Hong Kong Montreal
Table of Contents Chapter 1 Computer Networks and the Internet 1 1.1 What Is the Internet? 2 1.1.1 A Nuts-and-Bolts Description 2 1.1.2 A Services Description 5 1.1.3 What Is a Protocol? 7 1.2 The Network Edge 9 1.2.1 Client and Server Programs 12 1.2.2 Access Networks 12 1.2.3 Physical Media 21 1.3 The Network Core 25 1.3.1 Circuit Switching and Packet Switching 25 1.3.2 How Do Packets Make Their Way Through Packet-Switched Networks? 33 1.3.3 ISPs and Internet Backbones 34 1.4 Delay, Loss, and Throughput in Packet-Switched Networks 36 1.4.1 Overview of Delay in Packet-Switched Networks 36 1.4.2 Queuing Delay and Packet Loss 40 1.4.3 End-to-End Delay 43 1.4.4 Throughput in Computer Networks 45 1.5 Protocol Layers and Their Service Models 48 1.5.1 Layered Architecture 48 1.5.2 Messages, Segments, Datagrams, and Frames 54 1.6 Networks Under Attack 56 1.7 History of Computer Networking and the Internet 61 1.7.1 The Development of Packet Switching: 1961-1972 61 1.7.2 Proprietary Networks and Internetworking: 1972-1980 63 1.7.3 A Proliferation of Networks: 1980-1990 65 1.7.4 The Internet Explosion: The 1990s 66 1.7.5 Recent Developments 67 1.8 Summary 68 Road-Mapping This Book 69 XVII
xviii Table of Contents Homework Problems and Questions 70 Problems 72 Discussion Questions 79 Wireshark Lab 80 Interview: Leonard Kleinrock 82 Chapter 2 Application Layer 85 2.1 Principles of Network Applications 86 2.1.1 Network Application Architectures 86 2.1.2 Processes Communicating 90 2.1.3 Transport Services Available to Applications 92 2.1.4 Transport Services Provided by the Internet 94 2.1.5 Application-Layer Protocols 98 2.1.6 Network Applications Covered in This Book 99 2.2 The Web and HTTP 100 2.2.1 Overview of HTTP 100 2.2.2 Non-Persistent and Persistent Connections 102 2.2.3 HTTP Message Format 105 2.2.4 User-Server Interaction: Cookies 110 2.2.5 Web Caching 112 2.2.6 The Conditional GET 116 2.3 File Transfer: FTP 118 2.3.1 FTP Commands and Replies 120 2.4 Electronic Mail in the Internet 120 2.4.1 SMTP 123 2.4.2 Comparison with HTTP 126 2.4.3 Mail Message Formats 127 2.4.4 Mail Access Protocols 127 2.5 DNS The Internet's Directory Service 132 2.5.1 Services Provided by DNS 133 2.5.2 Overview of How DNS Works 135 2.5.3 DNS Records and Messages 141 2.6 Peer-to-Peer Applications 146 2.6.1 P2P File Distribution 147 2.6.2 Distributed Hash Tables (DHTs) 153 2.6.3 Case Study: P2P Internet Telephony with Skype 158 2.7 Socket Programming with TCP 160 2.7.1 S ocket Programming with TCP 161 2.7.2 An Example Client-Server Application in Java 163 2.8 Socket Programming with UDP 170 2.9 Summary 178
Table of Contents xix Homework Problems and Questions 179 Problems 181 Discussion Questions 189 Socket Programming Assignments 190 Wireshark Labs 192 Interview: Bram Cohen 193 Chapter 3 Transport Layer 197 3.1 Introduction and Transport-Layer Services 198 3.1.1 Relationship Between Transport and Network Layers 198 3.1.2 Overview of the Transport Layer in the Internet 201 3.2 Multiplexing and Demultiplexing 203 3.3 Connectionless Transport: UDP 210 3.3.1 UDP Segment Structure 214 3.3.2 UDP Checksum 214 3.4 Principles of Reliable Data Transfer 216 3.4.1 Building a Reliable Data Transfer Protocol 218 3.4.2 Pipelined Reliable Data Transfer Protocols 227 3.4.3 Go-Back-N (GBN) 230 3.4.4 Selective Repeat (SR) 235 3.5 Connection-Oriented Transport: TCP 242 3.5.1 The TCP Connection 243 3.5.2 TCP Segment Structure 245 3.5.3 Round-Trip Time Estimation and Timeout 250 3.5.4 Reliable Data Transfer 254 3.5.5 Flow Control 262 3.5.6 TCP Connection Management 264 3.6 Principles of Congestion Control 271 3.6.1 The Causes and the Costs of Congestion 272 3.6.2 Approaches to Congestion Control 278 3.6.3 Network-Assisted Congestion-Control Example: ATM ABR Congestion Control 279 3.7 TCP Congestion Control 281 3.7.1 Fairness 290 3.8 Summary 294 Homework Problems and Questions 296 Problems 299 Discussion Questions 310 Programming Assignments 311 Wireshark Lab: Exploring TCP 312 Interview: Sally Floyd 313
xx Table of Contents Chapter 4 The Network Layer 315 4.1 Introduction 316 4.1.1 Forwarding and Routing 318 4.1.2 Network Service Models 320 4.2 Virtual Circuit and Datagram Networks 323 4.2.1 Virtual-Circuit Networks 324 4.2.2 Datagram Networks 327 4.2.3 Origins of VC and Datagram Networks 329 4.3 What's Inside a Router? 330 4.3.1 Input Ports 332 4.3.2 Switching Fabric 334 4.3.3 Output Ports 337 4.3.4 Where Does Queuing Occur? 337 4.4 The Internet Protocol (IP): Forwarding and Addressing in the Internet 341 4.4.1 Datagram Format 342 4.4.2 IPv4 Addressing 348 4.4.3 Internet Control Message Protocol (ICMP) 363 4.4.4 IPv6 366 4.4.5 A Brief Foray into IP Security 372 4.5 Routing Algorithms 374 4.5.1 The Link-State (LS) Routing Algorithm 377 4.5.2 The Distance-Vector (DV) Routing Algorithm 381 4.5.3 Hierarchical Routing 389 4.6 Routing in the Internet 393 4.6.1 Intra-AS Routing in the Internet: RIP 394 4.6.2 Intra-AS Routing in the Internet: OSPF 398 4.6.3 Inter-AS Routing: BGP 400 4.7 Broadcast and Multicast Routing 407 4.7.1 Broadcast Routing Algorithms 408 4.7.2 Multicast 413 4.8 Summary 420 Homework Problems and Questions 421 Problems 424 Discussion Questions 435 Programming Assignment 436 Wireshark Labs 437 Interview: Vinton G. Cerf 438 Chapter 5 The Link Layer and Local Area Networks 441 5.1 Link Layer: Introduction and Services 443 5.1.1 The Services Provided by the Link Layer 443 5.1.2 Where Is the Link Layer Implemented? 446
Table of Contents xxi 5.2 Error-Detection and -Correction Techniques 448 5.2.1 Parity Checks 450 5.2.2 Checksumming Methods 452 5.2.3 Cyclic Redundancy Check (CRC) 452 5.3 Multiple Access Protocols 455 5.3.1 Channel Partitioning Protocols 457 5.3.2 Random Access Protocols 459 5.3.3 Taking-Turns Protocols" 466 5.3.4 Local Area Networks (LANs) 467 5.4 Link-Layer Addressing 469 5.4.1 MAC Addresses 469 5.4.2 Address Resolution Protocol (ARP) 471 5.5 Ethernet 475 5.5.1 Ethernet Frame Structure 477 5.5.2 CSMA/CD: Ethernet's Multiple Access Protocol 481 5.5.3 Ethernet Technologies 483 5.6 Link-Layer Switches 486 5.6.1 Forwarding and Filtering 487 5.6.2 Self-Learning 489 5.6.3 Properties of Link-Layer Switching 490 5.6.4 Switches Versus Routers 491 5.6.5 Virtual Local Area Networks (VLANs) 493 5.7 PPP: The Point-to-Point Protocol 497 5.7.1 PPP Data Framing 499 5.8 Link Virtualization: A Network as a Link Layer 501 5.9 A Day in the Life of a Web Page Request 505 5.10 Summary 510 Homework Problems and Questions 511 Problems 513 Discussion Questions 520 Wireshark Labs 520 Interview: Simon S. Lam 521 Chapter 6 Wireless and Mobile Networks 523 6.1 Introduction 524 6.2 Wireless Links and Network Characteristics 529 6.2.1 CDMA 532 6.3 WiFi: 802.11 Wireless LANs 536 6.3.1 The 802.11 Architecture 537 6.3.2 The 802.11 MAC Protocol 541 6.3.3 The IEEE 802.11 Frame 547
xxii Table of Contents 6.3.4 Mobility in the Same IP Subnet 551 6.3.5 Advanced Features in 802.11 552 6.3.6 Beyond 802.11: Bluetooth and WiMAX 554 6.4 Cellular Internet Access 558 6.4.1 An Overview of Cellular Architecture 558 6.5 Mobility Management: Principles 564 6.5.1 Addressing 566 6.5.2 Routing to a Mobile Node 568 6.6 Mobile IP 573 6.7 Managing Mobility in Cellular Networks 579 6.7.1 Routing Calls to a Mobile User 580 6.7.2 Handoffs in GSM 581 6.8 Wireless and Mobility: Impact on Higher-layer Protocols 584 6.9 Summary 587 Homework Problems and Questions 588 Problems 589 Discussion Questions 593 Wireshark Labs 593 Interview: Charlie Perkins 594 Chapter 7 Multimedia Networking 597 7.1 Multimedia Networking Applications 598 7.1.1 Examples of Multimedia Applications 598 7.1.2 Hurdles for Multimedia in Today's Internet 601 7.1.3 How Should the Internet Evolve to Support Multimedia Better? 602 7.1.4 Audio and Video Compression 604 7.2 Streaming Stored Audio and Video 608 7.2.1 Accessing Audio and Video Through a Web Server 608 7.2.2 Sending Multimedia from a Streaming Server to a Helper Application 610 7.2.3 Real-Time Streaming Protocol (RTSP) 612 7.3 Making the Best of the Best-Effort Service 616 7.3.1 The Limitations of a Best-Effort Service 616 7.3.2 Removing Jitter at the Receiver for Audio 619 7.3.3 Recovering from Packet Loss 622 7.3.4 Distributing Multimedia in Today's Internet: Content Distribution Networks 626 7.3.5 Dimensioning Best-Effort Networks to Provide Quality of Service 629 7.4 Protocols for Real-Time Interactive Applications 631 7.4.1 RTP 631 7.4.2 RTP Control Protocol (RTCP) 636
Table of Contents xxiii 7.4.3 SIP 639 7.4.4 H.323 645 7.5 Providing Multiple Classes of Service 647 7.5.1 Motivating Scenarios 648 7.5.2 Scheduling and Policing Mechanisms 653 7.5.3 Diffserv 660 7.6 Providing Quality of Service Guarantees 665 7.6.1 A Motivating Example 665 7.6.2 Resource Reservation, Call Admission, Call Setup 667 7.6.3 Guaranteed QoS in the Internet: Intserv and RSVP 669 7.7 Summary 672 Homework Problems and Questions 673 Problems 674 Discussion Questions 681 Programming Assignment 682 Interview: Henning Schulzrinne 684 Chapter 8 Security in Computer Networks 687 8.1 What Is Network Security? 688 8.2 Principles of Cryptography 691 8.2.1 Symmetric Key Cryptography 692 8.2.2 Public Key Encryption 699 8.3 Message Integrity and End-Point Authentication 704 8.3.1 Cryptographic Hash Functions 705 8.3.2 Message Authentication Code 707 8.3.3 Digital Signatures 709 8.3.4 End-Point Authentication 716 8.4 Securing E-mail 721 8.4.1 Secure E-mail 722 8.4.2 PGP 726 8.5 Securing TCP Connections: SSL 727 8.5.1 The Big Picture 729 8.5.2 A More Complete Picture 732 8.6 Network-Layer Security: IPsec and Virtual Private Networks 734 8.6.1 IPsec and Virtual Private Networks (VPNs) 734 8.6.2 The AH and ESP Protocols 736 8.6.3 Security Associations 736 8.6.4 The IPset Datagram 737 8.6.5 IKE: Key Management in IPsec 741 8.7 Securing Wireless LANs 742 8.7.1 Wired Equivalent Privacy (WEP) 742 8.7.2 1ЕЕЕ802.Ш 744
xxiv Table of Contents 8.8 Operational Security: Firewalls and Intrusion Detection Systems 747 8.8.1 Firewalls 747 8.8.2 Intrusion Detection Systems 755 8.9 Summary 758 Homework Problems and Questions 760 Problems 762 Discussion Questions 768 Wireshark Lab 768 IPsec Lab 768 Interview: Steven M. Bellovin 769 Chapter 9 Network Management 771 9.1 What Is Network Management? 772 9.2 The Infrastructure for Network Management 776 9.3 The Internet-Standard Management Framework 780 9.3.1 Structure of Management Information: SMI 782 9.3.2 Management Information Base: MIB 786 9.3.3 SNMP Protocol Operations and Transport Mappings 788 9.3.4 Security and Administration 791 9.4 ASN.l 794 9.5 Conclusion 799 Homework Problems and Questions 800 Problems 801 Discussion Questions 802 Interview: Jeff Case 803 References Index 805 835