TCPIP_01TOC.fm Page i Thursday, June 9, 2005 11:16 AM

THE TCP/IP GUIDE by Charles M. Kozierok

SECTION I TCP/IP OVERVIEW AND BACKGROUND INFORMATION

PART I-1 NETWORKING FUNDAMENTALS

1 NETWORKING INTRODUCTION, CHARACTERISTICS, AND TYPES 5 Introduction to Networking ...... 6 What Is Networking? ...... 6 The Advantages and Benefits of Networking ...... 7 The Disadvantages and Costs of Networking ...... 9 Fundamental Network Characteristics ...... 10 Networking Layers, Models, and Architectures ...... 10 Protocols: What Are They, Anyway? ...... 11 Circuit-Switching and Packet-Switching Networks ...... 13 Connection-Oriented and Connectionless Protocols ...... 16 Messages: Packets, Frames, Datagrams, and Cells ...... 17 Message Formatting: Headers, Payloads, and Footers ...... 19 Message Addressing and Transmission Methods: Unicast, Broadcast, and Multicast ...... 20 Network Structural Models and Client-Server and Peer-to-Peer Networking ...... 23 Types and Sizes of Networks ...... 26 Segments, Networks, , and Internetworks ...... 27 The , Intranets, and Extranets ...... 30

2 NETWORK PERFORMANCE ISSUES AND CONCEPTS 33 Putting Network Performance in Perspective ...... 34 Balancing Network Performance with Key Nonperformance Characteristics ...... 35 Performance Measurements: Speed, Bandwidth, Throughput, and Latency ...... 36 Speed ...... 36 Bandwidth ...... 37 Throughput ...... 37 Latency ...... 37 Summary of Performance Measurements ...... 38 Understanding Performance Measurement Units ...... 39 Bits and Bytes ...... 39 Baud ...... 40 Theoretical and Real-World Throughput, and Factors Affecting Network Performance ...... 41 Normal Network Overhead ...... 41 External Performance Limiters ...... 42 Network Configuration Problems ...... 42 Asymmetry ...... 43 Simplex, Full-Duplex, and Half-Duplex Operation ...... 43 Simplex Operation ...... 44 Half-Duplex Operation ...... 44 Full-Duplex Operation ...... 44 Quality of Service (QoS) ...... 45 TCPIP_01TOC.fm Page ii Thursday, June 9, 2005 11:16 AM

3 NETWORK STANDARDS AND STANDARDS ORGANIZATIONS 47 Proprietary, Open, and De Facto Standards ...... 48 Proprietary Standards ...... 48 Open Standards ...... 49 De Facto Standards ...... 50 Networking Standards ...... 50 International Networking Standards Organizations ...... 51 Networking Industry Groups ...... 53 Internet Standards Organizations (ISOC, IAB, IESG, IETF, IRSG, and IRTF) ...... 54 Internet Registration Authorities and Registries (IANA, ICANN, APNIC, ARIN, LACNIC, and RIPE NCC) ...... 57 Internet Centralized Registration Authorities ...... 57 Modern Hierarchy of Registration Authorities ...... 58 Internet Standards and the Request for Comment (RFC) Process ...... 59 RFC Categories ...... 60 The Internet Standardization Process ...... 60

4 A REVIEW OF DATA REPRESENTATION AND THE MATHEMATICS OF COMPUTING 63 Binary Information and Representation: Bits, Bytes, Nibbles, Octets, and Characters ...... 64 Binary Information ...... 64 Binary Information Representation and Groups ...... 65 Byte Versus Octet ...... 66 Decimal, Binary, Octal, and Hexadecimal Numbers ...... 67 Binary Numbers and Their Decimal Equivalents ...... 67 Making Binary Numbers Easier to Use by Grouping Bits ...... 68 Octal Numbers ...... 68 Hexadecimal Numbers ...... 69 Decimal, Binary, Octal, and Hexadecimal Number Conversion ...... 70 Binary, Octal, and Hexadecimal Conversions ...... 70 Conversion from Binary, Octal, or Hexadecimal to Decimal ...... 71 Conversion from Decimal to Binary, Octal or Hexadecimal ...... 72 Binary, Octal, and Hexadecimal Arithmetic ...... 73 Binary Arithmetic ...... 74 Octal and Hexadecimal Arithmetic ...... 74 Boolean Logic and Logical Functions ...... 75 Boolean Logical Functions ...... 75 Combining Boolean Expressions ...... 77 Bit Masking (Setting, Clearing, and Inverting) Using Boolean Logical Functions ...... 77 Setting Groups of Bits with OR ...... 78 Clearing Bits with AND ...... 78 Inverting Bits with XOR ...... 79

ii Contents in Detail TCPIP_01TOC.fm Page iii Thursday, June 9, 2005 11:16 AM

PART I-2 THE OPEN SYSTEM INTERCONNECTION (OSI) REFERENCE MODEL

5 GENERAL OSI REFERENCE MODEL ISSUES AND CONCEPTS 83 History of the OSI Reference Model ...... 84 General Reference Model Issues ...... 85 The Benefits of Networking Models ...... 85 Why Understanding the OSI Reference Model Is Important to You ...... 86 How to Use the OSI Reference Model ...... 87 Other Network Architectures and Protocol Stacks ...... 88 Key OSI Reference Model Concepts ...... 89 OSI Reference Model Networking Layers, Sublayers, and Layer Groupings ...... 89 “N” Notation and Other OSI Model Layer Terminology ...... 91 Interfaces: Vertical (Adjacent Layer) Communication ...... 93 Protocols: Horizontal (Corresponding Layer) Communication ...... 95 Data Encapsulation, Protocol Data Units (PDUs), and Service Data Units (SDUs) ...... 97 Indirect Device Connection and Message Routing ...... 100

6 OSI REFERENCE MODEL LAYERS 103 Physical Layer (Layer 1) ...... 104 Data Link Layer (Layer 2) ...... 105 Network Layer (Layer 3) ...... 107 Transport Layer (Layer 4) ...... 108 Session Layer (Layer 5) ...... 111 Presentation Layer (Layer 6) ...... 112 Application Layer (Layer 7) ...... 113

7 OSI REFERENCE MODEL SUMMARY 115 Understanding the OSI Model: An Analogy ...... 115 Remembering the OSI Model Layers: Some Mnemonics ...... 118 Summarizing the OSI Model Layers: A Summary Chart ...... 119

PART I-3 TCP/IP PROTOCOL SUITE AND ARCHITECTURE

8 TCP/IP PROTOCOL SUITE AND ARCHITECTURE 123 TCP/IP Overview and History ...... 124 TCP/IP History and Development ...... 124 Important Factors in the Success of TCP/IP ...... 125 TCP/IP Services ...... 127 The TCP/IP Client/Server Structural Model ...... 127 Hardware and Software Roles ...... 129 Transactional Roles ...... 129 TCP/IP Architecture and the TCP/IP Model ...... 130

Contents in Detail iii TCPIP_01TOC.fm Page iv Thursday, June 9, 2005 11:16 AM

Network Interface Layer ...... 131 Internet Layer ...... 131 Host-to-Host Transport Layer ...... 132 Application Layer ...... 132 TCP/IP Protocols ...... 133

SECTION II TCP/IP LOWER-LAYER CORE PROTOCOLS

PART II-1 TCP/IP NETWORK INTERFACE LAYER PROTOCOLS

9 TCP/IP SERIAL LINE INTERNET PROTOCOL (SLIP) AND POINT-TO-POINT PROTOCOL PPP OVERVIEW AND FUNDAMENTALS 141 SLIP versus PPP ...... 142 Serial Line Internet Protocol (SLIP) ...... 143 SLIP Data Framing Method and General Operation ...... 143 Problems and Limitations of SLIP ...... 144 Point-to-Point Protocol (PPP) Overview and Fundamentals ...... 146 Development and Standardization ...... 146 Function and Architecture ...... 147 Advantages and Benefits ...... 147 PPP Main Components ...... 148 PPP Functional Groups ...... 149 General Operation ...... 149 PPP Link Setup and Phases ...... 150 PPP Standards ...... 153

10 PPP CORE PROTOCOLS: LINK CONTROL, NETWORK CONTROL, AND AUTHENTICATION 157 Link Control Protocol (LCP) ...... 157 LCP Packets ...... 158 LCP Link Configuration ...... 159 LCP Link Maintenance ...... 161 LCP Link Termination ...... 161 Other LCP Messages ...... 161 The Network Control Protocols (IPCP, IPXCP, NBFCP, and Others) ...... 161 Operation of NCPs ...... 162 The Internet Protocol Control Protocol (IPCP): An Example NCP ...... 164 PPP Authentication Protocols: PAP and CHAP ...... 164 PAP ...... 164 CHAP ...... 165

11 PPP FEATURE PROTOCOLS 169 PPP Link Quality Monitoring and Reporting (LQM, LQR) ...... 170 LQR Setup ...... 170

iv Contents in Detail TCPIP_01TOC.fm Page v Thursday, June 9, 2005 11:16 AM

Using Link Quality Reports ...... 171 PPP Compression Control Protocol (CCP) and Compression Algorithms ...... 171 CCP Operation: Compression Setup ...... 172 CCP Configuration Options and Compression Algorithms ...... 173 Compression Algorithm Operation: Compressing and Decompressing Data ...... 173 PPP Encryption Control Protocol (ECP) and Encryption Algorithms ...... 174 ECP Operation: Encryption Setup ...... 175 ECP Configuration Options and Encryption Algorithms ...... 175 Encryption Algorithm Operation: Encrypting and Decrypting Data ...... 176 PPP Multilink Protocol (MP, MLP, MLPPP) ...... 177 PPP Multilink Protocol Architecture ...... 178 PPP Multilink Protocol Setup and Configuration ...... 179 PPP Multilink Protocol Operation ...... 179 PPP Bandwidth Allocation Protocol (BAP) and Bandwidth Allocation Control Protocol (BACP) . 180 BACP Operation: Configuring the Use of BAP ...... 181 BAP Operation: Adding and Removing Links ...... 181

12 PPP PROTOCOL FRAME FORMATS 183 PPP General Frame Format ...... 184 Protocol Field Ranges ...... 185 Protocol Field Values ...... 186 PPP Field Compression ...... 187 PPP General Control Protocol Frame Format and Option Format ...... 188 PPP Control Messages and Code Values ...... 189 PPP Control Message Option Format ...... 190 Summary of PPP Control Message Formatting ...... 192 PPP Link Control Protocol (LCP) Frame Formats ...... 192 PAP and CHAP Frame Formats ...... 194 PPP PAP Control Frame Formats ...... 194 PPP CHAP Control Frame Formats ...... 196 PPP Multilink Protocol (MP) Frame Format ...... 197 PPP MP Frame Fragmentation Process ...... 198 PPP MP Fragment Frame Format ...... 198 PPP MP Fragmentation Demonstration ...... 200

PART II-2 TCP/IP NETWORK INTERFACE/INTERNET LAYER CONNECTION PROTOCOLS

