ebook img

Computer Networking: Principles, Protocols, And Practice PDF

2011·13.9 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Computer Networking: Principles, Protocols, And Practice

Computer Networking : Principles, Protocols and Practice Release 0.25 Olivier Bonaventure January25,2012 Contents 1 Preface 3 1.1 Abouttheauthor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2 Part1: Introduction 5 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.2 Servicesandprotocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.3 Thereferencemodels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.4 Organisationofthebook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 3 Part2: TheApplicationLayer 27 3.1 TheapplicationLayer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.2 Principles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.3 Thetransportservices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.4 Application-levelprotocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 3.5 Writingsimplenetworkedapplications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 3.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 3.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 4 Part4: TheTransportLayer 67 4.1 Principlesofareliabletransportprotocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 4.2 TheUserDatagramProtocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 4.3 TheTransmissionControlProtocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 4.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 4.5 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 5 Part5: TheNetworkLayer 129 5.1 Thenetworklayer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 6 Part6: TheThedatalinklayerandtheLocalAreaNetworks 215 6.1 ThedatalinklayerandtheLocalAreaNetworks . . . . . . . . . . . . . . . . . . . . . . . . . . 215 7 Part7: Appendices 253 7.1 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 7.2 Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 7.3 Indicesandtables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 Bibliography 259 Index 273 i ii ComputerNetworking: Principles,ProtocolsandPractice,Release0.25 Contents 1 ComputerNetworking: Principles,ProtocolsandPractice,Release0.25 2 Contents 1 CHAPTER Preface Thistextbookcamefromafrustrationofitsmainauthor. Manyauthorschosetowriteatextbookbecausethere are no textbooks in their field or because they are not satisfied with the existing textbooks. This frustration has produced several excellent textbooks in the networking community. At a time when networking textbooks weremainlytheoretical,DouglasComerchosetowriteatextbookentirelyfocusedontheTCP/IPprotocolsuite [Comer1988], a difficult choice at that time. He later extended his textbook by describing a complete TCP/IP implementation,addingpracticalconsiderationstothetheoreticaldescriptionsin[Comer1988]. RichardStevens approached the Internet like an explorer and explained the operation of protocols by looking at all the packets thatwereexchangedonthewire[Stevens1994]. JimKuroseandKeithRossreinventedthenetworkingtextbooks bystartingfromtheapplicationsthatthestudentsuseandlaterexplainedtheInternetprotocolsbyremovingone layeraftertheother[KuroseRoss09]. The frustrations that motivated this book are different. When I started to teach networking in the late 1990s, studentswerealreadyInternetusers,buttheirusagewaslimited.Studentswerestillusingreferencetextbooksand spent time in the library. Today’s students are completely different. They are avid and experimented web users who find lots of information on the web. This is a positive attitude since they are probably more curious than theirpredecessors. ThankstotheinformationthatisavailableontheInternet,theycancheckorobtainadditional informationaboutthetopicsexplainedbytheirteachers. Thisabundantinformationcreatesseveralchallengesfor ateacher.Untiltheendofthenineteenthcentury,ateacherwasbydefinitionmoreknowledgeablethanhisstudents and it was very difficult for the students to verify the lessons given by their teachers. Today, given the amount ofinformationavailableatthefingertipsofeachstudentthroughtheInternet,verifyingalessonorgettingmore informationaboutagiventopicissometimesonlyafewclicksaway. Websitessuchaswikipediaprovidelotsof informationonvarioustopicsandstudentsoftenconsultthem. Unfortunately,theorganisationoftheinformation onthesewebsitesisnotwellsuitedtoallowstudentstolearnfromthem. Furthermore,therearehugedifferences inthequalityanddepthoftheinformationthatisavailablefordifferenttopics. Thesecondreasonisthatthecomputernetworkingcommunityisastrongparticipantintheopen-sourcemove- ment. Today,therearehigh-qualityandwidelyusedopen-sourceimplementationsformostnetworkingprotocols. This includes the TCP/IP implementations that are part of linux, freebsd or the uIP stack running on 8bits con- trollers,butalsoserverssuchasbind,unbound,apacheorsendmailandimplementationsofroutingprotocolssuch asxorporquagga. Furthermore,thedocumentsthatdefinealmostalloftheInternetprotocolshavebeendevel- opedwithintheInternetEngineeringTaskForce(IETF)usinganopenprocess. TheIETFpublishesitsprotocol specificationsinthepubliclyavailableRFCandnewproposalsaredescribedinInternetdrafts. This open textbook aims to fill the gap between the open-source implementations and the open-source network specificationsbyprovidingadetailedbutpedagogicaldescriptionofthekeyprinciplesthatguidetheoperationof the Internet. The book is released under a creative commons licence. Such an open-source license is motivated by two reasons. The first is that we hope that this will allow many students to use the book to learn computer networks. The second is that I hope that other teachers will reuse, adapt and improve it. Time will tell if it is possible to build a community of contributors to improve and develop the book further. As a starting point, the firstreleasecontainsallthematerialforaone-semesterfirstupperundergraduateoragraduatenetworkingcourse. Asofthiswriting,mostofthetexthasbeenwrittenbyOlivierBonaventure. LaurentVanbever,VirginieVanden 3 ComputerNetworking: Principles,ProtocolsandPractice,Release0.25 Schriek, Damien Saucez and Mickael Hoerdt have contributed to exercises. Pierre Reinbold designed the icons usedtorepresentswitchesandNipaulLonghasredrawnmanyfiguresintheSVGformat. StephaneBortzmeyer sent many suggestions and corrections to the text. Additional information about the textbook is available at http://inl.info.ucl.ac.be/CNP3 Note: Computer Networking : Principles, Protocols and Practice, (c) 2011, Olivier Bonaventure, Universite catholiquedeLouvain(Belgium)andthecollaboratorslistedabove,usedunderaCreativeCommonsAttribution (CCBY)licensemadepossiblebyfundingfromTheSaylorFoudnation’sOpenTextbookChallengeinorderto beincorporatedintoSaylor.org’collectionofopencoursesavailableathttp://www.saylor.org. Fulllicenseterms maybeviewedat: http://creativecommons.org/licenses/by/3.0/ 1.1 About the author Olivier Bonaventure is currently professor at Universite catholique de Louvain (Belgium) where he leads the IP Networking Lab and is vice-president of the ICTEAM institute. His research has been focused on Internet protocols for more than twenty years. Together with his Ph.D. students, he has developed traffic engineering techniques, performed various types of Internet measurements, improved the performance of routing protocols suchasBGPandIS-ISandparticipatedtothedevelopmentofnewInternetprotocolsincludingshim6,LISPand Multipath TCP. He frequently contributes to standardisation within the IETF. He was on the editorial board of IEEE/ACMTransactionsonNetworkingandisEducationDirectorofACMSIGCOMM. 4 Chapter1. Preface 2 CHAPTER Part 1: Introduction 2.1 Introduction When the first computers were built during the second world war, they were expensive and isolated. However, after about twenty years, as their prices gradually decreased, the first experiments began to connect computers together. Intheearly1960s,researchersincludingPaulBaran,DonaldDaviesorJosephLickliderindependently published the first papers describing the idea of building computer networks [Baran] [Licklider1963] . Given the cost of computers, sharing them over a long distance was an interesting idea. In the US, the ARPANET started in 1969 and continued until the mid 1980s [LCCD09]. In France, Louis Pouzin developed the Cyclades network [Pouzin1975]. Many other research networks were built during the 1970s [Moore]. At the same time, thetelecommunicationandcomputerindustriesbecameinterestedincomputernetworks. Thetelecommunication industry bet on the X25. The computer industry took a completely different approach by designing Local Area Networks (LAN). Many LAN technologies such as Ethernet or Token Ring were designed at that time. During the 1980s, the need to interconnect more and more computers led most computer vendors to develop their own suiteofnetworkingprotocols. Xeroxdeveloped[XNS],DECchoseDECNet[Malamud1991],IBMdeveloped SNA[McFadyen1976],MicrosoftintroducedNetBIOS[Winston2003],ApplebetonAppletalk[SAO1990]. In theresearchcommunity,ARPANETwasdecommissionedandreplacedbyTCP/IP[LCCD09]andthereference implementationwasdevelopedinsideBSDUnix[McKusick1999]. UniversitieswhowerealreadyrunningUnix couldthusadoptTCP/IPeasilyandvendorsofUnixworkstationssuchasSunorSiliconGraphicsincludedTCP/IP intheirvariantofUnix. Inparallel,theISO,withsupportfromthegovernments,workedondevelopinganopen 1 Suiteofnetworkingprotocols. Intheend,TCP/IPbecamethedefactostandardthatisnotonlyusedwithinthe research community. During the 1990s and the early 2000s, the growth of the usage of TCP/IP continued, and today proprietary protocols are seldom used. As shown by the figure below, that provides the estimation of the numberofhostsattachedtotheInternet,theInternethassustainedlargegrowththroughoutthelast20+years. Recent estimations of the number of hosts attached to the Internet show a continuing growth since 20+ years. However, although the number of hosts attached to the Internet is high, it should be compared to the number of mobile phones that are in use today. More and more of these mobile phones will be connected to the Inter- net. Furthermore, thanks to the availability of TCP/IP implementations requiring limited resources such as uIP [Dunkels2003],wecanexpecttoseeagrowthofTCP/IPenabledembeddeddevices. Before looking at the services provided by computer networks, it is useful to agree on some terminology that is widely used in networking literature. First of all, computer networks are often classified in function of the geographicalareathattheycover • LAN:alocalareanetworktypicallyinterconnectshoststhatareuptoafewormaybeafewtensofkilome- tersapart. • MAN :ametropolitanareanetworktypicallyinterconnectsdevicesthatareuptoafewhundredkilometers apart 1OpeninISOtermswasincontrastwiththeproprietaryprotocolsuiteswhosespecificationwasnotalwayspubliclyavailable. TheUS governmentevenmandatedtheusageoftheOSIprotocols(seeRFC1169),butthiswasnotsufficienttoencouragealluserstoswitchtothe OSIprotocolsuitethatwasconsideredbymanyastoocomplexcomparedtootherprotocolsuites. 5 ComputerNetworking: Principles,ProtocolsandPractice,Release0.25 Figure2.1: EstimationofthenumberofhostsontheInternet Figure2.2: Estimationofthenumberofmobilephones • WAN :awideareanetworkinterconnecthoststhatcanbelocatedanywhereonEarth2 Anotherclassificationofcomputernetworksisbasedontheirphysicaltopology. Inthefollowingfigures,physical linksarerepresentedaslineswhileboxesshowcomputersorothertypesofnetworkingequipment. Computer networks are used to allow several hosts to exchange information between themselves. To allow any hosttosendmessagestoanyotherhostinthenetwork,theeasiestsolutionistoorganisethemasafull-mesh,with a direct and dedicated link between each pair of hosts. Such a physical topology is sometimes used, especially whenhighperformanceandhighredundancyisrequiredforasmallnumberofhosts. However,ithastwomajor drawbacks: • for a network containing n hosts, each host must have n-1 physical interfaces. In practice, the number of physicalinterfacesonanodewilllimitthesizeofafull-meshnetworkthatcanbebuilt • foranetworkcontainingnhosts, n×(n−1) linksarerequired. Thisispossiblewhenthereareafewnodes 2 inthesameroom,butrarelywhentheyarelocatedseveralkilometersapart The second possible physical organisation, which is also used inside computers to connect different extension cards, is the bus. In a bus network, all hosts are attached to a shared medium, usually a cable through a single interface.Whenonehostsendsanelectricalsignalonthebus,thesignalisreceivedbyallhostsattachedtothebus. Adrawbackofbus-basednetworksisthatifthebusisphysicallycut, thenthenetworkissplitintotwoisolated networks. Forthisreason,bus-basednetworksaresometimesconsideredtobedifficulttooperateandmaintain, especiallywhenthecableislongandtherearemanyplaceswhereitcanbreak. Suchabus-basedtopologywas usedinearlyEthernetnetworks. A third organisation of a computer network is a star topology. In such topologies, hosts have a single physical interface and there is one physical link between each host and the center of the star. The node at the center of 2 Inthisbook, wefocusonnetworksthatareusedonEarth. Thesenetworkssometimesincludesatellitelinks. Besidesthenetwork technologiesthatareusedonEarth,researchersdevelopnetworkingtechniquesthatcouldbeusedbetweennodeslocatedondifferentplanets. SuchanInterPlanetaryInternetrequiresdifferenttechniquesthantheonesdiscussedinthisbook. SeeRFC4838andthereferencestherein forinformationaboutthesetechniques. 6 Chapter2. Part1: Introduction

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.