application*level*fmartignon/documenti/reseauxavances/2-applications... · " chatting between...
TRANSCRIPT
Application Level o Client-Server and Peer-to-Peer Paradigmso HTTP: Web Surfingo FTP: remote connectivityo SMTP: emailingo DNS: symbolic addressingo P2P: file sharing
Some network applications■World Wide Web
■HTTP ■E-Mail:
■SMTP, Gmail ■Social networking:
■Facebook, Twitter, Instagram, Snapchat, ecc..
■P2P file sharing: BitTorrent, eMule, etc.. ■Video streaming:
■ NetFlix, YouTube, Hulu■IP Telephony:
■Skype, Hangout, etc… ■ Network games■Video conference ■Massive parallel computing■ Instant messaging ■Remote login:
■TELNET■…
Downlink traffic (North America, March 2016)
Source: www.statista.com (2016)
Designing network applications
Write programs thatn run on different end
systems, andn communicate over a
network.n e.g., Web: Web server
software communicates with browser software (FireFox, Safari, Chrome …)
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
Designing network applicationsapplicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
Little software written for devices in network coren network core devices do
not run user application code
n applications on end systems allow for rapid app development, propagation etc. (no need to change network software, only end-users/servers)
Communications among Processes
Process: program running within a host.o within same host, two processes
communicate using inter-process communication (defined by OS).
o processes in different hosts communicate by exchanging messages
Processes and Protocols
o Processes running on remote host may exchange messages and services through the network
o The application protocols define the rules and the formats of the communication between remote processes
Application Protocols
Web (web server, browser, HTML) HTTP
E-mail (mail server, mail client, MIME) SMTP
Lower layers interactiono Application protocols use the services provided
by lower layers through the SAPs (Service Access Point)
o Each application process is associated to a SAPo OSI Stack:
Presentation
Session
WEB FTP Mail
Transport
Application controlled Layer
OS controlled layers
Lower layers interactiono The application protocols communicate
directly with the transport layer
WEB FTP Mail
TCP/UDP
Application controlled Layer
OS controlled layers
o process sends/receives messages to/from its socket
o socket analogous to doorn sending process shoves
message out of the door
n sending process relies on transport infrastructure on other side of door which brings message to socket at receiving process
process
TCP withbuffers,variables
socket
host orserver
process
TCP withbuffers,variables
socket
host orserver
Internet
controlledby OS
controlled byapp developer
Sockets
o Sockets equivalent to SAPs between application and transport layers
Addressing Processes o To receive messages, a process must
have an identifiero Each host device has unique 32-bit IP
addresso Q: does IP address of host on which
process runs suffice for identifying the process?
Addressing Processes
n Answer: NO, many processes can be running on the same host
n identifier includes both IP address and port number associated with process on host
n Example port numbers (HTTP server: 80, Mail server: 25)
n to send HTTP message to www.polimi.it:o IP address: 131.175.12.34o Port number: 80
n The transport layer multiplexes several flows coming from the application layer
App-layer protocol defineso Types of messages
exchanged, n e.g., request, response
o Message syntax:n what fields in messages
& how fields are delineated
o Message semantics n meaning of information
in fieldso Rules for when and how
processes send & respond to messages
Public-domain protocols:
o defined in RFCso allows for
interoperabilityo e.g., HTTP, SMTPProprietary protocols:o e.g., KaZaA
What transport service does an app need?
Data losso some apps (e.g.,
audio) can tolerate some loss
o other apps (e.g., file transfer, telnet) require 100% reliable data transfer
Timingo some apps (e.g.,
Internet telephony, interactive games) require low delay to be “effective”
Bandwidtho some apps (e.g.,
multimedia) require minimum amount of bandwidth to be “effective”
o other apps (“elastic apps”) make use of whatever bandwidth they get
Application
file transfere-mail
Web documentsreal-time audio/video
stored audio/videointeractive gamesinstant messaging
Data loss
no lossno lossno lossloss-tolerant
loss-tolerantloss-tolerantno loss
Bandwidth
elasticelasticelasticaudio: 5kbps-1Mbpsvideo:10kbps-5Mbpssame as above few kbps upelastic
Time Sensitive
nononoyes, 100’s msec
yes, few secsyes, 100’s msecyes and no
Transport service requirements of common apps
Internet transport protocols services
TCP service:o connection-oriented:
setup required between client and server processes
o reliable transport between sending and receiving process
o flow control: sender won’t overwhelm receiver
o congestion control:throttle sender when network overloaded
o does not provide: timing, minimum bandwidth guarantees
UDP service:o unreliable data
transfer between sending and receiving process
o does not provide: connection setup, reliability, flow control, congestion control, timing, or bandwidth guarantee
Q: why bother? Why is there a UDP?
Application
e-mailremote terminal access
Web file transfer
streaming multimedia
Internet telephony
Applicationlayer protocol
SMTP [RFC 2821]Telnet [RFC 854]HTTP [RFC 2616]FTP [RFC 959]proprietary(e.g. RealNetworks)proprietary(e.g., Vonage,Dialpad)
Underlyingtransport protocol
TCPTCPTCPTCPTCP or UDP
typically UDP
Applications vs Transport Protocols
Client-Server Architecture
o The main target of the communication between remote processes is the provisioning of services
o Two functionalities can be accomplished by a process:n Request for servicesn Provide services
o If a given process accomplishes just one of the above functionalities, the communication is a client-server one
client serverrequest
response
Client-Server Architecture
o Client processes make requests and interpret responses
o Server processes interpret requests and provide the responses
o If the same host needs to issue requests and provide responses two processes are needed
Client/Server Paradigmo Differences between program and process
n Program: softwaren Process: instance of the program being executed
o A server process is continuously executed on the host (daemon) and is activated through a passive open
o A client process is activated when needed only (by the user or by some other process) through an active open
o After the passive open the server is able to handle requests from clients
o The active open requires the indication of the IP address and the port of the server
request
response
... ...
Client/Server Paradigmo Multiple clients can issues requests to a
single servero Clients may also issue multiple requests at
the same time
Client/Server Paradigm
o A client may implement both serial and parallel operation modesn Example: multiple requests can be issued
for all the files contained in a web pageo Even a server may implement both
serial and parallel operation modeso Usually, the applications using UDP are
handled serially
Client/Server Paradigm
o Usually, the servers using TCP implement parallel operation mode
o A TCP connection towards all the clients is opened for all the time needed to exchange requests/responses
o The procedure handling each client is handled via multi-threading, using fork operations
Application Protocols: Possible Architectures
o Client-servern Terminals act as clients OR as serversn Client hosts and server hosts may have
different featureso Peer-to-peer (P2P)
n All the terminals can implement the client process AND the server one
o Hybrid
Client-server architectureServer:
n always-on hostn permanent IP
addressn server farms for
scalingClients:
n communicate with server
n may be intermittently connected
n may have dynamic IP addresses
n do not communicate directly with each other
Pure P2P architectureo no always-on servero arbitrary end
systems directly communicate
o peers are intermittently connected and change IP addresses
o example: Gnutella
Highly scalable but difficult to manage
Hybrid of client-server and P2P
Skypen Internet telephony appn Finding address of remote party: centralized
server(s)n Client-client connection is direct (not through
server) Instant messaging
n Chatting between two users is P2Pn Presence detection/location centralized:
o User registers its IP address with central server when it comes online
o User contacts central server to find IP addresses of buddies
Web BrowsingHyper Text Transfer Protocol (HTTP)
HyperText Tranfer Protocol (HTTP)
o client-server architectureo clients request objects (files) identified
through a URLo servers send back the files to the clientso Stateless operation (no memory on
previous requests is mantained)
client serverHTTP request
HTTP response
• "Hypertext Transfer Protocol -- HTTP/1.0," RFC 1945, May 1996. • "Hypertext Transfer Protocol -- HTTP/1.1," RFC 2616, June 1999.• “Hypertext Transfer Protocol” Version 2 (HTTP/2), RFC 7540, May 2015.•
Message transfero HTTP relies upon TCP for message transfer
o Usually a web page is composed of a main document (HTML) and multiple linked objects
o Requests use theURL (Uniform Resource Locator)
http://www.u-psud.fr/index.html
Type of protocol
Symbolic address of theserver
Document on the server
TCP assigns port number 80 to HTTP servers
Method Host:// : Port Path/
Message transfero Suppose a client requests a composite web page
(1 main HTML document + 10 figures)
:
■Two operation modes can be adopted
■Non-persistentconnection (default mode of HTTP 1.0)
■Persistent connection(default mode of HTTP 1.1)HTML Text
Other Objects
Non-persistento One TCP connection for each request-response cycle.
The server closes the TCP connection once it has sent the requested object
o The same procedure is adopted for all the docs within the required web page
o Multiple TCP connections can be opened in parallelo The maximum number of connections can be set in the
browser configuration options
Request (index.html)
Response (index.html file)Request (image1.jpg)
Request (image2.jpg)
Persistent connectiono The server does not close the connection after the responseo The same connection can be used to transfer other objects
within the same page or even other web pageso The server closes the connection on a timeout basiso Two Flavors:
n without pipelining: the client issues a new request only upon reception of the previous response
n with pipelining: multiple requests can be issued at the same time (default mode HTTP v1.1)
Requests
Some Methods
GET To get a doc from the server. The doc is specified by the URL. The server answers with the required doc in the body of the response message
HEAD To get info on a specified doc. The server answers with the requested information
POST To post some input to the server regarding a given object identified by the URL
PUT To store a doc on the server. The doc is carried by the request message. The URL specifies the position for the doc to be stored.
■Other Methods:■ PATCH, COPY, MOVE, DELETE, LINK, UNLINK, OPTIONS.
Responses
Messages
100 Continue: Go On
.
500 Internal server error
Server failure
501 Not implemented Required functionality not supported
503 Service unavailable
Unavailable service
200 OK: Request OK, the required info is in the field of this message
302 Moved Permanently:
The required object has been moved (perm)
304 Moved Temporalily:
The required object has been moved (temp)
400 Bad Request: Generic error401 Unauthorized: Access failed due to userID or
password error404 Not Found: File not found
■1xx Informational
■2xx Success
■3xx Redirection
■4xx Client error
■5xx Server error
Headers
o headers are used to exchange further service information
o A message can carry multiple headerso Examples
Header name Header value:
Cache-control Cache infoAccept Supported formatsAccept-language Supported languagesAuthorization Client permitsIf-modified-since send doc. only if modified
User-agent user agent type
Message Exchangeo Example: request
GET /ntw/index.html HTTP/1.1 Connection: close User-agent: Mozilla/4.0 Accept: text/html, image/gif, image/jpeg Accept-language:it
HTTP/1.1 200 OK Connection: close Date: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) Last-Modified: Mon, 22 Jun 1998 09:23:24 GMT Content-Length: 6821 Content-Type: text/html data data data data data ...
o Example: response
Conditional get
Client:GET /fruit/kiwi.gif HTTP/1.0 User-agent: Mozilla/4.0 Accept: text/html, image/gif, image/jpeg If-modified-since: Mon, 22 Jun 1998 09:23:24
Server:HTTP/1.0 304 Not Modified Date: Wed, 19 Aug 1998 15:39:29 Server: Apache/1.3.0 (Unix) (empty entity body)
o Also method HEAD can be used
Network caching and proxy
o Main duty of a proxy is to provide a distributed cache memory
o If a doc is stored in a proxy near the client the download time can be reduced
Proxy
o A proxy is an application gateway, that is, it implements up to the application layer
o It must act both as a client and as a servero The final server speaks with the client on
the proxy (hiding of users)
LL
IP
TCP
HTTPUser Agent
LL
IP
TCP
HTTP
Server
LL
IP
TCP
HTTPProxy
Authenticationo HTTP is statelesso Consecutive requests from the same user
cannot be recognizedo Very simple authentication procedure based
on userID and password to be inserted in the requests
GET /ntw/index.html HTTP/1.1
401 Authorization RequiredWWW-Authenticate:[authentication type]
GET /ntw/index.html HTTP/1.1Authorization: account, passwd
GET image.gif HTTP/1.1Authorization: account, passwd
...
Cookieso The server can assign to each client a cookie number
which identifies the client in future transactionso The cookie number is stored by the client and used in
the following requests towards the same servero Used in e-commerce, among others
GET /ntw/index.html HTTP/1.1
200 OKSet-cookie:18988466
GET /ntw/basket/index.html HTTP/1.1Cookie: 18988466
GET image.gif HTTP/1.1Cookie: 18988466
...
HTML (HyperText Markup Language)
o HTTP handles the object transfer and does not account for the object format
o The visualization of the object is done through interpreter programs (browsers)
o Formatted text pages are transferred in ASCII files and are interpreted according to formatting instructions written in HTML
o HTML pages may contain references to other objects which need to be interpreted by the browser as n Part of the document to visualizen Links to other pages
o If an HTML page is stored on the server and is sent upon request, this is a static page
Dynamic WEB Pages
o If a page is created on-the-fly upon reception of a request, this is a dynamic page
o The server examines the request, executes a program associated to the request and generates the HTML page to be sent back
GET /cgi-bin/prog.pl HTTP/1.1
prog.pl
200 OK Dynamic Page
Active Web Pageso A web page may contain a program to
be executed by the cliento The program is downloaded and
executed locally by the cliento This can be used to set up interactive
pages, moving graphs, etc.
GET /java/applet HTTP/1.1
200 OK program
Page download with HTTP 1.0
o We can download an HTTP page using telnet
o 1) We just need to connect to the web server, port 80telnet www.u-psud.fr 80Trying 129.175.212.14...Connected to cmspub2.di.u-psud.fr.Escape character is '^]'.
o 2) We request (GET) a webpageGET /fr/index.html HTTP/1.0
o 3) The page is downloaded, the connection is closed
cURL
o cURL is a command-line tool for manipulating and transfer data with URLs (see http://curl.haxx.se/)
o Let’s try something:n Obtain a webpage:
o curl www.u-psud/fr/index.htmln If we only want the header of this page:
o curl –-head www.u-psud/fr/index.htmlHTTP/1.1 200 OKDate: Wed, 22 Mar 2017 08:15:53 GMTServer: Apache/2.2.15 (CentOS)Accept-Ranges: bytesX-Mod-Pagespeed: 1.12.34.1-0Vary: Accept-Encoding,User-AgentCache-Control: max-age=0, no-cacheContent-Length: 164349Connection: closeContent-Type: text/html; charset=UTF-8
cURL
o Let us monitor the exchange of files between the client and the servern curl -–trace-ascii filename.txt www.u-psud.fr/fr/index.html
o If we are interested in the request/ response time (cURLcan be used to measure the loading time of webpages):n curl -–trace-ascii filename.txt -–trace-time www.u-
psud.fr/fr/index.html
09:24:13.149793 == Info: Trying 129.175.212.14...09:24:13.151325 == Info: Connected to www.u-psud.fr (129.175.212.14) port 80 (#0)09:24:13.151396 => Send header, 90 bytes (0x5a)0000: GET /fr/index.html HTTP/1.1001d: Host: www.u-psud.fr0032: User-Agent: curl/7.43.0004b: Accept: */*0058:09:24:13.197224 <= Recv header, 17 bytes (0x11)0000: HTTP/1.1 200 OK…
File Transfer Protocol (FTP)
File Transfer Protocol (FTP)
o Used to transfer files between two remote hosts
o The application operates directly on the file system (both at the server and at the client side)
"File Transfer Protocol”, RFC 959, October 1985.
File Transfer Protocol (FTP)o Uses TCP for the transfero Two TCP connections are used for the
transfer of data and control
User Interface
Control process
Data tranfer process
LFS
Control process
Data transfer process
LFS
client
server
Port 21
Port 20
FTP: user interface
FTP: control connectiono It is opened in the usual way
n The server issues a passive open with port number 21 and waits for requests
n The client issues an active open with a dynamic port number every time it needs to transfer files
o The control connection is persistent, and remains open for the whole data transfer time
Control process
Data transfer process
LFS LFS
client serverPassive openPort 21 Control
process
Data transfer process
Active openPort 66778
FTP: Data connections
o Data connections are non-persistent, n one connection for each file to transfer, n connection closed upon completion of file transfer
o To open a data connection:1st Way:n The client issues a passive open with a dynamic port
numbern The client notifies the port number to the server on the
control connection through the PORT commandn The server issues an active open towards the specified
port of the client, using 20 as local port number2nd Way:n The client sends the PASV command to the servern The server chooses a dynamic port number, issues a
passive open and communicate the chosen port number to the client
n The client issues an active open using the port number received from the server
FTP: Data connections
o The data transfer can be accomplished in different ways and using different formats:
o File types:n ASCII n Binary:
o Transmission modes:n Stream mode: the file is sent down to TCP as a
stream of unstructured bytesn Block mode: the file is structured in blocks with
a header each, and sent down to TCP
FTP: commandso Commands are transferred in ASCII
USER usernamePASS password QUIT log out
Access CommandsCWD change directoryDELE delete fileLIST list filesRETR retrieve fileSTOR store file
File Management
TYPE file typeMODE transfer mode
PORT client portPASV server choose port
Transfer Management
Port Management
FTP: Responses125 Data connection already open; transfer starting 200 Command OK225 Data connection open226 Closing data connection227 Entering passive mode; srv. sends Ip_add.,port230 User login OK331 Username OK, password required 425 Can't open data connection 426 Connection closed; tranfer aborted452 Error writing file 500 Syntax error; unrecognized command501 Syntax error in parameters or arguments502 Command not implemented
FTP: Transfer Example
Client Server220 service ready
USER fabio
331 username OK; password ?
PASS pippo123
230 user login OK
PORT 65667
150 opening data connection
LIST /usr/pub
125 data connection OK
226 closing data connection
Data
E-mail ServiceSimple Mail Transfer Protocol (SMTP)
E-mailo Service to send textual messages in an
asynchronous way
o It is implemented through a network of mail servers using the SMTP (Simple Mail Transfer Protocol)
SMTP
o Textual protocolo Also the body of the messages needs to be
ASCIIn Binaries must be converted to ASCII
o Once a server receives a message from a user agentn Stores the message in a queuen Opens a TCP connection (port 25) with the
destination servern Sends the message
J.B. Postel, "Simple Mail Transfer Protocol," RFC 821, August 1982.
Client/Server Message exchange
S: 220 hamburger.edu C: HELO crepes.fr S: 250 Hello crepes.fr, pleased to meet you C: MAIL FROM: <[email protected]>S: 250 [email protected]... Sender ok C: RCPT TO: <[email protected]>S: 250 [email protected] ... Recipient ok C: DATAS: 354 Enter mail, end with "." on a line by itself C: Do you like ketchup? C: How about pickles? C: .S: 250 Message accepted for delivery C: QUIT S: 221 hamburger.edu closing connection
Han
dsha
ke
Message Format
o The message format is specified (command DATA)
o Some headers are added to the message
D.H. Crocker, "Standard for the Format of ARPA Internet Text Messages," RFC 822, August 1982.
From: [email protected] To: [email protected] Subject: Request of information<black line><Body>.
Multipurpose Internet Mail Extensions (MIME)
o MIME is used to allow the transfer of non-ASCII messages
•"Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies," RFC 2045, Nov. 1996. •"Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types," RFC 2046, Nov. 1996.
From: [email protected] To: [email protected] Subject: Picture of yummy crepe. MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Type: image/jpeg base64 encoded data ..... ........................ .....base64 encoded data.
Multipurpose Internet Mail Extensions (MIME)
o Coding techniques:n Base64:
o The flow of bits is divided into chunks of 24 bits eacho Each chunk is divided into 4 groups of 6 bits eacho Each chunk is interpreted as a character according
to a conversion table
11001100 10000001 00111001
110011 (51) 001000 (8) 000100 (4) 111001 (57)
01111010 01001001 01000101 00110101
Z I E 5
base64
Multipurpose Internet Mail Extensions (MIME)
o Quoted-printableo The flow of bits is divided into chunks of 8 bits eacho If a sequence corresponds to a ASCII character, it is sent
straight awayo Otherwise it is sent as three characters: “=“ followed by
the hexadecimal representation of the byte
00100110&
01001100L
10011101Non-ASCII
Quotable-printable
001110019
00100110&
01001100L =
001110019
1001 9
1101D
Multipurpose Internet Mail Extensions (MIME)
o MIME allows the transfer of multiple objects within the same message:
From: [email protected] To: [email protected] Subject: Picture of yummy crepe with commentary MIME-Version: 1.0 Content-Type: multipart/mixed; Boundary=StartOfNextPart --StartOfNextPart Dear Bob, Please find a picture of an absolutely scrumptious crepe.
--StartOfNextPart Content-Transfer-Encoding: base64 Content-Type: image/jpeg base64 encoded data .....
--StartOfNextPart Let me know if you would like the recipe..
MailBox Access Protocols
n POP3 (Post Office Protocol version 3)n IMAP (Internet Mail Access Protocol)n HTTP
n Security Issue: the protocols can run over TLS/SSL (Transport Layer Security, Secure Sockets Layer)
ESMTP
POP3
Authorization Phaseo Client Commands:
n user: usernamen pass: password
o Server Responses:n +OKn -ERR
Transaction Phase, client:o list: list mess. numbero retr: get messageo dele: delete messageo quit
C: list S: 1 498 S: 2 912 S: . C: retr 1 S: <message 1 contents>S: . C: dele 1 C: retr 2 S: <message 1 contents>S: . C: dele 2 C: quit S: +OK POP3 server signing off
S: +OK POP3 server ready C: user bob S: +OK C: pass hungry S: +OK user successfully logged on
Case History
o December 1995, S. Bhatia and J. Smith propose the first web based e-mail service (Hotmail)
o In 1 month, 100K userso In 1 year, 12M userso December 1997, Hotmail is acquired
by Microsoft for $400Mo Example of “first mover advantage”
and “viral marketing”
Remote TerminalTELNET
TELNET (TErminaL NETwork)o Remote terminal applicationo The commands are transferred through a TCP
connection
Terminaldriver
TCP
IP
LL
Telnetclient
Pseudo-terminaldriver
TCP
IP
LL
Telnetserver
Internet
TELNET (TErminaL NETwork)o TELNET transfers characters
n Data characters:o ASCII with the first byte “0”o ASCII characters with the first bite “1” (preceded
by a special control byte)n Control characters:
o 8 bit commands (first bit “1”)o examples
n IAC (255): next one is a control charactern EC (247): erase character
c a t f i l e a IAC EC 1
IAC = Interpret As CommandEC = Erase Character
TELNET (TErminaL NETwork)
Domain Name System (DNS)
Domain Name System (DNS)
o IP addresses are not suited to be used by applications
o Symbolic addresses are more convenientn Hierarchical (street, city, state)
n Independent from layer 3
o Binding is needed
131.175.21.1 morgana.elet.polimi.it
Domain Name System (DNS)
o IP networks provide a symbolic addressing service …
o … supported by a distributed database service which handles the binding: DNS (Domain Name System)
o DNS is an application layer protocol which uses UDP/IP to transfer its messages
o DNS is currently used also forn Host aliasingn Mail server aliasingn Load distribution
"Domain Names - Concepts and Facilities," RFC 1034, Nov. 1987. "Domain Names - Implementation and Specification," RFC 1035, Nov. 1987.
Symbolic Addressing
o Hierarchical Addressingo Each branch is controlled by a known
authorityo To get a symbolic address you must go
through these authorities
com edu org gov mil it fr jp de ...
ucla columbia polimi
eletcs
virgilio
rett
yahoo
morgana
morgana.elet.polimi.it
Types of Name Serverso Local Name Servers
n Directly connected to the hostsn Each ISP (residential, university, industry, etc.)
has a LNSn Talks with the Root NS
o Root Name Serversn Stores info on the addressing of big groups of
hosts and domainsn Stores info on the authoritative NS for a given
domainn Talks with the Authoritative NS
o Authoritative Name Serversn NS responsible for a specific hostname
Hierarchical DNS
Every level in the hierarchy has a different “depth” of information
Example: a user wants the IP address of www.google.com
– Root Name Servers know how to “find” the name servers that manage “.com” domains
– .com servers know how to find NS that manage domain “google.com”
– google.com Name Servers know the correspondence “symbolic name www.google.com<--->IP Address”
Root NS
How To resolve a binding
o Every host knows (has configured) the Local NS (LNS) address
o Each request for resolving a binding is sent to the local NS using UDP
o The LNS gets the info and answers
HOST Local NS
DNS request
DNS response DNS Network
Stored Infoo Type
n A: Name is a host name and Value is the IP address(morgana.elet.polimi.it, 131.175.21.1, A, TTL)
n NS: Name is a domain and Value is the symbolic name of a server which knows how to resolve the name(elet.polimi.it, morgana.elet.polimi.it, NS, TTL)
n CNAME: Name is an alias and Value is the real name(www.polimi.it, zephyro.rett.polimi.it, CNAME, TTL)
n MX: Name is a mail domain or a mail alias and Value is the name of the mail server(elet.polimi.it, mailserver.elet.polimi.it, MX,TTL)
Name, Value, Type, TTL
Database Organizationo ARPANET was using a central databaseo Internet uses a distributed database structureo Branches are divided into zones and each zone is
associated to a DNSo The server of a zone is authoritative for that zone
com edu org gov mil it fr jp de ...
ucla columbia polimi
eletcs
virgilio
rett
yahoo
morgana
How to get Infoo Recursive Way:
n Requests travel along the hierarchy
n Responses travel the opposite direction
Source: Computer Networking, J. Kurose
How to get Infoo Iterative Way:
o A server can notify the name of another server where to get the info from
Caching
o A server can cache a info temporarily
o If a request is issued regarding cached info, the server can answer even if it is not authoritative for that specific info
o TTL is set by the authoritative server to advertise the “freshness” of a piece of info
o The non-authoritative server uses the TTL to set a validity timer for the cached info
DNS Messages
o identification: identifies the couple request/response
o flag: request/response, authoritative/non auth., iterative/recursive
o number of: field sin the following header sections
o questions: name to resolve (usually A or MX)
o answers: complete resource records
o authority: contains other record provided by other servers
o additional info
Binary Format (not ASCII)
How to add a new domain to the Internet
o A new startup, I-Like-Networking wants to register the domain I-Like-Networking.com(let us suppose this domain is free)
o The startup will register this domain in one of the DNS Registrarsn I-Like-Networking must give to the DNS registrar
the symbolic name and the corresponding IP address of the authoritative Name Server(s)
n The DNS registrar inserts two Resource Records in the TLD (Top Level Domain) server .com
I-‐Like-‐Networking, dsn1.I-‐Like-‐Networking.com, NS dns1.I-‐Like-‐Networking.com, 212.212.212.1, A
n The DNS registrar eventually writes a record (of type MX) for I-Like-Networking.com
Simple DNS experimentso Using the command nslookup which permits
to send requests to a given DNS servern man nslookup
o To find the correspondence of a symbolic name:n nslookup www.u-psud.fr
o To find authoritative Name Servers for a given name:n nslookup –type=NS www.u-psud.fr
Simple DNS experimentsnslookup
o To find authoritative Name Servers for a given name:n nslookup –type=NS www.u-psud.fr
Server: 129.175.3.2Address: 129.175.3.2#53
Non-authoritative answer:www.u-psud.fr canonical name = cmspub2.di.u-psud.fr.
Authoritative answers can be found from:di.u-psud.frorigin = dns1.u-psud.frmail addr = dns.u-psud.frserial = 2009095455refresh = 1200retry = 3600expire = 1209600minimum = 3600
Simple DNS experimentsdig command
o The “dig” command (similar to nslookup) gives more detail on the DNS protocoln Let us try a simple query: dig www.u-sud.fr
; <<>> DiG 9.8.3-P1 <<>> www.u-psud.fr;; global options: +cmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15084;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 3, ADDITIONAL: 6
;; QUESTION SECTION:;www.u-psud.fr. IN A
;; ANSWER SECTION:www.u-psud.fr. 2235 IN CNAME cmspub2.di.u-psud.fr.cmspub2.di.u-psud.fr. 2235 IN A 129.175.212.14
;; AUTHORITY SECTION:di.u-psud.fr. 1494 IN NS ext1.u-psud.fr.di.u-psud.fr. 1494 IN NS dns1.u-psud.fr.di.u-psud.fr. 1494 IN NS dns2.u-psud.fr.
Header of the DNS message
Description of the request
Answer
Authoritative servers for the request
Simple DNS experimentsdig command
;; ADDITIONAL SECTION:dns1.u-psud.fr. 583 IN A 129.175.34.24dns1.u-psud.fr. 583 IN AAAA 2001:660:3201::2dns2.u-psud.fr. 583 IN A 129.175.36.26dns2.u-psud.fr. 583 IN AAAA 2001:660:3201::3ext1.u-psud.fr. 285 IN A 91.121.18.203ext1.u-psud.fr. 3285 IN AAAA 2001:41d0:1:65cb::1
;; Query time: 9 msec;; SERVER: 129.175.3.2#53(129.175.3.2);; WHEN: Wed Mar 22 11:36:27 2017;; MSG SIZE rcvd: 261
Additional information
Performance information on the request
CDNs – Content Distribution Networks
o Problem: how to efficiently distribute content, at the same time, to several users very far from each oterh
o Solution: create a network of geographically distributed servers that “host” a copy of the request content (a big “distributed cache”) –
o The network of servers (CDN) can be owned by the service provider (Google, Netflix, Facebook) or by third parts (Akamai, Limelight …)
CDNs – Content Distribution Networks
o DNS is used to redirect users’ requests to the “best” server, in terms of:
o Closest: choose the server geographically closest to the client
o Shortest path: choose the server reachable with the least number of hops towards the client
o Let the client choose: the service gives a list of possible servers and the client chooses the “best” (Netflix)
Peer-to-Peer Exchange
P2P file sharingExampleo Alice runs P2P client
application on her notebook computer
o Intermittently connects to Internet; gets new IP address for each connection
o Asks for “Hey Jude”o Application displays
other peers that have copy of Hey Jude.
o Alice chooses one of the peers, Bob.
o File is copied from Bob’s PC to Alice’s notebook: HTTP
o While Alice downloads, other users uploading from Alice.
o Alice’s peer is both a Web client and a transient Web server.
All peers are servers = highly scalable!
P2P: centralized directory
Original “Napster” design
1) when peer connects, it informs the central server:n IP addressn content
2) Alice queries for “Hey Jude”
3) Alice requests file from Bob
centralizeddirectory server
peers
Alice
Bob
1
1
1
12
3
P2P: problems with centralized directory
o Single point of failure
o Performance bottleneck
o Copyright infringement
file transfer is decentralized, but locating content is highly centralized
Query flooding: Gnutellao Fully distributed
n no central servero public domain
protocolo many Gnutella
clients worldwide
Overlay network: grapho edge between peer X
and Y if there’s a TCP connection
o all active peers and edges are overlay net
o Edge is not a physical link
o Given peer will typically be connected with < 10 overlay neighbors
Gnutella: protocol
QueryQueryHit
QueryQueryHit
File transfer:HTTP❒ Query message
sent over existing TCPconnections❒ peers forwardQuery message❒ QueryHit sent over reversepath
Scalability:limited scopeflooding
Gnutella: Peer joining
1. Joining peer X must find some other peer in Gnutella network: to use list of candidate peers
2. X sequentially attempts to make TCP with peers on list until connection setup with Y
3. X sends Ping message to Y; Y forwards Ping message.
4. All peers receiving Ping message respond with Pong message
5. X receives many Pong messages. It can then setup additional TCP connections
Exploiting heterogeneity: KaZaA
o Each peer is either a group leader or assigned to a group leader.n TCP connection
between peer and its group leader.
n TCP connections between some pairs of group leaders.
o Group leader tracks the content in all its children.
ordinary peer
group-leader peer
neighoring relationshipsin overlay network
KaZaA: Querying
o Each file has a hash and a descriptoro Client sends keyword query to its group
leadero Group leader responds with matches:
n For each match: metadata, hash, IP addresso If group leader forwards query to other
group leaders, they respond with matcheso Client then selects files for downloading
n HTTP requests using hash as identifier sent to peers holding desired file