13 ADDRESS RESOLUTION AND THE TCP/IP ADDRESS RESOLUTION PROTOCOL (ARP) 205 Address Resolution Concepts and Issues ...... 206 The Need for Address Resolution ...... 206 Address Resolution Through Direct Mapping ...... 208 Dynamic Address Resolution ...... 211 TCP/IP Address Resolution Protocol (ARP) ...... 214 ARP Address Specification and General Operation ...... 215 ARP Message Format ...... 218 ARP Caching ...... 220

Contents in Detail v TCPIP_01TOC.fm Page vi Thursday, June 9, 2005 11:16 AM

Proxy ARP ...... 223 TCP/IP Address Resolution for IP Multicast Addresses ...... 225 TCP/IP Address Resolution for IP Version 6 ...... 226

14 REVERSE ADDRESS RESOLUTION AND THE TCP/IP REVERSE ADDRESS RESOLUTION PROTOCOL (RARP) 229 The Reverse Address Resolution Protocol (RARP) ...... 230 RARP General Operation ...... 231 Limitations of RARP ...... 232

PART II-3 INTERNET PROTOCOL VERSION 4 (IP/IPV4)

15 INTERNET PROTOCOL VERSIONS: CONCEPTS AND OVERVIEW 237 IP Overview and Key Operational Characteristics ...... 238 IP Functions ...... 240 IP History, Standards, Versions, and Closely Related Protocols ...... 241 IP Versions and Version Numbers ...... 241 IP-Related Protocols ...... 242

16 IPV4 ADDRESSING CONCEPTS AND ISSUES 243 IP Addressing Overview and Fundamentals ...... 244 Number of IP Addresses Per Device ...... 245 Address Uniqueness and Network Specificity ...... 245 Contrasting IP Addresses and Data Link Layer Addresses ...... 246 Private and Public IP Network Addresses ...... 246 IP Address Configuration and Addressing Types ...... 246 IP Address Size, Address Space, and Notation ...... 247 IP Address Size and Binary Notation ...... 247 IP Address Dotted Decimal Notation ...... 247 IP Address Space ...... 248 IP Basic Address Structure and Main Components ...... 249 Network ID and Host ID ...... 249 Location of the Division Between Network ID and Host ID ...... 250 IP Addressing Categories and IP Address Adjuncts ...... 251 Conventional (Classful) Addressing ...... 252 Subnetted Classful Addressing ...... 252 Classless Addressing ...... 252 Subnet Mask and Default Gateway ...... 253 Number of IP Addresses and Multihoming ...... 253 IP Address Management and Assignment Methods and Authorities ...... 255

17 CLASSFUL (CONVENTIONAL) ADDRESSING 257 IP Classful Addressing Overview and Address Classes ...... 258 IP Address Classes ...... 258

vi Contents in Detail TCPIP_01TOC.fm Page vii Thursday, June 9, 2005 11:16 AM

Rationale for Classful Addressing ...... 259 IP Classful Addressing Network and Host Identification and Address Ranges ...... 260 Classful Addressing Class Determination Algorithm ...... 260 Determining Address Class from the First Octet Bit Pattern ...... 262 IP Address Class A, B, and C Network and Host Capacities ...... 264 IP Addresses with Special Meanings ...... 265 IP Reserved, Private, and Loopback Addresses ...... 267 Reserved Addresses ...... 267 Private, Unregistered, Nonroutable Addresses ...... 267 Loopback Addresses ...... 268 Reserved, Private, and Loopback Addressing Blocks ...... 269 IP Multicast Addressing ...... 270 Types and Ranges ...... 270 Well-Known Multicast Addresses ...... 271 Problems with Classful IP Addressing ...... 271

18 IP SUBNET ADDRESSING (SUBNETTING) CONCEPTS 275 IP Subnet Addressing Overview, Motivation, and Advantages ...... 276 IP Subnetting: Three-Level Hierarchical IP Subnet Addressing ...... 278 IP Subnet Masks, Notation, and Subnet Calculations ...... 279 Function of the Subnet Mask ...... 279 Subnet Mask Notation ...... 280 Applying the Subnet Mask: An Example ...... 281 Rationale for Subnet Mask Notation ...... 283 IP Default Subnet Masks for Address Classes A, B, and C ...... 283 IP Custom Subnet Masks ...... 285 Deciding How Many Subnet Bits to Use ...... 285 Determining the Custom Subnet Mask ...... 286 Subtracting Two from the Number of Hosts per Subnet and (Possibly) Subnets per Network ...... 288 IP Subnet Identifiers, Subnet Addresses, and Host Addresses ...... 289 Subnet Identifiers ...... 289 Subnet Addresses ...... 289 Host Addresses Within Each Subnet ...... 290 IP Subnetting Summary Tables for Class A, Class B, and Class C Networks ...... 291 IP Variable Length Subnet Masking (VLSM) ...... 294 The Solution: Variable Length Subnet Masking ...... 296 Multiple-Level Subnetting Using VLSM ...... 296

19 IP SUBNETTING PRACTICAL SUBNET DESIGN AND ADDRESS DETERMINATION EXAMPLE 299 IP Subnetting Step 1: Analyzing Requirements ...... 300 IP Subnetting Step 2: Partitioning Network Address Host Bits ...... 301 Class C Subnetting Design Example ...... 302 Class B Subnetting Design Example ...... 303 IP Subnetting Step 3: Determining the Custom Subnet Mask ...... 304 Calculating the Custom Subnet Mask ...... 305 Determining the Custom Subnet Mask Using Subnetting Tables ...... 307 IP Subnetting Step 4: Determining Subnet Identifiers and Subnet Addresses ...... 307 Class C Subnet ID and Address Determination Example ...... 308

Contents in Detail vii TCPIP_01TOC.fm Page viii Thursday, June 9, 2005 11:16 AM

Class B Subnet ID and Address Determination Example ...... 309 Using Subnet Address Formulas to Calculate Subnet Addresses ...... 311 IP Subnetting Step 5: Determining Host Addresses for Each Subnet ...... 312 Class C Host Address Determination Example ...... 312 Class B Host Address Determination Example ...... 315 Shortcuts for Computing Host Addresses ...... 315

20 IP CLASSLESS ADDRESSING—CLASSLESS INTER-DOMAIN ROUTING (CIDR)/SUPERNETTING 317 IP Classless Addressing and Supernetting Overview ...... 318 The Main Problem with Classful Addressing ...... 318 The Solution: Eliminate Address Classes ...... 319 The Many Benefits of Classless Addressing and Routing ...... 319 IP Supernetting: CIDR Hierarchical Addressing and Notation ...... 321 CIDR (Slash) Notation ...... 321 Supernetting: Subnetting the Internet ...... 322 Common Aspects of Classful and Classless Addressing ...... 323 IP Classless Addressing Block Sizes and Classful Network Equivalents ...... 324 IP CIDR Addressing Example ...... 326 First Level of Division ...... 326 Second Level of Division ...... 327 Third Level of Division ...... 329

21 INTERNET PROTOCOL DATAGRAM ENCAPSULATION AND FORMATTING 331 IP Datagram Encapsulation ...... 332 IP Datagram General Format ...... 334 IP Datagram Time to Live (TTL) Field ...... 337 IP Datagram Type of Service (TOS) Field ...... 337 IP Datagram Options and Option Format ...... 338

22 IP DATAGRAM SIZE, FRAGMENTATION, AND REASSEMBLY 341 IP Datagram Size, MTU, and Fragmentation Overview ...... 342 IP Datagram Size and the Underlying Network Frame Size ...... 342 MTU and Datagram Fragmentation ...... 343 Multiple-Stage Fragmentation ...... 344 Internet Minimum MTU: 576 Bytes ...... 345 MTU Path Discovery ...... 345 IP Message Fragmentation Process ...... 346 The IP Fragmentation Process ...... 346 Fragmentation-Related IP Datagram Header Fields ...... 348 IP Message Reassembly ...... 349

23 IP ROUTING AND MULTICASTING 353 IP Datagram Delivery ...... 354

viii Contents in Detail TCPIP_01TOC.fm Page ix Thursday, June 9, 2005 11:16 AM

Direct Datagram Delivery ...... 355 Indirect Datagram Delivery (Routing) ...... 355 The Relationship Between Datagram Routing and Addressing ...... 356 IP Routing Concepts and the Process of Next-Hop Routing ...... 357 IP Routes and Routing Tables ...... 359 IP Routing in a Subnet or Classless Addressing (CIDR) Environment ...... 361 IP Multicasting ...... 362 Multicast Addressing ...... 363 Multicast Group Management ...... 363 Multicast Datagram Processing and Routing ...... 363

PART II-4 INTERNET PROTOCOL VERSION 6 (IPV6)

24 IPV6 OVERVIEW, CHANGES, AND TRANSITION 367 IPv6 Motivation and Overview ...... 368 IPv6 Standards ...... 368 Design Goals of IPv6 ...... 369 Major Changes and Additions in IPv6 ...... 370 Transition from IPv4 to IPv6 ...... 372 IPv4 to IPv6 Transition: Differences of Opinion ...... 372 IPv4 to IPv6 Transition Methods ...... 373

25 IPV6 ADDRESSING 375 IPv6 Addressing Overview: Addressing Model, Address Types, and Address Size ...... 376 IPv6 Addressing Model Characteristics ...... 376 IPv6 Supported Address Types ...... 377 IPv6 Address Size and Address Space ...... 378 IPv6 Address and Address Notation and Prefix Representation ...... 380 IPv6 Address Hexadecimal Notation ...... 380 Zero Compression in IPv6 Addresses ...... 381 IPv6 Mixed Notation ...... 382 IPv6 Address Prefix Length Representation ...... 383 IPv6 Address Space Allocation ...... 383 IPv6 Global Unicast Address Format ...... 385 Rationale for a Structured Unicast Address Block ...... 385 Generic Division of the Unicast Address Space ...... 386 IPv6 Implementation of the Unicast Address Space ...... 386 Original Division of the Global Routing Prefix: Aggregators ...... 387 A Sample Division of the Global Routing Prefix into Levels ...... 388 IPv6 Interface Identifiers and Physical Address Mapping ...... 390 IPv6 Special Addresses: Reserved, Private, Unspecified, and Loopback ...... 391 Special Address Types ...... 392 IPv6 Private Addresses Type Scopes ...... 393 IPv6/IPv4 Address Embedding ...... 394 IPv6 Multicast and Anycast Addressing ...... 396 IPv6 Multicast Addresses ...... 396 IPv6 Anycast Addresses ...... 400 IPv6 Autoconfiguration and Renumbering ...... 400 IPv6 Stateless Autoconfiguration ...... 401

Contents in Detail ix TCPIP_01TOC.fm Page x Thursday, June 9, 2005 11:16 AM

IPv6 Device Renumbering ...... 402

