DNS: Domain Name System



Похожие документы
DNS: Domain Name System

Reti di Calcolatori:

DNS: Domain Name System

Programmare con le Socket

I name server DNS. DNS: Domain Name System. Esempio di DNS. DNS: Root name server. DNS: queries ripetute

Programmare con le Socket TCP

Programmare con le Socket TCP in java. 2: Application Layer 1

DNS: Domain Name System

RETI E SISTEMI INFORMATIVI Domain Name System. Prof. Andrea Borghesan

Fondamenti di Internet e Reti. Antonio Capone, Matteo Cesana, Ilario Filippini, Guido Maier

Applicazioni di rete. Applicazioni di rete

Programmazione in Rete

Parte II: Reti di calcolatori Lezione 10

Livello di applicazione. Reti di Calcolatori. Corso di Laurea in Ingegneria Informatica. Livello di applicazione DNS A.A.

TFA 42 Sistemi e Reti di Calcolatori per la Didattica

Il Linguaggio Java: Socket.

Cenni di programmazione distribuita in C++ Mauro Piccolo

Reti di calcolatori e Internet: Un approccio top-down. 4 a edizione Jim Kurose, Keith Ross 2-1

INFORMATICA DISTRIBUITA. lez 4 Livello applicazione

10.1. Un indirizzo IP viene rappresentato in Java come un'istanza della classe InetAddress.

CORSO DI RETI SSIS. Lezione n.2. 2 Novembre 2005 Laura Ricci

Corso di Reti di Calcolatori

Transmission Control Protocol

Esempi di programmi client/server in Python

Corso di Reti di Calcolatori. Datagrammi

Introduzione alle applicazioni di rete

Flavio De Paoli ITIS Lab

Programmazione dei socket con TCP #2

Esercitazione. Formato di compitini e compiti: domande ed esercizi "closed book" G. Ferrari - Reti di calcolatori.

Indirizzi Internet e. I livelli di trasporto delle informazioni. Comunicazione e naming in Internet

Datagrammi. NOTA: MulticastSocket estende DatagramSocket

Application Layer DNS, TELNET

Architettura Client-Server

INFORMATICA DISTRIBUITA. prof. Carlo Bellettini. lez 9 Distribuzione dei contenuti

Connessioni di rete. Progetto di reti di Calcolatori e Sistemi Informatici - Stefano Millozzi. PdR_ Stefano Millozzi

Fondamenti di Internet e Reti. Achille Pattavina, Francesco Musumeci

Dal protocollo IP ai livelli superiori

UDP. Livello di Trasporto. Demultiplexing dei Messaggi. Esempio di Demultiplexing

(VHUFLWD]LRQLGLEDVHVXOOH6RFNHWLQ-DYD 6RFNHWGLWLSRVWUHDP

Livello applicazione: Protocollo DNS

Fondamenti di Internet e Reti. Antonio Capone, Achille Pattavina, Francesco Musumeci, Matteo Cesana

ICMP OSI. Internet Protocol Suite. Telnet FTP SMTP SNMP TCP e UDP NFS. Application XDR. Presentation. Session RPC. Transport.

Livello applicazione: Protocollo DNS

Reti di Telecomunicazione Lezione 6

Networking. Mauro Migliardi Ph. D.

Sistemi e Servizi di TLC. Lezione N. 6. Il servizio DNS (Domain Name System)

SISTEMA DEI NOMI DI DOMINIO (DNS) Funzionamento del DNS. Soluzione centralizzata

SISTEMA DEI NOMI DI DOMINIO (DNS)

Applicazioni web. Parte 5 Socket

Telematica II 12. Esercitazione/Laboratorio 4

Inizializzazione degli Host. BOOTP e DHCP

Programmazione in Rete

Gestione degli indirizzi

(Domain Name System) DNS (Domain Name System) Architettura del DNS DNS. A.Lioy - Politecnico di Torino (2013) B-1. Antonio Lioy < lioy@polito.

Tecnologie di Sviluppo per il Web

Application layer. Protocolli a livello applicativo. Identificatori in Internet. Protocolli a livello applicativo, esempi. Francesco Dalla Libera

I Socket. Laboratorio Software M. Grotto R. Farina

Corsi di Reti di Calcolatori (Docente Luca Becchetti)

Esercizi (1-2): da: TCP/IP Sockets in C (Donahoo-Calvert)

ARP (Address Resolution Protocol)

OSOR. Applicazioni di Rete

Tecnologie Web L-A. Java e HTTP. Dario Bottazzi Tel , dario.bottazzi@unibo.it, SkypeID: dariobottazzi. Java e TCP/IP in a Nutshell

R.Focardi Laboratorio di Ingegneria del Software 6. 1

Gestione degli indirizzi

