livello di rete ip - home di...

20
Livello di rete IP

Upload: votram

Post on 17-Feb-2019

215 views

Category:

Documents


0 download

TRANSCRIPT

Livello di rete IP

Carlo BellettiniInformatica Distribuita

The Internet Network layer

forwardingtable

Host, router network layer functions:

Routing protocols• path selection• RIP, OSPF, BGP

IP protocol• addressing conventions• datagram format•packet handling conventions

ICMP protocol• error reporting• router “signaling”

Transport layer: TCP, UDP

Link layerphysical layer

Networklayer

Carlo BellettiniInformatica Distribuita

IP address: 32-bit identifier for host, router interface

interface: connection between host/router and physical link

router’s typically have multiple interfaces

host may have multiple interfaces

IP addresses associated with each interface

IP Addressing: introduction

223.1.1.1

223.1.1.3

223.1.1.4 223.1.2.9

223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 11

223.1.1.2

223.1.2.1

223.1.2.2223.1.3.27

223.1.3.1 223.1.3.2

Carlo BellettiniInformatica Distribuita

IP addressing: the last word...

How does an ISP get block of addresses?

ICANN: Internet Corporation for Assigned Names and Numbers

allocates addresses

manages DNS

assigns domain names, resolves disputes

Carlo BellettiniInformatica Distribuita

IP Addresses

given notion of “network”, let’s re-examine IP addresses:

“class-full” addressing:

10 network hostB 128.0.0.0 to191.255.255.255

110 network hostC 192.0.0.0 to223.255.255.255

1110 multicast addressD 224.0.0.0 to239.255.255.255

class

0network hostA 1.0.0.0 to127.255.255.255

32 bits

Carlo BellettiniInformatica Distribuita

Perché subnet-host?

Per poter fare il routing

Non c’è all’interno dell’indirizzo qualcosa che ne indica la posizione

un indirizzo IP potrebbe essere collegato a una macchina ovunque nel mondo

Non posso gestire 4 miliardi di casi ad-hoc

quanto dovrebbe essere grande la tabella dei router?

Le subnet sono il “compromesso”: il numero di casi gestibili

Carlo BellettiniInformatica Distribuita

IP addressing: CIDR

Classful addressing: inefficient use of address space, address space exhaustion

e.g., class B net allocated enough addresses for 65K hosts, even if only 2K hosts in that network

CIDR: Classless InterDomain Routingnetwork portion of address of arbitrary length

address format: a.b.c.d/x, where x is # bits in network portion of address

11001000 00010111 00010000 00000000

networkpart

hostpart

200.23.16.0/23

Carlo BellettiniInformatica Distribuita

Rilassamento univocità assegnamento

Nel tempoindirizzi dinamici

meno significativo di una volta a causa delle tariffe always-on FLAT

Nello spazioNAT

non solo per motivi di numerosità indirizzi

Carlo BellettiniInformatica Distribuita

NAT: Network Address Translation

Motivation:

local network uses just one IP address as far as outside word is concerned:

no need to be allocated range of addresses from ISP: - just one IP address is used for all devices

can change addresses of devices in local network without notifying outside world

can change ISP without changing addresses of devices in local network

devices inside local net not explicitly addressable, visible by outside world (a security plus).

Carlo BellettiniInformatica Distribuita

NAT: Network Address Translation

Implementation

