Internetworking With TCP/IP Vol I: Principles, Protocols, and Architecture Sixth Edition This page intentionally left blank Internetworking With TCP/IP Vol I: Principles, Protocols, and Architecture Sixth Edition DOUGLAS E. COMER Department of Computer Sciences Purdue University Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo Editorial Director, Engineering and Computer Science: Marcia J. Horton Acquisitions Editor: Matt Goldstein Editorial Assistant: Jenah Blitz-Stoehr Marketing Manager: Yez Alayan Marketing Assistant: Jon Bryant Senior Managing Editor: Scott Disanno Operations Specialist: Linda Sager Art Director: Anthony Gemmellaro Media Editor: Renata Butera Printer/Binder: Edwards Brothers Cover Printer: Lehigh-Phoenix Credits and acknowledgments borrowed from other sources and reproduced, with permission, in this textbook appear on the appropriate page within the text. Cisco is a registered trademark of Cisco Systems, Inc.
EUI-64 is a trademark of the Institute for Electrical and Electronic Engineers (IEEE). IEEE is a registered trademark of the Institute of Electrical and Electronics Engineers, Inc. Linux is a registered trademark of Linus Torvalds. UNIX is a registered trademark of The Open Group in the US and other countries.
ZigBee is a registered trademark of the ZigBee Alliance. OpenFlow is a trademark of Stanford University. Windows, Windows NT, Windows CE, and/or other Microsoft products referenced herein are either trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Skype is a registered trademark of Skype, Incorporated in the US and other countries.
Additional company and product names used in this text may be trademarks or registered trademarks of the individual companies, and are respectfully acknowledged. Copyright © 2014, 2006, 2000 Pearson Education, Inc., One Lake Street, Upper Saddle River, New Jersey 07458. All rights reserved. Manufactured in the United States of America.
This publication is protected by Copyright, and permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission(s) to use material from this work, please submit a written request to Pearson Education, Inc., Permissions Department, One Lake Street, Upper Saddle River, New Jersey 07458. Many of the designations by manufacturers and seller to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed in initial caps or all caps.
Library of Congress Cataloging-in-Publication Data on File 10 9 8 7 6 5 4 3 2 1 ISBN 10: 0-13-608530-X ISBN 13: 978-0-13-608530-0 www.com To Chris This page intentionally left blank Contents Foreword xxiii Preface xxv Chapter 1 Introduction And Overview 1 1.1 The Motivation For Internetworking 1 1.2 The TCP/IP Internet 2 1.4 History And Scope Of The Internet 6 1.5 The Internet Architecture Board 7 1.6 The IAB Reorganization 8 1.7 Internet Request For Comments (RFCs) 8 1.9 Transition To IPv6 12 1.10 Committee Design And The New Version of IP 12 1.11 Relationship Between IPv4 And IPv6 13 1.13 Dual Stack Systems 15 1.14 Organization Of The Text 15 1.15 Summary 16 Chapter 2 Overview Of Underlying Network Technologies 19 2.2 Two Approaches To Network Communication 20 2.3 WAN And LAN 21 2.4 Hardware Addressing Schemes 21 2.6 Wi-Fi (IEEE 802.8 Optical Carrier And Packet Over SONET (OC, POS) 27 2.9 Point-To-Point Networks 28 2.10 VLAN Technology And Broadcast Domains 28 viii Contents 2.12 Congestion And Packet Loss 30 2.13 Summary 31 Chapter 3 Internetworking Concept And Architectural Model 35 3.2 Application-Level Interconnection 35 3.3 Network-Level Interconnection 37 3.4 Properties Of The Internet 38 3.6 Interconnection Of Multiple Networks With IP Routers 39 3.7 The User’s View 41 3.8 All Networks Are Equal 42 3.9 The Unanswered Questions 43 3.10 Summary 43 Chapter 4 Protocol Layering 47 4.2 The Need For Multiple Protocols 47 4.3 The Conceptual Layers Of Protocol Software 49 4.4 Functionality Of The Layers 49 4.5 ISO 7-Layer Reference Model 50 4.25 And Its Relation To The ISO Model 51 4.7 The TCP/IP 5-Layer Reference Model 52 4.8 Locus Of Intelligence 56 4.9 The Protocol Layering Principle 57 4.10 The Layering Principle Applied To A Network 58 4.11 Layering In Mesh Networks 60 4.12 Two Important Boundaries In The TCP/IP Model 62 4.13 Cross-Layer Optimizations 63 4.14 The Basic Idea Behind Multiplexing And Demultiplexing 64 4.15 Summary 66 Chapter 5 Internet Addressing 69 5.2 Universal Host Identifiers 69 5.3 The Original IPv4 Classful Addressing Scheme 71 5.4 Dotted Decimal Notation Used With IPv4 72 5.5 IPv4 Subnet Addressing 72 Contents ix 5.6 Fixed Length IPv4 Subnets 75 5.7 Variable-Length IPv4 Subnets 77 5.8 Implementation Of IPv4 Subnets With Masks 77 5.9 IPv4 Subnet Mask Representation And Slash Notation 78 5.10 The Current Classless IPv4 Addressing Scheme 79 5.11 IPv4 Address Blocks And CIDR Slash Notation 82 5.12 A Classless IPv4 Addressing Example 82 5.13 IPv4 CIDR Blocks Reserved For Private Networks 83 5.14 The IPv6 Addressing Scheme 84 5.15 IPv6 Colon Hexadecimal Notation 84 5.16 IPv6 Address Space Assignment 85 5.17 Embedding IPv4 Addresses In IPv6 For Transition 86 5.18 IPv6 Unicast Addresses And /64 87 5.19 IPv6 Interface Identifiers And MAC Addresses 88 5.20 IP Addresses, Hosts, And Network Connections 89 5.22 Weaknesses In Internet Addressing 94 5.23 Internet Address Assignment And Delegation Of Authority 96 5.24 An Example IPv4 Address Assignment 96 5.25 Summary 98 Chapter 6 Mapping Internet Addresses To Physical Addresses (ARP) 101 6.2 The Address Resolution Problem 101 6.3 Two Types Of Hardware Addresses 102 6.4 Resolution Through Direct Mapping 102 6.5 Resolution In A Direct-Mapped Network 103 6.6 IPv4 Address Resolution Through Dynamic Binding 104 6.7 The ARP Cache 105 6.8 ARP Cache Timeout 106 6.10 Relationship Of ARP To Other Protocols 108 6.12 ARP Encapsulation And Identification 110 6.13 ARP Message Format 110 6.14 Automatic ARP Cache Revalidation 112 6.15 Reverse Address Resolution (RARP) 112 6.16 ARP Caches In Layer 3 Switches 113 6.18 IPv6 Neighbor Discovery 115 6.19 Summary 116 x Contents Chapter 7 Internet Protocol: Connectionless Datagram Delivery (IPv4, 119 IPv6) 7.3 Internet Architecture And Philosophy 120 7.4 Principles Behind The Structure 120 7.5 Connectionless Delivery System Characteristics 121 7.6 Purpose And Importance Of The Internet Protocol 122 7.7 The IP Datagram 122 7.8 Datagram Type Of Service And Differentiated Services 127 7.10 Datagram Size, Network MTU, and Fragmentation 130 7.12 Header Fields Used For Datagram Reassembly 135 7.13 Time To Live (IPv4) And Hop Limit (IPv6) 136 7.14 Optional IP Items 137 7.15 Options Processing During Fragmentation 141 7.16 Network Byte Order 143 7.17 Summary 144 Chapter 8 Internet Protocol: Forwarding IP Datagrams 147 8.2 Forwarding In An Internet 147 8.3 Direct And Indirect Delivery 149 8.4 Transmission Across A Single Network 150 8.6 Table-Driven IP Forwarding 152 8.7 Next-Hop Forwarding 153 8.8 Default Routes And A Host Example 155 8.9 Host-Specific Routes 156 8.10 The IP Forwarding Algorithm 157 8.11 Longest-Prefix Match Paradigm 158 8.12 Forwarding Tables And IP Addresses 160 8.13 Handling Incoming Datagrams 161 8.14 Forwarding In The Presence Of Broadcast And Multicast 162 8.15 Software Routers And Sequential Lookup 163 8.16 Establishing Forwarding Tables 163 8.17 Summary 163 Contents xi Chapter 9 Internet Protocol: Error And Control Messages (ICMP) 167 9.2 The Internet Control Message Protocol 167 9.3 Error Reporting Vs.4 ICMP Message Delivery 170 9.6 ICMP Message Format 171 9.7 Example ICMP Message Types Used With IPv4 And IPv6 172 9.8 Testing Destination Reachability And Status (Ping) 173 9.9 Echo Request And Reply Message Format 174 9.10 Checksum Computation And The IPv6 Pseudo-Header 175 9.11 Reports Of Unreachable Destinations 176 9.12 ICMP Error Reports Regarding Fragmentation 178 9.13 Route Change Requests From Routers 178 9.14 Detecting Circular Or Excessively Long Routes 180 9.15 Reporting Other Problems 181 9.16 Older ICMP Messages Used At Startup 182 9.17 Summary 182 Chapter 10 User Datagram Protocol (UDP) 185 10.2 Using A Protocol Port As An Ultimate Destination 185 10.3 The User Datagram Protocol 186 10.4 UDP Message Format 187 10.5 Interpretation Of the UDP Checksum 188 10.6 UDP Checksum Computation And The Pseudo-Header 189 10.7 IPv4 UDP Pseudo-Header Format 189 10.8 IPv6 UDP Pseudo-Header Format 190 10.9 UDP Encapsulation And Protocol Layering 190 10.10 Layering And The UDP Checksum Computation 192 10.11 UDP Multiplexing, Demultiplexing, And Protocol Ports 193 10.12 Reserved And Available UDP Port Numbers 194 10.13 Summary 196 Chapter 11 Reliable Stream Transport Service (TCP) 199 11.2 The Need For Reliable Service 199 11.3 Properties Of The Reliable Delivery Service 200 11.4 Reliability: Acknowledgements And Retransmission 201 11.5 The Sliding Window Paradigm 203 xii Contents 11.6 The Transmission Control Protocol 205 11.7 Layering, Ports, Connections, And Endpoints 206 11.8 Passive And Active Opens 208 11.9 Segments, Streams, And Sequence Numbers 208 11.10 Variable Window Size And Flow Control 209 11.11 TCP Segment Format 210 11.12 Out Of Band Data 212 11.14 TCP Checksum Computation 214 11.15 Acknowledgements, Retransmission, And Timeouts 216 11.16 Accurate Measurement Of Round Trip Samples 218 11.17 Karn’s Algorithm And Timer Backoff 219 11.18 Responding To High Variance In Delay 220 11.19 Response To Congestion 223 11.20 Fast Recovery And Other Response Modifications 225 11.21 Explicit Feedback Mechanisms (SACK and ECN) 227 11.22 Congestion, Tail Drop, And TCP 228 11.23 Random Early Detection (RED) 229 11.24 Establishing A TCP Connection 231 11.25 Initial Sequence Numbers 232 11.26 Closing a TCP Connection 233 11.27 TCP Connection Reset 234 11.28 TCP State Machine 235 11.29 Forcing Data Delivery 236 11.30 Reserved TCP Port Numbers 237 11.31 Silly Window Syndrome And Small Packets 238 11.32 Avoiding Silly Window Syndrome 239 11.33 Buffer Bloat And Its Effect On Latency 242 11.34 Summary 243 Chapter 12 Routing Architecture: Cores, Peers, And Algorithms 247 12.2 The Origin Of Forwarding Tables 248 12.3 Forwarding With Partial Information 249 12.4 Original Internet Architecture And Cores 251 12.5 Beyond The Core Architecture To Peer Backbones 253 12.6 Automatic Route Propagation And A FIB 254 12.7 Distance-Vector (Bellman-Ford) Routing 255 12.8 Reliability And Routing Protocols 257 12.9 Link-State (SPF) Routing 258 12.10 Summary 259 Contents xiii Chapter 13 Routing Among Autonomous Systems (BGP) 263 13.2 The Scope Of A Routing Update Protocol 263 13.3 Determining A Practical Limit On Group Size 264 13.4 A Fundamental Idea: Extra Hops 266 13.5 Autonomous System Concept 267 13.6 Exterior Gateway Protocols And Reachability 268 13.8 BGP Functionality And Message Types 270 13.9 BGP Message Header 271 13.10 BGP OPEN Message 272 13.11 BGP UPDATE Message 273 13.12 Compressed IPv4 Mask-Address Pairs 274 13.13 BGP Path Attributes 274 13.14 BGP KEEPALIVE Message 276 13.15 Information From The Receiver’s Perspective 277 13.16 The Key Restriction Of Exterior Gateway Protocols 278 13.17 The Internet Routing Architecture And Registries 280 13.18 BGP NOTIFICATION Message 280 13.19 BGP Multiprotocol Extensions For IPv6 281 13.20 Multiprotocol Reachable NLRI Attribute 283 13.21 Internet Routing And Economics 284 13.22 Summary 285 Chapter 14 Routing Within An Autonomous System (RIP, RIPng, 289 OSPF, IS-IS) 14. Dynamic Interior Routes 289 14.3 Routing Information Protocol (RIP) 293 14.4 Slow Convergence Problem 294 14.5 Solving The Slow Convergence Problem 296 14.6 RIP Message Format (IPv4) 297 14.7 Fields In A RIP Message 299 14.8 RIP For IPv6 (RIPng) 299 14.9 The Disadvantage Of Using Hop Counts 301 14.11 Delay Metrics, Oscillation, And Route Flapping 302 14.12 The Open SPF Protocol (OSPF) 303 14.13 OSPFv2 Message Formats (IPv4) 305 14.14 Changes In OSPFv3 To Support IPv6 310 14.15 IS-IS Route Propagation Protocol 312 14.16 Trust And Route Hijacking 313 xiv Contents 14.17 Gated: A Routing Gateway Daemon 313 14.18 Artificial Metrics And Metric Transformation 314 14.19 Routing With Partial Information 315 14.20 Summary 315 Chapter 15 Internet Multicasting 319 15.5 The Conceptual Building Blocks Of Internet Multicast 321 15.6 The IP Multicast Scheme 322 15.7 IPv4 And IPv6 Multicast Addresses 323 15.8 Multicast Address Semantics 326 15.9 Mapping IP Multicast To Ethernet Multicast 327 15.10 Hosts And Multicast Delivery 328 15.