Slides in formato PDF

Transcript

Slides in formato PDF
Reti
(già “Reti di Calcolatori”)
Livello Rete
ARP – ICMP - DHCP
RenatoLoCigno – MicheleSegata
http://disi.unitn.it/locigno/index.php/teaching-duties/computer-networks
Acknowledgement
• Credits
– Partof thematerialis based onslides provided by the
following authors
• JimKurose,KeithRoss,“ComputerNetworking: A
TopDownApproach,” 4thedition,Addison-Wesley,
July2007
• DouglasComer,“ComputerNetworksand
Internets,” 5thedition,PrenticeHall
• Behrouz A.Forouzan,Sophia Chung Fegan,“TCP/IP
Protocol Suite,”McGraw-Hill,January 2005
• Latraduzione,sepresente,èingeneraleopera(e
responsabilità)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
ProtocollodisupportoaIPpermapparegliindirizziIPsulle
interfaccefisiche,ovverosugliindirizziMAC(Ethernet)
[email protected] LivelloRete- ARP- ICMP- DHCP
4
Address Resolution
• Acrucialstepoftheforwardingprocessrequiresatranslation:
– forwardingusesIPaddresses
– aframetransmittedmustcontaintheMACaddressofthenext
hop
– IPmusttranslatethenext-hopIPaddresstoaMACaddress
• Theprincipleis:
– IPaddressesareabstractions
• providedbyprotocolsoftware
– TheData-Linkdoesnotknowhowtolocateacomputerfromits
IPaddress
• thenext-hopaddressmustbetranslatedtoanequivalent
MACaddress
[email protected] LivelloRete- ARP- ICMP- DHCP
5
Address Resolution
• Translationfromacomputer'sIPaddresstoanequivalent
hardwareaddressisknownasaddressresolution
– AndanIPaddressissaidtoberesolvedtothecorrectMAC
address
• Addressresolutionislocaltoanetwork
– simpleforPoint-to-Pointconnections
– needaprotocolinthegeneralcase ofsharedaccessmedium
• Aserver-basedsolutionintroducesdelaysandaweakpoint
• Localcommunicationsarecheapandoftenthemediumis
broadcast
• A“broadcastandselect”solutionistheonechosenbyIETF
[email protected] LivelloRete- ARP- ICMP- DHCP
6
Address Resolution
• Onecomputercanresolvetheaddressofanothercomputeronlyif
bothcomputersattachtothesamephysicalnetwork
– Directdelivery
– Acomputerneverresolvestheaddressofacomputerona
remotenetwork
– Addressresolutionisalwaysrestrictedtoasinglenetwork
[email protected] LivelloRete- ARP- ICMP- DHCP
7
Address Resolution
• Howcanahostknowiftheaddresstoresolveislocal?
– ifitislocal,thedest.IPaddressshouldhavethesameNetID
(prefix)ofthesourceIPaddress
• Whathappensiftheaddressisnotlocal?
– Indirectdelivery
– Givethepackettoamachinerouterthatisonthewaytothe
destinationè nexttopic
– MustinanycasetranslatetheIPoftheRouterintoitsMAC
address
[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
[email protected] LivelloRete- ARP- ICMP- DHCP
10
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(thatis
theinformationbeingrequested)
• fieldTARGETHADDRinanARPrequestisfilledwith“0”
• Inaresponse
– thetargetbindingreferstotheinitialcomputerthatsentthe
request
[email protected] LivelloRete- ARP- ICMP- DHCP
13
ARP Encapsulation
• WhenittravelsacrossaphysicalnetworkanARPmessageis
encapsulatedinahardwareframe
– e.g.,Ethernet
• AnARPmessageistreatedasdatabeingtransported
– thenetworkdoesnotparsetheARPmessageorinterpret
fields
[email protected] LivelloRete- ARP- ICMP- DHCP
14
ARP Encapsulation
• Thetype fieldintheframeheaderspecifiesthattheframecontains
anARPmessage
• Asendermustassigntheappropriatevaluetothetypefieldbefore
transmittingtheframe
• Areceivermustexaminethetypefieldineachincomingframe
• Ethernetusestypefield0x806 todenoteanARPmessage
• ThesamevalueisusedforbothARPrequests/responses
– FrametypedoesnotdistinguishbetweentypesofARP
messages
– AreceivermustexaminetheOPERATIONfieldinthemessageto
determinewhetheranincomingmessageisarequestora
response
[email protected] LivelloRete- ARP- ICMP- DHCP
15
ARP Caching and Message Processing
• SendinganARPrequestforeachdatagramisinefficient
– Threeframestraversethenetworkforeachdatagram
• anARPrequest,ARPresponse,andthedatadatagramitself
• Mostcommunicationsinvolveasequenceofpackets
– asenderislikelytorepeattheexchangemanytimes
• Toreducenetworktraffic
– ARPsoftwareextractsandsavestheinformationfroma
response
• soitcanbeusedforsubsequentpackets
– Thesoftwaredoesnotkeeptheinformationindefinitely
• Instead,ARPmaintainsasmalltableofbindingsinmemory
[email protected] LivelloRete- ARP- ICMP- DHCP
16
ARP Caching and Message Processing
• ARPmanagesthetableasacache
– anentryisreplacedwhenaresponsearrives
– theoldestentryisremovedwheneverthetablerunsoutof
spaceorafteranentryhasnotbeenupdatedforalongperiod
oftime
– ARPstartsbysearchingthecachewhenitneedstobindan
address
• ARPentriesexpireafter~30stoavoidsendingpacketstothe
wrongdestinationifthemappingIP-MACchanges
[email protected] LivelloRete- ARP- ICMP- DHCP
17
ARP Caching and Message Processing
• Ifthebindingispresentinthecache
– ARPusesthebindingwithouttransmittingarequest
• Ifthebindingisnotpresentinthecache
– ARPbroadcastsarequest
– waitsforaresponse
– updatesthecache
– sendthepacket
• ThecacheisupdatedwhenanARPmessagearrives
– eitherarequestoraresponse
– sincetrafficisnormallytwo-wayupdatingthecacheon
requestsreducesoverhead
[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
• ICMPcanbeseenasasignalingprotocolfornetworkmanagement
andmaintenance
• ManyICMPmessages havebeendefined
[email protected] LivelloRete- ARP- ICMP- DHCP
20
Internet Control Message Protocol
[email protected] LivelloRete- ARP- ICMP- DHCP
21
Internet Control Message Protocol
• ICMPcontainstwomessagetypes:
– messagesusedtoreporterrors
• e.g.,TimeExceeded andDestinationUnreachable
– messagesusedtoobtaininformation
• e.g.,EchoRequest andEchoReply
• EchoRequest/Replyareusedbythepingapplicationtotest
connectivity
– Whenahostreceivesanechorequestmessage
• ICMPsoftwareonahostorroutersendsanechoreplythat
carriesthesamedataastherequest
[email protected] LivelloRete- ARP- ICMP- DHCP
22
ICMP Format and Encapsulation
• ICMPusesIPtotransportmessages:
– whenarouterhasanICMPmessagetosend
• createsanIPdatagramandencapsulatestheICMP
messageinit
– theICMPmessageisthepayloadareaoftheIPdatagram
– thedatagramis forwardedasusual
[email protected] LivelloRete- ARP- ICMP- DHCP
23
ICMP handling
• ICMPmessagesdonothavespecialpriority
– Theyareforwardedlikeanyotherdatagram,withoneminor
exception
• IfanICMPerrormessagecausesanerror
– noerrormessageissent
• Thereasonshouldbeclear:
– thedesignerswantedtoavoidtheInternetbecoming
congestedcarryingerrormessagesabouterrormessages
[email protected] LivelloRete- ARP- ICMP- DHCP
24
Uso di ICMP
• Comando“ping”
– Echo Request +Echo Replay
• Comandotraceroute
– IlmittenteinvianormalipacchettiIPconTTLsettatoa1,2,3,...
– ConTTL=1,ilprimorouterdecrementaTTLchearrivaa0,
quindiilpacchettovienescartatoeilroutermanda(dovrebbe
mandare)unmessaggioICMLTimeExceeded
– ConTTL=2ilprimorouterdecrementaeinoltra,ilsecondo...
– Ecosì via
• Esempi“live”
– Conping misuroRTT,conTraceroute capiscochestradafailmio
pacchetto
[email protected] LivelloRete- ARP- ICMP- DHCP
25
DHCP: DYNAMIC HOST
CONFIGURATION PROTOCOL
Comebootstrappare unaretesenzadoverconfigurarei
singolihost
[email protected] LivelloRete- ARP- ICMP- DHCP
26
Protocol Parameters and Configuration
• Onceahostorrouterhasbeenpoweredon,OSisstartedandthe
networksoftwareisinitialized
• Howdoesthenetworksoftwareinahostorrouterbegin
operation?
• Forarouter,theconfigurationmanagermustspecifyinitialvalues
foritemssuchas
– theIPaddressforeachnetworkinterface
– theprotocolsoftwaretorun
– andinitialvaluesforaforwardingtable
– theconfigurationissaved,andarouterloadsthevaluesduring
startup
• Hostconfigurationusuallyusesatwo-stepprocess,knownas
bootstrapping
– DHCPisusedtotakecareofmostconfigurationneeds
[email protected] LivelloRete- ARP- ICMP- DHCP
27
Scenario client-server DHCP
A
server
DHCP
223.1.1.1
223.1.1.2
223.1.1.4
223.1.2.9
B
223.1.1.3
223.1.3.27
223.1.3.1
[email protected] LivelloRete- ARP- ICMP- DHCP
223.1.2.1
223.1.2.2
223.1.3.2
E
Il client DHCP
in arrivo su questa rete
ha bisogno di
un indirizzo
4-28
Dynamic Host Conf. Protocol (DHCP)
• Whenacomputerboots
– theDHCPclientbroadcastsaDHCPRequest
– theserver(s)sendaDHCPReply
• aserverreplyiscalledoffer
• theserverisofferinganaddresstotheclient
• WecanconfigureaDHCPservertosupplytwotypesofaddresses:
– permanentlyassignedaddresses
– apoolofdynamicaddressestobeallocatedondemand
• Typically,apermanentaddressisassignedtoaserver,anda
dynamicaddressisassignedtoanarbitraryhost
• Addressesassignedondemandarenotgivenoutforanarbitrary
lengthoftime
[email protected] LivelloRete- ARP- ICMP- DHCP
29
Scenario client-server DHCP
serverDHCP:223.1.2.5
Identificazione DHCP
Nuovohost
src : 0.0.0.0, 68
dest.: 255.255.255.255,67
yiaddr: 0.0.0.0
transaction ID: 654
Offerta DHCP
src: 223.1.2.5, 67
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4
transaction ID: 654
Lifetime: 3600 secs
Richiesta DHCP
tempo
src: 0.0.0.0, 68
dest:: 255.255.255.255, 67
yiaddrr: 223.1.2.4
transaction ID: 655
Lifetime: 3600 secs
Conferma DHCP
src: 223.1.2.5, 67
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4
transaction ID: 655
Lifetime: 3600 secs
[email protected] LivelloRete- ARP- ICMP- DHCP
30
Dynamic Host Conf Protocol (DHCP)
• DHCPissuesaleaseontheaddressforafiniteperiod
– TheuseofleasesallowsaDHCPservertoreclaimaddresses
• Whentheleaseexpires
– theserverplacestheaddresstothepoolofavailableaddresses
• Whenaleaseexpires,ahostcanchoosetorelinquishtheaddress
orrenegotiatewithDHCPtoextendthelease
– Negotiationoccursconcurrentwithotheractivity
• Normally,DHCPapproveseachleaseextension
– Acomputercontinuestooperatewithoutanyinterruption
– However,aservermaybeconfiguredtodenyleaseextension
foradministrativeortechnicalreasons
– DHCPgrantsabsolutecontrolofleasingtoaserver
– Ifaserverdeniesanextensionrequest
• thehostmuststopusingtheaddress
[email protected] LivelloRete- ARP- ICMP- DHCP
31
DHCP Protocol Operation
• Recoveryfromlossorduplication
– DHCPisdesignedtoinsurethatmissingorduplicatepacketsdo
notresultinmisconfiguration
– Ifnoresponseisreceived
• ahostretransmitsitsrequest
– Ifaduplicateresponsearrives
• ahostignorestheextracopy
• Cachingofaserveraddress
– onceahostfindsaDHCPserver
• thehostcachestheserver'saddress
• Avoidanceofsynchronizedflooding
– DHCPtakesstepstopreventsynchronizedrequests
[email protected] LivelloRete- ARP- ICMP- DHCP
32
DHCP Message Format
[email protected] LivelloRete- ARP- ICMP- DHCP
33
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
• Laterfieldsinthemessageareusedinaresponsetocarry
informationbacktothehostthatsentarequest
– ifahostdoesnotknowitsIPaddress,theserverusesfield
YOURIPADDRESStosupplythevalue
– serverusesfieldsSERVERIPADDRESSandSERVERHOSTNAME
togivethehostinformationaboutthelocationofaserver
– ROUTERIPADDRESScontainstheIPaddressofadefaultrouter
• DHCPallowsacomputertonegotiatetofindabootimage
– Todoso,thehostfillsinfieldBOOTFILENAMEwitharequest
– TheDHCPserverdoesnotsendanimage
[email protected] LivelloRete- ARP- ICMP- DHCP
35

Documenti analoghi

Tro u b lesh o o tin g To o ls

Tro u b lesh o o tin g To o ls Time Exceedded message; it provides a very loose measure of the travel time between local host and each router. Sometimes travel time changes significantly in the course of a few seconds due to tem...

Dettagli