Tải bản đầy đủ - 0 (trang)
Chapter 13. People Like Names, but Computers Like Numbers

Chapter 13. People Like Names, but Computers Like Numbers

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

ThischaptercoversthebasicsofhowaPCperformsname

resolution.Nameresolutionreferstotheprocessofa

computertakinganame,typicallysuppliedbytheuserofthe

computer,andfiguringoutthecorrespondingIPaddress.



LookingUptheNameandNumberinthePhone

Book(HostTable)

Ifyouneedtocallsomeoneandyouknowtheperson'sname

butnotthephonenumber,youcanjustlookuptheinformation

inthephonebook.It'ssimple,easy,andconvenient.However,

itonlyworksifthephonebookthatyouhavehappenstohave

thatperson'snameandnumberinit.

TCP/IPhostscanhavetheequivalentofaphonebooksittingin

afile.ThelocalhostfilecontainsalistofTCP/IPhost

computernamesandtheircorrespondingIPaddresses.That

hostcomputerjustneedstolookatthelocalhostfileforthe

nameandreadtheaddressnexttoit.Figure13-1showsthe

basicprocess.



Figure13-1.UsingaPC'sLocalHostFile



[Viewfullsizeimage]



Figure13-1showsfoursteps,asfollows:

1. Hannahopensabrowserandtypesin

http://www.example.com.

2. BeforeHannah'sPCcansendanIPpackettothe

example.comwebserverat150.1.3.3,shemustlookinher

hostfile.Thehostfilelistswww.example.com,alongwithIP

address150.1.3.3.Allthehigher-layerworksuchasHTTP

GETs,TCPconnectionestablishment,andthelikeflowsinIP

packets,andwhenHannahsendsthoseIPpackets,theygo

toIPaddress150.1.3.3.

3. HannahretrievestheIPaddressfromthelocalhostfile.

4. Hannah'sPCthensendspacketstothewebserverusing

destinationIPaddress150.1.3.3.



Eventhoughusingthelocalhostfilemightbeeasyto

understand,ithassomedrawbacks,justlikewhenyouusethe

phonebook.Yourphonebooksimplydoesn'tlistthenamesand

numbersofeveryoneontheplanet.Suchabookwould

probablyfillyourentirehouse,andfindingthenamewouldbea

bighassle.

Similarly,alocalhosttabledoesnotsolveallTCP/IPnaming

problems.Peoplefrequentlyaddnewservernamesinasingle

enterprisenetwork,andmanynewservernamesareaddedto

theInterneteveryday.Inaddition,theuserofeachPCis

ultimatelyresponsibleforupdatinghisownhostfile.Keeping

thelocalhostfileupdatedandaccurateisprettyimpractical;

evenifthelocalhostfilecouldbekeptupdated,thefilewould

probablygetreallylargeandunwieldy.Asaresult,mosthost

computersdonotusealocalhostfile;instead,theyuse

somethingcalledtheDomainNameSystem(DNS),which

you'lllearnaboutinthenextsection.







AskingSomeoneElsetoLookUpthePhone

Number(IPAddress)forYou

Insteadofusingyourlocalphonebook,youcanalwayscallthe

phonecompanyandaskforhelp.Phonecompaniescallthis

servicedirectoryassistance,andalmosteveryoneelseinthe

U.S.callstheserviceinformation.Youjustcalldirectory

assistance(dialing411intheU.S.),telltheoperatorthename

ofthepersonorbusinessthatyouwanttocall,andthe

operatortellsyouthenumber.

TheTCP/IPprotocolcalledDNSbehavessomethinglikeaphone

company'sdirectoryassistanceservice.DNSdefinesprotocols

forthepurposeofdiscoveringwhichnamescorrespondtowhich

IPaddress.DNSalsodefinesthestructureandformatofTCP/IP

hostnames.Similartothewaythatyoucandial411inthe

U.S.andgethelpfindingaphonenumber,aTCP/IPhostcan

sendamessagetoaDNSservertogethelpfindinganIP

address.

DNSdefineshowtofigureoutnamesandIPaddressesforthe

entireInternet,aswellasinsideasinglesiteatasingle

company.Inthenextsections,you'llfirstwalkthroughthe

simplerprocessesusedinsideasinglecompany;thenyou'll

learnaboutDNSintheInternetandtheconventionsforwhat

nameslooklike.



AskingforNameResolutionHelpInsidethe

Company

WhenyouusedirectoryassistanceintheU.S.,youpickupthe

phoneanddial411.TouseDNSinsideasinglecompany,each

TCP/IPhostasksforhelpfromacomputerthatisrunninga



servicecalledaDNSserver.Fortheprocesstowork,twokey

factsmustbetrue:

ThehostcomputermustknowtheIPaddressoftheDNS

server,similartohoweveryoneintheU.S.knowstocall

411toreachthephonecompany'sdirectoryassistance

service.

TheDNSservermustknowthenamesandcorrespondingIP

addresses,similartohowthephonecompanyhasalong

listofnamesandphonenumbers.

TheDNSserverisacomputerthatisrunningDNSserver

software.TheDNSserverhasalistofalltheTCP/IPhostnames

inthenetwork,alongwiththeircorrespondingIPaddresses.

Youcanthinkofthelistasthesamegeneralconceptasalocal

hosttable,butinsteadofneedingacopyoneveryhost

computer,there'sonecopyontheDNSserver.Keepingone

copyofthelistofnamesandIPaddressescurrentismuch

easierthanhavingeveryoneinthecompanytrytodothe

same!Asyou'lllearnmoreaboutinthesectiontitled"Asking

forNameResolutionHelpOutsidetheCompany,"aDNSserver

doesn'tneedtoknowallthenamesandIPaddressesinthe

