Data Communications and Networking By Behrouz A.Forouzan cn.pdf
Document Details
Uploaded by Deleted User
De Anza College
2007
Tags
Full Transcript
Don't forget to check out the Online Learning Center, www.mhhe.com/forouzan for additional resources! Instructors and students using Data Communications and Networking, Fourth Edition by Behrouz A. Forouzan will find a wide variety of resources available at the Online Learning Center, www.mhhe.com...
Don't forget to check out the Online Learning Center, www.mhhe.com/forouzan for additional resources! Instructors and students using Data Communications and Networking, Fourth Edition by Behrouz A. Forouzan will find a wide variety of resources available at the Online Learning Center, www.mhhe.comlforouzan Instructor Resources Instructors can access the following resources by contacting their McGraw-Hill Repre- sentative for a secure password. a PowerPoint Slides. Contain figures, tables, highlighted points, and brief descriptions of each section. o Complete Solutions Manual. Password-protected solutions to all end-of-chapter problems are provided. a Pageout. A free tool that helps you create your own course website. D Instructor Message Board. Allows you to share ideas with other instructors using the text. Student Resources The student resources are available to those students using the book. Once you have accessed the Online Learning Center, click on "Student Resources," then select a chap- ter from the drop down menu that appears. Each chapter has a wealth of materials to help you review communications and networking concepts. Included are: a Chapter Summaries. Bulleted summary points provide an essential review of major ideas and concepts covered in each chapter. a Student Solutions Manual. Contains answers for odd-numbered problems. o Glossary. Defines key terms presented in the book. o Flashcards. Facilitate learning through practice and review. a Animated Figures. Visual representations model key networking concepts, bringing them to life. D Automated Quizzes. Easy-to-use quizzes strengthen learning and emphasize impor- tant ideas from the book. a Web links. Connect students to additional resources available online. DATA COMMUNICATIONS AND NETWORKING McGraw-Hill Forouzan Networking Series Titles by Behrouz A. Forouzan: Data Communications and Networking TCPflP Protocol Suite Local Area Networks Business Data Communications DATA COMMUNICATIONS AND NETWORKING Fourth Edition Behrouz A. Forouzan DeAnza College with Sophia Chung Fegan Higher Education Boston Burr Ridge, IL Dubuque, IA Madison, WI New York San Francisco S1. Louis Bangkok Bogota Caracas Kuala Lumpur Lisbon London Madrid Mexico City Milan Montreal New Delhi Santiago Seoul Singapore Sydney Taipei Toronto The McGraw·HiII Companies.~I II Higher Education DATA COMMUNICATIONS AND NETWORKING, FOURTH EDITION Published by McGraw-Hill, a business unit of The McGraw-Hill Companies. Inc., 1221 Avenue of the Americas, New York, NY 10020. Copyright © 2007 by The McGraw-Hill Companies, Inc. AlI rights reserved. No part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written consent of The McGraw-Hill Companies, Inc., including, but not limited to, in any network or other electronic storage or transmission, or broadcast for distance learning. Some ancillaries, including electronic and print components, may not be available to customers outside the United States. This book is printed on acid-free paper. 1234567890DOC/DOC09876 ISBN-13 978-0-07-296775-3 ISBN-to 0-07-296775-7 Publisher: Alan R. Apt Developmental Editor: Rebecca Olson Executive Marketing Manager: Michael Weitz Senior Project Manager: Sheila M. Frank Senior Production Supervisor: Kara Kudronowicz Senior Media Project Manager: Jodi K. Banowetz Associate Media Producer: Christina Nelson Senior Designer: David W Hash Cover Designer: Rokusek Design (USE) Cover Image: Women ascending Mount McKinley, Alaska. Mount McKinley (Denali) 12,000 feet, ©Allan Kearney/Getty Images Compositor: Interactive Composition Corporation Typeface: 10/12 Times Roman Printer: R. R. Donnelley Crawfordsville, IN Library of Congress Cataloging-in~Publication Data Forouzan, Behrouz A. Data communications and networking I Behrouz A Forouzan. - 4th ed. p. em. - (McGraw-HilI Forouzan networking series) Includes index. ISBN 978-0-07-296775-3 - ISBN 0-07-296775-7 (hard eopy : alk. paper) 1. Data transmission systems. 2. Computer networks. I. Title. II. Series. TK5105.F6617 2007 004.6--dc22 2006000013 CIP www.mhhe.com To lny wife, Faezeh, with love Behrouz Forouzan Preface XXlX PART 1 Overview 1 Chapter 1 Introduction 3 Chapter 2 Network Models 27 PART 2 Physical Layer and Media 55 Chapter 3 Data and Signals 57 Chapter 4 Digital Transmission 101 Chapter 5 Analog Transmission 141 Chapter 6 Bandwidth Utilization: Multiplexing and Spreading 161 Chapter 7 Transmission Media 191 Chapter 8 Switching 213 Chapter 9 Using Telephone and Cable Networksfor Data Transmission 241 PART 3 Data Link Layer 265 Chapter 10 Error Detection and Correction 267 Chapter 11 Data Link Control 307 Chapter 12 Multiple Access 363 Chapter 13 Wired LANs: Ethernet 395 Chapter 14 Wireless LANs 421 Chapter 15 Connecting LANs, Backbone Networks, and Virtual LANs 445 Chapter 16 Wireless WANs: Cellular Telephone and Satellite Networks 467 Chapter 17 SONETISDH 491 Chapter 18 Virtual-Circuit Nenvorks: Frame Relay andATM 517 vii viii BRIEF CONTENTS PART 4 Network Layer 547 Chapter 19 Netvvork Layer: Logical Addressing 549 Chapter 20 Netvvork Layer: Internet Protocol 579 Chapter 21 Netl,vork La.ver: Address Mapping, Error Reporting, and Multicasting 611 Chapter 22 Network Layer: Delivery, Fonvarding, and Routing 647 PARTS Transport Layer 701 Chapter 23 Process-to-Process Delivery: UDp, TCP, and SCTP 703 Chapter 24 Congestion Control and Quality ql'Sen'ice 761 PART 6 Application Layer 795 Chapter 25 Domain Name System 797 Chapter 26 Remote Logging, Electronic Mail, and File Transfer 817 Chapter 27 WWW and HTTP 851 Chapter 28 Network Management: SNMP 873 Chapter 29 Multimedia 901 PART 7 Security 929 Chapter 30 Cf}1J tography 931 Chapter 31 Network Security 961 Chapter 32 Securit}' in the Internet: IPSec, SSLlTLS, PCp, VPN, and Firewalls 995 Appendix A Unicode 1029 Appendix B Numbering Systems 1037 Appendix C Mathematical Review 1043 Appendix D 8B/6T Code 1055 Appendix E Telephone History 1059 Appendix F Co!1tact Addresses 1061 Appendix G RFCs 1063 Appendix H UDP and TCP Ports 1065 Acron.Vl11s 1067 ClOSSOlY 1071 References 1107 Index IIII Preface xxix PART 1 Overview 1 Chapter 1 Introduction 3 1.1 DATA COMMUNICATIONS 3 Components 4 Data Representation 5 DataFlow 6 1.2 NETWORKS 7 Distributed Processing 7 Network Criteria 7 Physical Structures 8 Network Models 13 Categories of Networks 13 Interconnection of Networks: Internetwork IS 1.3 THE INTERNET 16 A Brief History 17 The Internet Today 17 1.4 PROTOCOLS AND STANDARDS 19 Protocols 19 Standards 19 Standards Organizations 20 Internet Standards 21 1.5 RECOMMENDED READING 21 Books 21 Sites 22 RFCs 22 1.6 KEY TERMS 22 1.7 SUMMARY 23 1.8 PRACTICE SET 24 Review Questions 24 Exercises 24 Research Activities 25 Chapter 2 Network Models 27 2.1 LAYERED TASKS 27 Sender, Receiver, and Carrier 28 Hierarchy 29 ix x CONTENTS 2.2 THE OSI MODEL 29 Layered Architecture 30 Peer-to-Peer Processes 30 Encapsulation 33 2.3 LAYERS IN THE OSI MODEL 33 Physical Layer 33 Data Link Layer 34 Network Layer 36 Transport Layer 37 Session Layer 39 Presentation Layer 39 Application Layer 41 Summary of Layers 42 2.4 TCP/IP PROTOCOL SUITE 42 Physical and Data Link Layers 43 Network Layer 43 Transport Layer 44 Application Layer 45 2.5 ADDRESSING 45 Physical Addresses 46 Logical Addresses 47 Port Addresses 49 Specific Addresses 50 2.6 RECOMMENDED READING 50 Books 51 Sites 51 RFCs 51 2.7 KEY lERMS 51 2.8 SUMMARY 52 2.9 PRACTICE SET 52 Review Questions 52 Exercises 53 Research Activities 54 PART 2 Physical Layer and Media 55 Chapter 3 Data and Signals 57 3.1 ANALOG AND DIGITAL 57 Analog and Digital Data 57 Analog and Digital Signals 58 Periodic and Nonperiodic Signals 58 3.2 PERIODIC ANALOG SIGNALS 59 Sine Wave 59 Phase 63 Wavelength 64 Time and Frequency Domains 65 Composite Signals 66 Bandwidth 69 3.3 DIGITAL SIGNALS 71 Bit Rate 73 Bit Length 73 Digital Signal as a Composite Analog Signal 74 Transmission of Digital Signals 74 CONTENTS xi 3.4 TRANSMISSION IMPAIRMENT 80 Attenuation 81 Distortion 83 Noise 84 3.5 DATA RATE LIMITS 85 Noiseless Channel: Nyquist Bit Rate 86 Noisy Channel: Shannon Capacity 87 Using Both Limits 88 3.6 PERFORMANCE 89 Bandwidth 89 Throughput 90 Latency (Delay) 90 Bandwidth-Delay Product 92 Jitter 94 3.7 RECOMMENDED READING 94 Books 94 3.8 KEYTERMS 94 3.9 SUMMARY 95 3.10 PRACTICE SET 96 Review Questions 96 Exercises 96 Chapter 4 Digital Transmission 101 4.1 DIGITAL-TO-DIGITAL CONVERSION 101 Line Coding 101 Line Coding Schemes 106 Block Coding 115 Scrambling 118 4.2 ANALOG-TO-DIGITAL CONVERSION 120 Pulse Code Modulation (PCM) 121 Delta Modulation (DM) 129 4.3 TRANSMISSION MODES 131 Parallel Transmission 131 Serial Transmission 132 4.4 RECOMMENDED READING 135 Books 135 4.5 KEYTERMS 135 4.6 SUMMARY 136 4.7 PRACTICE SET 137 Review Questions 137 Exercises 137 Chapter 5 Analog TranSl1'lission 141 5.1 DIGITAL-TO-ANALOG CONVERSION 141 Aspects of Digital-to-Analog Conversion 142 Amplitude Shift Keying 143 Frequency Shift Keying 146 Phase Shift Keying 148 Quadrature Amplitude Modulation 152 5.2 ANALOG-TO-ANALOG CONVERSION 152 Amplitude Modulation 153 Frequency Modulation 154 Phase Modulation 155 xii CONTENTS 5.3 RECOMMENDED READING 156 Books 156 5.4 KEY lERMS 157 5.5 SUMMARY 157 5.6 PRACTICE SET 158 Review Questions 158 Exercises 158 Chapter 6 Ba17chridth Utili::.ation: Multiplexing and Spreading 161 6.1 MULTIPLEXING 161 Frequency-Division Multiplexing 162 Wavelength-Division Multiplexing 167 Synchronous Time-Division Multiplexing 169 Statistical Time-Division Multiplexing 179 6.2 SPREAD SPECTRUM 180 Frequency Hopping Spread Spectrum (FHSS) 181 Direct Sequence Spread Spectrum 184 6.3 RECOMMENDED READING 185 Books 185 6.4 KEY lERMS 185 6.5 SUMMARY 186 6.6 PRACTICE SET 187 Review Questions 187 Exercises 187 Chapter 7 Transmission Media 191 7.1 GUIDED MEDIA 192 Twisted-Pair Cable 193 Coaxial Cable 195 Fiber-Optic Cable 198 7.2 UNGUIDED MEDIA: WIRELESS 203 Radio Waves 205 Microwaves 206 Infrared 207 7.3 RECOMMENDED READING 208 Books 208 7.4 KEY lERMS 208 7.5 SUMMARY 209 7.6 PRACTICE SET 209 Review Questions 209 Exercises 210 Chapter 8 Svvitching 213 8.1 CIRCUIT-SWITCHED NETWORKS 214 Three Phases 217 Efficiency 217 Delay 217 Circuit-Switched Technology in Telephone Networks 218 8.2 DATAGRAM NETWORKS 218 Routing Table 220 CONTENTS xiii Efficiency 220 Delay 221 Datagram Networks in the Internet 221 8.3 VIRTUAL-CIRCUIT NETWORKS 221 Addressing 222 Three Phases 223 Efficiency 226 Delay in Virtual-Circuit Networks 226 Circuit-Switched Technology in WANs 227 8.4 STRUCTURE OF A SWITCH 227 Structure of Circuit Switches 227 Structure of Packet Switches 232 8.5 RECOMMENDED READING 235 Books 235 8.6 KEY TERMS 235 8.7 SUMMARY 236 8.8 PRACTICE SET 236 Review Questions 236 Exercises 237 Chapter 9 Using Telephone and Cable Networks for Data Transm,ission 241 9.1 1ELEPHONE NETWORK 241 Major Components 241 LATAs 242 Signaling 244 Services Provided by Telephone Networks 247 9.2 DIAL-UP MODEMS 248 Modem Standards 249 9.3 DIGITAL SUBSCRIBER LINE 251 ADSL 252 ADSL Lite 254 HDSL 255 SDSL 255 VDSL 255 Summary 255 9.4 CABLE TV NETWORKS 256 Traditional Cable Networks 256 Hybrid Fiber-Coaxial (HFC) Network 256 9.5 CABLE TV FOR DATA TRANSFER 257 Bandwidth 257 Sharing 259 CM and CMTS 259 Data Transmission Schemes: DOCSIS 260 9.6 RECOMMENDED READING 261 Books 261 9.7 KEY TERMS 261 9.8 SUMMARY 262 9.9 PRACTICE SET 263 Review Questions 263 Exercises 264 xiv CONTENTS PART 3 Data Link Layer 265 Chapter 10 Error Detection and Correction 267 10.1 INTRODUCTION 267 Types of Errors 267 Redundancy 269 Detection Versus Correction 269 Forward Error Correction Versus Retransmission 269 Coding 269 Modular Arithmetic 270 10.2 BLOCK CODING 271 Error Detection 272 Error Correction 273 Hamming Distance 274 Minimum Hamming Distance 274 10.3 LINEAR BLOCK CODES 277 Minimum Distance for Linear Block Codes 278 Some Linear Block Codes 278 10.4 CYCLIC CODES 284 Cyclic Redundancy Check 284 Hardware Implementation 287 Polynomials 291 Cyclic Code Analysis 293 Advantages of Cyclic Codes 297 Other Cyclic Codes 297 10.5 CHECKSUM 298 Idea 298 One's Complement 298 Internet Checksum 299 10.6 RECOMMENDED READING 30 I Books 301 RFCs 301 10.7 KEY lERMS 301 10.8 SUMMARY 302 10.9 PRACTICE SET 303 Review Questions 303 Exercises 303 Chapter 11 Data Link Control 307 11.1 FRAMING 307 Fixed-Size Framing 308 Variable-Size Framing 308 11.2 FLOW AND ERROR CONTROL 311 Flow Control 311 Error Control 311 11.3 PROTOCOLS 311 11.4 NOISELESS CHANNELS 312 Simplest Protocol 312 Stop-and-Wait Protocol 315 11.5 NOISY CHANNELS 318 Stop-and-Wait Automatic Repeat Request 318 Go-Back-N Automatic Repeat Request 324 CONTENTS xv Selective Repeat Automatic Repeat Request 332 Piggybacking 339 11.6 HDLC 340 Configurations and Transfer Modes 340 Frames 341 Control Field 343 11.7 POINT-TO-POINT PROTOCOL 346 Framing 348 Transition Phases 349 Multiplexing 350 Multilink PPP 355 11.8 RECOMMENDED READING 357 Books 357 11.9 KEY TERMS 357 11.10 SUMMARY 358 11.11 PRACTICE SET 359 Review Questions 359 Exercises 359 Chapter 12 Multiple Access 363 12.1 RANDOMACCESS 364 ALOHA 365 Carrier Sense Multiple Access (CSMA) 370 Carrier Sense Multiple Access with Collision Detection (CSMAlCD) 373 Carrier Sense Multiple Access with Collision Avoidance (CSMAlCA) 377 12.2 CONTROLLED ACCESS 379 Reservation 379 Polling 380 Token Passing 381 12.3 CHANNELIZATION 383 Frequency-Division Multiple Access (FDMA) 383 Time-Division Multiple Access (TDMA) 384 Code-Division Multiple Access (CDMA) 385 12.4 RECOMMENDED READING 390 Books 391 12.5 KEY TERMS 391 12.6 SUMMARY 391 12.7 PRACTICE SET 392 Review Questions 392 Exercises 393 Research Activities 394 Chapter 13 Wired LANs: Ethernet 395 13.1 IEEE STANDARDS 395 Data Link Layer 396 Physical Layer 397 13.2 STANDARD ETHERNET 397 MAC Sublayer 398 Physical Layer 402 13.3 CHANGES IN THE STANDARD 406 Bridged Ethernet 406 Switched Ethernet 407 Full-Duplex Ethernet 408 xvi CONTENTS 13.4 FAST ETHERNET 409 MAC Sublayer 409 Physical Layer 410 13.5 GIGABIT ETHERNET 412 MAC Sublayer 412 Physical Layer 414 Ten-Gigabit Ethernet 416 13.6 RECOMMENDED READING 417 Books 417 13.7 KEY TERMS 417 13.8 SUMMARY 417 13.9 PRACTICE SET 418 Review Questions 418 Exercises 419 Chapter 14 Wireless LANs 421 14.1 IEEE 802.11 421 Architecture 421 MAC Sublayer 423 Addressing Mechanism 428 Physical Layer 432 14.2 BLUETOOTH 434 Architecture 435 Bluetooth Layers 436 Radio Layer 436 Baseband Layer 437 L2CAP 440 Other Upper Layers 441 14.3 RECOMMENDED READING 44 I Books 442 14.4 KEYTERMS 442 14.5 SUMMARY 442 14.6 PRACTICE SET 443 Review Questions 443 Exercises 443 Chapter 15 Connecting LANs, Backbone Networks, and VirtuaL LANs 445 15.1 CONNECTING DEVICES 445 Passive Hubs 446 Repeaters 446 Active Hubs 447 Bridges 447 Two-Layer Switches 454 Routers 455 Three-Layer Switches 455 Gateway 455 15.2 BACKBONE NETWORKS 456 Bus Backbone 456 Star Backbone 457 Connecting Remote LANs 457 CONTENTS xvii 15.3 VIRTUAL LANs 458 Membership 461 Configuration 461 Communication Between Switches 462 IEEE Standard 462 Advantages 463 15.4 RECOMMENDED READING 463 Books 463 Site 463 15.5 KEY TERMS 463 15.6 SUMMARY 464 15.7 PRACTICE SET 464 Review Questions 464 Exercises 465 Chapter 16 Wireless WANs: Cellular Telephone and Satellite Networks 467 16.1 CELLULAR TELEPHONY 467 Frequency-Reuse Principle 467 Transmitting 468 Receiving 469 Roaming 469 First Generation 469 Second Generation 470 Third Generation 477 16.2 SATELLITE NETWORKS 478 Orbits 479 Footprint 480 Three Categories of Satellites 480 GEO Satellites 481 MEO Satellites 481 LEO Satellites 484 16.3 RECOMMENDED READING 487 Books 487 16.4 KEY TERMS 487 16.5 SUMMARY 487 16.6 PRACTICE SET 488 Review Questions 488 Exercises 488 Chapter 17 SONETISDH 491 17.1 ARCHITECTURE 491 Signals 491 SONET Devices 492 Connections 493 17.2 SONET LAYERS 494 Path Layer 494 Line Layer 495 Section Layer 495 Photonic Layer 495 Device-Layer Relationships 495 xviii CONTENTS 17.3 SONET FRAMES 496 Frame, Byte, and Bit Transmission 496 STS-l Frame Format 497 Overhead Summary 501 Encapsulation 501 17.4 STS MULTIPLEXING 503 Byte Interleaving 504 Concatenated Signal 505 AddlDrop Multiplexer 506 17.5 SONET NETWORKS 507 Linear Networks 507 Ring Networks 509 Mesh Networks 510 17.6 VIRTUAL TRIBUTARIES 512 Types ofVTs 512 17.7 RECOMMENDED READING 513 Books 513 17.8 KEY lERMS 513 17.9 SUMMARY 514 17.1 0 PRACTICE SET 514 Review Questions 514 Exercises 515 Chapter 18 Virtual-Circuit Networks: Frame Relm' and ATM 517 18.1 FRAME RELAY 517 Architecture 518 Frame Relay Layers 519 Extended Address 521 FRADs 522 VOFR 522 LMI 522 Congestion Control and Quality of Service 522 18.2 ATM 523 Design Goals 523 Problems 523 Architecture 526 Switching 529 ATM Layers 529 Congestion Control and Quality of Service 535 18.3 ATM LANs 536 ATM LAN Architecture 536 LAN Emulation (LANE) 538 Client/Server Model 539 Mixed Architecture with Client/Server 540 18.4 RECOMMENDED READING 540 Books 541 18.5 KEY lERMS 541 18.6 SUMMARY 541 18.7 PRACTICE SET 543 Review Questions 543 Exercises 543 CONTENTS xix PART 4 Network Layer 547 Chapter 19 Netvl/ark Layer: Logical Addressing 549 19.1 IPv4ADDRESSES 549 Address Space 550 Notations 550 Classful Addressing 552 Classless Addressing 555 Network Address Translation (NAT) 563 19.2 IPv6 ADDRESSES 566 Structure 567 Address Space 568 19.3 RECOMMENDED READING 572 Books 572 Sites 572 RFCs 572 19.4 KEY TERMS 572 19.5 SUMMARY 573 19.6 PRACTICE SET 574 Review Questions 574 Exercises 574 Research Activities 577 Chapter 20 Network Layer: Internet Protocol 579 20.1 INTERNETWORKING 579 Need for Network Layer 579 Internet as a Datagram Network 581 Internet as a Connectionless Network 582 20.2 IPv4 582 Datagram 583 Fragmentation 589 Checksum 594 Options 594 20.3 IPv6 596 Advantages 597 Packet Format 597 Extension Headers 602 20.4 TRANSITION FROM IPv4 TO IPv6 603 Dual Stack 604 Tunneling 604 Header Translation 605 20.5 RECOMMENDED READING 605 Books 606 Sites 606 RFCs 606 20.6 KEY TERMS 606 20.7 SUMMARY 607 20.8 PRACTICE SET 607 Review Questions 607 Exercises 608 Research Activities 609 xx CONTENTS Chapter 21 Network Layer: Address Mapping, Error Reporting, and Multicasting 611 21.1 ADDRESS MAPPING 611 Mapping Logical to Physical Address: ARP 612 Mapping Physical to Logical Address: RARp, BOOTP, and DHCP 618 21.2 ICMP 621 Types of Messages 621 Message Format 621 Error Reporting 622 Query 625 Debugging Tools 627 21.3 IGMP 630 Group Management 630 IGMP Messages 631 Message Format 631 IGMP Operation 632 Encapsulation 635 Netstat Utility 637 21.4 ICMPv6 638 Error Reporting 638 Query 639 21.5 RECOMMENDED READING 640 Books 641 Site 641 RFCs 641 21.6 KEYTERMS 641 21.7 SUMMARY 642 21.8 PRACTICE SET 643 Review Questions 643 Exercises 644 Research Activities 645 Chapter 22 Network Layer: Delivery, Forwarding, and Routing 647 22.1 DELIVERY 647 Direct Versus Indirect Delivery 647 22.2 FORWARDING 648 Forwarding Techniques 648 Forwarding Process 650 Routing Table 655 22.3 UNICAST ROUTING PROTOCOLS 658 Optimization 658 Intra- and Interdomain Routing 659 Distance Vector Routing 660 Link State Routing 666 Path Vector Routing 674 22.4 MULTICAST ROUTING PROTOCOLS 678 Unicast, Multicast, and Broadcast 678 Applications 681 Multicast Routing 682 Routing Protocols 684 CONTENTS xxi 22.5 RECOMMENDED READING 694 Books 694 Sites 694 RFCs 694 22.6 KEY lERMS 694 22.7 SUMMARY 695 22.8 PRACTICE SET 697 Review Questions 697 Exercises 697 Research Activities 699 PART 5 Transport Layer 701 Chapter 23 Process-fa-Process Delivery: UDp, TCp, and SeTP 703 23.1 PROCESS-TO-PROCESS DELIVERY 703 Client/Server Paradigm 704 Multiplexing and Demultiplexing 707 Connectionless Versus Connection-Oriented Service 707 Reliable Versus Unreliable 708 Three Protocols 708 23.2 USER DATAGRAM PROTOCOL (UDP) 709 Well-Known Ports for UDP 709 User Datagram 710 Checksum 711 UDP Operation 713 Use ofUDP 715 23.3 TCP 715 TCP Services 715 TCP Features 719 Segment 721 A TCP Connection 723 Flow Control 728 Error Control 731 Congestion Control 735 23.4 SCTP 736 SCTP Services 736 SCTP Features 738 Packet Format 742 An SCTP Association 743 Flow Control 748 Error Control 751 Congestion Control 753 23.5 RECOMMENDED READING 753 Books 753 Sites 753 RFCs 753 23.6 KEY lERMS 754 23.7 SUMMARY 754 23.8 PRACTICE SET 756 Review Questions 756 Exercises 757 Research Activities 759 xxii CONTENTS Chapter 24 Congestion Control and Quality (~j'Service 767 24.1 DATA lRAFFIC 761 Traffic Descriptor 76] Traffic Profiles 762 24.2 CONGESTION 763 Network Performance 764 24.3 CONGESTION CONTROL 765 Open-Loop Congestion Control 766 Closed-Loop Congestion Control 767 24.4 lWO EXAMPLES 768 Congestion Control in TCP 769 Congestion Control in Frame Relay 773 24.5 QUALITY OF SERVICE 775 Flow Characteristics 775 Flow Classes 776 24.6 TECHNIQUES TO IMPROVE QoS 776 Scheduling 776 Traffic Shaping 777 Resource Reservation 780 Admission Control 780 24.7 INTEGRATED SERVICES 780 Signaling 781 Flow Specification 781 Admission 781 Service Classes 781 RSVP 782 Problems with Integrated Services 784 24.8 DIFFERENTIATED SERVICES 785 DS Field 785 24.9 QoS IN SWITCHED NETWORKS 786 QoS in Frame Relay 787 QoS inATM 789 24.10 RECOMMENDED READING 790 Books 791 24.11 KEY TERMS 791 24.12 SUMMARY 791 24.13 PRACTICE SET 792 Review Questions 792 Exercises 793 PART 6 Application Layer 795 Chapter 25 DO/nain Name Svstem 797 25.1 NAME SPACE 798 Flat Name Space 798 Hierarchical Name Space 798 25.2 DOMAIN NAME SPACE 799 Label 799 Domain Narne 799 Domain 801 CONTENTS xxiii 25.3 DISTRIBUTION OF NAME SPACE 801 Hierarchy of Name Servers 802 Zone 802 Root Server 803 Primary and Secondary Servers 803 25.4 DNS IN THE INTERNET 803 Generic Domains 804 Country Domains 805 Inverse Domain 805 25.5 RESOLUTION 806 Resolver 806 Mapping Names to Addresses 807 Mapping Address to Names 807 Recursive Resolution 808 Iterative Resolution 808 Caching 808 25.6 DNS MESSAGES 809 Header 809 25.7 TYPES OF RECORDS 811 Question Record 811 Resource Record 811 25.8 REGISTRARS 811 25.9 DYNAMIC DOMAIN NAME SYSTEM (DDNS) 812 25.10 ENCAPSULATION 812 25.11 RECOMMENDED READING 812 Books 813 Sites 813 RFCs 813 25.12 KEY TERMS 813 25.13 SUMMARY 813 25.14 PRACTICE SET 814 Review Questions 814 Exercises 815 Chapter 26 Remote Logging, Electronic Mail, and File Transfer 817 26.1 REMOTE LOGGING 817 TELNET 817 26.2 ELECTRONIC MAIL 824 Architecture 824 User Agent 828 Message Transfer Agent: SMTP 834 Message Access Agent: POP and IMAP 837 Web-Based Mail 839 26.3 FILE TRANSFER 840 File Transfer Protocol (FTP) 840 Anonymous FTP 844 26.4 RECOMMENDED READING 845 Books 845 Sites 845 RFCs 845 26.5 KEY lERMS 845 26.6 SUMMARY 846 xxiv CONTENTS 26.7 PRACTICE SET 847 Review Questions 847 Exercises 848 Research Activities 848 Chapter 27 WWW and HTTP 851 27.1 ARCHITECTURE 851 Client (Browser) 852 Server 852 Uniform Resource Locator 853 Cookies 853 27.2 WEB DOCUMENTS 854 Static Documents 855 Dynamic Documents 857 Active Documents 860 27.3 HTTP 861 HTTP Transaction 861 Persistent Versus Nonpersistent Connection 868 Proxy Server 868 27.4 RECOMMENDED READING 869 Books 869 Sites 869 RFCs 869 27.5 KEY 1ERMS 869 27.6 SUMMARY 870 27.7 PRACTICE SET 871 Review Questions 871 Exercises 871 Chapter 28 Network Management: SNMP 873 28.1 NETWORK MANAGEMENT SYSTEM 873 Configuration Management 874 Fault Management 875 Performance Management 876 Security Management 876 Accounting Management 877 28.2 SIMPLE NETWORK MANAGEMENT PROTOCOL (SNMP) 877 Concept 877 Management Components 878 Structure of Management Information 881 Management Information Base (MIB) 886 Lexicographic Ordering 889 SNMP 891 Messages 893 UDP Ports 895 Security 897 28.3 RECOMMENDED READING 897 Books 897 Sites 897 RFCs 897 28.4 KEY 1ERMS 897 28.5 SUMMARY 898 CONTENTS xxv 28.6 PRACTICE SET 899 Review Questions 899 Exercises 899 Chapter 29 Multimedia 901 29.1 DIGITIZING AUDIO AND VIDEO 902 Digitizing Audio 902 Digitizing Video 902 29.2 AUDIO AND VIDEO COMPRESSION 903 Audio Compression 903 Video Compression 904 29.3 STREAMING STORED AUDIO/VIDEO 908 First Approach: Using a Web Server 909 Second Approach: Using a Web Server with Metafile 909 Third Approach: Using a Media Server 910 Fourth Approach: Using a Media Server and RTSP 911 29.4 STREAMING LIVE AUDIOIVIDEO 912 29.5 REAL-TIME INTERACTIVE AUDIOIVIDEO 912 Characteristics 912 29.6 RTP 916 RTP Packet Format 917 UDPPort 919 29.7 RTCP 919 Sender Report 919 Receiver Report 920 Source Description Message 920 Bye Message 920 Application-Specific Message 920 UDP Port 920 29.8 VOICE OVER IP 920 SIP 920 H.323 923 29.9 RECOMMENDED READING 925 Books 925 Sites 925 29.10 KEY 1ERMS 925 29.11 SUMMARY 926 29.12 PRACTICE SET 927 Review Questions 927 Exercises 927 Research Activities 928 PART 7 Security 929 Chapter 30 Cryptography 931 30.1 INTRODUCTION 931 Definitions 931 Two Categories 932 30.2 SYMMETRIC-KEY CRYPTOGRAPHY 935 Traditional Ciphers 935 Simple Modem Ciphers 938 xxvi CONTENTS Modern Round Ciphers 940 Mode of Operation 945 30.3 ASYMMETRIC-KEY CRYPTOGRAPHY 949 RSA 949 Diffie-Hellman 952 30.4 RECOMMENDED READING 956 Books 956 30.5 KEY TERMS 956 30.6 SUMMARY 957 30.7 PRACTICE SET 958 Review Questions 958 Exercises 959 Research Activities 960 Chapter 31 Network Security 961 31.1 SECURITY SERVICES 961 Message Confidentiality 962 Message Integrity 962 Message Authentication 962 Message Nonrepudiation 962 Entity Authentication 962 31.2 MESSAGE CONFIDENTIALITY 962 Confidentiality with Symmetric-Key Cryptography 963 Confidentiality with Asymmetric-Key Cryptography 963 31.3 MESSAGE INTEGRITY 964 Document and Fingerprint 965 Message and Message Digest 965 Difference 965 Creating and Checking the Digest 966 Hash Function Criteria 966 Hash Algorithms: SHA-1 967 31.4 MESSAGE AUTHENTICATION 969 MAC 969 31.5 DIGITAL SIGNATURE 971 Comparison 97 I Need for Keys 972 Process 973 Services 974 Signature Schemes 976 31.6 ENTITY AUTHENTICATION 976 Passwords 976 Challenge-Response 978 31.7 KEY MANAGEMENT 981 Symmetric-Key Distribution 981 Public-Key Distribution 986 31.8 RECOMMENDED READING 990 Books 990 31.9 KEY TERMS 990 31.10 SUMMARY 991 31.11 PRACTICE SET 992 Review Questions 992 Exercises 993 Research Activities 994 CONTENTS xxvii Chapter 32 Security in the Internet: IPSec, SSUFLS, PGP, VPN, and Firewalls 995 32.1 IPSecurity (lPSec) 996 Two Modes 996 Two Security Protocols 998 Security Association 1002 Internet Key Exchange (IKE) 1004 Virtual Private Network 1004 32.2 SSLffLS 1008 SSL Services 1008 Security Parameters 1009 Sessions and Connections 1011 Four Protocols 10 12 Transport Layer Security 1013 32.3 PGP 1014 Security Parameters 1015 Services 1015 A Scenario 1016 PGP Algorithms 1017 Key Rings 1018 PGP Certificates 1019 32.4 FIREWALLS 1021 Packet-Filter Firewall 1022 Proxy Firewall 1023 32.5 RECOMMENDED READING 1024 Books 1024 32.6 KEY lERMS 1024 32.7 SUMMARY 1025 32.8 PRACTICE SET 1026 Review Questions 1026 Exercises 1026 Appendix A Unicode 1029 A.l UNICODE 1029 Planes 1030 Basic Multilingual Plane (BMP) 1030 Supplementary Multilingual Plane (SMP) 1032 Supplementary Ideographic Plane (SIP) 1032 Supplementary Special Plane (SSP) 1032 Private Use Planes (PUPs) 1032 A.2 ASCII 1032 Some Properties of ASCII 1036 Appendix B Numbering Systems 1037 B.l BASE 10: DECIMAL 1037 Weights 1038 B.2 BASE 2: BINARY 1038 Weights 1038 Conversion 1038 xxviii CONTENTS B.3 BASE 16: HEXADECIMAL 1039 Weights 1039 Conversion 1039 A Comparison 1040 BA BASE 256: IP ADDRESSES 1040 Weights 1040 Conversion 1040 B.5 OTHER CONVERSIONS 1041 Binary and Hexadecimal 1041 Base 256 and Binary 1042 Appendix C Mathenwtical Revietv 1043 C.1 TRIGONOMETRIC FUNCTIONS 1043 Sine Wave 1043 Cosine Wave 1045 Other Trigonometric Functions 1046 Trigonometric Identities 1046 C.2 FOURIER ANALYSIS 1046 Fourier Series 1046 Fourier Transform 1048 C.3 EXPONENT AND LOGARITHM 1050 Exponential Function 1050 Logarithmic Function 1051 Appendix 0 8B/6T Code 1055 Appendix E Telephone History 1059 Before 1984 1059 Between 1984 and 1996 1059 After 1996 1059 Appendix F Contact Addresses 1061 Appendix G RFCs 1063 Appendix H UDP and TCP Ports 1065 Acronyms 1067 Glossary 1071 References 1107 Index 1111 Data communications and networking may be the fastest growing technologies in our culture today. One of the ramifications of that growth is a dramatic increase in the number of professions where an understanding of these technologies is essential for success- and a proportionate increase in the number and types of students taking courses to learn about them. Features of the Book Several features of this text are designed to make it particularly easy for students to understand data communications and networking. Structure We have used the five-layer Internet model as the framework for the text not only because a thorough understanding of the model is essential to understanding most current network- ing theory but also because it is based on a structure of interdependencies: Each layer builds upon the layer beneath it and supports the layer above it. In the same way, each con- cept introduced in our text builds upon the concepts examined in the previous sections. The Internet model was chosen because it is a protocol that is fully implemented. This text is designed for students with little or no background in telecommunica- tions or data communications. For this reason, we use a bottom-up approach. With this approach, students learn first about data communications (lower layers) before learning about networking (upper layers). Visual Approach The book presents highly technical subject matter without complex formulas by using a balance of text and figures. More than 700 figures accompanying the text provide a visual and intuitive opportunity for understanding the material. Figures are particularly important in explaining networking concepts, which are based on connections and transmission. Both of these ideas are easy to grasp visually. Highlighted Points We emphasize important concepts in highlighted boxes for quick reference and imme- diate attention. xxix xxx PREFACE Examples and Applications When appropriate, we have selected examples to reflect true-to-life situations. For exam- ple, in Chapter 6 we have shown several cases of telecommunications in current telephone networks. Recommended Reading Each chapter includes a list of books and sites that can be used for further reading. Key Terms Each chapter includes a list of key terms for the student. Summary Each chapter ends with a summary of the material covered in that chapter. The sum- mary provides a brief overview of all the important points in the chapter. Practice Set Each chapter includes a practice set designed to reinforce and apply salient concepts. It consists of three parts: review questions, exercises, and research activities (only for appropriate chapters). Review questions are intended to test the student's first-level under- standing of the material presented in the chapter. Exercises require deeper understanding of the materiaL Research activities are designed to create motivation for further study. Appendixes The appendixes are intended to provide quick reference material or a review of materi- als needed to understand the concepts discussed in the book. Glossary and Acronyms The book contains an extensive glossary and a list of acronyms. Changes in the Fourth Edition The Fourth Edition has major changes from the Third Edition, both in the organization and in the contents. Organization The following lists the changes in the organization of the book: 1. Chapter 6 now contains multiplexing as well as spreading. 2. Chapter 8 is now totally devoted to switching. 3. The contents of Chapter 12 are moved to Chapter 11. 4. Chapter 17 covers SONET technology. 5. Chapter 19 discusses IP addressing. 6. Chapter 20 is devoted to the Internet Protocol. 7. Chapter 21 discusses three protocols: ARP, ICMP, and IGMP. 8. Chapter 28 is new and devoted to network management in the Internet. 9. The previous Chapters 29 to 31 are now Chapters 30 to 32. PREFACE xxxi Contents We have revised the contents of many chapters including the following: 1. The contents of Chapters 1 to 5 are revised and augmented. Examples are added to clarify the contents. 2. The contents of Chapter 10 are revised and augmented to include methods of error detection and correction. 3. Chapter 11 is revised to include a full discussion of several control link protocols. 4. Delivery, forwarding, and routing of datagrams are added to Chapter 22. 5. The new transport protocol, SCTP, is added to Chapter 23. 6. The contents of Chapters 30, 31, and 32 are revised and augmented to include additional discussion about security issues and the Internet. 7. New examples are added to clarify the understanding of concepts. End Materials 1. A section is added to the end of each chapter listing additional sources for study. 2. The review questions are changed and updated. 3. The multiple-choice questions are moved to the book site to allow students to self-test their knowledge about the contents of the chapter and receive immediate feedback. 4. Exercises are revised and new ones are added to the appropriate chapters. 5. Some chapters contain research activities. Instructional Materials Instructional materials for both the student and the teacher are revised and augmented. The solutions to exercises contain both the explanation and answer including full col- ored figures or tables when needed. The Powerpoint presentations are more compre- hensive and include text and figures. Contents The book is divided into seven parts. The first part is an overview; the last part concerns network security. The middle five parts are designed to represent the five layers of the Internet model. The following summarizes the contents of each part. Part One: Overview The first part gives a general overview of data communications and networking. Chap- ter 1 covers introductory concepts needed for the rest of the book. Chapter 2 introduces the Internet model. Part Two: Physical Layer The second part is a discussion of the physical layer of the Internet model. Chapters 3 to 6 discuss telecommunication aspects of the physical layer. Chapter 7 introduces the transmission media, which, although not part of the physical layer, is controlled by it. Chapter 8 is devoted to switching, which can be used in several layers. Chapter 9 shows how two public networks, telephone and cable TV, can be used for data transfer. xxxii PREFACE Part Three: Data Link Layer The third part is devoted to the discussion of the data link layer of the Internet model. Chapter 10 covers error detection and correction. Chapters 11, 12 discuss issues related to data link control. Chapters 13 through 16 deal with LANs. Chapters 17 and] 8 are about WANs. LANs and WANs are examples of networks operating in the first two lay- ers of the Internet model. Part Four: Network Layer The fourth part is devoted to the discussion of the network layer of the Internet model. Chapter 19 covers IP addresses. Chapters 20 and 21 are devoted to the network layer protocols such as IP, ARP, ICMP, and IGMP. Chapter 22 discusses delivery, forwarding, and routing of packets in the Internet. Part Five: Transport Layer The fifth part is devoted to the discussion of the transport layer of the Internet model. Chapter 23 gives an overview of the transport layer and discusses the services and duties of this layer. It also introduces three transport-layer protocols: UDP, TCP, and SCTP. Chapter 24 discusses congestion control and quality of service, two issues related to the transport layer and the previous two layers. Part Six: Application Layer The sixth part is devoted to the discussion of the application layer of the Internet model. Chapter 25 is about DNS, the application program that is used by other application pro- grams to map application layer addresses to network layer addresses. Chapter 26 to 29 discuss some common applications protocols in the Internet. Part Seven: Security The seventh part is a discussion of security. It serves as a prelude to further study in this subject. Chapter 30 briefly discusses cryptography. Chapter 31 introduces security aspects. Chapter 32 shows how different security aspects can be applied to three layers of the Internet model. Online Learning Center The McGraw-Hill Online Learning Center contains much additional material. Avail- able at www.mhhe.com/forouzan. As students read through Data Communications and Networking, they can go online to take self-grading quizzes. They can also access lec- ture materials such as PowerPoint slides, and get additional review from animated fig- ures from the book. Selected solutions are also available over the Web. The solutions to odd-numbered problems are provided to students, and instructors can use a password to access the complete set of solutions. Additionally, McGraw-Hill makes it easy to create a website for your networking course with an exclusive McGraw-Hill product called PageOut. It requires no prior knowledge of HTML, no long hours, and no design skills on your part. Instead, Page:- Out offers a series of templates. Simply fill them with your course information and PREFACE xxxiii click on one of 16 designs. The process takes under an hour and leaves you with a pro- fessionally designed website. Although PageOut offers "instant" development, the finished website provides pow- erful features. An interactive course syllabus allows you to post content to coincide with your lectures, so when students visit your PageOut website, your syllabus will direct them to components of Forouzan's Online Learning Center, or specific material of your own. How to Use the Book This book is written for both an academic and a professional audience. The book can be used as a self-study guide for interested professionals. As a textbook, it can be used for a one-semester or one-quarter course. The following are some guidelines. o Parts one to three are strongly recommended. o Parts four to six can be covered if there is no following course in TCP/IP protocol. o Part seven is recommended if there is no following course in network security. Acknowledgments It is obvious that the development of a book of this scope needs the support of many people. Peer Review The most important contribution to the development of a book such as this comes from peer reviews. We cannot express our gratitude in words to the many reviewers who spent numerous hours reading the manuscript and providing us with helpful comments and ideas. We would especially like to acknowledge the contributions of the following reviewers for the third and fourth editions of this book. Farid Ahmed, Catholic University Kaveh Ashenayi, University of Tulsa Yoris Au, University ofTexas, San Antonio Essie Bakhtiar, Clayton College & State University Anthony Barnard, University ofAlabama, Brimingham A.T. Burrell, Oklahoma State University Scott Campbell, Miami University Teresa Carrigan, Blackburn College Hwa Chang, Tufts University Edward Chlebus, Illinois Institute ofTechnology Peter Cooper, Sam Houston State University Richard Coppins, Virginia Commonwealth University Harpal Dhillon, Southwestern Oklahoma State University Hans-Peter Dommel, Santa Clara University M. Barry Dumas, Baruch College, CUNY William Figg, Dakota State University Dale Fox, Quinnipiac University Terrence Fries, Coastal Carolina University Errin Fulp, Wake Forest University xxxiv PREFACE Sandeep Gupta, Arizona State University George Hamer, South Dakota State University James Henson, California State University, Fresno Tom Hilton, Utah State University Allen Holliday, California State University, Fullerton Seyed Hossein Hosseini, University ofWisconsin, Milwaukee Gerald Isaacs, Carroll College, Waukesha Hrishikesh Joshi, DeVry University E.S. Khosravi, Southern University Bob Kinicki, Worcester Polytechnic University Kevin Kwiat, Hamilton College Ten-Hwang Lai, Ohio State University Chung-Wei Lee, Auburn University Ka-Cheong Leung, Texas Tech University Gertrude Levine, Fairleigh Dickinson University Alvin Sek See Lim, Auburn University Charles Liu, California State University, Los Angeles Wenhang Liu, California State University, Los Angeles Mark Llewellyn, University of Central Florida Sanchita Mal-Sarkar, Cleveland State University Louis Marseille, Harford Community College Kevin McNeill, University ofArizona Arnold C. Meltzer, George Washington University Rayman Meservy, Brigham Young University Prasant Mohapatra, University of California, Davis Hung Z Ngo, SUNY, Buffalo Larry Owens, California State University, Fresno Arnold Patton, Bradley University Dolly Samson, Hawaii Pacific University Joseph Sherif, California State University, Fullerton Robert Simon, George Mason University Ronald 1. Srodawa, Oakland University Daniel Tian, California State University, Monterey Bay Richard Tibbs, Radford University Christophe Veltsos, Minnesota State University, Mankato Yang Wang, University ofMaryland, College Park Sherali Zeadally, Wayne State University McGraw-Hill Staff Special thanks go to the staff of McGraw-Hill. Alan Apt, our publisher, proved how a proficient publisher can make the impossible possible. Rebecca Olson, the developmen- tal editor, gave us help whenever we needed it. Sheila Frank, our project manager, guided us through the production process with enormous enthusiasm. We also thank David Hash in design, Kara Kudronowicz in production, and Patti Scott, the copy editor. Overview Objectives Part 1 provides a general idea of what we will see in the rest of the book. Four major concepts are discussed: data communications, networking, protocols and standards, and networking models. Networks exist so that data may be sent from one place to another-the basic con- cept of data communications. To fully grasp this subject, we must understand the data communication components, how different types of data can be represented, and how to create a data flow. Data communications between remote parties can be achieved through a process called networking, involving the connection of computers, media, and networking devices. Networks are divided into two main categories: local area networks (LANs) and wide area networks (WANs). These two types of networks have different charac- teristics and different functionalities. The Internet, the main focus of the book, is a collection of LANs and WANs held together by internetworking devices. Protocols and standards are vital to the implementation of data communications and networking. Protocols refer to the rules; a standard is a protocol that has been adopted by vendors and manufacturers. Network models serve to organize, unify, and control the hardware and software com- ponents of data communications and networking. Although the term "network model" suggests a relationship to networking, the model also encompasses data communications. Chapters This part consists of two chapters: Chapter 1 and Chapter 2. Chapter 1 In Chapter 1, we introduce the concepts of data communications and networking. We dis- cuss data communications components, data representation, and data flow. We then move to the structure of networks that carry data. We discuss network topologies, categories of networks, and the general idea behind the Internet. The section on protocols and standards gives a quick overview of the organizations that set standards in data communi- cations and networking. Chapter 2 The two dominant networking models are the Open Systems Interconnection (OSI) and the Internet model (TCP/IP).The first is a theoretical framework; the second is the actual model used in today's data communications. In Chapter 2, we first discuss the OSI model to give a general background. We then concentrate on the Internet model, which is the foundation for the rest of the book. I I , I CHAPTERl Introduction Data communications and networking are changing the way we do business and the way we live. Business decisions have to be made ever more quickly, and the decision makers require immediate access to accurate information. Why wait a week for that report from Germany to arrive by mail when it could appear almost instantaneously through computer networks? Businesses today rely on computer networks and internetworks. But before we ask how quickly we can get hooked up, we need to know how networks operate, what types of technologies are available, and which design best fills which set of needs. The development of the personal computer brought about tremendous changes for business, industry, science, and education. A similar revolution is occurring in data communications and networking. Technological advances are making it possible for communications links to carry more and faster signals. As a result, services are evolving to allow use of this expanded capacity. For example, established telephone services such as conference calling, call waiting, voice mail, and caller ID have been extended. Research in data communications and networking has resulted in new technolo- gies. One goal is to be able to exchange data such as text, audio, and video from all points in the world. We want to access the Internet to download and upload information quickly and accurately and at any time. This chapter addresses four issues: data communications, networks, the Internet, and protocols and standards. First we give a broad definition of data communications. Then we define networks as a highway on which data can travel. The Internet is dis- cussed as a good example of an internetwork (i.e., a network of networks). Finally, we discuss different types of protocols, the difference between protocols and standards, and the organizations that set those standards. 1.1 DATA COMMUNICATIONS When we communicate, we are sharing information. This sharing can be local or remote. Between individuals, local communication usually occurs face to face, while remote communication takes place over distance. The term telecommunication, which 3 4 CHAPTER 1 INTRODUCTION includes telephony, telegraphy, and television, means communication at a distance (tele is Greek for "far"). The word data refers to information presented in whatever form is agreed upon by the parties creating and using the data. Data communications are the exchange of data between two devices via some form of transmission medium such as a wire cable. For data communications to occur, the communicating devices must be part of a communication system made up of a com- bination of hardware (physical equipment) and software (programs). The effectiveness of a data communications system depends on four fundamental characteristics: deliv- ery, accuracy, timeliness, and jitter. I. Delivery. The system must deliver data to the correct destination. Data must be received by the intended device or user and only by that device or user. 7 Accuracy. The system must deliver the data accurately. Data that have been altered in transmission and left uncorrected are unusable. 3. Timeliness. The system must deliver data in a timely manner. Data delivered late are useless. In the case of video and audio, timely delivery means delivering data as they are produced, in the same order that they are produced, and without signifi- cant delay. This kind of delivery is called real-time transmission. -\.. Jitter. Jitter refers to the variation in the packet arrival time. It is the uneven delay in the delivery of audio or video packets. For example, let us assume that video packets are sent every 3D ms. If some of the packets arrive with 3D-ms delay and others with 4D-ms delay, an uneven quality in the video is the result. COinponents A data communications system has five components (see Figure 1.1). Figure 1.1 Five components ofdata communication Rule 1: Rule 1: r Rule 2: Rule 2: Protocol Protocol Rule n: -1 Message Rulen: Medium I. Message. The message is the information (data) to be communicated. Popular forms of information include text, numbers, pictures, audio, and video. I Sender. The sender is the device that sends the data message. It can be a com- puter, workstation, telephone handset, video camera, and so on. 3. Receiver. The receiver is the device that receives the message. It can be a com- puter, workstation, telephone handset, television, and so on. -1.. Transmission medium. The transmission medium is the physical path by which a message travels from sender to receiver. Some examples of transmission media include twisted-pair wire, coaxial cable, fiber-optic cable, and radio waves. SECTION 1.1 DATA COMMUNICATIONS 5 5. Protocol. A protocol is a set of rules that govern data communications. It repre- sents an agreement between the communicating devices. Without a protocol, two devices may be connected but not communicating, just as a person speaking French cannot be understood by a person who speaks only Japanese. Data Representation Information today comes in different forms such as text, numbers, images, audio, and video. Text In data communications, text is represented as a bit pattern, a sequence of bits (Os or Is). Different sets of bit patterns have been designed to represent text symbols. Each set is called a code, and the process of representing symbols is called coding. Today, the prevalent coding system is called Unicode, which uses 32 bits to represent a symbol or character used in any language in the world. The American Standard Code for Infor- mation Interchange (ASCII), developed some decades ago in the United States, now constitutes the first 127 characters in Unicode and is also referred to as Basic Latin. Appendix A includes part of the Unicode. Numbers Numbers are also represented by bit patterns. However, a code such as ASCII is not used to represent numbers; the number is directly converted to a binary number to simplify mathematical operations. Appendix B discusses several different numbering systems. Images Images are also represented by bit patterns. In its simplest form, an image is composed of a matrix of pixels (picture elements), where each pixel is a small dot. The size of the pixel depends on the resolution. For example, an image can be divided into 1000 pixels or 10,000 pixels. In the second case, there is a better representation of the image (better resolution), but more memory is needed to store the image. After an image is divided into pixels, each pixel is assigned a bit pattern. The size and the value of the pattern depend on the image. For an image made of only black- and-white dots (e.g., a chessboard), a I-bit pattern is enough to represent a pixel. If an image is not made of pure white and pure black pixels, you can increase the size of the bit pattern to include gray scale. For example, to show four levels of gray scale, you can use 2-bit patterns. A black pixel can be represented by 00, a dark gray pixel by 01, a light gray pixel by 10, and a white pixel by 11. There are several methods to represent color images. One method is called RGB, so called because each color is made of a combination of three primary colors: red, green, and blue. The intensity of each color is measured, and a bit pattern is assigned to it. Another method is called YCM, in which a color is made of a combination of three other primary colors: yellow, cyan, and magenta. Audio Audio refers to the recording or broadcasting of sound or music. Audio is by nature different from text, numbers, or images. It is continuous, not discrete. Even when we 6 CHAPTER 1 INTRODUCTION use a microphone to change voice or music to an electric signal, we create a continuous signal. In Chapters 4 and 5, we learn how to change sound or music to a digital or an analog signal. Video Video refers to the recording or broadcasting of a picture or movie. Video can either be produced as a continuous entity (e.g., by a TV camera), or it can be a combination of images, each a discrete entity, arranged to convey the idea of motion. Again we can change video to a digital or an analog signal, as we will see in Chapters 4 and 5. Data Flow Communication between two devices can be simplex, half-duplex, or full-duplex as shown in Figure 1.2. Figure 1.2 Data flow (simplex, half-duplex, andfull-duplex) Direction of data Mainframe Monitor a. Simplex Direction of data at time I ~ Direction of data at time 2 b. Half-duplex Direction of data all the time ) c. Full·duplex Simplex In simplex mode, the communication is unidirectional, as on a one-way street. Only one of the two devices on a link can transmit; the other can only receive (see Figure 1.2a). Keyboards and traditional monitors are examples of simplex devices. The key- board can only introduce input; the monitor can only accept output. The simplex mode can use the entire capacity of the channel to send data in one direction. Half-Duplex In half-duplex mode, each station can both transmit and receive, but not at the same time. : When one device is sending, the other can only receive, and vice versa (see Figure 1.2b). SECTION 1.2 NETWORKS 7 The half-duplex mode is like a one-lane road with traffic allowed in both direc- tions. When cars are traveling in one direction, cars going the other way must wait. In a half-duplex transmission, the entire capacity of a channel is taken over by whichever of the two devices is transmitting at the time. Walkie-talkies and CB (citizens band) radios are both half-duplex systems. The half-duplex mode is used in cases where there is no need for communication in both directions at the same time; the entire capacity of the channel can be utilized for each direction. Full-Duplex In full-duplex m.,lle (als@ called duplex), both stations can transmit and receive simul- taneously (see Figure 1.2c). The full-duplex mode is like a tW'''''''-- Input analog signal bandwidth Available bandwidth Output analog signal bandwidth / -,>:~,;:>~ L " Bandpass channel - - I Input analog signal Input analog signal Example 3.24 An example of broadband transmission using modulation is the sending of computer data through a telephone subscriber line, the line connecting a resident to the central telephone office. These lines, installed many years ago, are designed to carry voice (analog signal) with a limited band- width (frequencies between 0 and 4 kHz). Although this channel can be used as a low-pass chan- nel, it is normally considered a bandpass channel. One reason is that the bandwidth is so narrow (4 kHz) that if we treat the channel as low-pass and use it for baseband transmission, the maximum bit rate can be only 8 kbps. The solution is to consider the channel a bandpass channel, convert the digital signal from the computer to an analog signal, and send the analog signal. We can install two converters to change the digital signal to analog and vice versa at the receiving end. The converter, in this case, is called a modem (modulator/demodulator), which we discuss in detail in Chapter 5. Example 3.25 A second example is the digital cellular telephone. For better reception, digital cellular phones convert the analog voice signal to a digital signal (see Chapter 16). Although the bandwidth allo- cated to a company providing digital cellular phone service is very wide, we still cannot send the digital signal without conversion. The reason is that we only have a bandpass channel available between caller and callee. For example, if the available bandwidth is Wand we allow lOOO cou- ples to talk simultaneously, this means the available channel is WIlOOO, just part of the entire bandwidth. We need to convert the digitized voice to a composite analog signal before sending. The digital cellular phones convert the analog audio signal to digital and then convert it again to analog for transmission over a bandpass channel. 3.4 TRANSMISSION IMPAIRMENT Signals travel through transmission media, which are not petfect. The impetfection causes signal impairment. This means that the signal at the beginning of the medium is not the same as the signal at the end of the medium. What is sent is not what is received. Three causes of impairment are attenuation, distortion, and noise (see Figure 3.25). SECTION 3.4 TRANSMISSION IMPAIRMENT 81 Figure 3.25 Causes of impairment Attenuation Attenuation means a loss of energy. When a signal, simple or composite, travels through a medium, it loses some of its energy in overcoming the resistance of the medium. That is why a wire carrying electric signals gets warm, if not hot, after a while. Some of the electrical energy in the signal is converted to heat. To compensate for this loss, amplifiers are used to amplify the signal. Figure 3.26 shows the effect of attenuation and amplification. Figure 3.26 Attenuation Original Attenuated Amplified -Affi Point 1 Transmission medium Point 2 Point 3 Decibel To show that a signal has lost or gained strength, engineers use the unit of the decibel. The decibel (dB) measures the relative strengths of two signals or one signal at two dif- ferent points. Note that the decibel is negative if a signal is attenuated and positive if a signal is amplified. Variables PI and P 2 are the powers of a signal at points 1 and 2, respectively. Note that some engineering books define the decibel in terms of voltage instead of power. In this case, because power is proportional to the square of the voltage, the formula is dB = 20 log 10 (V2IV1). In this text, we express dB in terms of power. 82 CHAPTER 3 DATA AND SIGNALS Example 3.26 Suppose a signal travels through a transmission medium and its power is reduced to one-half. This means that P 2 = ~ PI' In this case, the attenuation (loss of power) can be calculated as Pz 0.5PI 1010glO - = 1010gl0 - - = 10 Iogl o 0.5 = 10(-0.3) = -3 dB PI PI A loss of 3 dB (-3 dB) is equivalent to losing one-half the power. Example 3.27 A signal travels through an amplifier, and its power is increased 10 times. This means that Pz = 1OP I' In this case, the amplification (gain of power) can be calculated as Example 3.28 One reason that engineers use the decibel to measure the changes in the strength of a signal is that decibel numbers can be added (or subtracted) when we are measuring several points (cascading) instead of just two. In Figure 3.27 a signal travels from point 1 to point 4. The signal is attenuated by the time it reaches point 2. Between points 2 and 3, the signal is amplified. Again, between points 3 and 4, the signal is attenuated. We can find the resultant decibel value for the signal just by adding the decibel measurements between each set of points. Figure 3.27 Decibels for Example 3.28 I dB dB _ _ 1 _ :_---'--'-=-.3 7dB -3 dB 1 ----'---- 'I' :1 Point 1 Transmission Point 2 Point 3 Transmission Point 4 medium medium In this case, the decibel value can be calculated as dB=-3+7-3=+1 The signal has gained in power. Example 3.29 Sometimes the decibel is used to measure signal power in milliwatts. In this case, it is referred to as dB m and is calculated as dB m = 10 loglO Pm' where Pm is the power in milliwatts. Calculate the power of a signal if its dB m = -30. SECTION 3.4 TRANSMISSION IMPAIRMENT 83 Solution We can calculate the power in the signal as dB m = 10 log 10 Pm = -30 loglO Pm := -3 Pm = 10-3 rnW Example 3.30 The loss in a cable is usually defined in decibels per kilometer (dB/km). If the signal at the beginning of a cable with -0.3 dBlkm has a power of 2 mW, what is the power of the signal at 5 km? Solution The loss in the cable in decibels is 5 x (-0.3)::: -1.5 dB. We can calculate the power as Distortion Distortion means that the signal changes its form or shape. Distortion can occur in a composite signal made of different frequencies. Each signal component has its own propagation speed (see the next section) through a medium and, therefore, its own delay in arriving at the final destination. Differences in delay may create a difference in phase if the delay is not exactly the same as the period duration. In other words, signal components at the receiver have phases different from what they had at the sender. The shape of the composite signal is therefore not the same. Figure 3.28 shows the effect of distortion on a composite signal. Figure 3.28 Distortion Composite signal Composite signal sent received Components, Components, in phase out of phase At the sender At the receiver 84 CHAPTER 3 DATA AND SIGNALS Noise Noise is another cause of impairment. Several types of noise, such as thermal noise, induced noise, crosstalk, and impulse noise, may corrupt the signal. Thermal noise is the random motion of electrons in a wire which creates an extra signal not originally sent by the transmitter. Induced noise comes from sources such as motors and appli- ances. These devices act as a sending antenna, and the transmission medium acts as the receiving antenna. Crosstalk is the effect of one wire on the other. One wire acts as a sending antenna and the other as the receiving antenna. Impulse noise is a spike (a sig- nal with high energy in a very short time) that comes from power lines, lightning, and so on. Figure 3.29 shows the effect of noise on a signal. We discuss error in Chapter 10. Figure 3.29 Noise Transmitted Noise I I I I I I Point 1 Transmission medium Point 2 Signal-to-Noise Ratio (SNR) As we will see later, to find the theoretical bit rate limit, we need to know the ratio of the signal power to the noise power. The signal-to-noise ratio is defined as = SNR average signal power average noise power We need to consider the average signal power and the average noise power because these may change with time. Figure 3.30 shows the idea of SNR. SNR is actually the ratio of what is wanted (signal) to what is not wanted (noise). A high SNR means the signal is less corrupted by noise; a low SNR means the signal is more corrupted by noise. Because SNR is the ratio of two powers, it is often described in decibel units, SNRdB , defined as SNRcm = lOloglo SNR Example 3.31 The power of a signal is 10 mW and the power of the noise is 1 /lW; what are the values of SNR and SNRdB ? SECTION 3.5 DATA RATE LIMITS 85 Figure 3.30 Two cases of SNR: a high SNR and a low SNR Signal Noise - a. Large SNR Noise Signal + noise b. Small SNR Solution The values of SNR and SN~B can be calculated as follows: SNR = 10.000 flW = 10 000 ImW ' SNRdB = 10 loglO 10,000 = 10 loglO 104 = 40 Example 3.32 The values of SNR and SNRdB for a noiseless channel are SNR = signal power = 0 o SNRdB = 10 loglO 00 = 0 We can never achieve this ratio in real life; it is an ideal. 3.5 DATA RATE LIMITS A very important consideration in data communications is how fast we can send data, in bits per second. over a channel. Data rate depends on three factors: 1. The bandwidth available 2. The level of the signals we use 3. The quality of the channel (the level of noise) Two theoretical formulas were developed to calculate the data rate: one by Nyquist for a noiseless channel. another by Shannon for a noisy channel. 86 CHAPTER 3 DATA AND SIGNALS Noiseless Channel: Nyquist Bit Rate For a noiseless channel, the Nyquist bit rate formula defines the theoretical maximum bit rate BitRate = 2 x bandwidth x 10g2 L In this formula, bandwidth is the bandwidth of the channel, L is the number of signal levels used to represent data, and BitRate is the bit rate in bits per second. According to the formula, we might think that, given a specific bandwidth, we can have any bit rate we want by increasing the number of signa11eve1s. Although the idea is theoretically correct, practically there is a limit. When we increase the number of sig- nal1eve1s, we impose a burden on the receiver. If the number of levels in a signal is just 2, the receiver can easily distinguish between a 0 and a 1. If the level of a signal is 64, the receiver must be very sophisticated to distinguish between 64 different levels. In other words, increasing the levels of a signal reduces the reliability of the system. Increasing the levels of a signal may reduce the reliability of the system. Example 3.33 Does the Nyquist theorem bit rate agree with the intuitive bit rate described in baseband transmission? Solution They match when we have only two levels. We said, in baseband transmission, the bit rate is 2 times the bandwidth if we use only the first harmonic in the worst case. However, the Nyquist formula is more general than what we derived intuitively; it can be applied to baseband transmis- sion and modulation. Also, it can be applied when we have two or more levels of signals. Example 3.34 Consider a noiseless channel with a bandwidth of 3000 Hz transmitting a signal with two signal levels. The maximum bit rate can be calculated as BitRate =2 x 3000 x log2 2 = 6000 bps Example 3.35 Consider the same noiseless channel transmitting a signal with four signal levels (for each level, we send 2 bits). The maximum bit rate can be calculated as BitRate =2 x 3000 X log2 4 = 12,000 bps Example 3.36 We need to send 265 kbps over a noiseless channel with a bandwidth of 20 kHz. How many sig- nallevels do we need? SECTION 3.5 DATA RATE LIMITS 87 Solution We can use the Nyquist formula as shown: 265,000 =2 X 20,000 X logz L log2 L = 6.625 L =2 6.625 = 98.7 levels Since this result is not a power of 2, we need to either increase the number of levels or reduce the bit rate. If we have 128 levels, the bit rate is 280 kbps. If we have 64 levels, the bit rate is 240 kbps. Noisy Channel: Shannon Capacity In reality, we cannot have a noiseless channel; the channel is always noisy. In 1944, Claude Shannon introduced a formula, called the Shannon capacity, to determine the theoretical highest data rate for a noisy channel: Capacity = bandwidth X log2 (1 + SNR) In this formula, bandwidth is the bandwidth of the channel, SNR is the signal-to- noise ratio, and capacity is the capacity of the channel in bits per second. Note that in the Shannon formula there is no indication of the signal level, which means that no matter how many levels we have, we cannot achieve a data rate higher than the capacity of the channel. In other words, the formula defines a characteristic of the channel, not the method of transmission. Example 3.37 Consider an extremely noisy channel in which the value of the signal-to-noise ratio is almost zero. In other words, the noise is so strong that the signal is faint. For this channel the capacity C is calculated as C =B log2 (1 + SNR) =B 10gz (l + 0) = B log2 1 ::;;: B x 0 :;;;; 0 This means that the capacity of this channel is zero regardless of the bandwidth. In other words, we cannot receive any data through this channel. Example 3.38 We can calculate the theoretical highest bit rate of a regular telephone line. A telephone line nor- mally has a bandwidth of 3000 Hz (300 to 3300 Hz) assigned for data communications. The sig- nal-to-noise ratio is usually 3162. For this channel the capacity is calculated as C = B log2 (1 + SNR) =3000 log2 (l + 3162) =3000 log2 3163 :::::: 3000 x 11.62 = 34,860 bps This means that the highest bit rate for a telephone line is 34.860 kbps. If we want to send data faster than this, we can either increase the bandwidth of the line or improve the signal-to- noise ratio. 88 CHAPTER 3 DATA AND SIGNALS Example 3.39 The signal-to-noise ratio is often given in decibels. Assume that SN~B = 36 and the channel bandwidth is 2 MHz. The theoretical channel capacity can be calculated as SNRdB = 10 loglO SNR... SNR = lOSNRoB/10... SNR::; 10 3.6 = 3981 6 C =B log2 (1+ SNR) = 2 X 10 X log2 3982 = 24 Mbps Example 3.40 For practical purposes, when the SNR is very high, we can assume that SNR + I is almost the same as SNR. In these cases, the theoretical channel capacity can be simplified to SNR dB C=BX - - = 3 For example, we can calculate the theoretical capacity of the previous example as 36 C= 2 MHz X - =24 Mbps 3 Using Both Limits In practice, we need to use both methods to find the limits and signal levels. Let us show this with an example. Example 3.41 We have a channel with a I-MHz bandwidth. The SNR for this channel is 63. What are the appro- priate bit rate and signal level? Solution First, we use the Shannon formula to find the upper limit. C =B log2 (l + SNR) = 106 log2 (1 + 63) = 106 10g2 64 = 6 Mbps The Shannon formula gives us 6 Mbps, the upper limit. For better performance we choose something lower, 4 Mbps, for example. Then we use the Nyquist formula to find the number of signal levels. 4Mbps=2x 1 MHz x log2 L... L=4 The Shannon capacity gives us the upper limit; the Nyquist formula tells us how many signal levels we need. SECTION 3.6 PERFORMANCE 89 3.6 PERFORMANCE Up to now, we have discussed the tools of transmitting data (signals) over a network and how the data behave. One important issue in networking is the performance of the network-how good is it? We discuss quality of service, an overall measurement of network performance, in greater detail in Chapter 24. In this section, we introduce terms that we need for future chapters. Bandwidth One characteristic that measures network performance is bandwidth. However, the term can be used in two different contexts with two different measuring values: bandwidth in hertz and bandwidth in bits per second. Bandwidth in Hertz We have discussed this concept. Bandwidth in hertz is the range of frequencies con- tained in a composite signal or the range of frequencies a channel can pass. For exam- ple, we can say the bandwidth of a subscriber telephone line is 4 kHz. Bandwidth in Bits per Seconds The term bandwidth can also refer to the number of bits per second that a channel, a link, or even a network can transmit. For example, one can say the bandwidth of a Fast Ethernet network (or the links in this network) is a maximum of 100 Mbps. This means that this network can send 100 Mbps. Relationship There is an explicit relationship between the bandwidth in hertz and bandwidth in bits per seconds. Basically, an increase in bandwidth in hertz means an increase in bandwidth in bits per second. The relationship depends on whether we have baseband transmission or transmission with modulation. We discu