INFORMATICA DISTRIBUITA. prof. Carlo Bellettini. lez 1 Informazioni Logistiche

Corso di Laurea in Ingegneria Informatica. Corso di Reti di Calcolatori a.a. 2009/10

2.5. L'indirizzo IP identifica il computer di origine, il numero di porta invece identifica il processo di origine.

Introduzione alla rete Internet

Esempi di applicazioni internet. WEB Trasferimento File Posta Elettronica Sistema dei nomi di dominio (DNS)

Parte II: Reti di calcolatori Lezione 8

Connessione di reti private ad Internet. Fulvio Risso

Introduzione alla rete Internet

20. DNS: Il Domain Name System

PROTOCOLLI APPLICATIVI PER INTERNET

Topologia delle reti. Rete Multipoint: ogni nodo è connesso agli altri tramite nodi intermedi (rete gerarchica).

Транскрипт:

DNS: Domain Name System Persone: molte mezzi di identificazione: CF, nome, # Passaporto Host, router Internet: Indirizzi IP (32 bit) usati per indirizzare i datagrammi IP Nome, es., gaia.cs.umass.edu usati dagli utenti Q: corrispondenza tra indirizzo IP e nome? Domain Name System: Database distribuito implementato come una gerarchia di molti name server Protocollo applicativo usato da host, router, name server per comunicare allo scopo di risolvere (tradurre) i nomi in indirizzi IP Nota: funzione di base di Internet implementata come protocollo applicativo La complessità trasferita al bordo della rete 2: Application Layer 1

Funzione del DNS Utilizzato da diverse aplicazioni: HTTP, SMTP, FTP Connessione TCP richiede la conoscenza dell indirizzo IP corrispondente all hostname Applicazione interroga un sever DNS per ottenere l indirizzo IP Opportuno utilizzare la cache per ridurre il ritardo Utilizza UDP UNIX: gethostbyname() Fornisce l hostname corrispondente ad un alias Alias di posta: fornisce l indirizzo IP o l hostname del Mail Server di un dominio Distribuzione del carico tra Server replicati. IL DNS fornisce un gruppo di indirizzi alternando l ordine Permette di dirigere un client al server più vicino 2: Application Layer 2

Name server DNS Perché non un server DNS centralizzato? Minore tolleranza ai guasti Traffico eccessivo Database centrale troppo distante in molti casi Scarsa scalabilità! Autorizzazione ed accesso per registrare nuovo host Nessun name server contiene tutte le associazioni nome simbolico/indirizzo IP Name server locali : Ogni ISP o compagnia ha un name server locale (default) La richiesta di traduzione (mapping) di un host è prima rivolta al name server locale Name server di riferimento : Per un host: per definizione è quello che è sempre in grado di eseguire la traduzione (mapping) nome simbolico /indirizzo IP dell host 2: Application Layer 3

DNS: Root name servers Contattato dal name server locale che non riesce a risolvere un nome root name server: Contatta il name server di riferimento (authoritative) se la traduzione non è nota Ottiene la traduzione Restituisce la traduzione al name server locale ~ una dozzina di root name server nel mondo 2: Application Layer 4

Esempio: schema ricorsivo root name server L host surf.eurecom.fr vuole l indirizzo IP di gaia.cs.umass.edu 1. Contatta il server DNS locale, dns.eurecom.fr 2. dns.eurecom.fr contatta il root name server, se necessario 3. Il root name server contatta il name server di riferimento o assoluto, dns.umass.edu, se necessario 4. Ogni host è registrato in almeno due name server assoluti 4. Il name server assoluto può coincidere con il neame server locale. local name server dns.eurecom.fr 1 2 6 Host che inoltra la richiesta surf.eurecom.fr 5 3 4 authorititive name server dns.umass.edu gaia.cs.umass.edu 2: Application Layer 5

Esempio (2) root name server Root name server: Può non essere a conoscenza di un name server di riferimento Può tuttavia conoscere un name server intermedio che contatta per avere raggiungere quello di riferimento local name server dns.eurecom.fr 1 2 8 Host che inoltra la richiesta surf.eurecom.fr 7 3 6 Name server intermedio dns.umass.edu 4 5 Name server di riferimento dns.cs.umass.edu gaia.cs.umass.edu 2: Application Layer 6

DNS: richieste ripetute (iterated queries) Richieste ricorsive (recursive query): Trasferisce il carico della traduzione al name server contattato Carico eccessivo? Richieste ripetute (iterated query): Il name server contattato risponde con l indirizzo del prossimo name server da contattare Non conosco questo nome, ma prova a rivolgerti a quest altro server Name server locale dns.eurecom.fr 1 2 8 Host che inizia la richiesta surf.eurecom.fr root name server 3 4 7 Richiesta ripetuta Name server intermedio dns.umass.edu 5 6 authoritative name server dns.cs.umass.edu gaia.cs.umass.edu 2: Application Layer 7

