The Linux Networking Architecture
This unique Linux networking tutorial/reference by experts provides readers with a practical overview and understanding of the implementation of networking protocols in the Linux kernel. The book shows how networking behavior and protocols can be implemented within the Linux operating system. Introduction to the Linux kernel, mainly focusing on the upcoming kernel version 2.4 but also valid for version 2.2 kernels. The organization of the book follows the TCP/IP layering model, beginning with the kernel’s network device drivers, continuing with link-layer protocols such as PPP, and finally giving a description of all core protocols of the TCP/IP protocol family. Additional supplementary protocols such as RSVP, IP Security, and Mobile IP are also covered. For anyone interested in Linux or networking, including network programmers and administrators.
Copyright ii
Preface xiii
Organization of this Book xiv
Additional Sources of Information xv
Conventions Used in this Book xvi
Acknowledgments xvii
Part I: The Linux Kernel 1
Chapter 1. Motivation 3
Section 1.1. The Linux Operating System 4
Section 1.2. What is Linux? 5
Section 1.3. Reasons for Using Linux 6
Chapter 2. The Kernel Structure 9
Section 2.1. Monolithic Architectures and Microkernels 11
Section 2.2. Activities in the Linux Kernel 12
Section 2.3. Locking—Atomic Operations 17
Section 2.4. Kernel Modules 23
Section 2.5. Device Drivers 29
Section 2.6. Memory Management in the Kernel 31
Section 2.7. Timing in the Linux Kernel 35
Section 2.8. The Proc File System 40
Section 2.9. Versioning 43
Part II: Architecture of Network Implementation 45
Chapter 3. The Architecture of Communication Systems 47
Section 3.1. Layer-Based Communication Models 47
Section 3.2. Services and Protocols 52
Chapter 4. Managing Network Packets in the Kernel 55
Section 4.1. Socket Buffers 55
Section 4.2. Socket-Buffer Queues 66
Chapter 5. Network Devices 71
Section 5.1. The net_device Interface 73
Section 5.2. Managing Network Devices 82
Section 5.3. Network Drivers 92
Part III: Layer I + II—Medium Access and Logical Link Layer 115
Chapter 6. Introduction to the Data-Link Layer 117
Section 6.1. Structure of the Data-Link Layer 117
Section 6.2. Processes on the Data-Link Layer 119
Section 6.3. Managing Layer-3 Protocols 127
Chapter 7. The Serial-Line Internet Protocol (SLIP) 132
Section 7.1. Introduction 132
Section 7.2. Slip Implementation in the Linux Kernel 134
Chapter 8. The Point-to-Point Protocol (PPP) 145
Section 8.1. Introduction 145
Section 8.2. PPP Configuration in Linux 148
Section 8.3. PPP Implementation in the Linux Kernel 150
Section 8.4. Implementing the PPP Daemon 158
Chapter 9. PPP over Ethernet 161
Section 9.1. Introduction 161
Section 9.2. PPPOE Specification in RFC 2516 161
Section 9.3. Implementation in the User Space 163
Section 9.4. Implementation in the Linux Kernel 164
Chapter 10. Asynchronous Transfer Mode—ATM 168
Section 10.1. Introduction 168
Section 10.2. Implementing ATM in Linux 169
Section 10.3. Configuration 177
Chapter 11. Bluetooth in Linux 179
Section 11.1. Host Controller Interface (HCI) 181
Section 11.2. L2CAP 185
Section 11.3. Other Protocols 188
Chapter 12. Transparent Bridges 189
Section 12.1. Introduction 189
Section 12.2. Basics 190
Section 12.3. Configuring a Bridge in Linux 199
Section 12.4. Implementation 202
Part IV: Network Layer 221
Chapter 13. The TCP/IP Protocols 223
Section 13.1. The Internet Protocol Suite 224
Chapter 14. The Internet Protocol V4 227
Section 14.1. Properties of the Internet Protocol 228
Section 14.2. Implementing the Internet Protocol 233
Section 14.3. IP Options 250
Section 14.4. Internet Control Message Protocol (ICMP) 262
Chapter 15. Address Resolution Protocol (ARP) 273
Section 15.1. Using the Address Resolution Protocol 274
Section 15.2. The ARP Command 276
Section 15.3. Implementing the ARP Instance in the Linux Kernel 277
Chapter 16. IP Routing 293
Section 16.1. Introduction 293
Section 16.2. Configuration 301
Section 16.3. Implementation 309
Chapter 17. IP Multicast for Group Communication 330
Section 17.1. Group Communication 331
Section 17.2. IP Multicast 333
Section 17.3. Internet Group Management Protocol (IGMP) 339
Section 17.4. Multicast Data Path in the Linux Kernel 345
Section 17.5. Multicasting in Today’s Internet 355
Section 17.6. Multicast Transport Protocols 364
Chapter 18. Using Traffic Control to Support Quality of Service (QoS) 366
Section 18.1. Introduction 366
Section 18.2. Basic Structure of Traffic Control in Linux 367
Section 18.3. Traffic Control in the Outgoing Direction 367
Section 18.4. Kernel Structures and Interfaces 369
Section 18.5. Ingress Policing 378
Section 18.6. Implementing a Queuing Discipline 378
Section 18.7. Configuration 381
Chapter 19. Packet Filters and Firewalls 383
Section 19.1. Introduction 383
Section 19.2. The Ipchains Architecture of Linux 2.2 386
Section 19.3. The Netfilter Architecture of Linux 2.4 391
Chapter 20. Connection Tracking 399
Section 20.1. Introduction 399
Section 20.2. Implementation 400
Chapter 21. Network Address Translation (NAT) 410
Section 21.1. Introduction 410
Section 21.2. Configuring NAT in Linux 414
Section 21.3. Implementing the NAT Module 416
Section 21.4. Interfaces to Extend the NAT Module 422
Chapter 22. Extending the Linux Network Architecture Functionality—KIDS 426
Section 22.1. Managing Dynamically Extendable Functionalities 426
Section 22.2. Structure of the KIDS Construction System 428
Section 22.3. Using the KIDS Example to Extend the Linux Network Architecture 431
Chapter 23. IPv6—Internet Protocol Version 6 443
Section 23.1. Introduction 443
Section 23.2. IPv6 Features 443
Section 23.3. IPv6 Implementation 450
Part V: Layer IV—Transport Layer 455
Chapter 24. Transmission Control Protocol (TCP) 457
Section 24.1. Overview 457
Section 24.2. Implementing The TCP Protocol Instance 460
Section 24.3. Connection Management 476
Section 24.4. Protocol Mechanisms For Data Exchange 486
Section 24.5. Timer Management In TCP 508
Chapter 25. User Datagram Protocol (UDP) 513
Section 25.1. Introduction 513
Section 25.2. Data Structures 514
Section 25.3. Sending and Receiving UDP Datagrams 519
Chapter 26. The Concept of Sockets 522
Section 26.1. Introduction 522
Section 26.2. BSD Sockets 522
Section 26.3. Protocol-Specific Sockets 526
Part VI: Layer V—Application Layer 533
Chapter 27. Network Programming With Sockets 535
Section 27.1. Introduction 535
Section 27.2. Functions of the Socket API 538
Section 27.3. Examples 548
Part VII: Appendices 549
Appendix A. The LXR Source-Code Browser 551
Section A.1. Functionality 551
Section A.2. Installation 555
Appendix B. Debugging in the Linux Kernel 557
Section B.1. Log Outputs From the Linux Kernel 557
Section B.2. Creating Strings in the Kernel 561
Section B.3. Information in the /proc Directory 564
Section B.4. Using a Debugger with the Linux Kernel 569
Appendix C. Tools and Commands for Network Operation 572
Section C.1. Using ifconfig to Manage Network Devices 572
Section C.2. Using ping to Test the Reachability 575
Section C.3. Using netstat to View the Network State 576
Section C.4. Using route for Routing Information 578
Section C.5. Using tcpdump for Network Analysis 579
Section C.6. USING traceroute TO TRACE PACKETS 582
Section C.7. Other Tools 584
Appendix D. Example for a Kernel Module 588
Appendix E. Example for a Network-Layer Protocol 591
Appendix F. Example for a Transport Protocol 593
Appendix G. Example for Communication over Sockets 595
Section G.1. SERVER 595
Section G.2. CLIENT 598
Bibliography
Index
Download: The Linux Networking Architecture