26 IPV6 DATAGRAM ENCAPSULATION AND FORMATTING 403 IPv6 Datagram Overview and General Structure ...... 404 IPv6 Datagram Main Header Format ...... 406 IPv6 Next Header Field ...... 407 Key Changes to the Main Header Between IPv4 and IPv6 ...... 408 IPv6 Datagram Extension Headers ...... 409 IPv6 Header Chaining Using the Next Header Field ...... 409 Summary of IPv6 Extension Headers ...... 411 IPv6 Routing Extension Header ...... 412 IPv6 Fragment Extension Header ...... 413 IPv6 Extension Header Order ...... 413 IPv6 Datagram Options ...... 414

27 IPV6 DATAGRAM SIZE, FRAGMENTATION, REASSEMBLY, AND ROUTING 417 Overview of IPv6 Datagram Sizing and Fragmentation ...... 418 Implications of IPv6’s Source-Only Fragmentation Rule ...... 419 The IPv6 Fragmentation Process ...... 420 IPv6 Datagram Delivery and Routing ...... 422

PART II-5 IP-RELATED FEATURE PROTOCOLS

28 IP NETWORK ADDRESS TRANSLATION (NAT) PROTOCOL 427 IP NAT Overview ...... 428 Advantages of IP NAT ...... 430 Disadvantages of IP NAT ...... 431 IP NAT Address Terminology ...... 432 IP NAT Static and Dynamic Address Mappings ...... 435 Static Mappings ...... 435 Dynamic Mappings ...... 435 Choosing Between Static and Dynamic Mapping ...... 435 IP NAT Unidirectional (Traditional/Outbound) Operation ...... 436 IP NAT Bidirectional (Two-Way/Inbound) Operation ...... 439 IP NAT Port-Based (Overloaded) Operation ...... 442 IP NAT Overlapping/Twice NAT Operation ...... 445 IP NAT Compatibility Issues and Special Handling Requirements ...... 449

29 IP SECURITY (IPSEC) PROTOCOLS 451 IPsec Overview, History, and Standards ...... 452 Overview of IPsec Services and Functions ...... 453 IPsec Standards ...... 453 IPsec General Operation, Components, and Protocols ...... 454

x Contents in Detail TCPIP_01TOC.fm Page xi Thursday, June 9, 2005 11:16 AM

IPsec Core Protocols ...... 455 IPsec Support Components ...... 455 IPsec Architectures and Implementation Methods ...... 456 Integrated Architecture ...... 457 Bump in the Stack (BITS) Architecture ...... 457 Bump in the Wire (BITW) Architecture ...... 458 IPsec Modes: Transport and Tunnel ...... 459 Transport Mode ...... 459 Tunnel Mode ...... 459 Comparing Transport and Tunnel Modes ...... 459 IPsec Security Constructs ...... 462 Security Policies, Security Associations, and Associated Databases ...... 462 Selectors ...... 463 Security Association Triples and Security Parameter Index (SPI) ...... 463 IPsec Authentication Header (AH) ...... 463 AH Datagram Placement and Linking ...... 464 AH Format ...... 467 IPsec Encapsulating Security Payload (ESP) ...... 468 ESP Fields ...... 468 ESP Operations and Field Use ...... 469 ESP Format ...... 472 IPsec Internet Key Exchange (IKE) ...... 473 IKE Overview ...... 474 IKE Operation ...... 474

30 INTERNET PROTOCOL MOBILITY SUPPORT (MOBILE IP) 477 Mobile IP Overview, History, and Motivation ...... 478 The Problem with Mobile Nodes in TCP/IP ...... 478 The Solution: Mobile IP ...... 480 Limitations of Mobile IP ...... 481 Mobile IP Concepts and General Operation ...... 482 Mobile IP Device Roles ...... 483 Mobile IP Functions ...... 484 Mobile IP Addressing: Home and Care-Of Addresses ...... 485 Foreign Agent Care-Of Address ...... 486 Mobile IP Agent Discovery ...... 488 Agent Discovery Process ...... 488 Agent Advertisement and Agent Solicitation Messages ...... 488 Mobile IP Home Agent Registration and Registration Messages ...... 493 Mobile Node Registration Events ...... 493 Registration Request and Registration Reply Messages ...... 493 Registration Process ...... 494 Registration Request Message Format ...... 495 Registration Reply Message Format ...... 497 Mobile IP Data Encapsulation and Tunneling ...... 497 Mobile IP Conventional Tunneling ...... 498 Mobile IP Reverse Tunneling ...... 500 Mobile IP and TCP/IP Address Resolution Protocol (ARP) Operation ...... 500 Mobile IP Efficiency Issues ...... 502 Mobile IP Security Considerations ...... 505

Contents in Detail xi TCPIP_01TOC.fm Page xii Thursday, June 9, 2005 11:16 AM

PART II-6 IP SUPPORT PROTOCOLS

31 ICMP CONCEPTS AND GENERAL OPERATION 509 ICMP Overview, History, Versions, and Standards ...... 510 ICMP General Operation ...... 512 The ICMP Message-Passing Service ...... 512 ICMP Error-Reporting Limited to the Datagram Source ...... 513 ICMP Message Classes, Types, and Codes ...... 514 ICMP Message Classes ...... 514 ICMP Message Types ...... 514 ICMP Message Codes ...... 515 ICMP Message Class and Type Summary ...... 515 ICMP Message Creation and Processing Conventions and Rules ...... 517 Limitations on ICMP Message Responses ...... 518 ICMP Message Processing Conventions ...... 519 ICMP Common Message Format and Data Encapsulation ...... 520 ICMP Common Message Format ...... 520 Original Datagram Inclusion in ICMP Error Messages ...... 521 ICMP Data Encapsulation ...... 522

32 ICMPV4 ERROR MESSAGE TYPES AND FORMATS 523 ICMPv4 Destination Unreachable Messages ...... 524 ICMPv4 Destination Unreachable Message Format ...... 524 ICMPv4 Destination Unreachable Message Subtypes ...... 525 Interpretation of Destination Unreachable Messages ...... 526 ICMPv4 Source Quench Messages ...... 527 ICMPv4 Source Quench Message Format ...... 528 Problems with Source Quench Messages ...... 528 ICMPv4 Time Exceeded Messages ...... 529 ICMPv4 Time Exceeded Message Format ...... 530 Applications of Time Exceeded Messages ...... 531 ICMPv4 Redirect Messages ...... 532 ICMPv4 Redirect Message Format ...... 533 Redirect Message Interpretation Codes ...... 534 Limitations of Redirect Messages ...... 535 ICMPv4 Parameter Problem Messages ...... 535 ICMPv4 Parameter Problem Message Format ...... 536 Parameter Problem Message Interpretation Codes and the Pointer Field ...... 536

33 ICMPV4 INFORMATIONAL MESSAGE TYPES AND FORMATS 539 ICMPv4 Echo (Request) and Echo Reply Messages ...... 540 ICMPv4 Echo and Echo Reply Message Format ...... 540 Application of Echo and Echo Reply Messages ...... 541 ICMPv4 Timestamp (Request) and Timestamp Reply Messages ...... 541 ICMPv4 Timestamp and Timestamp Reply Message Format ...... 542 Issues Using Timestamp and Timestamp Reply Messages ...... 543

xii Contents in Detail TCPIP_01TOC.fm Page xiii Thursday, June 9, 2005 11:16 AM

ICMPv4 Advertisement and Router Solicitation Messages ...... 543 The Router Discovery Process ...... 544 ICMPv4 Router Advertisement Message Format ...... 544 ICMPv4 Router Solicitation Message Format ...... 546 Addressing and Use of Router Advertisement and Router Solicitation Messages ...... 546 ICMPv4 Address Mask Request and Reply Messages ...... 547 ICMPv4 Address Mask Request and Address Mask Reply Message Format ...... 547 Use of Address Mask Request and Address Mask Reply Messages ...... 548 ICMPv4 Traceroute Messages ...... 548 ICMPv4 Traceroute Message Format ...... 549 Use of Traceroute Messages ...... 550

34 ICMPV6 ERROR MESSAGE TYPES AND FORMATS 551 ICMPv6 Destination Unreachable Messages ...... 552 ICMPv6 Destination Unreachable Message Format ...... 552 ICMPv6 Destination Unreachable Message Subtypes ...... 553 Processing of Destination Unreachable Messages ...... 554 ICMPv6 Packet Too Big Messages ...... 554 ICMPv6 Packet Too Big Message Format ...... 555 Applications of Packet Too Big Messages ...... 555 ICMPv6 Time Exceeded Messages ...... 556 ICMPv6 Time Exceeded Message Format ...... 557 Applications of Time Exceeded Messages ...... 558 ICMPv6 Parameter Problem Messages ...... 558 ICMPv6 Parameter Problem Message Format ...... 559 Parameter Problem Message Interpretation Codes and the Pointer Field ...... 559

35 ICMPV6 INFORMATIONAL MESSAGE TYPES AND FORMATS 561 ICMPv6 Echo Request and Echo Reply Messages ...... 562 ICMPv6 Echo and Echo Reply Message Format ...... 562 Application of Echo and Echo Reply Messages ...... 563 ICMPv6 Router Advertisement and Router Solicitation Messages ...... 564 ICMPv6 Router Advertisement Message Format ...... 564 ICMPv6 Router Solicitation Message Format ...... 566 Addressing of Router Advertisement and Router Solicitation Messages ...... 566 ICMPv6 Neighbor Advertisement and Neighbor Solicitation Messages ...... 567 ICMPv6 Neighbor Advertisement Message Format ...... 567 ICMPv4 Neighbor Solicitation Message Format ...... 568 Addressing of Neighbor Advertisement and Neighbor Solicitation Messages ...... 570 ICMPv6 Redirect Messages ...... 570 ICMPv6 Redirect Message Format ...... 570 Application of Redirect Messages ...... 571 ICMPv6 Router Renumbering Messages ...... 572 IPv6 Router Renumbering ...... 572 ICMPv6 Router Renumbering Message Format ...... 573 Addressing of Router Renumbering Messages ...... 574 ICMPv6 Informational Message Options ...... 574 Source Link-Layer Address Option Format ...... 575 Target Link-Layer Address Option Format ...... 576 Prefix Information Option Format ...... 576

Contents in Detail xiii TCPIP_01TOC.fm Page xiv Thursday, June 9, 2005 11:16 AM

Redirected Header Option Format ...... 578 MTU Option Format ...... 579

36 IPV6 NEIGHBOR DISCOVERY (ND) PROTOCOL 581 IPv6 ND Overview ...... 582 Formalizing Local Network Functions: The Neighbor Concept ...... 583 Neighbor Discovery Standards ...... 583 IPv6 ND General Operational Overview ...... 584 Host-Router Discovery Functions ...... 585 Host-Host Communication Functions ...... 585 Redirect Function ...... 585 Relationships Between Functions ...... 586 ICMPv6 Messages Used by ND ...... 586 IPv6 ND Functions Compared to Equivalent IPv4 Functions ...... 586 IPv6 ND Host-Router Discovery Functions ...... 588 Host-Router Discovery Functions Performed by Routers ...... 588 Host-Router Discovery Functions Performed by Hosts ...... 589 IPv6 ND Host-Host Communication Functions ...... 589 Next-Hop Determination ...... 590 Address Resolution ...... 590 Updating Neighbors Using Neighbor Advertisement Messages ...... 591 Neighbor Unreachability Detection and the Neighbor Cache ...... 591 Duplicate Address Detection ...... 592 IPv6 ND Redirect Function ...... 592