Internet,butjustasmallportionofthem.

TosupportDNS,eachTCP/IPhostneedstoknowtheIPaddress

oftheDNSserver.It'ssimilartotheideathateveryoneinthe

U.S.knowstodial411togettelephonedirectoryassistance.In

thiscase,theDNSserver'sIPaddressis150.1.3.4,andHannah

needstoknowthataddressbeforeshecansendpacketstothe

server.

Hannah'sPChastwowaysofknowingtheDNSserver'sIP

address.First,theaddressmightbestaticallyconfiguredat

Hannah'sPC.Alternatively,Hannahmightdynamicallylearn

thataddressusingtheDHCPprotocol,asmentionedinChapter



10,"DeliveringtheGoodstotheRightStreet(IP)Address."

RegardlessofhowHannahknowsthatherDNSisat150.1.3.4,

shemustknowthatfactaheadoftime.

Themainconceptissimple,asshowninFigure13-2.Thistime,

Hannahisinsidethefictitiousexample.comcorporation's

enterprisenetwork.



Figure13-2.ResolvingNamesandAddresses:The

BasicDNSProcess



[Viewfullsizeimage]



Figure13-2showsfoursteps,whichcanbeexplainedas

follows:

1. Hannahwantstoconnecttowebserver

http://www.example.com,sosheopensabrowser,typesin

thename,andpressesEnter.



2. Hannah'sPCsendsaDNSresolutionrequesttoherDNS

server.ADNSresolutionrequestissimplyaDNS

messagethatliststhehostname(www.example.com),and

thefactthattherequestinghostwouldliketoknowtheIP

addressthatcorrespondstothatname.

3. TheDNSsendsaDNSreplybacktoHannah.TheDNSreply

hasinformationinit,suchastheIPaddressof150.1.3.3.

4. Hannahcannowsendapackettothewebserver.Infact,

fromthispointonward,Hannahworksjustlikeshedidback

inFigure13-1,whensheusedalocalhostfile.



ForDNStoworkwellinsideacompany,someonemustbe

responsibleforsupportingit.Thatworkincludesupdatingand

changingthelistofnamesandIPaddresses.Whennewnames

areadded,oldonesarenolongerused,andwhenTCP/IPhosts

changetheirIPaddresses,thatpersonhastokeeptheDNS

serverupdated.



note

Althoughtheexamplesinthisbookusewebbrowsers,anyTCP/IP

applicationthatusesnamescan,andprobablydoes,useDNS.For

instance,ifyousendane-mailtobarney@example.com,the

"example.com"partidentifiesthehostnameoftheSMTPserverthatis

usedforexample.com.



AskingforNameResolutionHelpOutsidethe

Company

Yourlocaltelephonecompanyhasalistofallitscustomersand

theirlocalphonenumbers.Buttherearealotofpeopleinthe

worldwhoarenotcustomersofyourlocaltelephonecompany,

sothosepeoplewon'tbeonyourlocalphonecompany'slistof

names.However,thesedays,youcantypicallydial411inthe

U.S.andgethelpfindingaphonenumberofsomeone

anywhereinthecountry.Butifyouuseonelocalphone

company,sayBellSouth,andthepersonyouarecallingisa

customerofVerizon,howcantheBellSouthdirectory

assistancepersonhelpyoufindthephonenumber?Asitturns

out,thephonecompaniesshareinformationaboutthenames

andphonenumberssothattheycaneachprovidebetter

customerservicetotheirownlocalcustomers.Ineffect,the

masterlistofnamesandphonenumbersisdistributedamong

lotsofphonecompanies.

AsimilarkindofthinghappenswithDNS,althoughthereare

someunderlyingdifferences.MultipleDNSserverswork



together,witheachDNSholdingdifferentsetsofnamesandIP

addresses.Figure13-3pointsouttheneedforDNSserversto

cooperatetosupportnameresolutionforanyname.Inthis

case,Hannahisstillintheexample.comenterprisenetwork,

butnowshewantstoreachthehttp://www.fredsco.com

website,whichislocatedintheFredscoenterprisenetwork.



Figure13-3.DNSRequestIsMade,butDNS

ServerDoesn'tKnowtheName



[Viewfullsizeimage]



Thekeytounderstandingtheproblemanditssolutionisto

knowthataDNSserveronlyknowsaboutsomeofthenames

andaddresses.Forinstance,theexample.comcompany'sDNS

server(150.1.3.4)onlyknowsaboutnamesthatendwith

"example.com."ThethreestepsnumberedinFigure13-3show

howHannahdoesnotlearntheIPaddressofwww.fredsco.com



fromhernameserver:

1. Hannahplugshttp://www.fredsco.comintoherbrowser.

2. Hannah'sPCsendsanameresolutionrequesttothesame

DNSserveratexample.com.

3. Becausetheexample.comDNSserveronlyknowsabout

namesthatendin"example.com,"theDNSserverreturnsa

responsethatsaysthatitcan'tresolvethename.



Hannah'sPCdoesnotlearntheIPaddressofwww.fredsco.com,

soshecan'treachthewww.fredsco.comwebsite.She'll

probablyseeamessageinherbrowserwindowthatimplies

thatthesitecannotbefound.

TheDNSintheFredscoenterprisenetworkknowsthename

www.fredsco.comanditsIPaddress.However,Hannah,likeall

well-behavedTCP/IPhosts,askstheonlyDNSserversheknows

aboutfornameresolutionhelp.Tosolvetheproblem,theDNS

serversmustworktogether,asshowninFigure13-4.



Figure13-4.HowDNSsWorkTogether



[Viewfullsizeimage]



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

Chapter 13. People Like Names, but Computers Like Numbers

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

×