Livello Rete ARP – ICMP - DHCP - Home page |...
-
Upload
vuongthuan -
Category
Documents
-
view
229 -
download
0
Transcript of Livello Rete ARP – ICMP - DHCP - Home page |...
Reti(già “Reti di Calcolatori”)
Livello ReteARP – ICMP - DHCP
RenatoLoCigno – MicheleSegata
http://disi.unitn.it/locigno/index.php/teaching-duties/computer-networks
Acknowledgement
• Credits– Partof thematerialis based onslides provided by thefollowing authors• JimKurose,KeithRoss,“ComputerNetworking:ATopDownApproach,”4thedition,Addison-Wesley,July2007
• DouglasComer,“ComputerNetworksandInternets,”5thedition,PrenticeHall
• Behrouz A.Forouzan,Sophia Chung Fegan,“TCP/IPProtocol Suite,”McGraw-Hill,January 2005
• Latraduzione,sepresente,èingeneraleopera(eresponsabilità)deldocente
[email protected] - Livello Rete- ARP- ICMP- DHCP 2
Contenuto e temi
• Spaziodiindirizzamento
• IndirizziIPelorouso
• Consegnadeipacchetti
• ConfigurazionedeiPCedellereti
• InstradamentoeRouting
[email protected] LivelloRete- ARP- ICMP- DHCP 3
ARP: ADDRESS RESOLUTION PROTOCOL
ProtocollodisupportoaIPpermapparegliindirizziIPsulleinterfaccefisiche,ovverosugliindirizziMAC(Ethernet)
[email protected] LivelloRete- ARP- ICMP- DHCP 4
Address Resolution
• Acrucialstepoftheforwardingprocessrequiresatranslation:– forwardingusesIPaddresses– aframetransmittedmustcontaintheMACaddressofthenexthop
– IPmusttranslatethenext-hopIPaddresstoaMACaddress• Theprincipleis:
– IPaddressesareabstractions• providedbyprotocolsoftware
– TheData-LinkdoesnotknowhowtolocateacomputerfromitsIPaddress• thenext-hopaddressmustbetranslatedtoanequivalentMACaddress
[email protected] LivelloRete- ARP- ICMP- DHCP 5
Address Resolution
• Translationfromacomputer'sIPaddresstoanequivalenthardwareaddressisknownasaddressresolution– AndanIPaddressissaidtoberesolvedtothecorrectMACaddress
• Addressresolutionislocaltoanetwork– simpleforPoint-to-Pointconnections– needaprotocolinthegeneralcase ofsharedaccessmedium
• Aserver-basedsolutionintroducesdelaysandaweakpoint• Localcommunicationsarecheapandoftenthemediumis
broadcast• A“broadcastandselect”solutionistheonechosenbyIETF
[email protected] LivelloRete- ARP- ICMP- DHCP 6
Address Resolution
• Onecomputercanresolvetheaddressofanothercomputeronlyifbothcomputersattachtothesamephysicalnetwork– Directdelivery– Acomputerneverresolvestheaddressofacomputeronaremotenetwork
– Addressresolutionisalwaysrestrictedtoasinglenetwork
[email protected] LivelloRete- ARP- ICMP- DHCP 7
Address Resolution
• Howcanahostknowiftheaddresstoresolveislocal?– ifitislocal,thedest.IPaddressshouldhavethesameNetID(prefix)ofthesourceIPaddress
• Whathappensiftheaddressisnotlocal?– Indirectdelivery– Givethepackettoamachinerouterthatisonthewaytothedestinationè nexttopic
– MustinanycasetranslatetheIPoftheRouterintoitsMACaddress
[email protected] LivelloRete- ARP- ICMP- DHCP 8
Address Resolution Protocol (ARP)
• SupposeBneedstoresolvetheIPaddressofC• Bbroadcastsarequestthatsays:
– “I'mlookingfortheMACaddressofacomputerthathasIPaddressC”• Thebroadcastonlytravelsacrossonenetwork• AnARPrequestmessagereachesallcomputersonanetwork• WhenCreceivesacopyoftherequestitsendsadirectedreplybacktoBthatsays:
– “I'mthecomputerwithIPaddressC,andmyMACaddressisM”
[email protected] LivelloRete- ARP- ICMP- DHCP 9
ARP Message Format
• HARDWAREADDRESSTYPE– 16-bitfieldthatspecifiesthetypeofhardwareaddress– thevalueis1forEthernet
• PROTOCOLADDRESSTYPE– 16-bitfieldthatspecifiesthetypeofprotocoladdress– thevalueis0x0800forIPv4
• HADDRLEN– 8-bitintegerthatspecifiesthesizeofahardwareaddressinbytes
• PADDRLEN– 8-bitintegerthatspecifiesthesizeofaprotocoladdressinbytes
[email protected] LivelloRete- ARP- ICMP- DHCP 11
ARP Message Format
• OPERATION– 16-bitfieldthatspecifieswhetherthemessage
• “request”(1)or“response”(2)• SENDERHADDR
– HADDRLENbytesforthesender'shardwareaddress• SENDERPADDR
– PADDRLENbytesforthesender'sprotocoladdress• TARGETHADDR
– HADDRLENbytesforthetarget'shardwareaddress• TARGETPADDR
– PADDRLENbytesforthetarget'sprotocoladdress
[email protected] LivelloRete- ARP- ICMP- DHCP 12
ARP Message Format
• AnARPmessagecontainsfieldsfortwoaddressbindings– onebindingtothesender– othertotheintendedrecipient,ARPcallsittarget
• Whenarequestissent– thesenderdoesnotknowthetarget'shardwareaddress(thatistheinformationbeingrequested)• fieldTARGETHADDRinanARPrequestisfilledwith“0”
• Inaresponse– thetargetbindingreferstotheinitialcomputerthatsenttherequest
[email protected] LivelloRete- ARP- ICMP- DHCP 13
ARP Encapsulation
• WhenittravelsacrossaphysicalnetworkanARPmessageisencapsulatedinahardwareframe– e.g.,Ethernet
• AnARPmessageistreatedasdatabeingtransported– thenetworkdoesnotparsetheARPmessageorinterpretfields
[email protected] LivelloRete- ARP- ICMP- DHCP 14
ARP Encapsulation
• Thetype fieldintheframeheaderspecifiesthattheframecontainsanARPmessage
• Asendermustassigntheappropriatevaluetothetypefieldbeforetransmittingtheframe
• Areceivermustexaminethetypefieldineachincomingframe• Ethernetusestypefield0x806 todenoteanARPmessage• ThesamevalueisusedforbothARPrequests/responses
– FrametypedoesnotdistinguishbetweentypesofARPmessages
– AreceivermustexaminetheOPERATIONfieldinthemessagetodeterminewhetheranincomingmessageisarequestoraresponse
[email protected] LivelloRete- ARP- ICMP- DHCP 15
ARP Caching and Message Processing
• SendinganARPrequestforeachdatagramisinefficient– Threeframestraversethenetworkforeachdatagram
• anARPrequest,ARPresponse,andthedatadatagramitself• Mostcommunicationsinvolveasequenceofpackets
– asenderislikelytorepeattheexchangemanytimes• Toreducenetworktraffic
– ARPsoftwareextractsandsavestheinformationfromaresponse• soitcanbeusedforsubsequentpackets
– Thesoftwaredoesnotkeeptheinformationindefinitely• Instead,ARPmaintainsasmalltableofbindingsinmemory
[email protected] LivelloRete- ARP- ICMP- DHCP 16
ARP Caching and Message Processing
• ARPmanagesthetableasacache– anentryisreplacedwhenaresponsearrives– theoldestentryisremovedwheneverthetablerunsoutofspaceorafteranentryhasnotbeenupdatedforalongperiodoftime
– ARPstartsbysearchingthecachewhenitneedstobindanaddress
• ARPentriesexpireafter~30stoavoidsendingpacketstothewrongdestinationifthemappingIP-MACchanges
[email protected] LivelloRete- ARP- ICMP- DHCP 17
ARP Caching and Message Processing
• Ifthebindingispresentinthecache– ARPusesthebindingwithouttransmittingarequest
• Ifthebindingisnotpresentinthecache– ARPbroadcastsarequest– waitsforaresponse– updatesthecache– sendthepacket
• ThecacheisupdatedwhenanARPmessagearrives– eitherarequestoraresponse– sincetrafficisnormallytwo-wayupdatingthecacheonrequestsreducesoverhead
[email protected] LivelloRete- ARP- ICMP- DHCP 18
ICMP: INTERNET CONTROL MESSAGE PROTOCOL
Messaggidicontrollo,segnalazione,erroreallivelloIP
[email protected] LivelloRete- ARP- ICMP- DHCP 19
Internet Control Message Protocol
• IPincludesacompanionprotocol,ICMP– Itisusedtoreporterrorsbacktotheoriginalsource
• IPandICMPareco-dependent– IPdependsonICMPtoreporterrors– andICMPusesIPtocarryerrormessages
• ICMPcanbeseenasasignalingprotocolfornetworkmanagementandmaintenance
• ManyICMPmessageshavebeendefined
[email protected] LivelloRete- ARP- ICMP- DHCP 20
Internet Control Message Protocol
• ICMPcontainstwomessagetypes:– messagesusedtoreporterrors
• e.g.,TimeExceeded andDestinationUnreachable– messagesusedtoobtaininformation
• e.g.,EchoRequest andEchoReply• EchoRequest/Replyareusedbythepingapplicationtotest
connectivity– Whenahostreceivesanechorequestmessage
• ICMPsoftwareonahostorroutersendsanechoreplythatcarriesthesamedataastherequest
[email protected] LivelloRete- ARP- ICMP- DHCP 22
ICMP Format and Encapsulation
• ICMPusesIPtotransportmessages:– whenarouterhasanICMPmessagetosend
• createsanIPdatagramandencapsulatestheICMPmessageinit
– theICMPmessageisthepayloadareaoftheIPdatagram– thedatagramis forwardedasusual
[email protected] LivelloRete- ARP- ICMP- DHCP 23
ICMP handling
• ICMPmessagesdonothavespecialpriority– Theyareforwardedlikeanyotherdatagram,withoneminorexception
• IfanICMPerrormessagecausesanerror– noerrormessageissent
• Thereasonshouldbeclear:– thedesignerswantedtoavoidtheInternetbecomingcongestedcarryingerrormessagesabouterrormessages
[email protected] LivelloRete- ARP- ICMP- DHCP 24
Uso di ICMP
• Comando“ping”– Echo Request +Echo Replay
• Comandotraceroute– IlmittenteinvianormalipacchettiIPconTTLsettatoa1,2,3,...– ConTTL=1,ilprimorouterdecrementaTTLchearrivaa0,quindiilpacchettovienescartatoeilroutermanda(dovrebbemandare)unmessaggioICMLTimeExceeded
– ConTTL=2ilprimorouterdecrementaeinoltra,ilsecondo...– Ecosì via
• Esempi“live”– Conping misuroRTT,conTraceroute capiscochestradafailmiopacchetto
[email protected] LivelloRete- ARP- ICMP- DHCP 25
DHCP: DYNAMIC HOSTCONFIGURATION PROTOCOL
Comebootstrappare unaretesenzadoverconfigurareisingolihost
[email protected] LivelloRete- ARP- ICMP- DHCP 26
Protocol Parameters and Configuration
• Onceahostorrouterhasbeenpoweredon,OSisstartedandthenetworksoftwareisinitialized
• Howdoesthenetworksoftwareinahostorrouterbeginoperation?
• Forarouter,theconfigurationmanagermustspecifyinitialvaluesforitemssuchas– theIPaddressforeachnetworkinterface– theprotocolsoftwaretorun– andinitialvaluesforaforwardingtable– theconfigurationissaved,andarouterloadsthevaluesduringstartup
• Hostconfigurationusuallyusesatwo-stepprocess,knownasbootstrapping– DHCPisusedtotakecareofmostconfigurationneeds
[email protected] LivelloRete- ARP- ICMP- DHCP 27
4-28
Scenario client-server DHCP
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2223.1.3.1
223.1.3.27
A
BE
DHCP server
Il client DHCP in arrivo su questa reteha bisogno diun indirizzo
[email protected] LivelloRete- ARP- ICMP- DHCP
Dynamic Host Conf. Protocol (DHCP)
• Whenacomputerboots– theDHCPclientbroadcastsaDHCPRequest– theserver(s)sendaDHCPReply
• aserverreplyiscalledoffer• theserverisofferinganaddresstotheclient
• WecanconfigureaDHCPservertosupplytwotypesofaddresses:– permanentlyassignedaddresses– apoolofdynamicaddressestobeallocatedondemand
• Typically,apermanentaddressisassignedtoaserver,andadynamicaddressisassignedtoanarbitraryhost
• Addressesassignedondemandarenotgivenoutforanarbitrarylengthoftime
[email protected] LivelloRete- ARP- ICMP- DHCP 29
serverDHCP:223.1.2.5 Nuovohost
tempo
Identificazione DHCP
src : 0.0.0.0, 68 dest.: 255.255.255.255,67yiaddr: 0.0.0.0transaction ID: 654
Offerta DHCPsrc: 223.1.2.5, 67 dest: 255.255.255.255, 68yiaddrr: 223.1.2.4transaction ID: 654Lifetime: 3600 secs
Richiesta DHCPsrc: 0.0.0.0, 68 dest:: 255.255.255.255, 67yiaddrr: 223.1.2.4transaction ID: 655Lifetime: 3600 secs
Conferma DHCPsrc: 223.1.2.5, 67 dest: 255.255.255.255, 68yiaddrr: 223.1.2.4transaction ID: 655Lifetime: 3600 secs
Scenario client-server DHCP
[email protected] LivelloRete- ARP- ICMP- DHCP 30
Dynamic Host Conf Protocol (DHCP)
• DHCPissuesaleaseontheaddressforafiniteperiod– TheuseofleasesallowsaDHCPservertoreclaimaddresses
• Whentheleaseexpires– theserverplacestheaddresstothepoolofavailableaddresses
• Whenaleaseexpires,ahostcanchoosetorelinquishtheaddressorrenegotiatewithDHCPtoextendthelease– Negotiationoccursconcurrentwithotheractivity
• Normally,DHCPapproveseachleaseextension– Acomputercontinuestooperatewithoutanyinterruption– However,aservermaybeconfiguredtodenyleaseextensionforadministrativeortechnicalreasons
– DHCPgrantsabsolutecontrolofleasingtoaserver– Ifaserverdeniesanextensionrequest
• thehostmuststopusingtheaddress
[email protected] LivelloRete- ARP- ICMP- DHCP 31
DHCP Protocol Operation
• Recoveryfromlossorduplication– DHCPisdesignedtoinsurethatmissingorduplicatepacketsdonotresultinmisconfiguration
– Ifnoresponseisreceived• ahostretransmitsitsrequest
– Ifaduplicateresponsearrives• ahostignorestheextracopy
• Cachingofaserveraddress– onceahostfindsaDHCPserver
• thehostcachestheserver'saddress• Avoidanceofsynchronizedflooding
– DHCPtakesstepstopreventsynchronizedrequests
[email protected] LivelloRete- ARP- ICMP- DHCP 32
DHCP Message Format
• OPspecifieswhetherthemessageisaRequestoraResponse• HTYPEandHLENfieldsspecifythenetworkhardwaretypeand
thelengthofahardwareaddress• FLAGSspecifieswhetheritcanreceivebroadcastordirected
replies• HOPSspecifieshowmanyserversforwardedtherequest• TRANSACTIONIDENTIFIERprovidesavaluethataclientcanuse
todetermineifanincomingresponsematchesitsrequest• SECONDSELAPSEDspecifieshowmanysecondshaveelapsed
sincethehostbegantoboot• ExceptforOPTIONS(OP),eachfieldinaDHCPmessagehasa
fixedsize
[email protected] LivelloRete- ARP- ICMP- DHCP 34
DHCP Message Format
• Laterfieldsinthemessageareusedinaresponsetocarryinformationbacktothehostthatsentarequest– ifahostdoesnotknowitsIPaddress,theserverusesfieldYOURIPADDRESStosupplythevalue
– serverusesfieldsSERVERIPADDRESSandSERVERHOSTNAMEtogivethehostinformationaboutthelocationofaserver
– ROUTERIPADDRESScontainstheIPaddressofadefaultrouter• DHCPallowsacomputertonegotiatetofindabootimage
– Todoso,thehostfillsinfieldBOOTFILENAMEwitharequest– TheDHCPserverdoesnotsendanimage
[email protected] LivelloRete- ARP- ICMP- DHCP 35