What you should already have to get the most out of this book… • Familiarity with computer basics • Basic knowledge of computer operating systems A quick, easy introduction to Windows Sa
Trang 1ptg
Trang 2What you should already have to get the most out of this book…
• Familiarity with computer basics
• Basic knowledge of computer operating systems
A quick, easy introduction
to Windows
Sams Teach YourselfPHP, MySQL, and ApacheAll in One
ISBN 0-672-32976-X
A step-by-step approach tobasic setup and creation ofinteractive web applications
An introduction to managing
a Unix system
Where to go from here…
• Learn to automate system administration tasks with scripting
• Expand your system administration skills in Unix
A solid introduction tonetworking technology
Sams Teach YourselfShell Programming in
24 HoursISBN 0-672-32358-3
An easy-to-understandguide to Unix scripting
Sams Teach YourselfNetwork Troubleshooting
in 24 HoursISBN 0-672-32373-7
A beginner’s guide to finding and fixing networkproblems
What this book will help you learn…
• How to set up and administer a TCP/IP network
• How to troubleshoot network problems
Sams Teach Yourself
24 in
Hours
Trang 4Sams Teach Yourself TCP/IP in 24 Hours
Copyright © 2009 by Pearson Education, Inc
All rights reserved No part of this book shall be reproduced, stored in a retrieval system, or
transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without
written permission from the publisher No patent liability is assumed with respect to the use of
the information contained herein Although every precaution has been taken in the preparation of
this book, the publisher and author assume no responsibility for errors or omissions Nor is any
liability assumed for damages resulting from the use of the information contained herein
1 TCP/IP (Computer network protocol) I Title II Title: Teach yourself TCP/IP in 24 hours
III Title: TCP/IP in 24 hours
TK5105.585.C37 2009
005.7’1376—dc22
2008031826Printed in the United States of America
First Printing September 2008
Trademarks
All terms mentioned in this book that are known to be trademarks or service marks have been
appropriately capitalized Sams Publishing cannot attest to the accuracy of this information Use
of a term in this book should not be regarded as affecting the validity of any trademark or service
mark
Warning and Disclaimer
Every effort has been made to make this book as complete and as accurate as possible, but no
warranty or fitness is implied The information provided is on an “as is” basis The author and the
publisher shall have neither liability nor responsibility to any person or entity with respect to any
loss or damages arising from the information contained in this book
Bulk Sales
Sams Publishing offers excellent discounts on this book when ordered in quantity for bulk
pur-chases or special sales For more information, please contact
U.S Corporate and Government Sales
Trang 5Contents at a Glance
Part I: TCP/IP Basics
HOUR 1 What Is TCP/IP? . 7
2 How TCP/IP Works . 21
Part II: The TCP/IP Protocol System HOUR 3 The Network Access Layer . 35
4 The Internet Layer . 47
5 Subnetting and CIDR . 69
6 The Transport Layer . 83
7 The Application Layer . 107
Part III: Networking with TCP/IP HOUR 8 Routing . 121
9 Getting Connected . 143
10 Firewalls . 175
11 Name Resolution . 185
12 Automatic Configuration . 215
13 IPv6—The Next Generation . 229
Part IV: TCP/IP Utilities HOUR 14 TCP/IP Utilities . 243
15 Monitoring and Remote Access . 275
Part V: TCP/IP and the Internet HOUR 16 The Internet: A Closer Look . 297
17 HTTP, HTML, and the World Wide Web . 305
18 Email . 321
19 Streaming and Casting . 339
Trang 6Part VI: Advanced Topics
HOUR 20 Web Services . 353
21 The New Web . 363
22 Network Intrusion . 375
23 TCP/IP Security . 391
24 Implementing a TCP/IP Network—Seven Days in the Life of a Sys Admin . 413
Index . 425
iv
Sams Teach Yourself TPC/IP in 24 Hours
Trang 7Table of Contents
Part I: TCP/IP Basics
Networks and Protocols . 8
The Development of TCP/IP . 10
TCP/IP Features . 12
Standards Organizations and RFCs . 17
Summary . 18
Q&A . 19
Key Terms . 19
HOUR 2: How TCP/IP Works 21 The TCP/IP Protocol System . 22
TCP/IP and the OSI Model . 24
Data Packages . 26
A Quick Look at TCP/IP Networking . 28
Summary . 30
Q&A . 30
Key Terms . 31
Part II: The TCP/IP Protocol System HOUR 3: The Network Access Layer 35 Protocols and Hardware . 35
The Network Access Layer and the OSI Model . 37
Network Architecture . 38
Physical Addressing . 40
Trang 8Ethernet . 41
Anatomy of an Ethernet Frame . 43
Summary . 44
Q&A . 44
Key Terms . 45
HOUR 4: The Internet Layer 47 Addressing and Delivering . 48
Internet Protocol (IP) . 50
Address Resolution Protocol (ARP) . 62
Reverse ARP (RARP) . 63
Internet Control Message Protocol (ICMP) . 63
Other Internet Layer Protocols . 64
Summary . 65
Q&A . 65
Workshop . 66
Key Terms . 66
HOUR 5: Subnetting and CIDR 69 Subnets . 69
Dividing the Network . 70
Converting a Subnet Mask to Dotted Decimal Notation . 73
Working with Subnets . 75
Classless Internet Domain Routing (CIDR) . 80
Summary . 81
Q&A . 81
Key Terms . 82
HOUR 6: The Transport Layer 83 Introducing the Transport Layer . 84
Transport Layer Concepts . 85
Understanding TCP and UDP . 91
Firewalls and Ports . 101
vi
Sams Teach Yourself TPC/IP in 24 Hours
Trang 9Summary . 102
Q&A . 103
Key Terms . 104
HOUR 7: The Application Layer 107 What Is the Application Layer? . 107
The TCP/IP Application Layer and OSI . 108
Network Services . 109
APIs and the Application Layer . 114
TCP/IP Utilities . 115
Summary . 116
Q&A . 116
Key Terms . 117
Part III: Networking with TCP/IP HOUR 8: Routing 121 Routing in TCP/IP . 121
Routing on Complex Networks . 134
Examining Interior Routers . 136
Classless Routing . 138
Higher in the Stack . 139
Summary . 140
Q&A . 140
Key Terms . 141
HOUR 9: Getting Connected 143 Dial-Up Networking . 144
Cable Broadband . 151
Digital Subscriber Line (DSL) . 153
Wide Area Networks (WANs) . 154
Wireless Networking . 155
Connectivity Devices . 167
Contents vii
Trang 10Summary . 171
Q&A . 171
Key Terms . 172
HOUR 10: Firewalls 175 What Is a Firewall? . 175
Firewall Options . 177
The DMZ . 178
Firewall Rules . 180
Proxy Service . 181
Reverse Proxy . 182
Summary . 183
Q&A . 183
Key Terms . 184
HOUR 11: Name Resolution 185 What Is Name Resolution? . 185
Name Resolution Using Hosts Files . 187
DNS Name Resolution . 189
Registering a Domain . 195
Managing DNS . 196
Dynamic DNS . 203
NetBIOS Name Resolution . 204
Summary . 211
Q&A . 211
Workshop . 212
Key Terms . 212
HOUR 12: Automatic Configuration 215 The Case for Server-Supplied IP Addresses . 215
What Is DHCP? . 216
How DHCP Works . 217
Configuring DHCP . 220
DHCP Server Configuration . 221
viii
Sams Teach Yourself TPC/IP in 24 Hours
Trang 11Network Address Translation (NAT) . 223
Zero Configuration . 224
Summary . 227
Q&A . 227
Key Terms . 228
HOUR 13: IPv6—The Next Generation 229 Why a New IP? . 229
IPv6 Header Format . 232
IPv6 Addressing . 236
IPv6 with IPv4 . 237
IPv6 and Quality of Service (QoS) . 238
Summary . 239
Q&A . 239
Key Terms . 240
Part IV: TCP/IP Utilities HOUR 14: TCP/IP Utilities 243 Connectivity Problems . 244
Protocol Dysfunction and Misconfiguration . 245
Line Problems . 252
Name Resolution Problems . 253
Network Performance Problems . 254
Using Connectivity Utilities to Troubleshoot Problems . 261
File Transfer Protocol (FTP) . 262
Trivial File Transfer Protocol (TFTP) . 267
Remote Copy . 267
Integrating Network File Access . 268
Summary . 270
Q&A . 270
Workshop . 271
Key Terms . 272
Contents ix
Trang 12Telnet . 275
Berkeley Remote Utilities . 278
Secure Shell (SSH) . 282
Screen Sharing . 283
Simple Network Management Protocol . 284
Remote Monitoring . 289
Summary . 291
Q&A . 291
Key Terms . 292
Part V: TCP/IP and the Internet HOUR 16: The Internet: A Closer Look 297 How the Internet Looks . 297
What Happens on the Internet . 299
URIs and URLs . 301
Summary . 304
Q&A . 304
Key Terms . 304
HOUR 17: HTTP, HTML, and the World Wide Web 305 What Is the World Wide Web? . 305
Understanding HTML . 308
Understanding HTTP . 313
Dynamic HTML . 316
Summary . 318
Q&A . 318
Key Terms . 319
HOUR 18: Email 321 What Is Email? . 321
Email Format . 322
How Email Works . 324
x
Sams Teach Yourself TPC/IP in 24 Hours
Trang 13Simple Mail Transfer Protocol (SMTP) . 326
Retrieving the Mail . 328
Email Readers . 331
Webmail . 333
Spam . 334
Summary . 336
Q&A . 337
Workshop . 337
Key Terms . 338
HOUR 19: Streaming and Casting 339 The Streaming Problem . 339
Realtime Transport Protocol (RTP) . 341
Transport Options . 343
Multimedia Links . 344
Podcasting . 346
Voice Over IP (VoIP) . 347
Summary . 348
Q&A . 349
Key Terms . 349
Part VI: Advanced Topics HOUR 20: Web Services 353 Understanding Web Services . 353
XML . 355
SOAP . 357
WSDL . 358
Web Service Stacks . 358
E-Commerce . 359
Summary . 361
Q&A . 362
Key Terms . 362
Contents xi
Trang 14Web 2.0 . 363
XHTML . 367
Peer-to-Peer . 368
IRC and Instant Messaging . 369
The Semantic Web . 371
Summary . 372
Q&A . 373
Key Terms . 373
HOUR 22: Network Intrusion 375 Vandals and Cyber-Crooks . 375
What Do Intruders Want? . 376
Root Access . 385
Going Phishing . 386
Denial-of-Service Attacks . 387
Summary . 389
Key Terms . 389
HOUR 23: TCP/IP Security 391 Encryption . 391
Securing TCP/IP . 402
Virtual Private Networks (VPNs) . 404
Kerberos . 406
Summary . 409
Q&A . 409
Key Terms . 410
HOUR 24: Implementing a TCP/IP Network—Seven Days in the Life of a Sys Admin 413 A Brief History of Hypothetical, Inc . 413
Seven Days in the Life of Maurice . 414
Summary . 422
Q&A . 423
xii
Sams Teach Yourself TPC/IP in 24 Hours
Trang 15About the Author
Joe Casad is an engineer, author, and editor who has written widely on computer
network-ing and system administration He has written or co-written 12 books on computers and
networking In a past life, he was the editor of C/C++ Users Journal and senior editor of
UnixReview.com
Trang 16Thanks to Trina MacDonald, Michael Thurston, Betsy Harris, and Ravi Prakash for their
patience and good advice I would also like to acknowledge the following individuals for
their contributions to previous editions of Sams Teach Yourself TCP/IP in 24 Hours: Bob
Willsey, Sudha Putnam, Walter Glenn, Art Hammond, Jane Brownlow, Jeff Koch, Mark
Renfrow, Vicki Harding, Mark Cierzniak, Marc Charney, and Jenny Watson
Trang 17We Want to Hear from You!
As the reader of this book, you are our most important critic and commentator We value
your opinion and want to know what we’re doing right, what we could do better, what
areas you’d like to see us publish in, and any other words of wisdom you’re willing to pass
our way
You can email or write me directly to let me know what you did or didn’t like about this
book—as well as what we can do to make our books stronger
Please note that I cannot help you with technical problems related to the topic of this book, and
that due to the high volume of mail I receive, I might not be able to reply to every message.
When you write, please be sure to include this book’s title and author as well as your name
and phone or email address I will carefully review your comments and share them with the
author and editors who worked on the book
E-mail: networking@samspublishing.com
Editor-in-ChiefSams Publishing
1330 Avenue of the AmericasNew York, NY 10019 USA
Reader Services
Visit our website and register this book at informit.com/register for convenient access to any
updates, downloads, or errata that might be available for this book
Trang 18This page intentionally left blank
Trang 19Introduction
Welcome to Sams Teach Yourself TCP/IP in 24 Hours, Fourth Edition This book provides a clear
and concise introduction to TCP/IP for newcomers, and also for users who have worked with
TCP/IP but would like a little more of the inside story The fourth edition includes new
material on recent developments in TCP/IP and offers a closer look at topics such as
. Firewalls
. Streaming
. Web services
You’ll find new chapters on casting and streaming, web services, and the new Web, as well
as several new sections throughout the book on recent developments in TCP/IP
Does Each Chapter Take an Hour?
Each chapter is organized so that you can learn the concepts within one hour The chapters
are designed to be short enough to read all at once In fact, you should be able to read a
chapter in less than one hour and still have time to take notes and reread more complex
sections in your one-hour study session
How to Use This Book
The books in the Sams Teach Yourself series are designed to help you learn a topic in a few
easy and accessible sessions Sams Teach Yourself TCP/IP in 24 Hours, Fourth Edition, is divided
into six parts Each part brings you a step closer to mastering the goal of proficiency in
TCP/IP
. Part I, “TCP/IP Basics,” introduces you to TCP/IP and the TCP/IP protocol stack
. Part II, “The TCP/IP Protocol System,” takes a close look at each of TCP/IP’s protocol
layers: the Network Access, Internet, Transport, and Application layers You learn
about IP addressing and subnetting, as well as physical networks and application
services You’ll also learn about the protocols that operate at each of TCP/IP’s layers
Trang 20. Part III, “Networking with TCP/IP,” describes some of the devices, services, and utilities
necessary for supporting TCP/IP networks You learn about routing and network
hard-ware, DHCP, DNS, and IPv6
. Part IV, “TCP/IP Utilities,” introduces some of the common utilities used to configure,
manage, and troubleshoot TCP/IP networks You learn about Ping, Netstat, FTP,
Telnet, and other network utilities
. Part V, “TCP/IP and the Internet,” describes the world’s largest TCP/IP network: the
Internet You learn about the structure of the Internet You also learn about HTTP,
HTML, XML, email, and Internet streaming
. Part VI, “Advanced Topics,” describes topics such as web services, messaging, the
semantic web, and TCP/IP security Part VI ends with a case study showing how the
components of TCP/IP interact in a real working environment
The concepts in this book, like TCP/IP itself, are independent of a system and descend from
the standards defined in Internet Requests for Comment (RFCs)
How This Book Is Organized
Each hour in Sams Teach Yourself TCP/IP in 24 Hours, Fourth Edition, begins with a quick
intro-duction and a list of goals for the hour You can also find the following elements
Main Section
Each hour contains a main section that provides a clear and accessible discussion of the
hour’s topic You’ll find figures and tables helping to explain the concepts described in the
text Interspersed with the text are special notes labeled By The Way? These notes come
with definitions, descriptions, or warnings that help you build a better understanding of the
material
These boxes clarify a concept that is discussed in the text A By The Way mightadd some additional information or provide an example, but they typically aren’tessential for a basic understanding of the subject If you’re in a hurry, or if youwant to know only the bare essentials, you can bypass these sidebars
2
Sams Teach Yourself TCP/IP in 24 Hours
By the
Way
Trang 21Q&A
Each hour ends with some questions designed to help you explore and test your
under-standing of the concepts described in the hour Complete answers to the questions are also
provided
Additionally, some hours include Workshops—exercises designed to help you
through the details or give you practice with a particular task You’ll find them only
in hours where a little real-world exploration will help build a better understanding
of the material Even if you don’t have the necessary software and hardware to
undertake some of the exercises in the Workshop, you might benefit from reading
through the exercises to see how the tools work in a real network implementation
Key Terms
Each hour includes a summary of important key terms that are introduced in the hour The
key terms are compiled into an alphabetized list at the end of each hour
Introduction
3
By the
Way
Trang 22This page intentionally left blank
Trang 23PART I
TCP/IP Basics