DNS: caching e aggiornamento Quando un qualsiasi name server apprende una traduzione la memorizza localmente (caching) Le traduzioni memorizzate nella cache (cache entries) scadono (timeout) dopo un certo tempo (di solito un paio di giorni) Se possibile, richieste successive vengono servite usando la traduzione presente in cache I meccanismi di aggiornmento/modifica in studio da parte dell IETF RFC 2136 http://www.ietf.org/html.charters/dnsind-charter.html 2: Application Layer 8

Record DNS DNS: database distribuito che memorizza Resource Record (RR) Formato RR: (nome, valore, tipo, ttl) Tipo=A nome è il nome dell host valore è l indirizzo IP Tipo=NS nome è il dominio (es. foo.com) valore è l indirizzo IP del name server di riferimento per questo dominio Tipo=CNAME nome è un alias di qualche nome reale ( canonico ) valore è il nome canonico Tipo=MX valore è il nome di un mailserver associato a nome 2: Application Layer 9

Protocollo DNS, messaggi Protocollo DNS : messaggi di richiesta (query) e risposta (reply), client server Header di messaggio identification: numero a 16 bit per la richiesta, la risposta usa lo stesso numero flags: Richiesta o risposta Chiesta la ricorsione (Q) Ricorsione disponibile (R) Il server che risponde è di riferimento per la richiesta (R) Nota: richiesta e risposta hanno lo stesso formato 2: Application Layer 10

Protocollo DNS, messaggi (2) Nome, campi tipo per una richiesta RR in risposta a una richiesta Record per server di riferimento Informazioni addizionali Es.: RR di tipo A contenente indirizzo IP di un mail server il cui nome canonico è contenuto nella answer section 2: Application Layer 11

Esercizi 1. Come vengono trattati oggetti multipli all interno di una pagina Web e di un e -mail MIME Multipart 2. Come sono separati gli oggetti in una connessione permamente HTTP e differenti messaggi una connessione permamente SMTP 3. Quali protocolli studiati finora sono di tipo Pull e quali di tipo Push 2: Application Layer 12

Socket programming Goal: learn how to build client/server application that communicate using sockets Socket API introduced in BSD4.1 UNIX, 1981 explicitly created, used, released by apps client/server paradigm two types of transport service via socket API: unreliable datagram reliable, byte stream -oriented socket a host-local, application -created/owned, OS-controlled interface (a door ) into which application process can both send and receive messages to/from another (remote or local) application process 2: Application Layer 13

Socket-programming using TCP Socket: a door between application process and end -end-transport protocol (UCP or TCP) TCP service: reliable transfer of bytes from one process to another controlled by application developer controlled by operating system process socket TCP with buffers, variables internet process socket TCP with buffers, variables controlled by application developer controlled by operating system host or server host or server 2: Application Layer 14

Socket programming with TCP Client must contact server server process must first be running server must have created socket (door) that welcomes client s contact Client contacts server by: creating client-local TCP socket specifying IP address, port number of server process When client creates socket: client TCP establishes connection to server TCP When contacted by client, server TCP creates new socket for server process to communicate with client allows server to talk with multiple clients application viewpoint TCP provides reliable, in-order transfer of bytes ( pipe ) between client and server 2: Application Layer 15

Socket programming with TCP Example client-server app: client reads line from standard input (infromuser stream), sends to server via socket (outtoserver stream) server reads line from socket server converts line to uppercase, sends back to client client reads, prints modified line from socket (infromserver stream) Input stream: sequence of bytes into process Output stream: sequence of bytes out of process infromuser outtoserver client socket iinfromserver 2: Application Layer 16

Client/server socket interaction: TCP Server (running on hostid) create socket, port=x, for incoming request: welcomesocket = ServerSocket() wait for incoming connection request connectionsocket = welcomesocket.accept() read request from connectionsocket write reply to connectionsocket close connectionsocket TCP connection setup Client create socket, connect to hostid, port=x clientsocket = Socket() send request using clientsocket read reply from clientsocket close clientsocket 2: Application Layer 17

Example: Java client (TCP) import java.io.*; import java.net.*; class TCPClient { Create input stream Create client socket, connect to server Create output stream attached to socket public static void main(string argv[]) throws Exception { String sentence; String modifiedsentence; BufferedReader infromuser = new BufferedReader(new InputStreamReader(System.in)); Socket clientsocket = new Socket("hostname", 6789); DataOutputStream outtoserver = new DataOutputStream(clientSocket.getOutputStream()); 2: Application Layer 18

Example: Java client (TCP), cont. Create input stream attached to socket Send line to server Read line from server BufferedReader infromserver = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); sentence = infromuser.readline(); outtoserver.writebytes(sentence + '\n'); modifiedsentence = infromserver.readline(); System.out.println("FROM SERVER: " + modifiedsentence); clientsocket.close(); } } 2: Application Layer 19

