Tải bản đầy đủ - 0 (trang)
Chapter 11. Knowing Where to Turn at Each Intersection (Router)

Chapter 11. Knowing Where to Turn at Each Intersection (Router)

Tải bản đầy đủ - 0trang

eventuallygettoyourdestination.

WithIProuting,aPCsendsanIPpackettosomenearbyrouter.

Thatrouterchoosestheinterfacethattherouterusesto

forwardthepacket.Thepackettravelsacrossthephysical

network,forinstance,overaLANswitch,tothenextrouter.

Eventually,thepacketarrivesatthelastrouter,whichroutes

thepackettothedestinationaddress.

Theroutingprocessisactuallyprettysimple,andyou've

alreadyseenthebasicsinChapter10.Thischaptercoversmore

detailsoftheroutingprocessthatpullsomeimportantconcepts

together.



AShortTripfromYourHouse(PC)totheLocal

Store(Server)

Isometimessitbackandthinkabouthowbigandpopulousthe

worldhasgotten.SometimesI'lldrivedownalargehighwayin

rushhour,seeallthecars,andwonderhowmanycarsdriveon

thatroadeachday.Okay,maybeI'vegotalittletoomuchtime

onmyhandsifIhavetimetopondersuchthings,butlet'sface

it:TheU.S.DepartmentofTransportation(DOT)hastoworry

aboutbuildingroadsthataccommodatealotofcars.

WhentheDOTbuildshighwaysinamajorcity,ittypicallyhas

tobereadytobuildlotsoflanes,expectingpossiblyhundreds

ofthousandsofcarstodriveovertheroadeachday.Likewise,

routersforwardalotofIPpacketsontheaverageday.Someof

themoreexpensive,fasterroutersclaimtobeabletoforward

hundredsofmillionsofpacketspersecond.Eventheleast

expensiveroutersfromCiscocanforwardtensofthousandsof

IPpacketspersecond.Likeabusyintersectionhandlesalotof

carspassingthroughit,arouterneedstohandlealotof

individualpacketspassingthroughit.

Now,thinklikethepeoplewhomadeupIPandIProutingfora

moment.Ifyouneedtodefineprotocolsandstandardsabout

howtodosomething,andthatthinghastohappenthousands

ormillionsoftimespersecond,youhadbetterfollowtheKISS

(Keepitsimple,stupid)principle!Ifyoumaderoutingoverly

complicated,youwouldneedreallyexpensiverouterhardware

toforwardallthosepackets.Bykeepingtheamountofwork

perpackettoabareminimum,thevendorscouldcreaterouters

thatcouldmeettheneedtoforwardlotsofpackets,while

keepingthecostoftheroutersalittlelower.

Thispartofthebooktakesalookatthelifeofapacketasit

