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

Applicazioni di rete. Applicazioni di rete

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

Parte II: Reti di calcolatori Lezione 10

Programmazione in Rete

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

Il Linguaggio Java: Socket.

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

TFA 42 Sistemi e Reti di Calcolatori per la Didattica

Esempi di programmi client/server in Python

Corso di Reti di Calcolatori

Introduzione alle applicazioni di rete

Corso di Reti di Calcolatori. Datagrammi

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

INFORMATICA DISTRIBUITA. lez 4 Livello applicazione

Programmazione dei socket con TCP #2

Transmission Control Protocol

Application Layer DNS, TELNET

Cenni di programmazione distribuita in C++ Mauro Piccolo

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

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

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

Datagrammi. NOTA: MulticastSocket estende DatagramSocket

Architettura Client-Server

Fondamenti di Internet e Reti. Achille Pattavina, Francesco Musumeci

Flavio De Paoli ITIS Lab

(VHUFLWD]LRQLGLEDVHVXOOH6RFNHWLQ-DYD 6RFNHWGLWLSRVWUHDP

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

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

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

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

Applicazioni web. Parte 5 Socket

Livello applicazione: Protocollo DNS

Networking. Mauro Migliardi Ph. D.

R.Focardi Laboratorio di Ingegneria del Software 6. 1

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

Dal protocollo IP ai livelli superiori

Tecnologie di Sviluppo per il Web

Telematica II 12. Esercitazione/Laboratorio 4

Reti di Telecomunicazione Lezione 6

Programmazione in Rete

Gestione degli indirizzi

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

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

Corsi di Reti di Calcolatori (Docente Luca Becchetti)

ARP (Address Resolution Protocol)

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

Gestione degli indirizzi

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

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

SISTEMA DEI NOMI DI DOMINIO (DNS)

Inizializzazione degli Host. BOOTP e DHCP

Introduzione. Livello applicativo Principi delle applicazioni di rete. Stack protocollare Gerarchia di protocolli Servizi e primitive di servizio 2-1

I Socket. Laboratorio Software M. Grotto R. Farina

OSOR. Applicazioni di Rete

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

Connessione di reti private ad Internet. Fulvio Risso

Introduzione alla rete Internet

PROTOCOLLI APPLICATIVI PER INTERNET

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

Reti di Telecomunicazioni LB Introduzione al corso

Chat. Si ha un server in ascolto sulla porta Quando un client richiede la connessione, il server risponde con: Connessione accettata.

Web e HTTP. path name. host name Realizzato da Roberto Savino.

Транскрипт:

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 D.: 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 Name server DNS Perché non un server DNS centralizzato?! Minor tolleranza ai guasti! Traffico eccessivo! Database centrale troppo distante in molti casi! Scarsa scalabilità!! 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 2

DNS: Root name server! 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 3 Esempio 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, dns.umass.edu, se necessario 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 4

Esempio (2) 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 root name server 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 5 DNS: richieste ripetute (iterated root name server 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 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 6

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 7 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 8

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! flag: " 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 9 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 10

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 streamoriented socket a host-local, applicationcreated/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 11 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 12

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 13 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 14

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 15 Example: Java client (TCP) import java.io.*; import java.net.*; class TCPClient { input stream client socket, connect to server 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 16

Example: Java client (TCP), cont. 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 17 Example: Java server (TCP) import java.io.*; import java.net.*; class TCPServer { welcoming socket at port 6789 Wait, on welcoming socket for contact by client 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 18

Example: Java server (TCP), cont 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 19 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 20

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(), 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 21 Example: Java client (UDP) input stream client socket Translate hostname to IP address using DNS import java.io.*; import java.net.*; 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 22

Example: Java client (UDP), cont. 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 23 Example: Java server (UDP) import java.io.*; import java.net.*; datagram socket at port 9876 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 24

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(); String capitalizedsentence = sentence.touppercase(); datagram to send to client Write out datagram to socket 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 25 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 26

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 27