Example: Java server (TCP) import java.io.*; import java.net.*; class TCPServer { Create welcoming socket at port 6789 Wait, on welcoming socket for contact by client Create input stream, attached to socket public static void main(string argv[]) throws Exception { String clientsentence; String capitalizedsentence; ServerSocket welcomesocket = new ServerSocket(6789); while(true) { Socket connectionsocket = welcomesocket.accept(); BufferedReader infromclient = new BufferedReader(new InputStreamReader(connectionSocket.getInputStream())); 2: Application Layer 20

Example: Java server (TCP), cont Create output stream, attached to socket Read in line from socket DataOutputStream outtoclient = new DataOutputStream(connectionSocket.getOutputStream()); clientsentence = infromclient.readline(); capitalizedsentence = clientsentence.touppercase() + '\n'; Write out line to socket } } } outtoclient.writebytes(capitalizedsentence); End of while loop, loop back and wait for another client connection 2: Application Layer 21

Socket programming with UDP UDP: no connection between client and server no handshaking sender explicitly attaches IP address and port of destination server must extract IP address, port of sender from received datagram application viewpoint UDP provides unreliable transfer of groups of bytes ( datagrams ) between client and server UDP: transmitted data may be received out of order, or lost 2: Application Layer 22

Client/server socket interaction: UDP Server (running on hostid) Client create socket, port=x, for incoming request: serversocket = DatagramSocket() read request from serversocket create socket, clientsocket = DatagramSocket() Create, address (hostid, port=x, send datagram request using clientsocket write reply to serversocket specifying client host address, port umber read reply from clientsocket close clientsocket 2: Application Layer 23

Example: Java client (UDP) import java.io.*; import java.net.*; Create input stream Create client socket Translate hostname to IP address using DNS class UDPClient { public static void main(string args[]) throws Exception { BufferedReader infromuser = new BufferedReader(new InputStreamReader(System.in)); DatagramSocket clientsocket = new DatagramSocket(); InetAddress IPAddress = InetAddress.getByName("hostname"); byte[] senddata = new byte[1024]; byte[] receivedata = new byte[1024]; String sentence = infromuser.readline(); senddata = sentence.getbytes(); 2: Application Layer 24

Example: Java client (UDP), cont. Create datagram with data-to-send, length, IP addr, port Send datagram to server Read datagram from server } DatagramPacket sendpacket = new DatagramPacket(sendData, senddata.length, IPAddress, 9876); clientsocket.send(sendpacket); DatagramPacket receivepacket = new DatagramPacket(receiveData, receivedata.length); clientsocket.receive(receivepacket); String modifiedsentence = new String(receivePacket.getData()); System.out.println("FROM SERVER:" + modifiedsentence); clientsocket.close(); } 2: Application Layer 25

Example: Java server (UDP) import java.io.*; import java.net.*; Create datagram socket at port 9876 Create space for received datagram Receive datagram class UDPServer { public static void main(string args[]) throws Exception { DatagramSocket serversocket = new DatagramSocket(9876); byte[] receivedata = new byte[1024]; byte[] senddata = new byte[1024]; while(true) { DatagramPacket receivepacket = new DatagramPacket(receiveData, receivedata.length); serversocket.receive(receivepacket); 2: Application Layer 26

Example: Java server (UDP), cont Get IP addr port #, of sender String sentence = new String(receivePacket.getData()); InetAddress IPAddress = receivepacket.getaddress(); int port = receivepacket.getport(); Create datagram to send to client Write out datagram to socket } } String capitalizedsentence = sentence.touppercase(); senddata = capitalizedsentence.getbytes(); DatagramPacket sendpacket = new DatagramPacket(sendData, senddata.length, IPAddress, port); serversocket.send(sendpacket); } End of while loop, loop back and wait for another datagram 2: Application Layer 27

Chapter 2: Summary Our study of network apps now complete! application service requirements: reliability, bandwidth, delay client-server paradigm Internet transport service model connection-oriented, reliable: TCP unreliable, datagrams: UDP specific protocols: http ftp smtp, pop3 dns socket programming client/server implementation using tcp, udp sockets 2: Application Layer 28

Chapter 2: Summary Most importantly: learned about protocols typical request/reply message exchange: client requests info or service server responds with data, status code message formats: headers: fields giving info about data data: info being communicated control vs. data msgs in-based, out-of-band centralized vs. decentralized stateless vs. stateful reliable vs. unreliable msg transfer complexity at network edge security: authentication 2: Application Layer 29