NAT router must:outgoing datagrams: replace (source IP address, port #) of every outgoing datagram to (NAT IP address, new port #)

. . . remote clients/servers will respond using (NAT IP address, new port #) as destination addr.

remember (in NAT translation table) every (source IP address, port #) to (NAT IP address, new port #) translation pair

incoming datagrams: replace (NAT IP address, new port #) in dest fields of every incoming datagram with corresponding (source IP address, port #) stored in NAT table

Carlo BellettiniInformatica Distribuita

NAT

A B C D

AB

CD

NAT

NAT

Internetgoogle

Carlo BellettiniInformatica Distribuita

IP v6: solo alcuni elementi

indirizzo a 128 bit

informazione su localizzazione geografica

IPSEC: sicurezza

Livello di collegamento

Carlo BellettiniInformatica Distribuita

Primo indovinello20 nani entrano alla ricerca di un tesoro all’interno di un regno sotterraneo. Vengono catturati dal malvagio re degli orchetti che se li vuole mangiare...

Lo scongiurano di lasciarli andare, ma il massimo che ottengono è che li sottoponga alla seguente prova:

Li metterà in fila indiana in modo che ognuno veda i compagni davanti a sé.

Ad ogni nano verrà messo in testa (senza che lui lo veda) un cappello (che può essere di 2 colori diversi [rosso, o blu])

A partire dall’ultimo ognuno dovrà alzare una paletta con scritto il colore del cappello che ha in testa, il re degli orchetti dirà tale colore con voce atona, intensità, velocità e ritardo costante, etc etc...

Chi indovina potrà andare via, chi non indovina verrà mangiato

I nani confabulano un po’ tra di loro e poi decidono di accettare... In quanti si salveranno?

Carlo BellettiniInformatica Distribuita

Link Layer Services (more)

Flow Control: pacing between adjacent sending and receiving nodes

Error Detection: errors caused by signal attenuation, noise.

receiver detects presence of errors:

signals sender for retransmission or drops frame

Error Correction: receiver identifies and corrects bit error(s) without resorting to retransmission

Half-duplex and full-duplexwith half duplex, nodes at both ends of link can transmit, but not at same time

Carlo BellettiniInformatica Distribuita

Error Detection

EDC = Error Detection and Correction bits (redundancy)

D = Data protected by error checking, may include header fields

Error detection not 100% reliable!

protocol may miss some errors, but rarely

larger EDC field yields better detection and correction

Carlo BellettiniInformatica Distribuita

Hamming distanceThe number of bit positions in which two codewords differ is called the Hamming distance (Hamming, 1950).

In most data transmission applications, all 2m possible data messages are legal, but due to the way the check bits are computed, not all of the 2n possible codewords are used.

The error-detecting and error-correcting properties of a code depend on its Hamming distance.

To detect d errors, you need a distance d + 1 code

there is no way that d single-bit errors can change a valid codeword into another valid codeword. When the receiver sees an invalid codeword, it can tell that a transmission error has occurred.

To correct d errors, you need a distance 2d + 1 code

the legal codewords are so far apart that even with d changes, the original codeword is still closer than any other codeword, so it can be uniquely determined.

Carlo BellettiniInformatica Distribuita

Parity Checking

L’ultimo bit e’ di ridondanza e rende dispari il numero di 1 dell’intero messaggio

Se erano gia’ pari pb = 0

Se erano dispari pb = 1

Distanza di hamming: 2Riesco a riconoscere errore su singolo bit

Single Bit Parity:Detect single bit errors

Carlo BellettiniInformatica Distribuita

Risposta al primo indovinello?Se avete notato rispetto all’indovinello 0 ho aggiunto la possibilita` per i nani di vedere TUTTI i nani davanti a loro e continuano a sentire quello che dicono i nani dietro di loro…

Quindi ora possono comunicare qualcosa di cumulativo…Cosa succede se il primo nano dice blu se il numero di cappeli blu davanti a lui e’ dispari e altrimenti dice rosso?

Cioe’ dice il bit di bluita` (rende pari il numero di cappelli blu)

Per lui non cambia nulla… ha comunque il 50% di possibilita`

Chi e’ davanti a lui pero’ ha una informazione… e pensa:

Quello dietro a me ha detto

”blu”: allora ha visto un numero dispari di blu… quanti ne vedo io?

Se ne vedo dispari anche io vuol dire che il mio e’ rosso…

Se ne vedo pari, vuol dire che il mio cappello e’ quello che rende dispari i blu… e quindi e’ blu…

“Rosso”: allora ha visto un numero pari di blu… quanti ne vedo io?

Se ne vedo pari anche io vuol dire che il mio e’ rosso…

Se ne vedo dispari, vuol dire che il mio cappello e’ quello che rende pari i blu… e quindi e’ blu…

Cosa sta comunicando questo secondo nano a quello davanti a lui?

Sta comunicando il colore di bluita` considerando quelli che vede davanti a lui e quelli dichiarati da chi era dietro a lui…

Carlo BellettiniInformatica Distribuita

Esempio con sette nani: B R B B R B BIl primo nano (a sinistra) vede 4 blu e dice allora rosso:

Il re e’ molto contento perche’ se lo mangia…

Il secondo nano pensa…Vedo 4 blu, sono stati detti 0 blu…

E’ gia’ pari… io ho il rosso… e scappa via vivo

Il terzo nano pensa…Vedo 3 blu, sono stati detti 0 blu…

Devo renderlo pari… ho il blu e scappa via vivo

Il quarto nano pensa…Vedo 2 blu, sono stati detti 1 blu

Devo renderlo pari… ho il blu e scappa via vivo

Il quinto nano pensaVedo 2 blu, sono stati detti 2 blu

E’ gia’ pari… io ho il rosso e scappa via vivo

Il sesto nano pensaVedo 1 blu, sono stati detti 2 blu

Devo renderlo pari… ho il blu e scappa via vivo

Il settimo nano pensaVedo 0 blu (beh non vedo niente… sono l’ultimo), sono stati detti 3 blu

Devo renderlo pari… ho il blu e scappa via vivo