PART II-7 TCP/IP ROUTING PROTOCOLS (GATEWAY PROTOCOLS)

37 OVERVIEW OF KEY ROUTING PROTOCOL CONCEPTS 597 Routing Protocol Architectures ...... 597 Core Architecture ...... 598 Autonomous System (AS) Architecture ...... 598 Modern Protocol Types: Interior and Exterior Routing Protocols ...... 599 Routing Protocol Algorithms and Metrics ...... 600 Distance-Vector (Bellman-Ford) Routing Protocol Algorithm ...... 600 Link-State (Shortest Path First) Routing Protocol Algorithm ...... 601 Hybrid Routing Protocol Algorithms ...... 601 Static and Dynamic Routing Protocols ...... 601

38 ROUTING INFORMATION PROTOCOL (RIP, RIP-2, AND RIPNG) 603 RIP Overview ...... 604 RIP Standardization ...... 604 RIP Operational Overview, Advantages, and Limitations ...... 605 Development of RIP Version 2 (RIP-2) and RIPng for IPv6 ...... 606 RIP Route Determination Algorithm and Metric ...... 606 RIP Routing Information and Route Distance Metric ...... 606 RIP Route Determination Algorithm ...... 607

xiv Contents in Detail TCPIP_01TOC.fm Page xv Thursday, June 9, 2005 11:16 AM

RIP Route Determination and Information Propagation ...... 607 Default Routes ...... 610 RIP General Operation, Messaging, and Timers ...... 610 RIP Messages and Basic Message Types ...... 610 RIP Update Messaging and the 30-Second Timer ...... 611 Preventing Stale Information: The Timeout Timer ...... 611 Removing Stale Information: The Garbage-Collection Timer ...... 612 Triggered Updates ...... 612 RIP Problems and Some Resolutions ...... 612 Issues with RIP’s Algorithm ...... 613 Issues with RIP’s Metric ...... 616 RIP Special Features for Resolving RIP Algorithm Problems ...... 617 RIP Version-Specific Message Formats and Features ...... 620 RIP Version 1 (RIP-1) Message Format and Features ...... 620 RIP Version 2 (RIP-2) Message Format and Features ...... 623 RIPng (RIPv6) Message Format and Features ...... 626

39 OPEN SHORTEST PATH FIRST (OSPF) 631 OSPF Overview ...... 632 Development and Standardization of OSPF ...... 632 Overview of OSPF Operation ...... 633 OSPF Features and Drawbacks ...... 633 OSPF Basic Topology and the Link-State Database ...... 634 OSPF Basic Topology ...... 634 LSDB Information Storage and Propagation ...... 635 OSPF Hierarchical Topology ...... 636 OSPF Areas ...... 636 Router Roles in OSPF Hierarchical Topology ...... 637 OSPF Route Determination Using SPF Trees ...... 639 The SPF Tree ...... 639 OSPF Route Determination ...... 640 OSPF General Operation ...... 643 OSPF Message Types ...... 644 OSPF Messaging ...... 644 OSPF Message Authentication ...... 645 OSPF Message Formats ...... 645 OSPF Common Header Format ...... 645 OSPF Hello Message Format ...... 647 OSPF Database Description Message Format ...... 647 OSPF Link State Request Message Format ...... 649 OSPF Link State Update Message Format ...... 649 OSPF Link State Acknowledgment Message Format ...... 650 OSPF Link State Advertisements and the LSA Header Format ...... 650

40 BORDER GATEWAY PROTOCOL (BGP/BGP-4) 653 BGP Overview ...... 654 BGP Versions and Defining Standards ...... 655 Overview of BGP Functions and Features ...... 656 BGP Topology ...... 657 BGP Speakers, Router Roles, Neighbors, and Peers ...... 658

Contents in Detail xv TCPIP_01TOC.fm Page xvi Thursday, June 9, 2005 11:16 AM

BGP AS Types, Traffic Flows, and Routing Policies ...... 659 BGP Route Storage and Advertisement ...... 662 BGP Route Information Management Functions ...... 662 BGP Routing Information Bases (RIBs) ...... 662 BGP Path Attributes and Algorithm Overview ...... 663 BGP Path Attribute Classes ...... 664 BGP Path Attribute Characteristics ...... 665 BGP Route Determination and the BGP Decision Process ...... 666 BGP Decision Process Phases ...... 666 Criteria for Assigning Preferences to Routes ...... 666 Limitations on BGP’s Ability to Select Efficient Routes ...... 667 Originating New Routes and Withdrawing Unreachable Routes ...... 668 BGP General Operation and Messaging ...... 668 Speaker Designation and Connection Establishment ...... 668 Route Information Exchange ...... 669 Connectivity Maintenance ...... 669 Error Reporting ...... 669 BGP Detailed Messaging, Operation, and Message Formats ...... 670 BGP Message Generation and Transport ...... 670 BGP General Message Format ...... 670 BGP Connection Establishment: Open Messages ...... 672 BGP Route Information Exchange: Update Messages ...... 674 BGP Connectivity Maintenance: Keepalive Messages ...... 677 BGP Error Reporting: Notification Messages ...... 680

41 OTHER INTERIOR ROUTING PROTOCOLS 685 TCP/IP Gateway-to-Gateway Protocol (GGP) ...... 686 The HELLO Protocol (HELLO) ...... 687 Interior Gateway Routing Protocol (IGRP) ...... 689 Enhanced Interior Gateway Routing Protocol (EIGRP) ...... 691 TCP/IP Exterior Gateway Protocol (EGP) ...... 692

PART II-8 TCP/IP TRANSPORT LAYER PROTOCOLS

42 OVERVIEW AND COMPARISON OF TCP AND UDP 697 Two Protocols for TCP/IP Transport Layer Requirements ...... 698 Applications of TCP and UDP ...... 699 TCP Applications ...... 699 UDP Applications ...... 700 Summary Comparison of UDP and TCP ...... 700

43 TCP AND UDP ADDRESSING: PORTS AND SOCKETS 703 TCP/IP Processes, Multiplexing, and Client/Server Application Roles ...... 704 Multiplexing and Demultiplexing ...... 704 TCP/IP Client Processes and Server Processes ...... 705 TCP/IP Ports: TCP/UDP Addressing ...... 707

xvi Contents in Detail TCPIP_01TOC.fm Page xvii Thursday, June 9, 2005 11:16 AM

Multiplexing and Demultiplexing Using Ports ...... 707 Source Port and Destination Port Numbers ...... 707 Summary of Port Use for Datagram Transmission and Reception ...... 709 TCP/IP Application Assignments and Server Port Number Ranges ...... 709 Reserved Port Numbers ...... 710 TCP/UDP Port Number Ranges ...... 710 TCP/IP Client (Ephemeral) Ports and Client/Server Application Port Use ...... 711 Ephemeral Port Number Assignment ...... 712 Ephemeral Port Number Ranges ...... 713 Port Number Use During a Client/Server Exchange ...... 713 TCP/IP Sockets and Socket Pairs: Process and Connection Identification ...... 714 Common TCP/IP Applications and Well-Known and Registered Port Numbers ...... 715

44 TCP/IP USER DATAGRAM PROTOCOL (UDP) 719 UDP Overview, History, and Standards ...... 720 UDP Operation ...... 721 What UDP Does ...... 721 What UDP Does Not Do ...... 721 UDP Message Format ...... 722 UDP Common Applications and Server Port Assignments ...... 724 Why Some TCP/IP Applications Use UDP ...... 725 Common UDP Applications and Server Port Use ...... 726 Applications That Use Both UDP and TCP ...... 727

45 TCP OVERVIEW, FUNCTIONS, AND CHARACTERISTICS 729 TCP Overview, History, and Standards ...... 730 TCP History ...... 730 Overview of TCP Operation ...... 731 TCP Standards ...... 731 TCP Functions ...... 732 Functions That TCP Performs ...... 733 Functions That TCP Doesn’t Perform ...... 733 TCP Characteristics ...... 734 The Robustness Principle ...... 736

46 TRANSMISSION CONTROL PROTOCOL (TCP) FUNDAMENTALS AND GENERAL OPERATION 737 TCP Data Handling and Processing ...... 738 Increasing the Flexibility of Application Data Handling: TCP’s Stream Orientation ...... 738 TCP Data Packaging: Segments ...... 738 TCP Data Identification: Sequence Numbers ...... 739 The Need for Application Data Delimiting ...... 741 TCP Sliding Window Acknowledgment System ...... 741 The Problem with Unreliable Protocols: Lack of Feedback ...... 742 Providing Basic Reliability Using Positive Acknowledgment with Retransmission (PAR) ...... 742 Improving PAR ...... 744

Contents in Detail xvii TCPIP_01TOC.fm Page xviii Thursday, June 9, 2005 11:16 AM

TCP’s Stream-Oriented Sliding Window Acknowledgment System ...... 744 More Information on TCP Sliding Windows ...... 750 TCP Ports, Connections, and Connection Identification ...... 751 TCP Common Applications and Server Port Assignments ...... 752

47 TCP BASIC OPERATION: CONNECTION ESTABLISHMENT, MANAGEMENT, AND TERMINATION 755 TCP Operational Overview and the TCP Finite State Machine (FSM) ...... 756 Basic FSM Concepts ...... 756 The Simplified TCP FSM ...... 757 TCP Connection Preparation ...... 760 Storing Connection Data: The Transmission Control Block (TCB) ...... 761 Active and Passive OPENs ...... 761 Preparation for Connection ...... 762 TCP Connection Establishment Process: The Three-Way Handshake ...... 762 Connection Establishment Functions ...... 762 Control Messages Used for Connection Establishment: SYN and ACK ...... 763 Normal Connection Establishment: The Three-Way Handshake ...... 763 Simultaneous Open Connection Establishment ...... 765 TCP Connection Establishment Sequence Number Synchronization and Parameter Exchange ...... 767 Initial Sequence Number Selection ...... 767 TCP Sequence Number Synchronization ...... 768 TCP Parameter Exchange ...... 769 TCP Connection Management and Problem Handling ...... 770 The TCP Reset Function ...... 770 Handling Reset Segments ...... 771 Idle Connection Management and Keepalive Messages ...... 771 TCP Connection Termination ...... 772 Requirements and Issues In Connection Termination ...... 772 Normal Connection Termination ...... 773 The TIME-WAIT State ...... 775 Simultaneous Connection Termination ...... 776

