Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
Reti(già “Reti di Calcolatori”)
Livello ReteIndizzamento IP (v4) e inoltro dei pacchetti
RenatoLoCigno
http://disi.unitn.it/locigno/teaching-duties/reti
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/IPProtocolSuite,”McGraw-Hill,January 2005
• Latraduzione,sepresente,èingeneraleopera(eresponsabilità)deldocente
[email protected] LivelloRete- IPv4 2
Contenuto e temi
• Spaziodiindirizzamento
• IndirizziIPelorouso
• Consegnadeipacchetti
• ConfigurazionedeiPCedellereti
• InstradamentoeRouting
[email protected] LivelloRete- IPv4 3
1- Fisico
Livello Rete
Livellidiapplicazione(utente)
Livellidirete2- Collegamentodati
Fisico
3- Rete
4- Trasporto
5- Sessione
6- Presentazione
7- Applicazione
Collegamentodati:Ethernet,PPP,ATM,...
Rete:IP
Trasporto:TCP- UDP
Applicaz.:HTTP,E-mail
[email protected] LivelloRete- IPv4 4
[email protected] LivelloRete- IPv4 5
Consegna Diretta e Indiretta
NtwA165.5.1.0/24
NtwB98.23.0.0/16
NtwC201.12.82.0/24
HostA
HostC
165.5.1.5
201.12.82.4
NtwD201.12.83.0/24
NtwE198.35.112.0/24
Questo router è non è collegato allarete C, come fa a conoscere l’host201.12.82.4? E come fa a inoltrare i pacchetticorrettamente verso ques’ultimo?
Prospettiva globale
• Trasportodeipacchettidasorgentearicevitore.Ipacchetticontengonounsegmentodilivellotrasporto
• IpacchettisonoincapsulatiintrameL2
• Alricevitoreisegmentisonoestrattidaipacchettieconsegnatiallivellotrasporto
• Iprotocollidiretesonointuttiglihost erouter
• Unrouterdeveesaminarel’intestazionedituttiipacchetticheloattraversano
Applicaz.
Trasporto
Rete
DataLink
Fisico
Applicaz.
Trasporto
Rete
DataLink
Fisico
Rete
L2
L1
L2
L1
Rete
L2
L1
L2
L1
IPL2
IP
IPL2
IPL2
IP
IPL2
IPL2
IPL2IPL2
IP
IPL2
IPL2
IP
[email protected] LivelloRete- IPv4 6
Funzioni fondamentali del livello rete
• Instradamento(Routing)– Trovareilpercorsodallasorgentealladestinazioneè AlgoritmidiRouting
• Simileapianificareunviaggio:devodeterminarelestradedafareegliincrociincuicambiarelamiastrada
• Inoltro(Forwarding)– Funzionecheesegueiltrasportodeipacchettidagliingressialleuscitedeirouter...datocheilpercorsoègiànoto
• Simileaprenderel’uscitagiustadiunarotonda,sapendochedevoandareinunaspecificadirezione
• Entramberichiedonounospaziodiindirizzamentoappropriato...eirelativiindirizzi
[email protected] LivelloRete- IPv4 7
1
23
0111
valore dell’indirizzonel pacchetto in arrivo
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Relazione tra routing e forwarding
[email protected] LivelloRete- IPv4 8
Schema di architettura dei Router
• duefunzionifondamentali:– eseguireiprotocolliealgoritmidiinstradamento(RIP,OSPF,BGP)– inoltrareidatagrammi(pacchetti)dagliingressialleuscite
[email protected] LivelloRete- IPv4 9
Il Datagramma IP
• TCP/IPusailtermine“IPdatagram”peridentificareunpacchettodilivellorete
• Ciascundatagrammaècompostodaunaintestazione (header)– da20a60bytes checontengonoleinformazioniessenzialiperl’instradamentoelaconsegna
• seguitadaidatitrasportati (payload)– Ladimensionedeipayload nonèfissa– Ladimensioneeffettivaèdeterminatadall’applicazionee/odalprotocolloditrasporto
– C’e` unadimensionemassimadi64kB(65536)
[email protected] LivelloRete- IPv4 11
Formato del Datagramma IP
• L’headercontieneinformazioniutiliperl’instradamentodeldatagramma:– L’indirizzodellasorgente(chihainviatoperprimoildatagramma)
– L’indirizzodelladestinazione(chiriceveràildatagrammasetuttovabene)
– Iltipodiprotocollochehageneratoidati– ...
• GliindirizzisonoditipoIP(ovvio)• GliindirizziMACsono“esterni”aldatagramma• Icampisonodidimensionefissaperefficienzadimanipolazione
[email protected] LivelloRete- IPv4 12
The IP Datagram Header Format
• VERS:Eachdatagrambeginswitha4-bitprotocolversionnumber• H.LEN:4-bitheaderspecifiesthenumberof32-bitquantitiesinthe
header– Ifnooptionsarepresent,thevalueis5
• TypeofService(ToS)– 8-bitfieldthatcarriesaclassofserviceforthedatagram
• potentiallyusedforDiffServ andECN(ExplicitCongestionNotification)
• seldomusedinpractice• TOTALLENGTH:16-bitintegerthatspecifiesthetotalnumberof
bytesincludingboththeheaderandthedata
[email protected] LivelloRete- IPv4 14
The IP Datagram Header Format
• IDENTIFICATION– 16-bitnumber(usuallysequential)assignedtothedatagram
• usedtogatherallfragmentsforreassemblytothedatagram• FLAGS
– 3-bitfieldwithindividualbitsspecifyingwhetherthedatagramisafragment
• Ifso,thenwhetherthefragmentcorrespondstothelastpieceoftheoriginaldatagram
• FRAGMENTOFFSET– 13-bitfieldthatspecifieswhereintheoriginaldatagramthedatainthisfragmentbelongs
– thevalueofthefieldismultipliedby8toobtainanoffset
[email protected] LivelloRete- IPv4 15
The IP Datagram Header Format
• TIMETOLIVE(TTL)– 8-bitintegerinitializedbytheoriginalsender– itisdecrementedbyeachrouter thatprocessesthedatagram– ifthevaluereacheszero(0)thedatagramisdiscarded andanerrormessageissentbacktothesource
• PROTOCOL– 8-bitfieldthatspecifiesthetypeofthepayload,i.e.,theprotocolabove(e.g.,6forTCP,17forUDP)
• HEADERCHECKSUM– 16-bitones-complementchecksumofheaderfields
• SOURCEIPADDRESS– 32-bitInternetaddressoftheoriginalsender
[email protected] LivelloRete- IPv4 16
The IP Datagram Header Format
• DESTINATIONIPADDRESS– The32-bitInternetaddressoftheultimatedestination
• IPOPTIONS– Optionalheaderfieldsusedtocontrolroutinganddatagramprocessing
– Mostdatagramsdonotcontainanyoptions• PADDING
– Ifoptionsdonotendona32-bitboundary• zerobitsofpaddingareaddedtomaketheheaderamultipleof32bits
[email protected] LivelloRete- IPv4 17
FRAMMENTAZIONE DEI PACCHETTI IP
L’USO DELLA FRAMMENTAZIONE È “DEPRECATO”. MOLTI ROUTER SEMPLICEMENTE NON LA IMPLEMENTANOE SCARTANO IL PACCHETTO.
[email protected] LivelloRete- IPv4 18
MTU and Datagram Fragmentation
• Eachhardwaretechnologyspecifiesthemaximumamountofdatathataframecancarry– ThelimitisknownasaMaximumTransmissionUnit (MTU)
• NetworkhardwareisnotdesignedtoacceptortransferframesthatcarrymoredatathantheMTUallows– AdatagrammustbesmallerorequaltothenetworkMTU
• oritcannotbeencapsulatedfortransmission• Inaninternetthatcontainsheterogeneousnetworks,MTU
restrictionscreateaproblem• AroutercanconnectnetworkswithdifferentMTUvalues
– adatagramthatarouterreceivesoveronenetworkcanbetoolargetosendoveranothernetwork
[email protected] LivelloRete- IPv4 19
MTU and Datagram Fragmentation
• Example:arouterinterconnectstwonetworkswithMTUvaluesof1500and1000– HostH1 attachestoanetworkwithanMTUof1500
• andcansendadatagramthatisupto1500octets– HostH2 attachestoanetworkthathasanMTUof1000
• whichmeansthatitcannotsend/receiveadatagramlargerthan1000octets
– IfhostH1 sendsa1500-octetdatagramtohostH2
• routerRwillnotbeabletoencapsulateitfortransmissionacrossnetwork2
[email protected] LivelloRete- IPv4 21
MTU and Datagram Fragmentation
• WhenadatagramislargerthantheMTUofthenetworkoverwhichitmustbesent– therouterdividesthedatagramintosmallerpiecescalledfragments
– andsendseachfragmentindependently• Afragmenthasthesameformatasotherdatagrams
– abitintheFLAGSfieldoftheheaderindicateswhetheradatagramisafragmentoracompletedatagram
• Otherfieldsintheheaderareassignedinformationfortheultimatedestinationtoreassemblefragments– toreproducetheoriginaldatagram
• TheFRAGMENTOFFSETspecifieswhereintheoriginaldatagramthefragmentbelongs
[email protected] LivelloRete- IPv4 22
MTU and Datagram Fragmentation
• ArouterusesthenetworkMTUandtheheadersizetocalculate– themaximumamountofdatathatcanbesentineachfragment– andthenumberoffragmentsthatwillbeneeded
• Theroutercreatesthefragments– Itusesfieldsfromtheoriginalheadertocreateafragmentheader
– Itcopiestheappropriatedatafromtheoriginaldatagramintothefragment
– Transmitstheresult
[email protected] LivelloRete- IPv4 23
Reassembling a Datagram
• Example:packetssentfromH1toH2– ifhostH1sendsa1500-octetdatagramtohostH2,routerR1willdividethedatagramintotwofragments,whichitwillforwardtoR2
– RouterR2doesnotreassemblethefragments• InsteadRusesthedestinationaddressinafragmenttoforwardthefragmentasusual
– Theultimatedestinationhost,H2,collectsthefragmentsandreassemblesthemtoproducetheoriginaldatagram
[email protected] LivelloRete- IPv4 25
Reassembling a Datagram
• Requiringtheultimatedestinationtoreassemblefragmentshastwoadvantages:– Itreducestheamountofstateinformationinrouters
• Whenforwardingadatagram,arouterdoesnotneedtoknowwhetherthedatagramisafragment
– Itallowsroutes tochangedynamically• Ifanintermediaterouterweretoreassemblefragments,allfragmentswouldneedtoreachtherouter
• Bypostponingreassemblyuntiltheultimatedestination– IPisfreetopasssomefragmentsfromadatagramalongdifferentroutesthanotherfragments
[email protected] LivelloRete- IPv4 26
The Consequence of Fragment Loss
• Adatagramcannotbereassembleduntilallfragmentsarrive• Thereceivermustsave(buffer)thefragments
– Incasemissingfragmentsareonlydelayed– Areceivercannotholdfragmentsanarbitrarilylongtime
• IPspecifiesamaximumtimetoholdfragments• Whenthefirstfragmentarrivesfromagivendatagram
– thereceiverstartsareassemblytimer• Ifallfragmentsofadatagramarrivebeforethetimerexpires
– thereceivercancelsthetimerandreassemblesthedatagram• Otherwisethereceiverdiscardsthefragments
[email protected] LivelloRete- IPv4 27
Gli indirizzi di Internet
• Lospaziodiindirizzamentoèuncomponentecritico• Tuttiglihost eirouterdevonousareunoschemadiindirizzamento
uniforme• GliindirizziUnicast,cheidentificanounaspecificainterfacciadevono
essereunici• EsistonoduespazidiindirizzamentospecificatiperInternet
– IPv4:quelloattualmenteinusoconindirizzia32bit– IPv6:ilsistemadiindirizzamentocheavrebbedovutosostituireIPv4,machecontinuaanonfarlo
• indirizzia128bit• funzioni“avanzate”• esistonomolte“isole”IPv6eormaituttiirouterdeimaggiorivendor losupportano
[email protected] LivelloRete- IPv4 29
The IP Addressing Scheme
• IPaddressesaresuppliedbyprotocolsoftware
• Eachnetworkinterfaceisassignedaunique32-bitnumber– TheinterfaceIPaddress orInternetaddress
• WhensendingapacketacrosstheInternet,sender’sprotocolsoftwaremustspecify– itsown32-bitIPaddress(thesourceaddress)– andtheaddressoftheintendedrecipient(thedestinationaddress)
• Routersonlyusethedestinationaddressforforwrding androuting
[email protected] LivelloRete- IPv4 30
Dotted Decimal Notation
• Insteadofwriting32bits,anotationmoreconvenientforhumanstounderstandisused,knownasdotteddecimalnotation– expresseach8-bitsectionofa32-bitnumberasadecimalvalue– useperiodstoseparatethesections
• Dotteddecimaltreatseachoctet(byte)asanunsignedbinaryinteger– thesmallestvalue,0
• occurswhenallbitsofanoctetarezero(0)– thelargestvalue,255
• occurswhenallbitsofanoctetareone(1)– dotteddecimaladdressesrange
0.0.0.0through255.255.255.255
[email protected] LivelloRete- IPv4 31
The IP Address Hierarchy
• IPaddressisdividedintotwoparts:• Aprefixè identifiesthephysicalnetworktowhichthehostis
attached(alsoknownadNetID)– EachnetworkintheInternetisassignedauniquenetworknumber
• Asuffixè identifiesaspecificinterfaceonthenetwork(alsoknownadHostID)– EachNIConagivennetworkisassignedauniquesuffix
• IPaddressschemeguaranteestwoproperties:– Eachcomputerisassignedauniqueaddress– Networknumbers(prefix)mustbecoordinatedglobally– Suffixesareassignedlocallywithoutglobalcoordination
[email protected] LivelloRete- IPv4 33
INDIRIZZAMENTO CON CLASSI (OBSOLETO)
Schemadiorganizzazionedegliindirizziusatofinoallametàdeglianni‘90ebasatosuunadivisionestaticatraNetID eHostID
Èusoancoraoggiriferirel’organizzazionedegliindirizziadunconcetto(eterminologia)diclasse
[email protected] LivelloRete- IPv4 34
Original Classes of IP Addresses
• Internetcontainsafewlargephysicalnetworksandmanysmallnetworks– thedesignerschoseanaddressingschemetoaccommodateacombinationoflargeandsmallnetworks
• Theoriginalclassful IPaddressingdividedtheIPaddressspaceinto3primaryclasses– eachclasshasadifferentsizeprefixandsuffix
• ThefirstfourbitsofanIPaddressdeterminedtheclasstowhichtheaddressbelonged– Itspecifieshowtheremainderoftheaddresswasdividedintoprefixandsuffix
[email protected] LivelloRete- IPv4 35
Division of the Address Space
• Theclassful schemedividedtheaddressspaceintounequalsizes• Thedesignerschoseanunequaldivisiontoaccommodateavariety
ofscenarios– Forexample,althoughitislimitedto128networks,classAcontainshalfofalladdresses
• ThemotivationwastoallowmajorISPstoeachdeployalargenetworkthatconnectedmillionsofcomputers
• ButAclasseswereassignedtosmallnetworksallintheUS...– Similarly,themotivationforclassCwastoallowanorganizationtohaveafewcomputersconnectedonaLAN
[email protected] LivelloRete- IPv4 37
Authority for Addresses
• InternetCorporationforAssignedNamesandNumbers(ICANN)authorityhasbeenestablished– tohandleaddressassignmentandadjudicatedisputes
• ICANNdoesnotassignindividualprefixes– Instead,ICANNauthorizesasetofregistrars todoso
• RegistrarsmakeblocksofaddressesavailabletoISPs– ISPsprovideaddressestosubscribers
• Toobtainaprefix– acorporationusuallycontactsanISP
[email protected] LivelloRete- IPv4 39
INDIRIZZAMENTO SENZA CLASSI E CIDR
SchemainusoattualecondivisionedinamicatraNetID eHostID
CIDR(Classless Inter-DomainRouting)consentel’instradamentoglobalesenzausarelanozionediclasse
[email protected] LivelloRete- IPv4 40
Subnets and Classless Addressing
• AstheInternetgrewtheoriginalclassfuladdressingschemebecamealimitation
• EveryonedemandedaclassAorclassBaddress– Sotheywouldhaveenoughaddressesforfuturegrowth
• butmanyaddressesinclassAandBwereunused• Twomechanisms,closelyrelated,weredesignedtoovercomethe
limitation– Subnetaddressing– Classlessaddressing
• Insteadofhavingthreedistinctaddressclasses,allowthedivisionbetweenprefix/suffixonanarbitrarybitboundary
[email protected] LivelloRete- IPv4 41
Classless Addressing: Motivation
• ConsideranISPthathandsoutprefixes.SupposeacustomeroftheISPrequestsaprefixforanetworkthatcontains55hosts– classfuladdressingrequiresacompleteclassCprefix– only6bitsofsuffixareneededtorepresentallpossiblehostvalues
• means190ofthe254possiblesuffixeswouldneverbeassigned
– mostoftheclassCaddressspaceiswasted• Fortheaboveexample
– classlessaddressingallowstheISPtoassign• aprefixthatis26bitslong• asuffixthatis6bitslong
[email protected] LivelloRete- IPv4 42
Classless Addressing: Example
• AssumeanISPownsaclassCprefix– Classfuladdressingassignstheentireprefixtooneorganization
• Withclasslessaddressing– theISPcandividetheprefixintoseverallongerprefixes
• Forinstance,theISPcandivideaclassCprefixinto4longerprefixes– eachonecanaccommodateanetworkofupto62hosts
• all0sandall1sarereserved• TheoriginalclassCaddresshas8bitsofsuffix
– andeachoftheclasslessaddresseshas6bitsofsuffix• Thus,insteadofwastingaddresses
– ISPcanassigneachofthe4classlessprefixestoasubscriber
[email protected] LivelloRete- IPv4 43
Address (subnet) Masks
• HowcananIPaddressbedividedatanarbitraryboundary?• Theclasslessandsubnetaddressingschemesrequirehostsand
routerstostoreanadditionalpieceofinformation:– avaluethatspecifiestheexactboundarybetweenprefixandsuffix
• Tomarktheboundary,IPusesa32-bitvalue– knownasanaddressmask,alsocalledasubnetmask
• Whystoretheboundarysizeasabitmask?– Amaskmakesprocessingefficient
• Hostsandroutersneedtocomparethenetworkprefixportionoftheaddresstoavalueintheirforwardingtables– Thebit-maskrepresentationmakesthecomparisonefficient
[email protected] LivelloRete- IPv4 45
Address Masks
• Supposearouterisgiven– adestinationaddress,D– anetworkprefixrepresentedasa32-bitvalue,N– a32-bitaddressmask,M
• AssumethetopbitsofNcontainanetworkprefix,andtheremainingbitshavebeensettozero
• Totestwhetherthedestinationliesonthespecifiednetwork,therouterteststhecondition:
N==(D&M)• Therouter
– usesthemaskwitha“logicaland(&)”operationtosetthehostbitsofaddressDtozero(0)
– andthencomparestheresultwiththenetworkprefixN
[email protected] LivelloRete- IPv4 46
Address Masks: Example
• Considerthefollowing32-bitnetworkprefix:10000000000010100000000000000000 à 128.10.0.0
• Considera32-bitmask:11111111111111110000000000000000 à 255.255.0.0
• Considera32-bitdestinationaddress,whichhasa10000000000010100000001000000011 à 128.10.2.3
• Alogical &betweenthedestinationaddressandtheaddressmaskextractsthehigh-order16-bits10000000000010100000000000000000 à 128.10.0.0
[email protected] LivelloRete- IPv4 47
CIDR Notation
• ClasslessInter-DomainRouting(CIDR)• Considera maskdefiningasubnetwith26 nodes
– Ithas26bitsof1sfollowedby6bitsof0s– Indotteddecimal,themaskis:255.255.255.192
• ThegeneralformofCIDRnotationis:ddd.ddd.ddd.ddd/m– ddd isthedecimalvalueforanoctetoftheaddress– m isthenumberofonebitsinthemask
• Thus,onemightwritethefollowing:192.5.48.69/26– whichspecifiesamaskof26bits
[email protected] LivelloRete- IPv4 48
A CIDR Example
• AssumeanISPhasthefollowingblock128.211.0.0/16• SupposetheISPhas2customers
– onecustomerneeds12IPaddressesandtheotherneeds9• TheISPcanassign
– customer1CIDR:128.211.0.16/28– customer2CIDR:128.211.0.32/28– bothcustomershavethesamemasksize(28bits),theprefixesdiffer
[email protected] LivelloRete- IPv4 49
A CIDR Example (cont’d)
• Thebinaryvalueassignedtocustomer1is:– 10000000110100110000000000010000
• Thebinaryvalueassignedtocustomer2is:– 10000000110100110000000000100000
• Thereisnoambiguity– Eachcustomerhasauniqueprefix– Moreimportant,theISPretainsmostoftheoriginaladdressblock
• itcanthenallocatetoothercustomers
[email protected] LivelloRete- IPv4 50
CIDR Host Addresses
• OnceanISPassignsacustomeraCIDRprefix– thecustomercanassignhostaddressesforitsnetworkusers
• Supposeanorganizationisassigned128.211.0.16/28– theorganizationwillhave4-bitstouseasahostaddressfield
• Disadvantageofclasslessaddressing– Becausethehostsuffixcanstartonanarbitraryboundary,valuesarenoteasytoreadindotteddecimal
[email protected] LivelloRete- IPv4 51
INDIRIZZI PRIVATI, SPECIALI E INDIRIZZI DEI ROUTERNontuttigliindirizziIPsonoutilizzabili,alcuniindirizzihannosignificatosolointernoalcomputerealtriconsentonodifareilbootstrap dellemacchineprimacheabbianounindirizzoIPconcuicomunicare.IRoutersonomacchineconpiùindirizziIP...anchesenonsempreconpiùinterfaccefisichedicomunicazione.
[email protected] LivelloRete- IPv4 53
Indirizzi pubblici e privati
• NontuttigliindirizziIPUnicast validisonouguali• Alcuniindirizzisonostatidefiniti“privati”enonsonoinstradabiliin
Internet– PossonoessereusatipercostruireIntra-netprivate
• Unhost conindirizzoIPprivatohabisognodiunaapparatoattivochetraducaopportunamenteisuoipacchettiperaccedereaInternet
• NAT:NetworkAddress Translator– Mappala5-tuplacheidentificaunflussosuun’altra5-tuplaconindirizzopubblico,lavoraalivelloL3/L4
• Proxy– GatewaydiL7,cheinterconnettealivellodisingolaapplicazione
[email protected] LivelloRete- IPv4 54
Indirizzi Privati
• 10.0.0.0– 10.255.255.255• 172.16.0.0– 172.31.255.255• 192.168.0.0– 192.168.255.255
• Unindirizzoprivatopuòessereriutilizzatoinmoltipostidiversi• All’internodiunastessaretedevonoessereuniciepossonoessere
“routati”finoaun“border router”cheinveceimpediscediandareversoInternet
• NormalmentesonoassegnatitramiteDHCPenonsonoassegnatistaticamenteaunhost
• Nonc’è una reale differenza tra i tre gruppi diindirizzi,maingenere i router“domestici”usano 192.168.x.y/24
[email protected] LivelloRete- IPv4 55
Special IP Addresses
• IPdefinesasetofspecialaddressformsthatarereserved– Thatis,specialaddressesareneverassignedtohosts
• Examples:– NetworkAddress– DirectedBroadcastAddress– LimitedBroadcastAddress– ThisComputerAddress– LoopbackAddress– Multicastaddresses
[email protected] LivelloRete- IPv4 56
Network Address
• Itisconvenienttohaveanaddressthatcanbeusedtodenotetheprefix assignedtoagivennetwork
• IPreserveshostaddresszero– andusesittodenoteanetwork
• Thus,theaddress128.211.0.16/28denotesanetwork– becausethebitsbeyondthe28arezero– 10000000110100110000000000010000
• Anetworkaddressshouldneverappearasthedestinationaddressinapacket
[email protected] LivelloRete- IPv4 57
Directed Broadcast Address
• Tosimplifybroadcasting(sendtoall)– IPdefinesadirectedbroadcastaddressforeachphysicalnetwork
• Whenapacketissenttoanetwork'sdirectedbroadcast– asinglecopyofthepackettravelsacrosstheInternet
• untilitreachesthespecifiednetwork– thepacketisthendeliveredtoallhostsonthenetwork
• Thedirectedbroadcastaddressforanetworkisformedbyaddingasuffixthatconsistsofall1bitstothenetworkprefix– 10000000110100110000000000011111
[email protected] LivelloRete- IPv4 58
Limited Broadcast Address
• Limitedbroadcastreferstoabroadcastonadirectly-connectednetwork:– informally,wesaythatthebroadcastislimitedtoa“singleLAN”meaningthatitwillneverbeforwardedbyarouter,evenifthe“LAN”canbeahugeCampusLANwithhundredsofcomputers
• Limitedbroadcastisusedduringsystemstartup– byacomputerthatdoesnotyetknowthenetworknumber
• IPreservestheaddressconsistingof32-bitsof1s– 11111111111111111111111111111111
• Thus,IPwillbroadcastanypacketsenttotheall-1saddressacrossthelocalnetwork
[email protected] LivelloRete- IPv4 59
This Computer Address
• AcomputerneedstoknowitsIPaddress– beforeitcansendorreceiveInternetpackets
• TCP/IPcontainsprotocolsacomputercanusetoobtainitsIPaddressautomaticallywhenthecomputerboots– …butthestartupprotocolsalsouseanIPtocommunicate
• Whenusingsuchstartupprotocols– acomputercannotsupplyacorrectIPsourceaddress– TohandlesuchcasesIPreservestheaddressthatconsistsofall0stomeanthiscomputer
– 00000000000000000000000000000000
[email protected] LivelloRete- IPv4 60
Loopback Address
• Loopbackaddressusedtotestnetworkapplications– e.g.,forpreliminarydebuggingafteranetworkapplicationhasbeencreated
• Aprogrammermusthavetwoapplicationprogramsthatareintendedtocommunicateacrossanetwork
• Insteadofexecutingeachprogramonaseparatecomputer– theprogrammerrunsbothprogramsonasinglecomputer– andinstructsthemtousealoopbackaddresswhencommunicating
• Whenoneapplicationsendsdatatoanother– datatravelsdowntheprotocolstacktotheIPsoftware– thenforwardsitbackupthroughtheprotocolstacktothesecondprogram
[email protected] LivelloRete- IPv4 61
Loopback Address (cont’d)
• IPreservesthenetworkprefix127/8 forusewithloopback• Thehostaddressusedwith127isirrelevant
– allhostaddressesaretreatedthesame– programmersoftenusehostnumber1– soitmakes127.0.0.1 themostpopularloopbackaddress
• Duringloopbacktestingnopacketseverleaveacomputer– theIPsoftwareforwardspacketsfromoneapplicationtoanother
• Theloopbackaddressneverappearsinapackettravelingacrossanetwork
[email protected] LivelloRete- IPv4 62
Indirizzo Multicast
• Internetammettel’inviodipacchettia“molti”• Iroutersipreoccupano(complesso,nonlovediamoinquesto
corso)dicapireilpuntoottimodoveduplicarel’informazione• Unpacchettomulticast è inviato aunindirizzo di“gruppo”• InIPv4:ClassD,iniziano per1110• 224.0.0.0– 239.255.255.255• Esistonogruppimulticast “well known”• 224.0.0.1:All Hosts onthis Subnet• 224.0.0.2:All Routers onthis Subnet• Glialtripossonoessereusatiperapplicazioniproprietarieonuove• PurtropponontuttigliISPpermettonotrafficomulticast senonper
lagestionedeiprotocollidirouting stessi
[email protected] LivelloRete- IPv4 64
Multicast Routing
• Multicast:deliveryofsamepackettoagroupofreceiverswiththeminimumoverhead
• Multipleunicastvs.multicast– Hostbasedvs.networkbased
[email protected] LivelloRete- IPv4 65
Routers and IP Addresses
• EachrouterisassignedtwoormoreIPaddresses– oneaddressforeach logicalnetworktowhichtherouterattaches
• Tounderstandwhy,recalltwofacts:– Arouter connectsmultipleIPnetworks(bydefinition)– EachIPaddresscontainsaprefixthatspecifiesa logicalnetwork
• AsingleIPaddressdoesnotsufficeforarouter– becauseeachrouterconnectstomultiplenetworks– andeachnetworkhasauniqueprefix
• TheIPschemecanbeexplainedbyaprinciple:– AnIPaddressdoesnotidentifyaspecificcomputer– eachaddressidentifies ininterface,i.e.,alogicalconnectionbetween
acomputerandanetwork– Acomputerwithmultiplenetworkconnections(e.g.,arouter)must
beassignedoneIPaddressforeachconnection
[email protected] LivelloRete- IPv4 66
Un altro esempio
[email protected] LivelloRete- IPv4 68
Campus LAN con 4 reti IP private: 192.168.1.0/24192.168.2.0/24192.168.3.0/24192.168.4.0/24
Routerdicampuscheinterconnettele4 retiedinoltraalRouterNATdicollegamentoversoInternet:5 indirizziIPtuttisullastessainterfacciafisicadellacampusLAN
192.168.1.1192.168.2.1192.168.3.1192.168.4.1192.168.5.1
Router,NATFirewallperaccessoaInternet2 indirizziIPsudueinterfaccediverse
153.18.125.1192.168.5.2
Un altro esempio (cont)
[email protected] LivelloRete- IPv4 69
Routerdicampuscheinterconnettele4retiedinoltraalRouterNATdicollegamentoversoInternet:5 indirizziIPtuttisullastessainterfacciafisicadellacampusLAN
168.192.1.1168.192.2.1168.192.3.1168.192.4.1168.192.5.1
Collegamentoalivelloethernet
153.18.125.1168.192.5.2
...