goesfromonecomputer(Hannah)toawebserver(



http://www.example.com).Theprocessthateachcomputerand

routerperformsisindeedprettysimple,whichallowstherouter

tomoveontothenextpacketthat'swaitingtobeforwarded.



OverviewoftheEnd-to-EndRoutingProcess

Let'sreviewthebasicprocessofroutingascoveredinChapter

10.Figure11-1issimilartoseveralfiguresfromChapter10,

butthisonehasalittlelesscluttersothatyoucanfocuson

howtogetapacketfromHannahtothewww.example.comweb

server.



Figure11-1.InternetworkwithTwoRoutersand

ThreeIPNetworks



[Viewfullsizeimage]



ThisinternetworkusesthreedifferentIPnetworknumbers,with

oneIPnetworknumberforeachphysicalnetwork.Simplyput,

thisinternetworkdoesnotusesubnetting.



note

Tokeepthingsstraightinthischapter,Iwillusetheword

"internetwork"torefertotheentirenetworkshowninafigure,andthe

word"network"torefertoanindividualphysicalnetwork,suchasthe

threeseparateEthernetnetworksshowninFigure11-1.Remember:

Youcanusetheword"network"inmanydifferentways;todescribe

routing,using"internetwork"and"network"asdescribedherewillmake

thetextalittlemorereadable.



ForHannahtosendapackettothewebserver,afewseparate

stepshappen:

1. HannahsendsthepackettoR1.(Ofcourse,thepacket

passesthroughtheLANswitchonthelefttogettoR1,but

you'refocusingontherouterlogicforIProutingrightnow.)

2. R1makesaforwardingdecisiontosendthepackettoR2.

3. R2decidestoforwardthepacketdirectlytothewebserver.



Figure11-1showseachofthesethreesteps;thenextthree

sectionsofthischaptertakeacloserlookateach.



Step1:LeavingYourNeighborhoodtheSame

Way,EveryTime

Formostpeoplewhohaveacar,whenyouleaveyourhouseor

apartment,youcanonlydriveonedirection.Eventually,you'll



gettosomeintersection,whereyoucanmakeachoiceof

wheretoturn.Ifyouknowwhereyou'regoing,youcango

aheadandturn.Ifnot,youcanlookforroadsignsateach

intersection,withtheroadsignstellingyouwhichwaytoturn.

InFigure11-1,Hannahisinthesamebasicsituation.After

Hannah'sPC'sIPsoftwarehasbuilttheIPpacketthatneedsto

besenttotheserver,itneedstoknowwheretosendthe

packetfirst.Asitturnsout,becauseR1istheonlyrouter

attachedtoHannah'sIPnetwork(network8.0.0.0),sheneeds

tosendthepackettoR1.

TosendthepackettoR1,HannahneedstoknowR1'sIP

addressspecifically,theIPaddressoftherouterinterfacethat's

connectedtothesameEthernetasHannah.InTCP/IP

terminology,R1wouldbeHannah'sdefaultrouter,ordefault

gateway.APC'sdefaultrouterissimplytheroutertowhich

thatPCsendspacketswhenthedestinationisinanother

networkorsubnet.AsyoucanseeinFigure11-2,Hannah

knowsherdefaultrouterisR1.



Figure11-2.ByDefault,LeaveYourNetworkVia

theDefaultRouter



[Viewfullsizeimage]



HannahisinIPnetwork8.0.0.0,andR1istheonlyrouterthat's

connectedtothatIPnetwork.BecauseHannahknowsthat

routersknowhowtoroutepackets,itmakessensethatHannah

shouldforwardthepackettoR1.However,thereareseveral

littledetailsthatareimportanttonoteinFigure11-2.First,

Hannah'sPCknowsitsdefaultrouterbytheIPaddress,notby

thename.RouterstypicallyhaveoneIPaddressperphysical

interface;HannahneedstoknowR1'sIPaddressonR1's

Ethernet1interfaceinthiscase,becauseR1'sEthernet1

interfaceisconnectedtothesameEthernetLANthatHannahis.

(Becauseroutershavelotsofinterfacesofmanydifferent

types,routerslabelthephysicalinterfaceswithanameanda

number,suchasEthernet1.)



note

Althoughtheterm"defaultrouter"makessense,mostpeopleusethe

term"defaultgateway"tomeanthesamething.Beforetheterm

"router"becamepopular,peoplecalledthesamekindofdevicea

"gateway."Oddlyenough,althoughalmosteveryoneusestheterm

"router"whenspeakingofahardwaredevicethatperformsrouting,

manypeoplestillusetheterm"defaultgateway,"whereasothersuse

"defaultrouter."



Thelastdetailstopointouthavetodowithhowthepacket

getsfromHannahtoR1.NoticeinFigure11-2thatHannah'sIP

address(8.1.1.1)islistedasthesourceand

www.example.com'sIPaddress(130.4.3.3)islistedasthe

destination.So,howdoesHannahgetthepackettoR1?Well,

thereareafewthingstocovertogetthefullstory,including

encapsulationandaprotocolcalledAddressResolution

Protocol(ARP),whichyouwilllearnaboutinthenext

sections.



GettingintoYourCartoDrivetoLunch

Whenit'stimetotakealunchbreakandyourofficebuilding

isn'tclosetoanyrestaurants,youmighthavetogetinyourcar

anddrive.Ifyou'remeetingsomefriendsorbusinessassociates

forlunch,andyoutalkbeforemeetingthemthere,you

probablydon'tbothertomentionhowyou'llbedrivingtothe

restaurant.Theytypicallyaren'tthatinterestedinhowyouget

there.

Likewise,beforeanIPpacketcandotheequivalentofdriving



overtheroads,itneedstodotheequivalentofgettingintoa

car.BeforeanIPpacketcancrossanEthernet,ithastobe

encapsulatedinsideanEthernetframe.Whenperformingthe

encapsulation,Hannahhappenstoovercometwodifferent

problems:

Shecan'tsendanIPpacketoveranEthernet,butshecan

sendanEthernetframeoveranEthernet.

ThedestinationIPaddressfieldintheIPheaderholdsthe

truedestination'saddress130.4.3.3inthiscase.There'sno

placefora"defaultgatewayIPaddress"intheheader;

therefore,Hannahmusthaveanothermeanstoensurethat

R1receivesthepacket.

Thesolutiontothefirstproblem,asyou'veprobablyguessed,is

encapsulation.Remember:EachlayerintheTCP/IP

acrchitecuralmodelprovidesservicestothelayeraboveit.

EthernetsitsatthenetworkinterfacelayerofTCP/IP,right

belowtheinternetworklayer.TogetthepacketfromHannahto

R1,IPusesEthernet.HannahencapsulatestheIPpacketinan

EthernetframefortransmissionovertheLAN.Figure11-3

showsthedetails.



Figure11-3.EncapsulatinganIPPacketinan

EthernetFrame



[Viewfullsizeimage]



AquickreviewofEthernetencapsulationmightbehelpful.

Otherlayers'protocolsaddonlyaheaderwhenthey

encapsulatedata.However,datalinklayerprotocolsEthernet

includedaddbothaheaderandatrailer,withtheIPpacket

beingplacedbetweentheheaderandtrailer.TheEthernet

headercontainsseveralfields,includingboththesourceand

destinationEthernetaddressfields.Thetrailercontainsthe

framechecksequence(FCS)field,whichdetermineswhether

errorsoccurredduringphysicaltransmission;iferrorsdidoccur,

thereceiverdiscardstheframe.

InFigure11-3,Hannah'sPCtakesthefollowingstepsto

encapsulateandsendtheIPpacketintoanEthernetframe:

1. CreateanewEthernetheader.

2. SetthesourceEthernetaddresstoHannah'sEthernet

address.

3. SetthedestinationEthernetaddresstoR1'saddress.

4. Createanewtrailer.

5. InsertanIPpacketintotheframe.

6. Sendtheframe.



ByencapsulatingtheIPpacketinanEthernetframe,Hannah

hascreatedsomethingthatcanbetransmittedacrossthe

EthernetLAN.NowHannahjusthastosolvetheotherproblem

ofmakingsurethattheframegetstoR1andmakingsurethat

R1processestheframewhenitisreceived.

Whileyou'rethinkingaboutencapsulation,it'sagoodideato

reviewencapsulationattheotherlayers.Alllayersofthe

TCP/IPmodeluseencapsulation,butnowyou'veseenhowit

worksateachlayer.Forinstance,theHTTPprotocoldefines

headers,andwhenawebbrowserorwebserversendsdata,

HTTPencapsulatesthedatainsideanHTTPheader.It'susefulto

seealltheheadersinatleastoneexample,asshowninFigure

11-4.ThisfigureshowstheEthernet,IP,TCP,andHTTP

headers,alongwiththeenduserdata(awebpage)inthe

responsefromthewebserver.



Figure11-4.EncapsulatinganIPPacketinan

EthernetFrame



[Viewfullsizeimage]



Fortherestofthischapter,you'llreadaboutroutingandignore

anythingaftertheIPheader.However,keepinmindthatthe

wholegoalistodeliverapplicationdata,asshowninFigure114.



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Chapter 11. Knowing Where to Turn at Each Intersection (Router)

Tải bản đầy đủ ngay(0 tr)

×