48 TCP MESSAGE FORMATTING AND DATA TRANSFER 779 TCP Message (Segment) Format ...... 780 TCP Checksum Calculation and the TCP Pseudo Header ...... 784 Detecting Transmission Errors Using Checksums ...... 784 Increasing the Scope of Detected Errors: The TCP Pseudo Header ...... 784 Advantages of the Pseudo Header Method ...... 786 TCP Maximum Segment Size (MSS) ...... 787 MSS Selection ...... 788 TCP Default MSS ...... 788 Nondefault MSS Value Specification ...... 789 TCP Sliding Window Data Transfer and Acknowledgment Mechanics ...... 790 Sliding Window Transmit and Receive Categories ...... 790 Send (SND) and Receive (RCV) Pointers ...... 791 TCP Segment Fields Used to Exchange Pointer Information ...... 793 An Example of TCP Sliding Window Mechanics ...... 794 Real-World Complications of the Sliding Window Mechanism ...... 797

xviii Contents in Detail TCPIP_01TOC.fm Page xix Thursday, June 9, 2005 11:16 AM

TCP Immediate Data Transfer: Push Function ...... 799 TCP Priority Data Transfer: Urgent Function ...... 800

49 TCP RELIABILITY AND FLOW-CONTROL FEATURES 803 TCP Segment Retransmission Timers and the Retransmission Queue ...... 804 Managing Retransmissions Using the Retransmission Queue ...... 804 Recognizing When a Segment Is Fully Acknowledged ...... 805 TCP Noncontiguous Acknowledgment Handlingand Selective Acknowledgment (SACK) ...... 808 Policies for Dealing with Outstanding Unacknowledged Segments ...... 809 A Better Solution: Selective Acknowledgment (SACK) ...... 811 TCP Adaptive Retransmission and Retransmission Timer Calculations ...... 813 Adaptive Retransmission Based on RTT Calculations ...... 813 Acknowledgment Ambiguity ...... 814 Refinements to RTT Calculation and Karn’s Algorithm ...... 814 TCP Window Size Adjustment and Flow Control ...... 815 Reducing Send Window Size to Reduce the Rate Data Is Sent ...... 816 Reducing Send Window Size to Stop the Sending of New Data ...... 818 Closing the Send Window ...... 818 TCP Window-Management Issues ...... 819 Problems Associated with Shrinking the TCP Window ...... 819 Reducing Buffer Size Without Shrinking the Window ...... 820 Handling a Closed Window and Sending Probe Segments ...... 821 TCP Silly Window Syndrome ...... 822 How Silly Window Syndrome Occurs ...... 822 Silly Window Syndrome Avoidance Algorithms ...... 825 TCP Congestion Handling and Congestion Avoidance Algorithms ...... 826 Congestion Considerations ...... 827 TCP Congestion-Handling Mechanisms ...... 828

SECTION III TCP/IP APPLICATION LAYER PROTOCOLS

PART III-1 NAME SYSTEMS AND TCP/IP NAME REGISTRATION AND NAME RESOLUTION

50 NAME SYSTEM ISSUES, CONCEPTS, AND TECHNIQUES 835 Name System Overview ...... 836 Symbolic Names for Addressing ...... 836 A Paradox: Name Systems Are Both Essential and Unnecessary ...... 836 Basic Name System Functions: Name Space, Name Registration, and Name Resolution 839 Name Spaces and Name Architectures ...... 841 Name Space Functions ...... 841 Flat Name Architecture (Flat Name Space) ...... 842 Hierarchical Name Architecture ...... 842 Comparing Name Architectures ...... 843 Name Registration Methods, Administration, and Authorities ...... 844 Name Registration Functions ...... 844 Hierarchical Name Registration ...... 845

Contents in Detail xix TCPIP_01TOC.fm Page xx Thursday, June 9, 2005 11:16 AM

Name Registration Methods ...... 845 Name Resolution Techniques and Elements ...... 846 Name Resolution Methods ...... 847 Client/Server Resolution Functional Elements ...... 848 Efficiency, Reliability, and Other Name Resolution Considerations ...... 848 Efficiency Considerations ...... 849 Reliability Considerations ...... 849 Other Considerations ...... 850

51 TCP/IP NAME SYSTEMS OVERVIEW AND THE HOST TABLE NAME SYSTEM 851 A Brief History of TCP/IP Host Names and Name Systems ...... 852 Developing the First Name System: ARPAnet Host Name Lists ...... 852 Storing Host Names in a Host Table File ...... 852 Outgrowing the Host Table Name System and Moving to DNS ...... 853 The TCP/IP Host Table Name System ...... 853 Host Table Name Resolution ...... 854 Host Table Name Registration ...... 854 Weaknesses of the Host Table Name System ...... 855 Use of the Host Table Name System in Modern Networking ...... 856

52 DOMAIN NAME SYSTEM (DNS) OVERVIEW, FUNCTIONS, AND CHARACTERISTICS 857 DNS Overview, History, and Standards ...... 858 Early DNS Development and the Move to Hierarchical Domains ...... 858 Standardization of DNS and Initial Defining Standards ...... 859 DNS Evolution and Important Additional Standards ...... 860 DNS Adaptation for Internet Protocol Version 6 ...... 860 DNS Design Goals, Objectives, and Assumptions ...... 861 DNS Design Goals and Objectives ...... 861 DNS Design Assumptions ...... 862 DNS Components and General Functions ...... 863 DNS Name Space ...... 863 Name Registration (Including Administration and Authorities) ...... 864 Name Resolution ...... 864

53 DNS NAME SPACE, ARCHITECTURE, AND TERMINOLOGY 867 DNS Domains and the DNS Hierarchical Name Architecture ...... 868 The Essential Concept in the DNS Name Space: Domains ...... 868 The DNS Hierarchical Tree Structure of Names ...... 868 DNS Structural Elements and Terminology ...... 870 DNS Tree-Related Terminology ...... 870 DNS Domain-Related Terminology ...... 870 DNS Family-Related Terminology ...... 871 DNS Labels, Names, and Syntax Rules ...... 873 DNS Labels and Label Syntax Rules ...... 873 Domain Name Construction ...... 874 Absolute (Fully Qualified) and Relative (Partially Qualified) Domain Name Specifications .....875

xx Contents in Detail TCPIP_01TOC.fm Page xxi Thursday, June 9, 2005 11:16 AM

Fully Qualified Domain Names ...... 875 Partially Qualified Domain Names ...... 876

54 DNS NAME REGISTRATION, PUBLIC ADMINISTRATION, ZONES, AND AUTHORITIES 877 DNS Hierarchical Authority Structure and the Distributed Name Database ...... 878 The DNS Root Domain Central Authority ...... 878 TLD Authorities ...... 879 Lower-Level Authority Delegation ...... 879 Authority Hierarchy’s Relationship to the Name Hierarchy ...... 879 The DNS Distributed Name Database ...... 880 DNS Organizational (Generic) TLDs and Authorities ...... 880 Original Generic TLDs ...... 881 New Generic TLDs ...... 881 DNS Geopolitical (Country Code) TLDs and Authorities ...... 884 Country Code Designations ...... 884 Country Code TLD Authorities ...... 885 Leasing/Sale of Country Code Domains ...... 885 Drawbacks of the Geopolitical TLDs ...... 886 Public Registration for Second-Level and Lower Domains ...... 886 Registration Authority ...... 887 Registration Coordination ...... 888 DNS Public Registration Disputes and Dispute Resolution ...... 888 Public Registration Disputes ...... 888 Methods of Registration Dispute Resolution ...... 890 The Uniform Domain Name Dispute Resolution Policy ...... 890 DNS Name Space Administrative Hierarchy Partitioning: DNS Zones of Authority ...... 891 Methods of Dividing a Name Space into Zones of Authority ...... 892 The Impact of Zones on Name Resolution: Authoritative Servers ...... 892 DNS Private Name Registration ...... 894 Using Publicly Accessible Private Names ...... 894 Using Private Names for Internal Use ...... 895 Using Private Names on Networks Not Connected to the Internet ...... 895

55 DNS NAME SERVER CONCEPTS AND OPERATION 897 DNS General Operation ...... 898 DNS Name Server Architecture and the Distributed Name Database ...... 898 DNS Server Support Functions ...... 899 The Logical Nature of the DNS Name Server Hierarchy ...... 900 DNS Name Server Data Storage ...... 900 Binary and Text Representations of Resource Records (RRs) ...... 900 Use of RRs and Master Files ...... 901 Common RR Types ...... 902 RR Classes ...... 903 DNS Name Server Types and Roles ...... 903 Master (Primary)/Slave (Secondary) Servers ...... 903 Name Server Roles ...... 905 Caching-Only Name Servers ...... 905 DNS Zone Management, Contacts, and Zone Transfers ...... 905 Domain Contacts ...... 906

Contents in Detail xxi TCPIP_01TOC.fm Page xxii Thursday, June 9, 2005 11:16 AM

Zone Transfers ...... 906 DNS Root Name Servers ...... 909 Root Name Server Redundancy ...... 909 Current Root Name Servers ...... 910 DNS Name Server Caching ...... 911 Name Server Caching ...... 912 Caching Data Persistence and the Time to Live Interval ...... 912 Negative Caching ...... 914 DNS Name Server Load Balancing ...... 914 Using Multiple Address Records to Spread Out Requests to a Domain ...... 914 Using Multiple DNS Servers to Spread Out DNS Requests ...... 915 DNS Name Server Enhancements ...... 915 Automating Zone Transfers: DNS Notify ...... 916 Improving Zone Transfer Efficiency: Incremental Transfers ...... 917 Dealing with Dynamic IP Addresses: DNS Update/Dynamic DNS ...... 917

56 DNS RESOLUTION CONCEPTS AND RESOLVER OPERATIONS 919 DNS Resolver Functions and General Operation ...... 920 Name Resolution Services ...... 920 Functions Performed by Name Resolvers ...... 920 DNS Name Resolution Techniques: Iterative and Recursive Resolution ...... 922 Iterative Resolution ...... 923 Recursive Resolution ...... 924 Contrasting Iterative and Recursive Resolution ...... 924 DNS Name Resolution Efficiency Improvements: Caching and Local Resolution ...... 925 The Motivation for Caching: Locality of Reference ...... 926 Name Resolver Caching ...... 926 Local Resolution ...... 927 DNS Name Resolution Process ...... 928 A Simple Example of DNS Name Resolution ...... 928 Changes to Resolution to Handle Aliases (CNAME Records) ...... 930 DNS Reverse Name Resolution Using the IN-ADDR.ARPA Domain ...... 931 The Original Method: Inverse Querying ...... 931 The IN-ADDR.ARPA Name Structure for Reverse Resolution ...... 932 RR Setup for Reverse Resolution ...... 932 DNS Electronic Mail Support and Mail Exchange (MX) ResourceRecords ...... 934 Special Requirements for Email Name Resolution ...... 935 The Mail Exchange (MX) Record and Its Use ...... 935

57 DNS MESSAGING AND MESSAGE, RESOURCE RECORD, AND MASTER FILE FORMATS 937 DNS Message Generation and Transport ...... 938 DNS Client/Server Messaging Overview ...... 938 DNS Message Transport Using UDP and TCP ...... 939 DNS Message Processing and General Message Format ...... 940 DNS Message Header Format ...... 942 DNS Question Section Format ...... 945 DNS Message Resource Record Field Formats ...... 945 DNS Common RR Format ...... 946 RData Field Formats for Common RRs ...... 946

