Understanding TCP/IP
By Alena Kabelová and Libor Dostálek
4/5
()
About this ebook
Related to Understanding TCP/IP
Related ebooks
Cisco Networking All-in-One For Dummies Rating: 4 out of 5 stars4/5Cisco Networking Essentials Rating: 0 out of 5 stars0 ratingsLearn Cisco Network Administration in a Month of Lunches Rating: 0 out of 5 stars0 ratingsKali Linux Penetration Testing Bible Rating: 0 out of 5 stars0 ratingsWireshark for Security Professionals: Using Wireshark and the Metasploit Framework Rating: 4 out of 5 stars4/5CCNA Certification All-in-One For Dummies Rating: 5 out of 5 stars5/5TCP / IP For Dummies Rating: 5 out of 5 stars5/5Software Networks: Virtualization, SDN, 5G and Security Rating: 0 out of 5 stars0 ratingsCentOS 8 Essentials: Learn to Install, Administer and Deploy CentOS 8 Systems Rating: 0 out of 5 stars0 ratingsCompTIA Server+ Study Guide: Exam SK0-005 Rating: 5 out of 5 stars5/55G Explained: Security and Deployment of Advanced Mobile Communications Rating: 0 out of 5 stars0 ratingsLEARN MPLS FROM SCRATCH PART-A: A Beginner's Guide to Next Level of Networking Rating: 0 out of 5 stars0 ratingsNetworking Fundamentals: Develop the networking skills required to pass the Microsoft MTA Networking Fundamentals Exam 98-366 Rating: 0 out of 5 stars0 ratingsTCP/IP for Everyone Rating: 4 out of 5 stars4/5Mastering Linux Network Administration Rating: 4 out of 5 stars4/5A Practical Guide Wireshark Forensics Rating: 5 out of 5 stars5/5Wireshark Essentials Rating: 0 out of 5 stars0 ratingsLearning Linux Shell Scripting Rating: 4 out of 5 stars4/5Packet Analysis with Wireshark Rating: 0 out of 5 stars0 ratingsTCP/IP Networking Interview Questions, Answers, and Explanations: TCP/IP Network Certification Review Rating: 5 out of 5 stars5/5Mastering Linux Shell Scripting Rating: 4 out of 5 stars4/5Mastering Bash Rating: 5 out of 5 stars5/5Linux Networking Cookbook Rating: 0 out of 5 stars0 ratingsCisco Network Administration Interview Questions: CISCO CCNA Certification Review Rating: 5 out of 5 stars5/5Linux Shell Scripting Cookbook, Second Edition Rating: 0 out of 5 stars0 ratingsPacket Tracer Network Simulator Rating: 5 out of 5 stars5/5CCNA Routing and Switching Complete Review Guide: Exam 100-105, Exam 200-105, Exam 200-125 Rating: 0 out of 5 stars0 ratings
Information Technology For You
Cybersecurity for Beginners : Learn the Fundamentals of Cybersecurity in an Easy, Step-by-Step Guide: 1 Rating: 0 out of 5 stars0 ratingsCreating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Summary of Super-Intelligence From Nick Bostrom Rating: 4 out of 5 stars4/5An Ultimate Guide to Kali Linux for Beginners Rating: 3 out of 5 stars3/5CompTIA A+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Core 1 Exam 220-1101 Rating: 0 out of 5 stars0 ratingsExcel VBA: A Step-By-Step Tutorial For Beginners To Learn Excel VBA Programming From Scratch: 1 Rating: 4 out of 5 stars4/5Data Analytics for Beginners: Introduction to Data Analytics Rating: 4 out of 5 stars4/5The iPadOS 17: The Complete User Manual to Quick Set Up and Mastering the iPadOS 17 with New Features, Pictures, Tips, and Tricks Rating: 0 out of 5 stars0 ratingsCOMPUTER SCIENCE FOR ROOKIES Rating: 0 out of 5 stars0 ratingsSupercommunicator: Explaining the Complicated So Anyone Can Understand Rating: 3 out of 5 stars3/5Learning Microsoft Endpoint Manager: Unified Endpoint Management with Intune and the Enterprise Mobility + Security Suite Rating: 0 out of 5 stars0 ratingsCompTia Security 701: Fundamentals of Security Rating: 0 out of 5 stars0 ratingsCompTIA ITF+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Exam FC0-U61 Rating: 5 out of 5 stars5/5Design and Build Modern Datacentres, A to Z practical guide Rating: 3 out of 5 stars3/5How to Write Effective Emails at Work Rating: 4 out of 5 stars4/5How to Find a Wolf in Siberia (or, How to Troubleshoot Almost Anything) Rating: 0 out of 5 stars0 ratingsA Practical Guide Wireshark Forensics Rating: 5 out of 5 stars5/5Self-Sovereign Identity Rating: 0 out of 5 stars0 ratingsInkscape Beginner’s Guide Rating: 5 out of 5 stars5/5Getting started with Audacity 1.3 Rating: 5 out of 5 stars5/5The Design Inference Rating: 5 out of 5 stars5/5Learn Algorithmic Trading: Build and deploy algorithmic trading systems and strategies using Python and advanced data analysis Rating: 0 out of 5 stars0 ratingsCompTIA Network+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Exam N10-008 Rating: 0 out of 5 stars0 ratingsDevOps Handbook: What is DevOps, Why You Need it and How to Transform Your Business with DevOps Practices Rating: 4 out of 5 stars4/5The Programmer's Brain: What every programmer needs to know about cognition Rating: 5 out of 5 stars5/5Who Says Elephants Can't Dance?: Leading a Great Enterprise Through Dramatic Change Rating: 4 out of 5 stars4/5
Reviews for Understanding TCP/IP
2 ratings0 reviews
Book preview
Understanding TCP/IP - Alena Kabelová
Table of Contents
Understanding TCP/IP
Credits
About the Authors
Acknowledgements
Preface
What This Book Covers
What You Need for This Book
Conventions
Reader Feedback
Customer Support
Errata
Questions
1. Introduction to Network Protocols
1.1 ISO OSI
1.1.1 Physical Layer
1.1.2 Data Link Layer
1.1.3 Network Layer
1.1.4 Transport Layer
1.1.5 Session Layer
1.1.6 Presentation Layer
1.1.7 Application Layer
1.2 TCP/IP
1.2.1 Internet Protocol
1.2.2 TCP and UDP
1.2.3 Application Protocols
1.3 Methods of Information Transmission
1.3.1 Synchronous Transmission
1.3.2 Packet Transmission
1.3.3 Asynchronous Transmission
1.4 Virtual Circuit
2. Network Monitoring Tools
2.1 Packet Drivers
2.2 MS Network Monitor
2.2.1 Frame Capturing
2.2.2 Viewing Captured Frames
2.2.3 Filters for Displaying Captured Frames
2.3 Ethereal
2.4 Homework
3. Physical Layer
3.1 Serial Line
3.1.1 Serial and Parallel Data Transport
3.1.2 Symmetrical and Asymmetrical Signals
3.1.3 Synchronous and Asynchronous Transport
3.1.4 V.24, V.35, and X.21 Protocols
3.1.5 Null Modem
3.2 Modems
3.2.1 Dial-Up Connection
3.2.2 Leased Lines
3.2.3 Automatic Modem
3.2.3.1 AT Commands
3.2.4 Synchronous Transmission
3.2.5 Baseband, Voice Band, and ADSL
3.2.6 Transmission Rate
3.2.6.1 The V.90 Recommendation
3.2.7 Data Compression
3.2.8 Error Detection
3.3 Digital Circuits
3.3.1 ISDN
3.3.1.1 Basic Rate
3.3.1.2 Higher Layer Protocols and Signalization
3.3.2 E and T Lines
3.4 LAN
3.4.1 Structured Cables
3.4.1.1 Copper Distribution
3.4.1.2 Optical Fibers
3.4.2 Ethernet (10 Mbps)
3.4.2.1 AUI
3.4.2.2 BNC
3.4.2.3 Twisted-Pair
Optical Fiber
3.4.3 Fast Ethernet (100 Mbps)
3.4.4 Gigabyte Ethernet (1 Gbps)
4. Link Layer
4.1 Serial Line Internet Protocol
4.2 Compressed SLIP
4.3 High-Level Data Link Control Protocol
4.3.1 Flag
4.3.2 Address Field
4.3.3 Control Field
4.3.3.1 I-Frame
4.3.3.2 S-Frame
4.3.3.3 U-Frame
4.3.4 Data Field and a Transferred Protocol Type
4.3.5 Checksum
4.3.6 HDLC Protocol Summary
4.4 Point-To-Point Protocol
4.4.1 Dialing a Phone Line
4.4.2 Link Control Protocol
4.4.3 Authentication
4.4.3.1 Password Authentication Protocol
4.4.3.2 Challenge Handshake Authentication Protocols
4.4.3.3 Extensible Authentication Protocol
4.4.3.4 Radius Protocol
4.4.4 Call-Back Control Protocol
4.4.5 Other Protocols
4.4.5.1 Multilink Protocol
4.4.5.2 Bandwidth Allocation Protocol and Bandwidth Allocation Control Protocol
4.4.5.3 Compression Control Protocol
4.4.5.4 Encryption Control Protocol
4.4.5.5 Setting Encryption Keys
4.4.6 Internet Protocol Control Protocol
4.5 Frame Relay
4.5.1 A Frame Relay Protocol Frame
4.5.2 IP Through Frame Relay
4.5.3 Local Management Interface
4.5.4 Frame Relay Configuration on CISCO Routers
4.5.5 Frame Relay Protocol
4.6 Local Area Networks
4.6.1 Ethernet
4.7 Wireless Local Area Network
4.7.1 Typical WLAN Configuration
4.7.1.1 Peer-To-Peer Networks
4.7.1.2 Access Point
4.7.1.3 Roaming (Several Access Points)
4.7.1.4 Backbone Point-to-Point Connection
4.7.2 Antennas
4.7.3 Security of WLAN
4.7.3.1 Service Set ID
4.7.3.2 Wired Equivalent Privacy
4.7.3.3 IEEE 802.1X
4.8 Fixed Wireless Access
4.8.1 The Differences Between FWA and WLAN
4.8.2 The Main Benefits of FWA
5. Internet Protocol
5.1 IP Datagram
5.2. Internet Control Message Protocol
5.2.1 Echo
5.2.2 Destination Unreachable
5.2.3 Source Quench (Lower Sending Speed)
5.2.4 Redirect
5.2.5 ICMP Router Discovery
5.2.6 Time Exceeded
5.2.7 Subnet Address Mask Request
5.2.8 Time Synchronization
5.3 Fragmentation
5.4 Optional Entries in the IP Header
5.4.1 Record Route
5.4.2 Timestamp
5.4.3 Source Routing
5.4.4 IP Router Alert Option
5.5 ARP and RARP Protocols
5.5.1 ARP Filtering
5.5.2 Proxy ARP
5.5.3 Reverse ARP
5.6 Internet Group Management Protocol
5.7 Multicast and Link Protocol
6. IP Address
6.1 Network: First Period of History
6.1.1 Special-Use IP Addresses
6.1.2 Network Mask
6.2 Network: Second Period of History
6.2.1 Subnetworks
6.2.2 Super-Networks and Autonomous Systems
6.3 IP Addresses in the Intranet and Special-Use IP Addresses
6.4 Unnumbered Interface
6.4.1 Dynamic Address Assignment
6.5 Address Plan
6.6 Over 254 Interfaces in a LAN
7. Routing
7.1 Forwarding and Screening
7.2 Routing
7.2.1 Processing
7.3 Handling Routing Tables
7.3.1 List of Contents of a Routing Table in a Command Prompt
7.3.1.1 Contents of a Routing Table in UNIX
7.3.2 Routing Table Listing in Windows 2000/XP/2003
7.3.3 Contents of a Routing Table in Cisco Routers
7.3.4 Routing Table Entry Addition and Removal
7.4 Routing Protocols
7.4.1 Routing Vector Protocols
7.4.1.1 RVP Principle
7.4.1.2 RIP and RIP2
7.4.2 Link State Protocols
7.4.2.1 OSPF
7.4.3 IPG and EGP
7.4.4 Aggregation
7.4.5 Redistribution
7.5 Neutral Exchange Point
8. IP Version 6
8.1 Next Headers of IP Version 6 Datagram
8.1.1 Hop-By-Hop Options
8.1.2 Routing Header
8.1.3 Fragment Header
8.1.4 Authentication Header
8.1.5 Encapsulating Security Payload Header
8.2 ICMP Version 6 Protocol
8.2.1 Address Resolution
8.2.2 Router Discovery
8.2.3 Redirect
8.3. IP Addresses
8.3.1 Types of Address Inscription
8.3.2 Multicasts
8.3.3 Unicasts
8.4 Windows 2003
9. Transmission Control Protocol
9.1 TCP Segments
9.2 TCP Header Options
9.3 Establishing and Terminating a Connection with TCP
9.3.1 Establishing a Connection
9.3.2 Terminating a Connection
9.3.3 Aborting a Connection
9.4 Determining the Connection State
9.5 Response Delay Techniques
9.6 Window Technique
9.7 Network Congestion
9.7.1 Slow Start
9.7.2 Congestion Avoidance
9.7.3 Segment Loss
9.8 The Window Scale Factor
10. User Datagram Protocol
10.1 Fragmentation
10.2 Broadcasts and Multicasts
11. Domain Name System
11.1 Domains and Subdomains
11.2 Name Syntax
11.3 Reverse Domains
11.4 Resource Records
11.5 DNS Protocol
11.6 DNS Query
11.6.1 DNS Query Packet Format
11.6.2 DNS Query Packet Header
11.6.3 Question Section
11.6.4 The Answer Section, Authoritative Servers, and Additional Information
12. Telnet
12.1 The NVT Protocol
12.2 Telnet Protocol Commands
12.2.1 Signal for Synchronization
12.2.2 The Telnet Command Line
12.2.3 Communication Modes
12.3 Example of Windows NT Client Communication
12.4 Example of UNIX Client Communication
13. File Transfer Protocol
13.1 Architecture
13.2 Active Mode of FTP Protocol Communication
13.3 Passive Mode of FTP Protocol Communication
13.4 FTP Commands
13.5 Proxy
13.6 Return Codes
13.7 Abnormal Termination of Data Transfer
13.8 Anonymous FTP
14. Hypertext Transfer Protocol
14.1 Client-Server
14.2 Proxy
14.3 Gateway
14.4 Tunnel
14.5 More Intermediate Nodes
14.6 Uniform Resource Identifier
14.6.1 The http Scheme
14.6.2 The ftp Scheme
14.6.3 The mailto Scheme
14.6.4 The nntp Scheme
14.6.5 The telnet Scheme
14.6.6 The file Scheme
14.6.7 The pop Scheme
14.7 Relative URI
14.8 The HTTP Request
14.8.1 The GET Method
14.8.2 The POST Method
14.8.3 The HEAD Method
14.8.4 The TRACE Method
14.8.5 The OPTIONS Method
14.9 The HTTP Response
14.9.1 An Overview of Result Codes
14.10 Other Header Fields
14.10.1 Accept Header Field
14.10.2 Client Authentication
14.10.3 Proxy Authentication
14.10.4 Content Header Field
14.10.5 Redirection and Temporary Unavailability of Objects
14.10.6 Cache
14.10.7 Software Information
14.11 Cookie
14.11.1 Set-Cookie and Set-Cookie2 Header Fields
14.11.1.1 Cookie Header Field
15. Email
15.1 Email Architecture
15.1.1 DNS and Email
15.2 Mail Message Format
15.2.1 Basic Header Fields
15.3 MIME
15.3.1 MIME Header Fields
15.3.1.1 MIME-Version
15.3.1.2 Content-Type
15.3.1.3 Content-Transfer-Encoding
15.3.1.4 Content-Disposition
15.3.2 Standard Encoding Mechanisms
15.3.2.1 Quoted-Printable
15.3.2.2 Base64
15.3.3 Non-ASCII Text in Message Header Fields
15.3.4 Discrete Media Types in Content-Type
15.3.4.1 text
15.3.4.2 application
15.3.4.3 image
15.3.4.4 audio
15.3.4.5 video
15.3.4.6 model
15.3.5 Composite Media Types in Content-Type
15.3.5.1 multipart
15.3.5.2 message
15.4 SMTP
15.5 ESMTP
VERB
8BITMIME
SIZE
ETRN
15.5.1 Message Delivery Receipt
15.5.1.1 Delivery Status Notification
15.5.1.2 The Disposition-Notification-To Header Field
15.6 POP3
15.7 IMAP4
15.7.1 Unauthenticated State
15.7.1.1 LOGIN
15.7.1.2 AUTHENTICATE
15.7.2 Authenticated State
15.7.2.1 CREATE, DELETE, RENAME, and LIST Commands
15.7.2.2 SUBSRCIBE, LSUB, and UNSUBSCRIBE Commands
15.7.2.3 STATUS
15.7.2.4 SELECT and EXAMINE Commands
15.7.3 Open Mailbox
15.7.3.1 COPY
15.7.3.2 SEARCH
15.7.3.3 FETCH
15.7.3.4 STORE
15.7.3.5 EXPUNGE
15.7.3.6 CLOSE
15.8 Mailing Lists
16. Forums
16.1 Message Format
16.2 NNTP Protocol
16.2.1 End User Communication
16.2.2 Communication Among Servers
16.2.3 Session Termination
17. Lightweight Directory Access Protocol
17.1 Protocol Principle
17.2 Data Model of LDAP Directory
17.3 LDAP Protocol Data Units
17.3.1 The Search Operation
17.3.1.1 Filters
17.3.2 Further Operations with Entries
17.3.2.1 The Add Operation
17.3.2.2 The Modify Operation
17.3.2.3 The Delete Operation
17.3.2.4 The Modify DN Operation
17.3.2.5 The Compare Operation
17.4 Server Programs
17.5 Client Programs
17.5.1 The LDAP Browser
17.5.2 The OpenLDAP Client
17.5.3 ADSIedit
17.5.4 MS Outlook Express and MS Outlook
17.6 Lightweight Directory Interchange Format
A. CISCO Routers
A.1 Interface Identification
A.2 Cables
A.3 Memory
A.4 Console
A.5 Commands
A.5.1 Non-Privileged Mode
A.5.2 Privileged mode
A.6 Configuration
A.6.1 Setting a Password for Privileged Mode
A.6.2 Web
A.6.3 ConfigMaker
A.7 Debugging
Index
Understanding TCP/IP
Libor Dostálek
Alena Kabelová
Understanding TCP/IP
A clear and comprehensive guide to TCP/IP protocols
Copyright © 2006 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, Packt Publishing, nor its dealers or distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: April 2006
Production Reference: 1130406
Published by Packt Publishing Ltd. 32 Lincoln Road Olton Birmingham, B27 6PA, UK.
ISBN 1-904811-71-X
www.packtpub.com
Cover Design by www.visionwt.com
This is an authorized and updated translation from the Czech language.
Copyright © Computer Press 2003 Velký průvodce protokoly TCP/IP a systémem DNS . ISBN: 80-722-6675-6. All rights reserved.
Credits
Authors
Libor Dostálek
Alena Kabelová
Contributing Authors
Marta Vohnoutová
Luděk Rašek
Michal Hojsík
Technical Editors
Abhishek Shirodkar
Darshan Parekh
Development Editor
Louay Fatoohi
Editorial Manager
Dipali Chittar
Indexer
Abhishek Shirodkar
Proofreader
Chris Smith
Production Coordinator
Manjiri Nadkarni
Illustrator
Shantanu Zagade
Cover Designer
Helen Wood
About the Authors
Libor Dostálek was born in 1957 in Prague, Czech Republic. He graduated in mathematics at the Charles University in Prague. For the last 20 years he has been involved in ICT architecture and security. His experiences as the IT architect and the hostmaster of one of the first European Internet Service Providers have been used while writing this publication.
Later he became an IT architect of one of the first home banking applications fully based on the PKI architecture, and also an IT architect of one of the first GSM banking applications (mobile banking). As a head consultant, he designed the architecture of several European public certification service providers (certification authorities) and also many e-commerce and e-banking applications.
The public knows him either as an author of many publications about TCP/IP and security or as a teacher. He has taught at various schools as well as held various commercial courses. At present, he lectures on Cryptology protocols at the Charles University in Prague.
He is currently an employee of the Siemens.
Alena Kabelová was born in 1964 in Budweis, Czech Republic. She graduated in ICT at the Economical University in Prague. She worked together with Libor Dostálek as a hostmaster. She is mostly involved in software development and teaching. At present, she works as a senior project manager at the PVT and focuses mainly on electronic banking.
Her experiences as the hostmaster of an important European ISP are applied in this publication.
Acknowledgements
This book has a long history. In every new edition, there were new chapters and sections added by different co-authors. We extend our special thanks to our following co-authors:
Luděk Rašek wrote Chapter 17 (Lightweight Directory Access Protocol).
Marta Vohnoutová wrote section 4.7 (Wireless Local Area Network).
Michal Hojsík wrote section 7.4.2 (Link State Protocols).
The English edition was really a tough one. The original book was split into two volumes: Understanding TCP/IP (ISBN: 1-904811-71-X) and DNS in Action (ISBN: 1-904811-78-7). The book has been rewritten and the content list is not the same as the original book. The person who urged us to rewrite the book was the book's editor from Packt Publishing, Abhishek Shirodkar. Thanks to Abhishek, the English edition of this has turned out to be really good.
Preface
You are probably wondering whether to refer to this book to understand more about TCP/IP or to read some other good books describing similar topics and containing the word TCP/IP in their titles. Let us explain to you what moved us to write another publication about the TCP/IP protocols on which the Internet is based.
Publications about the Internet are usually of two types:
Publications involved with concrete operating systems (Microsoft Windows, UNIX, CISCO, etc.). The goal of such publications is to train readers in a particular TCP/IP implementation, while describing the main TCP/IP principles is only their secondary goal.
Publications written for the academic environment. Even if their main goal is to describe the basic TCP/IP principles, they could be too tedious for many readers.
So we faced the task of creating a basic TCP/IP guide, independent from any concrete environment (for example, Microsoft Windows, UNIX, CISCO, etc.), emphasizing presentation of the text in a clear and apt form to readers so that they understand the main coherences. To explain the basic principles and coherences in the best way, we have used a lot of illustrations. These illustrations were not created by chance. We drew and constantly refined them according to the requirements from our countless TCP/IP courses. First we chalked them on a blackboard, next we drew them on a white blackboard, and finally we drew them in Microsoft Visio. It has been twenty years since we started teaching TCP/IP.
If you say to yourself that you will not pay for this book and will study TCP/IP directly from the Internet RFC standards, you have unknowingly found the next goal of this publication. Exploring the huge number of RFC standards takes a lot of time, and moreover their study is very difficult for a beginner. (The idea of someone reading international standards as a novel in his or her bed before sleep is funny.) So another goal of this publication is to equip readers with such knowledge that they would be able to study RFC by themselves after reading this book.
We, the authors, wish you good luck and hope that you get a lot of useful information by reading this publication.
What This Book Covers
Chapter 1 contains a general introduction to computer networks. The ISO OSI model is mentioned and compared with the TCP/IP protocol family.
Chapter 2 acquaints the reader with the basics of network sniffing. Network sniffing is demonstrated with the help of two tools: MS Network Monitor and Ethereal. We use network sniffing as our basic means to clarify principles of particular protocols.
Chapter 3 deals with the physical layer. Concretely, it deals with serial lines, modems, ISDN, and LAN.
Chapter 4 deals with a link layer. It describes the SLIP, CSLIP, PPP, FrameRelay, Ethernet, WiFi (IEEE 802.11), and FWA protocols.
Chapter 5 describes the Internet Protocol (IP) including ICMP, IGMP, ARP, and RARP protocols.
Chapter 6 clarifies the meaning of an IP address and a network mask. It also emphasizes the historical process by which the meaning of the term IP network has developed.
Chapter 7 describes the term 'routing', which is, without any doubt, the most complicated area of IP networks. This chapter explains the principles on which particular types of routing protocols are based. However, a detailed description of individual routing protocols is beyond the scope of this publication.
Chapter 8 deals with the new IP generation—the Internet Protocol version 6.
Chapter 9 turns to the TCP protocol.
Chapter 10 describes the little brother of the TCP protocol—the UDP protocol.
Chapter 11 discusses the Domain Name System (DNS), which translates names into IP addresses and vice versa.
Chapter 12 describes the Telnet protocol. It is rarely used today, but because it is often a base of application protocols, we will use it to explain the principles of these application protocols (excluding the LDAP protocol).
Chapter 13 addresses the File Transfer protocol (FTP).
Chapter 14 describes probably the most popular protocol, HTTP.
Chapter 15 deals with electronic mail. It describes the following protocols: SMTP, ESMTP, POP3, IMAP4, and MIME; and even mailing lists are mentioned here.
Chapter 16 describes discussions forums (the NNTP protocol).
Chapter 17 deals with the Lightweight Directory Access Protocol (LDAP).
Appendix A contains the basic principles of working with CISCO routers for beginners.
What You Need for This Book
This publication is created to help beginners who are already familiar with computers to discover the secrets of TCP/IP. It will be useful for students, advanced users, computer and network administrators, computer managers, and security managers. Professionals who want to discover secrets of Internet technology can also appreciate it. It will be also useful as a textbook of TCP/IP lectures.
This publication contains a lot of examples. Please do not blame us if we take the side of some particular operating system; we have put here examples from both Windows and UNIX, and sometimes even CISCO. We have added a supplement containing the basics of the CISCO system because a basic knowledge of the operating system of CISCO routers is essential not only for network administrators, but also for the general readers.
This book explains the TCP/IP concepts to users, independently of the hardware and software they use. Readers can effectively work with TCP/IP even in a not-so-powerful personal computer.
Conventions
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
There are three styles for code. Code words in text are shown as follows: You can set it explicitly for the ping and traceroute commands.
A block of code will be set as follows:
C: HEAD / HTTP/1.1;;
C: Host: www.iana.org
C:
S: HTTP/1.1 200 OK
S: Date: Tue, 20 Dec 2005 21:17:06 GMT
S: Server: Apache/1.3.27 (Unix) (Red-Hat/Linux)
S: Last-Modified: Thu, 04 Nov 2004 19:34:30 GMT
S: ETag: 1acad9-153a-418a8446
S: Accept-Ranges: bytes
S: Content-Length: 5434
S: Connection: close
S: Content-Type: text/html
When we wish to draw your attention to a particular part of a code block, the relevant lines or items will be made bold:
+ FRAME: Base frame properties
+ ETHERNET: ETYPE = 0x0800 : Protocol = IP: DOD Internet Protocol
IP: ID = 0x673D; Proto = ICMP; Len: 84
IP: Version = 4 (0x4)
IP: Header Length = 44 (0x2C)
+ IP: Service Type = 0 (0x0)
IP: Total Length = 84 (0x54)
IP: Identification = 26429 (0x673D)
+ IP: Flags Summary = 0 (0x0)
IP: Fragment Offset = 0 (0x0) bytes
IP: Time to Live = 32 (0x20)
New terms and important words are introduced in a bold-type font. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this: clicking the Next button moves you to the next screen
.
Note
Warnings or important notes appear in a box like this.
Reader Feedback
Feedback from our readers is always welcome. Let us know what you think about this book, what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply drop an email to<[email protected]>, making sure to mention the book title in the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer Support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Errata
Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in text or code—we would be grateful if you would report this to us. By doing this you can save other readers from frustration, and help to improve subsequent versions of this book. If you find any errata, report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the Submit Errata link, and entering the details of your errata. Once your errata have been verified, your submission will be accepted and the errata added to the list of existing errata. The existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Questions
You can contact us at<[email protected]> if you are having a problem with some aspect of the book, and we will do our best to address it.
Chapter 1. Introduction to Network Protocols
Just as diplomats use diplomatic protocols in their meetings, computers use network protocols to communicate in computer networks. There are many network protocols in existence; TCP/IP is a family of network protocols that are used for the Internet.
A network protocol is a standard written down on a piece of paper (or, more precisely, with a text editor in a computer). The standards that are used for the Internet are called Requests For Comment (RFC) . RFCs are numbered from 1 onwards. There are more than 4,500 RFCs today. Many of them have become out of date, so only a handful of the first thousand RFCs are still used today.
The International Standardization Office (ISO) has standardized a system of network protocols called as ISO OSI. Another organization that issues communication standards is the International Telecommunication Union (ITU) located in Geneva. The ITU was formerly known as the CCITT and, being founded in 1865, is one of the oldest worldwide organizations (for comparison, the Red Cross was founded in 1863). Some standards are also issued by the Institute of Electrical and Electronics Engineers (IEEE) . RFC, standards released by RIPE (Réseaux IP Européens), and PKCS (Public Key Cryptography Standard) are freely available on the Internet and are easy to get hold of. Other organizations (ISO, ITU, and so on) do not provide their standards free of charge—you have to pay for them. If that presents a problem, then you have to spend some time doing some library research.
First of all, let’s have a look at why network communication is divided into several protocols. The answer is simple although this is a very complex problem that reaches across many different professions. Most books concerning network protocols explain the problem using a metaphor of two foreigners (or philosophers, doctors, and so on) trying to communicate with each other. Each of the two can only communicate in his or her respective language. In order for them to be able to communicate with each other, they need a translator as shown in the following figure:
Figure 1.1: Three-layer communication architecture
The two foreigners exchange ideas, i.e., they communicate. But they only do so virtually. In reality, they are both handing over information to their interpreters, who then transmit this information by sending vibrations through the surrounding air with their vocal cords. Or if the parties are far away from each other, the interpreters communicate over the phone; thus the information is physically transmitted over phone lines. We can therefore talk about virtual communication in the horizontal direction (philosophical communication, the shared language between interpreters, and electronic signals transmitted via phone lines) and real communication in the vertical direction (foreigner-to-interpreter and interpreter-to-phone). We can thus distinguish three levels of communication:
Between two foreigners
Between interpreters
Physical transmission of information using media (phone lines, sound waves, etc.)
Communication between the two foreigners and between the two interpreters is only virtual. In fact, the only real communication happens between the foreigner and his or her interpreter.
Even more layers are used in computer networks. The number of layers depends on which system of network protocols you choose to use. The system of network protocols is sometimes referred to as the network model. You most commonly work with a system that uses the Internet, which is also referred to as the TCP/IP family. In addition to TCP/IP, we will also come across the ISO OSI model that was standardized by the ISO.
Figure 1.2: Comparison of TCP/IP and ISO OSI network models
The TCP/IP family uses four layers while ISO OSI uses seven layers as shown in the figure above. The TCP/IP and ISO OSI systems differ from each other significantly, although they are very similar on the network and transport layers.
Except for some exceptions like SLIP or PPP, the TCP/IP family does not deal with the link and physical layers. Therefore, even on the Internet, we use the link and physical protocols of the ISO OSI model.
1.1 ISO OSI
Communication between two computers is shown in the following figure:
Figure 1.3: Seven-layer architecture of ISO OSI
1.1.1 Physical Layer
The physical layer is responsible for activating the physical circuit between the Data Terminal Equipment (DTE) and Data Circuit-terminating Equipment (DCE) , communicating through it, and then deactivating it. Additionally, the physical layer is also responsible for the communication between DCEs (see Figure 1.3a). A computer or router can represent the DTE. The DCE, on the other hand, is usually represented by a modem or a multiplexer.
Figure 1.3a: DTE and DCE
To put it differently, the physical layer describes the electric or optical signals used for communicating between two computers. Physical circuits are created on the physical layer. Other appliances such as modems modulating a signal for a phone line are often put in the physical circuits created between two computers.
Physical layer protocols specify the following:
Electrical signals (for example, +1V)
Connector shapes (for example, V.35)
Media type (twisted pair, coaxial cable, optical fiber, etc.)
Modulation (for example, FM, PM, etc.)
Coding (for example, RZ, NRZ, etc.)
Synchronization (synchronous and asynchronous communication, time source, and so on)
1.1.2 Data Link Layer
As for serial links, the link layer provides data exchange between neighboring computers as well as data exchange between computers within a local network.
For the link layer, the basic unit of data transfer is the data link packet frame (see Figure 1.4). A data frame is composed of a header, payload, and trailer.
Figure 1.4: Data link packet or frame
A frame carries the destination link address, source link address, and other control information in the header. The trailer usually contains the checksum of the transported data. By using the checksum, we can find out whether the payload has been damaged during transfer. The network‑layer packet is usually included in the payload.
In Figure 1.3a, the link layer does not engage in a conversation between DTE and DCE (the link layer does not see the DCE). It is engaged, however, in the frame exchange between DTEs. (It relies on the physical layer to handle the DCE issue.)
The following figure illustrates that different protocols can be used for each end of the connection on the physical layer. In our case, one of the ends uses the X.21 protocol while the other end uses the V.35 protocol. This rule is valid not only for serial links, but also for local networks. In local networks, you are more likely to encounter more complicated setups in which a switch that converts the link frames of one link protocol into link frames of a second one (for example, Ethernet into FDDI) is inserted between the two ends of the connection. This obviously results in different protocols being used on the physical layer.
Figure 1.5: Link layer communication
A serial port or an Ethernet card can serve as a link interface. A link interface has a link address that is unique within a particular Local Area Network (LAN).
1.1.3 Network Layer
The network layer ensures the data transfer between two remote computers within a particular Wide Area Network (WAN) . The basic unit of transfer is a datagram that is wrapped (encapsulated) in a frame. The datagram is also composed of a header and data field. Trailers are not very common in network protocols.
Figure 1.6: Network packet and its insertion in the link frame
As shown in the figure above, the datagram header, together with data (network-layer payload), creates the payload or data field of the frame.
There is usually at least one router on WANs between two computers. The connection between two neighboring routers on the link layer is always direct. The router unpacks the datagram from a frame, only to wrap it again into a different frame (or, more generally, in a frame of different link protocol) before sending it to a different line. The network layer does not see the appliances on the physical and link layers (modems, repeaters, switches, etc.).
The network layer does not care about what kind of link protocols are used on route between the source and the destination.
Figure 1.7: Network layer communication
A serial port or an Ethernet card can be used as a network interface. A network interface has a one or more unique address within a particular WAN.
1.1.4 Transport Layer
A network layer facilitates the connection between two remote computers. As far as the transport layer is concerned, it acts as if there were no modems, repeaters, bridges, or routers along the way. The transport layer relies completely on the services of lower layers. It also expects that the connection between two computers has been established, and it can therefore fully dedicate its efforts to the cooperation between two distant computers. Generally, the transport layer is responsible for communication between two applications running on different computers.
There can be several transport connections between two computers at any given time (for example, one for a virtual terminal and another for email). On the network layer, the transport packets are directed based on the address of the computer (or its network interface). On the transport layer, individual applications are addressed. Applications use unique addresses within one computer, so the transport address is usually composed of both the network and transport addresses.
Figure 1.8: Transport layer connection
In this case, the basic transmission unit is the segment that is composed of a header and payload. The transport packet is transmitted within the payload of the network packet.
Figure 1.9: Inserting transport packets into network packets that are then inserted into link frames
1.1.5 Session Layer
The session layer facilitates exchange of data between two applications. In other words, it serves as a checkpoint and is involved in synchronizing transactions, correctly closing files, and so on. Sharing a network disk is a good example of a session. The disk can be shared for a certain period of time, but the disk is not used for the entire time. When we need to work with a file on the network disk, a connection is established on the transport layer from the time when the file is opened to when it is closed. The session, however, exists on the session layer for the entire time the disk is being shared.
The basic unit is a session layer PDU (Protocol Data Unit), which is inserted in a segment. Other books often illustrate this with a figure of a session-layer PDU, composed of the session header and payload, being inserted in the segment. Starting with the session layer, however, this does not necessarily have to be the case. The session layer information can be transmitted inside the payload. This situation is even more noticeable if, for example, the presentation layer encrypts the data, and thus changes the whole content of the session-layer PDU.
1.1.6 Presentation Layer
The presentation layer is responsible for representing and securing data. The representation can differ on different computers. For example, it deals with the problem of whether the highest bit is in the byte on the right or on the left. By securing, we mean encrypting, ensuring data integrity, digital signing, and so forth.
1.1.7 Application Layer
The application layer defines the format in which the data should be received from or handed over to the applications. For example, the OSI Virtual Terminal protocol describes how data should be formatted as well as the dialogue used between the two ends of the connection.
Figure 1.10: Examples of network protocols from the ISO OSI protocols family
1.2 TCP/IP
With a few exceptions, the TCP/IP family does not deal with the physical or link layers. In practice, Internet protocols often use protocols that adhere to the ISO OSI standards for the physical and link layers.
What is the correlation between the ISO OSI protocols and TCP/IP? Each group of protocols has its definition of its own layers as well as the protocols used on these layers. Generally speaking, ISO OSI protocols and TCP/IP are incompatible. In practice, ISO OSI-compliant communication appliances need to be used for transferring IP datagrams, or on the other hand, services based on ISO OSI need to be provided via the Internet.
1.2.1 Internet Protocol
Internet Protocol (IP) basically corresponds to the network layer. IP is used for transmitting IP datagrams between remote computers. Each IP datagram header contains the destination address, which is the complete routing information used for delivering the IP datagram to its destination. Therefore, the network can only transmit each datagram individually. IP datagrams of one session can be transmitted through different paths and can thus be received by the destination in a different order than they were sent.
Each network interface on the large Internet network has one or more IP address that is unique worldwide. (One network interface can have several IP addresses, but one IP address cannot be used by many network interfaces.) The Internet is composed of individual networks that are interconnected via routers. Routers are also referred to as gateways in old literature.
1.2.2 TCP and UDP
TCP and UDP correspond to the transportation layer. TCP transports data using TCP segments that are addressed to individual applications. UDP transports data using UDP datagrams.
TCP and UDP arrange a connection between applications that run on remote computers. TCP and UDP can also facilitate communication between processes running on the same computer, but this is not very interesting for our purposes.
The difference between TCP and UDP is that TCP is a connection-oriented service—the destination confirms the data received. If some data (TCP segments) gets lost, the destination requests a retransmission of the lost data. UDP transports data using datagrams (the delivery is not guaranteed). In other words, the source party sends the datagram without worrying about whether it has been received. UDP is connectionless-oriented service.
The port is used as the address. To understand the difference between an IP address and port number, think of it as a mailing address. The IP address corresponds to the address of a house, while the port tells you the name of the person that should receive the letter.
TCP is described in Chapter 9 and UDP in Chapter 10.
1.2.3 Application Protocols
Application protocols correspond to several ISO OSI layers. The session, presentation, and application ISO OSI layers are reduced to one TCP/IP application layer.
The absence of a presentation layer is made up for by introducing specialized presentation-application protocols such as SSL and S/MINE that specialize in securing data or the Virtual Terminal and ASN.1 protocols that are designed for presenting data. The Virtual Terminal protocol (not to be confused with the ISO OSI protocol of the same name) specifies the network data presentation for character-oriented network protocols (Telnet, FTP, SMTP, and, partly, HTTP). Similarly, ASN.1 is often used for binary-oriented network transport. ASN.1 (including BER or DER encoding) was initially used by SNMP, but today it is also used by S/MINE.
There are many different application protocols. For practical purposes, they can be divided into two groups:
User protocols utilized by user applications (HTTP, SMTP, Telnet, FTP, IMAP, PIP3, and so on).
Service protocols, i.e., the protocols that ordinary Internet users rarely encounter. These protocols make sure the Internet functions correctly. For example, these could be routing protocols that are used for mutual communication by routers to correctly set their routing tables. Another example is SNMP usage in network administration.
Figure 1.11: Some protocols of the TCP/IP family
1.3 Methods of Information Transmission
There are many different network protocols and several protocols can be available even on a single layer. Especially with lower-layer protocols, we distinguish between the types of transmission that they facilitate, whether they provide connection-oriented or connection-less services, if the protocol uses virtual circuits, and so on. We also distinguish between synchronous, packet, and asynchronous transmission.
1.3.1 Synchronous Transmission
Synchronous transmission is needed when it is necessary to provide a stable (guaranteed) bandwidth, for example, in audio and video. If the source does not use the provided bandwidth it remains unused. Synchronous transmission uses frames that are of fixed length and are transmitted at constant speeds.
Figure 1.12: Frames divided into slots in synchronous transmission
In synchronous transmission, the guaranteed bandwidth is established by dividing the transmitted frames into slots (see Figure 1.12). One or more slots in any transmitted frame are reserved for a particular connection. Let’s say that each frame has slot 1 reserved for our connection. Since the frames follow each other steadily in a network, our application has a guaranteed bandwidth consisting of the number of slot 1s that can be transmitted through the network in one second.
The concept becomes even clearer if we draw several frames under each other, creating a ‘super-frame’ (see Figure 1.13). The slots located directly under each other belong to the same connection.
Figure 1.13: Super-frame
Synchronous transmission is used to connect your company switchboard to the phone company exchange. In this case, we use an E1(or T1 in United States) link containing 32 slots of 64 Kbps each. A slot can be used for making a phone call. Therefore, in theory, 32 calls are guaranteed at the same time (although some slots are probably used for servicing).
The Internet does not use synchronous transmission, i.e., in general, does not guarantee bandwidth. Quality audio or video transmission on the Internet is usually achieved by over-dimensioning the transmission lines. Recently, there has been a steady increase in requests for audio and video transmission via the Internet, so more and more often we come across systems that guarantee bandwidth even on the Internet with the help of Quality of Service (QoS). In order for us to reach the expected results, however, all appliances on route from the source to the destination must support these services. Today, we are more likely to get involved with only those areas on the Internet that guarantee bandwidth such as within a particular Internet provider.
1.3.2 Packet Transmission
(From now onwards we will use the term packet to refer to ‘packet’, ‘datagram’, ‘segment’, ‘protocol data unit’.) Packet transmission is especially valuable for transferring data. Packets usually carry data of variable size.
Figure 1.14: Packet data transmission
One packet always carries data of one particular application (of one connection). It is not possible to guarantee bandwidth, because the packets are of various lengths. On the other hand, we can use the bandwidth more effectively because if one application does not transmit data, then other applications can use the bandwidth instead.
1.3.3 Asynchronous Transmission
Asynchronous transmission is used in the ATM protocol. This transmission type combines features of packet transmission with features of synchronous transmission.
Figure 1.15: Asynchronous data transfer
Similarly to synchronous transmission, in asynchronous transmission, the data are transmitted in packets that are rather small, but are all of the same size; these packets are called cells. Similarly to packet transmission, data for one application (one connection) is transmitted in one cell. All cells have the same length; so if we guarantee that the nth cell will be available for a certain application (a particular connection), the bandwidth will be guaranteed by this as well. Additionally, it doesn’t really matter if the application does not send the cell since a different application’s cell might be sent instead.
1.4 Virtual Circuit
Some network protocols create virtual circuits in networks. A virtual circuit is conducted through the network and all packets of a particular connection go via the circuit. If the circuit gets interrupted anywhere, then the connection is interrupted, a new circuit is established, and data transmission continues.
Figure 1.16: Virtual circuit
In the figure above, a virtual circuit between nodes A and D is established via nodes B, F, and G. All packets must go through this circuit.
Datagrams can be transmitted via the virtual circuit in two ways:
The circuit does not guarantee the datagram’s delivery to its destination. (If network congestion occurs, the circuit can even throw the datagram away.) An example is the Frame Relay protocol.
The virtual circuit can establish a connection and guarantee the data delivery, i.e., the data packets transmitted are numbered and the destination confirms their reception. If any data gets lost, a request to resend the data is made. For example, this mechanism is used in the X.25 protocol.
The advantage of virtual circuits is that they are first established (using signalization) and then the data is inserted only into the established circuit. Each packet does not have to carry the globally unique address of the destination (complete routing information) in its header. It only needs the circuit ID.
The virtual mechanism is not used on the Internet, which was primarily aimed for use by the U.S. Department of Defense, since the destruction