C C OMPUTER AND OMMUNICATION N ETWORKS This page intentionally left blank C C OMPUTER AND OMMUNICATION N ETWORKS Nader F. Mir UpperSaddleRiver,NJ . Boston . Indianapolis . SanFrancisco . NewYork Toronto . Montreal . London . Munich . Paris . Madrid . Capetown Sydney . Tokyo . Singapore . MexicoCity Manyofthedesignationsusedbymanufacturersandsellerstodistinguishtheirproductsareclaimedastrademarks.Where thosedesignationsappearinthisbook,andthepublisherwasawareofatrademarkclaim,thedesignationshavebeenprinted withinitialcapitallettersorinallcapitals. Theauthorandpublisherhavetakencareinthepreparationofthisbook,butmakenoexpressedorimpliedwarrantyofany kindandassumenoresponsibilityforerrorsoromissions.Noliabilityisassumedforincidentalorconsequentialdamages inconnectionwithorarisingoutoftheuseoftheinformationorprogramscontainedherein. Thepublisheroffersexcellentdiscountsonthisbookwhenorderedinquantityforbulkpurchasesorspecialsales,which mayincludeelectronicversionsand/orcustomcoversandcontentparticulartoyourbusiness,traininggoals,marketing focus,andbrandinginterests.Formoreinformation,pleasecontact: U.S.CorporateandGovernmentSales (800)382-3419 [email protected] ForsalesoutsidetheUnitedStates,pleasecontact: InternationalSales [email protected] ThisBookIsSafariEnabled TheSafari®Enabledicononthecoverofyourfavoritetechnologybookmeansthebookisavailablethrough SafariBookshelf.Whenyoubuythisbook,yougetfreeaccesstotheonlineeditionfor45days. SafariBookshelfisanelectronicreferencelibrarythatletsyoueasilysearchthousandsoftechnicalbooks,findcodesamples, downloadchapters,andaccesstechnicalinformationwheneverandwhereveryouneedit. Togain45-daySafariEnabledaccesstothisbook: . Gotohttp://www.prenhallprofessional.com/safarienabled . Completethebriefregistrationform . EnterthecouponcodeVZGY-SBEH-4Q1D-K8IN-BX58 If you have difficulty registering on Safari Bookshelf or accessing the online edition, please e-mail customer- [email protected]. VisitusontheWeb:www.prenhallprofessional.com LibraryofCongressCataloging-in-PublicationData Mir,NaderF. Computerandcommunicationnetworks/NaderF.Mir. p. cm. Includesbibliographicalreferencesandindex. ISBN0-13-174799-1(hardcover:alk.paper) 1.Computernetworks. 2.Datatransmissionsystems. I.Title. TK5105.5M5672006 004.6—dc22 2006025914 Copyright©2007PearsonEducation,Inc. Allrightsreserved.PrintedintheUnitedStatesofAmerica.Thispublicationisprotectedbycopyright,andpermissionmust beobtainedfromthepublisherpriortoanyprohibitedreproduction,storageinaretrievalsystem,ortransmissioninany formorbyanymeans,electronic,mechanical,photocopying,recording,orlikewise.Forinformationregardingpermissions, writeto: PearsonEducation,Inc. RightsandContractsDepartment OneLakeStreet UpperSaddleRiver,NJ07458 Fax:(201)236-3290 ISBN0-13-174799-1 TextprintedintheUnitedStatesonrecycledpaperatR.R.DonnelleyinCrawfordsville,Indiana. Firstprinting,November2006 To Sherry and Navid This page intentionally left blank Contents Preface xxi AbouttheAuthor xxxi PART I: Fundamental Concepts 1 1 Packet-SwitchedNetworks 3 1.1 BasicDefinitionsinDataNetworks 4 1.1.1 PacketSwitchingversusCircuitSwitching 4 1.1.2 Messages,Packets,andFrames 5 1.1.3 TheInternet 6 1.1.4 ISPsandInternetworkComponents 9 1.2 TypesofPacket-SwitchedNetworks 10 1.2.1 ConnectionlessNetworks 11 1.2.2 Connection-OrientedNetworks 13 1.3 PacketSizeandOptimizations 14 1.4 Summary 16 1.5 Exercises 17 2 FoundationofNetworkingProtocols 19 2.1 5-LayerTCP/IPModel 20 2.2 7-LayerOSIModel 22 2.3 InternetProtocolsandAddressing 23 2.3.1 IPPacket 23 2.3.2 IPAddressingScheme 24 2.3.3 SubnetAddressingandMasking 25 viii Contents 2.3.4 ClasslessInterdomainRouting(CIDR) 27 2.3.5 PacketFragmentationandReassembly 28 2.3.6 InternetControlMessageProtocol(ICMP) 29 2.3.7 IPVersion6(IPv6) 30 2.4 Equal-SizedPacketsModel:ATM 33 2.4.1 ATMProtocolStructure 34 2.4.2 ATMCellStructure 36 2.5 Summary 39 2.6 Exercises 39 3 NetworkingDevices 43 3.1 Multiplexers 43 3.1.1 Frequency-DivisionMultiplexing(FDM) 44 3.1.2 Wavelength-DivisionMultiplexing(WDM) 44 3.1.3 Time-DivisionMultiplexing 45 3.2 ModemsandInternetAccessDevices 50 3.2.1 LineCodingMethods 50 3.2.2 DigitalModulationTechniques 52 3.2.3 DigitalSubscriberLine(DSL)Modems 54 3.2.4 CableModems 56 3.3 SwitchingandRoutingDevices 57 3.3.1 Repeaters,Hubs,andBridges 57 3.3.2 RoutersandHigher-LayerSwitches 59 3.4 RouterStructure 60 3.4.1 InputPortProcessor(IPP) 60 3.4.2 SwitchFabric 63 3.4.3 SwitchController 64 3.4.4 OutputPortProcessors(OPP) 65 3.5 Summary 67 3.6 Exercises 67 4 DataLinksandTransmission 71 4.1 DataLinks 72 4.2 WiredLinksandTransmission 73 4.2.1 Twisted-PairLinks 73 4.2.2 CoaxialCable 73 4.2.3 OpticalFiber 73 4.3 WirelessLinksandTransmission 74 4.3.1 ChoiceofAntenna 75 Contents ix 4.3.2 WirelessChannels 76 4.3.3 CapacityLimitsofWirelessChannels 79 4.3.4 ChannelCoding 79 4.3.5 Flat-FadingCountermeasures 79 4.3.6 IntersymbolInterferenceCountermeasures 80 4.3.7 OrthogonalFrequencyDivisionMultiplexing(OFDM) 81 4.4 MethodsofChannelAccessonLinks 82 4.4.1 Frequency-DivisionMultipleAccess 83 4.4.2 Time-DivisionMultipleAccess 83 4.4.3 Code-DivisionMultipleAccess 85 4.4.4 Space-DivisionMultipleAccess 87 4.4.5 HybridMultiple-AccessTechniques 87 4.5 ErrorDetectionandCorrection 87 4.5.1 ErrorDetectionMethods 89 4.5.2 CyclicRedundancyCheck(CRC)Algorithm 89 4.6 Link-LevelFlowControl 94 4.6.1 Stop-and-WaitFlowControl 95 4.6.2 Sliding-WindowFlowControl 96 4.7 Summary 98 4.8 Exercises 99 5 LocalAreaNetworksandNetworksofLANs 101 5.1 LANsandBasicTopologies 102 5.2 LANProtocols 103 5.2.1 Logical-LinkLayer(LLC) 103 5.2.2 MediumAccessControl(MAC) 104 5.3 MACandIPAddresses 104 5.3.1 AddressResolutionProtocol(ARP) 105 5.3.2 ReverseAddressResolutionProtocol(RARP) 106 5.4 ClassificationofMACProtocols 106 5.5 Contention-AccessMAC 107 5.5.1 CarrierSenseMultipleAccess(CSMA) 108 5.5.2 EthernetLAN:IEEE802.3Standard 113 5.6 Round-Robin-AccessMAC 114 5.6.1 Token-RingAccessProtocol 114 5.6.2 Token-Ring:IEEE802.5Standard 116 5.7 NetworkofLANs 116 5.7.1 UsingRepeaters,Hubs,andBridges 117 5.7.2 Layers2and3Switches 124