xxii Contents in Detail TCPIP_01TOC.fm Page xxiii Thursday, June 9, 2005 11:16 AM

DNS Name Notation and Message Compression ...... 950 Standard DNS Name Notation ...... 950 DNS Electronic Mail Address Notation ...... 951 DNS Message Compression ...... 951 DNS Master File Format ...... 953 DNS Common Master File Record Format ...... 954 Use and Interpretation of Partially Qualified Domain Names (PQDNs) ...... 954 Master File Directives ...... 955 Syntax Rules for Master Files ...... 955 Specific RR Syntax and Examples ...... 956 Sample Master File ...... 958 DNS Changes to Support IPv6 ...... 958 IPv6 DNS Extensions ...... 959 Proposed Changes to the IPv6 DNS Extensions ...... 959

PART III-2 NETWORK FILE AND RESOURCE SHARING PROTOCOLS AND THE TCP/IP NETWORK FILE SYSTEM (NFS)

58 NETWORK FILE AND RESOURCE SHARING AND THE TCP/IP NETWORK FILE SYSTEM (NFS) 963 File and Resource Sharing Concepts and Components ...... 964 The Power of File and Resource Sharing Protocols ...... 964 Components of a File and Resource Sharing Protocol ...... 964 NFS Design Goals, Versions, and Standards ...... 965 NFS Design Goals ...... 965 NFS Versions and Standards ...... 966 NFS Architecture and Components ...... 967 NFS Main Components ...... 967 Other Important NFS Functions ...... 968 NFS Data Definition with the External Data Representation (XDR) Standard ...... 969 A Method of Universal Data Exchange: XDR ...... 969 XDR Data Types ...... 970 NFS Client/Server Operation Using Remote Procedure Calls (RPCs) ...... 971 RPC Operation and Transport Protocol Usage ...... 972 Client and Server Responsibilities in NFS ...... 973 Client and Server Caching ...... 973 NFS Server Procedures and Operations ...... 974 NFS Version 2 and Version 3 Server Procedures ...... 974 NFS Version 4 Server Procedures and Operations ...... 976 NFS File System Model and the Mount Protocol ...... 978 The NFS File System Model ...... 978 The Mount Protocol ...... 978

Contents in Detail xxiii TCPIP_01TOC.fm Page xxiv Thursday, June 9, 2005 11:16 AM

PART III-3 HOST CONFIGURATION AND TCP/IP HOST CONFIGURATION PROTOCOLS

59 HOST CONFIGURATION CONCEPTS, ISSUES, AND MOTIVATION 983 The Purpose of Host Configuration ...... 983 The Problems with Manual Host Configuration ...... 984 Automating the Process: Host Configuration Protocols ...... 985 The Role of Host Configuration Protocols in TCP/IP ...... 985

60 TCP/IP BOOTSTRAP PROTOCOL (BOOTP) 987 BOOTP Overview, History, and Standards ...... 988 BOOTP: Correcting the Weaknesses of RARP ...... 988 Vendor-Specific Parameters ...... 989 Changes to BOOTP and the Development of DHCP ...... 990 BOOTP Client/Server Messaging and Addressing ...... 990 BOOTP Messaging and Transport ...... 991 BOOTP Use of Broadcasts and Ports ...... 991 Retransmission of Lost Messages ...... 992 BOOTP Detailed Operation ...... 993 BOOTP Bootstrapping Procedure ...... 993 Interpretation of the Client IP Address (CIAddr) Field ...... 994 BOOTP Message Format ...... 995 BOOTP Vendor-Specific Area and Vendor Information Extensions ...... 998 BOOTP Vendor Information Extensions ...... 999 BOOTP Vendor Information Fields ...... 1000 BOOTP Relay Agents (Forwarding Agents) ...... 1001 The Function of BOOTP Relay Agents ...... 1002 Normal BOOTP Operation Using a Relay Agent ...... 1002 Relaying BOOTP Requests Using Broadcasts ...... 1003

61 DHCP OVERVIEW AND ADDRESS ALLOCATION CONCEPTS 1007 DHCP Overview, History, and Standards ...... 1008 DHCP: Building on BOOTP’s Strengths ...... 1009 Overview of DHCP Features ...... 1009 DHCP Address Assignment and Allocation Mechanisms ...... 1010 DHCP Address Allocation ...... 1010 DHCP Manual Allocation ...... 1011 DHCP Dynamic Allocation ...... 1011 DHCP Automatic Allocation ...... 1012 DHCP Leases ...... 1013 DHCP Lease Length Policy ...... 1013 Issues with Infinite Leases ...... 1015 DHCP Lease Life Cycle and Lease Timers ...... 1015 DHCP Lease Life Cycle Phases ...... 1016 Renewal and Rebinding Timers ...... 1016 DHCP Lease Address Pools, Ranges, and Address Management ...... 1018

xxiv Contents in Detail TCPIP_01TOC.fm Page xxv Thursday, June 9, 2005 11:16 AM

Address Pool Size Selection ...... 1018 Lease Address Ranges (Scopes) ...... 1019 Other Issues with Address Management ...... 1020

62 DHCP CONFIGURATION AND OPERATION 1023 DHCP Overview of Client and Server Responsibilities ...... 1024 DHCP Server Responsibilities ...... 1024 DHCP Client Responsibilities ...... 1025 DHCP Client/Server Roles ...... 1025 DHCP Relay Agents ...... 1026 DHCP Configuration Parameters, Storage, and Communication ...... 1026 Configuration Parameter Management ...... 1026 Parameter Storage ...... 1027 Configuration Parameter Communication ...... 1027 DHCP General Operation and the Client Finite State Machine ...... 1027 DHCP Lease Allocation, Reallocation, and Renewal ...... 1031 Initial Lease Allocation Process ...... 1031 DHCP Lease Reallocation Process ...... 1036 DHCP Lease Renewal and Rebinding Processes ...... 1038 DHCP Early Lease Termination (Release) Process ...... 1041 DHCP Parameter Configuration Process for Clients with Non-DHCP Addresses ...... 1043

63 DHCP MESSAGING, MESSAGE TYPES, AND FORMATS 1045 DHCP Message Generation, Addressing, Transport, and Retransmission ...... 1046 Message Generation and General Formatting ...... 1046 Message Transport ...... 1046 Retransmission of Lost Messages ...... 1047 DHCP Message Format ...... 1048 DHCP Options ...... 1051 Options and Option Format ...... 1052 Option Categories ...... 1053 Option Overloading ...... 1054 Summary of DHCP Options/BOOTP Vendor Information Fields ...... 1055 RFC 1497 Vendor Extensions ...... 1055 IP Layer Parameters Per Host ...... 1057 IP Layer Parameters Per Interface ...... 1057 Link Layer Parameters Per Interface ...... 1058 TCP Parameters ...... 1058 Application and Service Parameters ...... 1058 DHCP Extensions ...... 1060

64 DHCP CLIENT/SERVER IMPLEMENTATION, FEATURES, AND IPV6 SUPPORT 1063 DHCP Server and Client Implementation and Management Issues ...... 1064 DHCP Server Implementations ...... 1064 DHCP Client Implementations ...... 1066 DHCP Message Relaying and BOOTP Relay Agents ...... 1066 Use of BOOTP Relay Agents for DHCP ...... 1067

Contents in Detail xxv TCPIP_01TOC.fm Page xxvi Thursday, June 9, 2005 11:16 AM

DHCP Relaying Process ...... 1067 DHCP Autoconfiguration/Automatic Private IP Addressing (APIPA) ...... 1068 APIPA Operation ...... 1069 APIPA Limitations ...... 1070 DHCP Server Conflict Detection ...... 1071 DHCP and BOOTP Interoperability ...... 1072 BOOTP Clients Connecting to a DHCP Server ...... 1073 DHCP Clients Connecting to a BOOTP Server ...... 1073 DHCP Security Issues ...... 1073 DHCP Security Concerns ...... 1074 DHCP Authentication ...... 1074 DHCP for IP Version 6 (DHCPv6) ...... 1075 Two Methods for Autoconfiguration in IPv6 ...... 1075 DHCPv6 Operation Overview ...... 1075 DHCPv6 Message Exchanges ...... 1076

PART III-4 TCP/IP NETWORK MANAGEMENT FRAMEWORK AND PROTOCOLS

65 TCP/IP INTERNET STANDARD MANAGEMENT FRAMEWORK OVERVIEW 1079 Overview and History of the TCP/IP Internet Standard Management Framework and Simple Network Management Protocol (SNMP) ...... 1080 Early Development of SNMP ...... 1080 The Two Meanings of SNMP ...... 1081 Design Goals of SNMP ...... 1081 Further Development of SNMP and the Problem of SNMP Variations ...... 1082 TCP/IP SNMP Operational Model, Components, and Terminology ...... 1082 SNMP Device Types ...... 1082 SNMP Entities ...... 1083 SNMP Operational Model Summary ...... 1083 TCP/IP Internet Standard Management Framework Architecture and Protocol Components .. 1085 SNMP Framework Components ...... 1085 SNMP Framework Architecture ...... 1086 TCP/IP Internet Standard Management Framework and SNMP Versions (SNMPv1, SNMPv2 Variants, and SNMPv3) ...... 1087 SNMPv1 ...... 1087 SNMPsec ...... 1088 SNMPv2 ...... 1088 SNMPv2 Variants ...... 1088 SNMPv3 ...... 1089 TCP/IP Internet Standard Management Framework and SNMP Standards ...... 1090

66 TCP/IP STRUCTURE OF MANAGEMENT INFORMATION (SMI) AND MANAGEMENT INFORMATION BASES (MIBS) 1095 SNMP’s Information-Oriented Design ...... 1096 MIB and MIB Objects ...... 1097 Defining MIB Objects: SMI ...... 1098 TCP/IP MIB Objects, Object Characteristics, and Object Types ...... 1099

xxvi Contents in Detail TCPIP_01TOC.fm Page xxvii Thursday, June 9, 2005 11:16 AM

MIB Object Characteristics ...... 1099 SMI Data Types ...... 1101 TCP/IP MIB Object Descriptors and Identifiers and the Object Name Hierarchy ...... 1102 Object Descriptors ...... 1103 Object Identifiers ...... 1103 Structure of the MIB Object Name Hierarchy ...... 1104 Recursive Definition of MIB Object Identifiers ...... 1106 TCP/IP MIB Modules and Object Groups ...... 1106 The Organization of MIB Objects into Object Groups ...... 1106 MIB Modules ...... 1108 MIB Module Format ...... 1109

67 TCP/IP SIMPLE NETWORK MANAGEMENT PROTOCOL (SNMP) CONCEPTS AND OPERATION 1111 SNMP Protocol Overview ...... 1112 Early Development of SNMPv1 ...... 1112 SNMPv2 and the Division of SNMP into Protocol Operations and Transport Mappings 1113 SNMP Communication Methods ...... 1114 SNMP Protocol Operations ...... 1114 SNMP PDU Classes ...... 1115 Basic Request/Response Information Poll Using GetRequest and (Get)Response Messages ...... 1116 Table Traversal Using GetNextRequest and GetBulkRequest Messages ...... 1117 Object Modification Using SetRequest Messages ...... 1119 Information Notification Using Trap and InformRequest Messages ...... 1121 SNMP Protocol Security Issues and Methods ...... 1122 Problems with SNMPv1 Security ...... 1123 SNMPv2/v3 Security Methods ...... 1123

68 SNMP PROTOCOL MESSAGING AND MESSAGE FORMATS 1125 SNMP Protocol Message Generation ...... 1126 SNMP Transport Mappings ...... 1126 UDP Message Size Issues ...... 1127 Lost Transmission Issues ...... 1127 SNMP General Message Format ...... 1128 The Difference Between SNMP Messages and PDUs ...... 1129 General PDU Format ...... 1129 SNMP Version 1 (SNMPv1) Message Format ...... 1131 SNMPv1 General Message Format ...... 1131 SNMPv1 PDU Formats ...... 1132 SNMP Version 2 (SNMPv2) Message Formats ...... 1134 SNMP Version 2 (SNMPv2p) Message Format ...... 1135 Community-Based SNMP Version 2 (SNMPv2c) Message Format ...... 1136 User-Based SNMP Version 2 (SNMPv2u) Message Format ...... 1136 SNMPv2 PDU Formats ...... 1138 SNMP Version 3 (SNMPv3) Message Format ...... 1141

Contents in Detail xxvii TCPIP_01TOC.fm Page xxviii Thursday, June 9, 2005 11:16 AM

69 TCP/IP REMOTE NETWORK MONITORING (RMON) 1145 RMON Standards ...... 1146 RMON MIB Hierarchy and Object Groups ...... 1146 RMON Alarms, Events, and Statistics ...... 1148

PART III-5 TCP/IP APPLICATION LAYER ADDRESSING AND APPLICATION CATEGORIES

70 TCP/IP APPLICATION LAYER ADDRESSING: UNIFORM RESOURCE IDENTIFIERS, LOCATORS, AND NAMES (URIS, URLS, AND URNS) 1151 URI Overview and Standards ...... 1152 URI Categories: URLs and URNs ...... 1153 URI Standards ...... 1154 URL General Syntax ...... 1154 Common Internet Scheme Syntax ...... 1155 Omission of URL Syntax Elements ...... 1156 URL Fragments ...... 1157 Unsafe Characters and Special Encodings ...... 1157 URL Schemes and Scheme-Specific Syntaxes ...... 1158 World Wide Web/Hypertext Transfer Protocol Syntax (http) ...... 1158 File Transfer Protocol Syntax (ftp) ...... 1159 Electronic Mail Syntax (mailto) ...... 1159 Gopher Protocol Syntax (gopher) ...... 1160 Network News/Usenet Syntax (news) ...... 1160 Network News Transfer Protocol Syntax (nttp) ...... 1160 Telnet Syntax (telnet) ...... 1161 Local File Syntax (file) ...... 1161 Special Syntax Rules ...... 1161 URL Relative Syntax and Base URLs ...... 1162 Interpretation Rules for Relative URLs ...... 1163 Practical Interpretation of Relative URLs ...... 1164 URL Length and Complexity Issues ...... 1166 URL Wrapping and Delimiting ...... 1167 Explicit URL Delimiting and Redirectors ...... 1168 URL Abbreviation ...... 1168 URL Obscuration, Obfuscation, and General Trickery ...... 1168 URNs ...... 1171 The Problem With URLs ...... 1171 Overview of URNs ...... 1172 URN Namespaces and Syntax ...... 1172 URN Resolution and Implementation Difficulties ...... 1173

71 FILE AND MESSAGE TRANSFER OVERVIEW AND APPLICATION CATEGORIES 1175 File Concepts ...... 1176 Application Categories ...... 1176

xxviii Contents in Detail TCPIP_01TOC.fm Page xxix Thursday, June 9, 2005 11:16 AM

General File Transfer Applications ...... 1176 Message Transfer Applications ...... 1176 The Merging of File and Message Transfer Methods ...... 1177

PART III-6 TCP/IP GENERAL FILE TRANSFER PROTOCOLS

72 FILE TRANSFER PROTOCOL (FTP) 1181 FTP Overview, History, and Standards ...... 1182 FTP Development and Standardization ...... 1182 Overview of FTP Operation ...... 1183 FTP Operational Model, Protocol Components, and Key Terminology ...... 1184 The Server-FTP Process and User-FTP Process ...... 1184 FTP Control Connection and Data Connection ...... 1184 FTP Process Components and Terminology ...... 1185 Server-FTP Process Components ...... 1185 User-FTP Process Components ...... 1186 Third-Party File Transfer (Proxy FTP) ...... 1186 FTP Control Connection Establishment, User Authentication, and Anonymous FTP Access ....1187 FTP Login Sequence and Authentication ...... 1187 FTP Security Extensions ...... 1188 Anonymous FTP ...... 1189 FTP Data Connection Management ...... 1189 Normal (Active) Data Connections ...... 1190 Passive Data Connections ...... 1190 Efficiency and Security Issues Related to the Connection Methods ...... 1191 FTP General Data Communication and Transmission Modes ...... 1193 Stream Mode ...... 1193 Block Mode ...... 1194 Compressed Mode ...... 1194 FTP Data Representation: Data Types, Format Control, and Data Structures ...... 1194 FTP Data Types ...... 1195 ASCII Data Type Line-Delimiting Issues ...... 1196 FTP Format Control ...... 1196 FTP Data Structures ...... 1197 FTP Internal Command Groups and Protocol Commands ...... 1197 FTP Command Groups and Commands ...... 1197 FTP Replies ...... 1200 Advantages of Using Both Text and Numeric Replies ...... 1200 Reply Code Structure and Digit Interpretation ...... 1201 FTP Multiple-Line Text Replies ...... 1204 FTP User Interface and User Commands ...... 1205 Command-Line and Graphical FTP Interfaces ...... 1205 Typical FTP User Commands ...... 1206 Sample FTP Session ...... 1208

73 TRIVIAL FILE TRANSFER PROTOCOL (TFTP) 1211 TFTP Overview, History, and Standards ...... 1212 Why TFTP Was Needed ...... 1212 Comparing FTP and TFTP ...... 1213

Contents in Detail xxix TCPIP_01TOC.fm Page xxx Thursday, June 9, 2005 11:16 AM

Overview of TFTP Operation ...... 1213 TFTP General Operation, Connection Establishment, and Client/Server Communication ..... 1214 Connection Establishment and Identification ...... 1215 Lock-Step Client/Server Messaging ...... 1215 Difficulties with TFTP’s Simplified Messaging Mechanism ...... 1216 TFTP Detailed Operation and Messaging ...... 1216 Initial Message Exchange ...... 1216 Data Block Numbering ...... 1217 TFTP Read Process Steps ...... 1217 TFTP Write Process Steps ...... 1218 TFTP Options and Option Negotiation ...... 1220 TFTP Option Negotiation Process ...... 1220 TFTP Options ...... 1223 TFTP Message Formats ...... 1223 Read Request and Write Request Messages ...... 1223 Data Messages ...... 1224 Acknowledgment Messages ...... 1225 Error Messages ...... 1225 Option Acknowledgment Messages ...... 1226

PART III-7 TCP/IP ELECTRONIC MAIL SYSTEM: CONCEPTS AND PROTOCOLS

74 TCP/IP ELECTRONIC MAIL SYSTEM OVERVIEW AND CONCEPTS 1229 TCP/IP Electronic Mail System Overview and History ...... 1230 The Early Days of Email ...... 1230 History of TCP/IP Email ...... 1231 Overview of the TCP/IP Email System ...... 1231 TCP/IP Email Communication Overview ...... 1232 TCP/IP Email Message Communication Model ...... 1234 Protocol Roles in Email Communication ...... 1236

75 TCP/IP ELECTRONIC MAIL ADDRESSES AND ADDRESSING 1237 TCP/IP Email Addressing and Address Resolution ...... 1238 Standard DNS-Based Email Addresses ...... 1238 Special Requirements of Email Addresses ...... 1239 TCP/IP Historical and Special Email Addressing ...... 1240 FidoNet Addressing ...... 1240 UUCP-Style Addressing ...... 1241 Addressing for Gatewaying ...... 1241 TCP/IP Email Aliases and Address Books ...... 1242 Multiple Recipient Addressing ...... 1242 Mailing Lists ...... 1243

xxx Contents in Detail TCPIP_01TOC.fm Page xxxi Thursday, June 9, 2005 11:16 AM

76 TCP/IP ELECTRONIC MAIL MESSAGE FORMATS AND MESSAGE PROCESSING: RFC 822 AND MIME 1245 TCP/IP Email RFC 822 Standard Message Format Overview ...... 1246 Development of the RFC 822 Message Format Standard ...... 1247 Overview of RFC 822 Messages ...... 1247 General RFC 822 Message Structure ...... 1248 TCP/IP Email RFC 822 Standard Message Format Header Fields and Groups ...... 1249 Header Field Structure ...... 1249 Header Field Groups ...... 1249 Common Header Field Groups and Header Fields ...... 1250 TCP/IP Email RFC 822 Standard Message Format Processing and Interpretation ...... 1253 MIME Overview ...... 1254 MIME Capabilities ...... 1255 MIME Standards ...... 1256 MIME Basic Structures and Headers ...... 1257 Basic Structures ...... 1258 MIME Entities ...... 1258 Primary MIME Headers ...... 1258 Additional MIME Headers ...... 1259 MIME Content-Type Header and Discrete Media ...... 1260 Content-Type Header Syntax ...... 1260 Discrete Media Types and Subtypes ...... 1261 MIME Composite Media Types: Multipart and Encapsulated Message Structures ...... 1265 MIME Multipart Message Type ...... 1265 Multipart Message Encoding ...... 1266 MIME Encapsulated Message Type ...... 1269 MIME Content-Transfer-Encoding Header and Encoding Methods ...... 1269 7-Bit and 8-Bit Encoding ...... 1270 Quoted-Printable Encoding ...... 1270 Base64 Encoding ...... 1270 MIME Extension for Non-ASCII Mail Message Headers ...... 1273

77 TCP/IP ELECTRONIC MAIL DELIVERY PROTOCOL: THE SIMPLE MAIL TRANSFER PROTOCOL (SMTP) 1275 SMTP Overview, History, and Standards ...... 1276 SMTP Standards ...... 1276 SMTP Communication and Message Transport Methods ...... 1277 Terminology: Client/Server and Sender/Receiver ...... 1279 SMTP Connection and Session Establishment and Termination ...... 1279 Overview of Connection Establishment and Termination ...... 1280 Connection Establishment and Greeting Exchange ...... 1280 Connection Establishment Using SMTP Extensions ...... 1281 Connection Termination ...... 1282 SMTP Mail Transaction Process ...... 1283 Overview of SMTP Mail Transaction ...... 1283 SMTP Mail Transaction Details ...... 1284 SMTP Special Features, Capabilities, and Extensions ...... 1286 SMTP Special Features and Capabilities ...... 1287 SMTP Extensions ...... 1288 SMTP Security Issues ...... 1289 SMTP Commands ...... 1291

Contents in Detail xxxi TCPIP_01TOC.fm Page xxxii Thursday, June 9, 2005 11:16 AM

SMTP Replies and Reply Codes ...... 1293 Reply Code Structure and Digit Interpretation ...... 1293 SMTP Multiple-Line Text Replies ...... 1296 Enhanced Status Code Replies ...... 1296

78 TCP/IP ELECTRONIC MAIL ACCESS AND RETRIEVAL PROTOCOLS AND METHODS 1297 TCP/IP Email Mailbox Access Model, Method, and Protocol Overview ...... 1298 Email Access and Retrieval Models ...... 1299 TCP/IP Post Office Protocol (POP/POP3) ...... 1300 POP Overview, History, Versions, and Standards ...... 1300 POP3 General Operation ...... 1302 POP3 Session States ...... 1302 TCP/IP Internet Message Access Protocol (IMAP/IMAP4) ...... 1309 IMAP Overview, History, Versions, and Standards ...... 1310 IMAP4 General Operation ...... 1312 IMAP Session States ...... 1312 IMAP Commands, Results, and Responses ...... 1314 IMAP4 Not Authenticated State: User Authentication Process and Commands ...... 1318 IMAP4 Authenticated State: Mailbox Manipulation/Selection Process and Commands 1319 IMAP4 Selected State: Message Manipulation Process and Commands ...... 1321 TCP/IP Direct Server Email Access ...... 1323 TCP/IP World Wide Web Email Access ...... 1325

PART III-8 TCP/IP WORLD WIDE WEB AND THE HYPERTEXT TRANSFER PROTOCOL (HTTP)

79 WORLD WIDE WEB AND HYPERTEXT OVERVIEW AND CONCEPTS 1329 World Wide Web and Hypertext Overview and History ...... 1330 History of Hypertext ...... 1330 The World Wide Web Today ...... 1331 World Wide Web System Concepts and Components ...... 1332 Major Functional Components of the Web ...... 1332 Web Servers and Web Browsers ...... 1333 World Wide Web Media and the Hypertext Markup Language ...... 1334 Overview of HTML ...... 1334 HTML Elements and Tags ...... 1335 Common HTML Elements ...... 1336 Common Text Formatting Tags ...... 1338 World Wide Web Addressing: HTTP Uniform Resource Locators ...... 1338 HTTP URL Syntax ...... 1339 Resource Paths and Directory Listings ...... 1340

80 HTTP GENERAL OPERATION AND CONNECTIONS 1341 HTTP Versions and Standards ...... 1342

xxxii Contents in Detail TCPIP_01TOC.fm Page xxxiii Thursday, June 9, 2005 11:16 AM

HTTP/0.9 ...... 1342 HTTP/1.0 ...... 1342 HTTP/1.1 ...... 1343 Future HTTP Versions ...... 1344 HTTP Operational Model and Client/Server Communication ...... 1345 Basic HTTP Client/Server Communication ...... 1345 Intermediaries and the HTTP Request/Response Chain ...... 1346 The Impact of Caching on HTTP Communication ...... 1347 HTTP Transitory and Persistent Connections and Pipelining ...... 1348 Persistent Connections ...... 1349 Pipelining ...... 1349 HTTP Persistent Connection Establishment and Management ...... 1350

81 HTTP MESSAGES, METHODS, AND STATUS CODES 1353 HTTP Generic Message Format ...... 1354 HTTP Request Message Format ...... 1355 Request Line ...... 1356 Headers ...... 1358 HTTP Response Message Format ...... 1358 Status Line ...... 1359 Headers ...... 1360 HTTP Methods ...... 1361 Common Methods ...... 1361 Other Methods ...... 1362 Safe and Idempotent Methods ...... 1363 HTTP Status Codes and Reason Phrases ...... 1364 Status Code Format ...... 1364 Reason Phrases ...... 1365 The 100 (Continue) Preliminary Reply ...... 1368

82 HTTP MESSAGE HEADERS 1369 HTTP General Headers ...... 1370 Cache-Control Headers ...... 1370 Warning ...... 1371 Other HTTP General Headers ...... 1372 HTTP Request Headers ...... 1373 HTTP Response Headers ...... 1376 HTTP Entity Headers ...... 1377

83 HTTP ENTITIES, TRANSFERS, CODING METHODS, AND CONTENT MANAGEMENT 1381 HTTP Entities and Internet Media Types ...... 1382 Media Types and Subtypes ...... 1382 HTTP’s Use of Media Types ...... 1383 Differences in HTTP and MIME Constructs ...... 1383 HTTP Content and Transfer Encodings ...... 1384 HTTP’s Two-Level Encoding Scheme ...... 1385 Use of Content and Transfer Encodings ...... 1385

Contents in Detail xxxiii TCPIP_01TOC.fm Page xxxiv Thursday, June 9, 2005 11:16 AM

HTTP Data Length Issues, Chunked Transfers, and Message Trailers ...... 1386 Dynamic Data Length ...... 1387 Chunked Transfers and Message Trailers ...... 1387 HTTP Content Negotiation and Quality Values ...... 1390 Content Negotiation Techniques ...... 1390 Quality Values for Preference Weights ...... 1392

84 HTTP FEATURES, CAPABILITIES, AND ISSUES 1393 HTTP Caching Features and Issues ...... 1394 Benefits of HTTP Caching ...... 1394 Cache Locations ...... 1395 Cache Control ...... 1396 Important Caching Issues ...... 1397 HTTP Proxy Servers and Proxying ...... 1398 Benefits of Proxies ...... 1398 Comparing Proxies and Caches ...... 1399 Important Proxying Issues ...... 1399 HTTP Security and Privacy ...... 1400 HTTP Authentication Methods ...... 1400 Security and Privacy Concerns and Issues ...... 1401 Methods for Ensuring Privacy in HTTP ...... 1402 HTTP State Management Using Cookies ...... 1402 Issues with Cookies ...... 1403 Managing Cookie Use ...... 1404

PART III-9 OTHER FILE AND MESSAGE TRANSFER APPLICATIONS

85 USENET (NETWORK NEWS) AND THE TCP/IP NETWORK NEWS TRANSFER PROTOCOL (NNTP) 1409 Usenet Overview, History, and Operation ...... 1410 History of Usenet ...... 1410 Usenet Operation and Characteristics ...... 1411 Usenet Transport Methods ...... 1412 Usenet Communication Model ...... 1413 Usenet’s Public Distribution Orientation ...... 1414 Usenet Communication Process ...... 1414 Message Propagation and Server Organization ...... 1416 Usenet Addressing: Newsgroups ...... 1416 Usenet Message Format and Special Headers ...... 1420 Usenet Header Categories and Common Headers ...... 1420 Additional Usenet Headers ...... 1422 Usenet MIME Messages ...... 1423 NNTP Overview and General Operation ...... 1423 NNTP Interserver Communication Process: News Article Propagation ...... 1425 The Usenet Server Structure ...... 1425 Basic NNTP Propagation Methods ...... 1426 NNTP Client-Server Communication Process: News Posting and Access ...... 1428 News Posting, Access, and Reading ...... 1429 News Access Methods ...... 1430

xxxiv Contents in Detail TCPIP_01TOC.fm Page xxxv Thursday, June 9, 2005 11:16 AM

Other Client/Server Functions ...... 1430 Article Threading ...... 1431 NNTP Commands and Command Extensions ...... 1432 Command Syntax ...... 1432 Base Command Set ...... 1432 NNTP Command Extensions ...... 1434 NNTP Status Responses and Response Codes ...... 1438

86 GOPHER PROTOCOL (GOPHER) 1443 Gopher Overview and General Operation ...... 1443 Information Storage on Gopher Servers ...... 1444 Gopher Client/Server Operation ...... 1444 Important Differences Between Gopher and the Web ...... 1445 Gopher’s Role in the Modern Internet ...... 1445

PART III-10 INTERACTIVE AND ADMINISTRATIVE UTILITIES AND PROTOCOLS

87 TCP/IP INTERACTIVE AND REMOTE APPLICATION PROTOCOLS 1449 Telnet Protocol ...... 1450 Telnet Overview, History, and Standards ...... 1450 Telnet Connections and Client/Server Operation ...... 1453 Telnet Communications Model and the Network Virtual Terminal (NVT) ...... 1455 Telnet Protocol Commands ...... 1458 Telnet Interrupt Handling ...... 1461 Telnet Options and Option Negotiation ...... 1462 Berkeley Remote (r) Commands ...... 1466 Berkeley Remote Login (rlogin) ...... 1467 Berkeley Remote Shell (rsh) ...... 1468 Other Berkeley Remote Commands ...... 1469 Internet Relay Chat Protocol (IRC) ...... 1470 IRC Communication Model and Client/Server Operation ...... 1471 Messaging and IRC Channels ...... 1471 IRC and the Modern Internet ...... 1472

88 TCP/IP ADMINISTRATION AND TROUBLESHOOTING UTILITIES AND PROTOCOLS 1473 TCP/IP Host Name Utility (hostname) ...... 1474 TCP/IP Communication Verification Utility (ping) ...... 1475 Operation of the ping Utility ...... 1476 Basic Use of ping ...... 1476 Methods of Diagnosing Connectivity Problems Using ping ...... 1477 ping Options and Parameters ...... 1478 TCP/IP Route Tracing Utility (traceroute) ...... 1479 Operation of the traceroute Utility ...... 1480 Basic Use of the traceroute Utility ...... 1481

Contents in Detail xxxv TCPIP_01TOC.fm Page xxxvi Thursday, June 9, 2005 11:16 AM

traceroute Options and Parameters ...... 1482 TCP/IP Address Resolution Protocol Utility (arp) ...... 1483 TCP/IP DNS Name Resolution and Lookup Utilities (nslookup, host, and dig) ...... 1484 The nslookup Utility ...... 1485 The host Utility ...... 1487 The dig Utility ...... 1488 TCP/IP DNS Registry Database Lookup Utility (whois/nicname) ...... 1489 TCP/IP Network Status Utility (netstat) ...... 1491 The UNIX netstat Utility ...... 1492 The Windows netstat Utility ...... 1494 TCP/IP Configuration Utilities (ifconfig, ipconfig, and winipcfg) ...... 1496 The ifconfig Utility for UNIX ...... 1496 The ipconfig for Windows NT, 2000, and XP ...... 1498 The winipcfg Utility for Windows 95, 98, and Me ...... 1500 Miscellaneous TCP/IP Troubleshooting Protocols ...... 1501

xxxvi Contents in Detail