Application Layer 2-1
Chapter 2Application Layer
Part of slides provided by J.F Kurose and K.W. Ross, All Rights Reserved
Communication NetworksP. Demeester
Computer networking -A top-down approach featuring the internet4th Edition, 2008Addison WesleyJames F. Kurose, Keith W. RossISBN 0-321-49770-8
Application Layer 2-2
TCP-Connection
Internet Protocol
10 Mbit/s local area network
router
100 Gbit/s WDM transatlantic optical cable
2 Mbit/sISDN linklocal telephone
switch
56.6 kbit/smodem connection
140 Mbit/sPDH link
IP-datagram
client server
RFC 1011 : “Internet Protocols”
URL: www.ietf.org
IETF webpage
find info about Internet on the Web !
Remote login : TelnetWeb access : HTTPFile transfer : FTP
E-mail : SMTP/POP/IMAPAddress resolution : DNS
Focus : Application Layer
Application Layer 2-3
Chapter 2 outline
2.1 Principles of app layer protocols
2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail 2.5 DNS
Application Layer 2-4
Application : communicating, distributed processes (e.g. e-mail, Web, P2P file sharing, …)
Applications offer services to human users (or other applications) via a User Interface: Text-oriented User Interface (Telnet, FTP)
Graphical User Interface (GUI) (WWW)
Applications use an application-layer protocol to implement these services(protocol commands “independent” of user interface)
The application layer is the collection of these protocols (FTP, SMTP, POP, IMAP, HTTP, etc.)
Example : FTP user interface : PUT and GETor drag-and-drop
FTP protocol : STOR and RETR
Applications and application-layer protocols
Application Layer 2-5Note : server program <> server-class computer
APPLICATIONCLIENT
HTMLdocuments
Application Layer Protocol
...
Webbrowser GUI
communicatingprocesses
transport
network
data link
physical
terminal
network
data link
physical
data link
physical
router
network
data link
physical
data link
physical
router
transport
network
data link
physical
terminal
APPLICATIONSERVER
HTMLdocuments
Application Layer Protocol
...
Web server GUI
API:socket interface
Applications and application-layer protocols
Application Layer 2-6
Processes communicating across network
process sends/receives messages to/from its socket (=SAP)
socket analogous to door sending process shoves
message out door sending process assumes
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
API or socket : (1) choice of transport protocol; (2) ability to fix a few parameters
Application Layer 2-7
Application-layer protocol defines:
Types of messages exchanged, e.g., request & response messages
Syntax of message types: what fields in messages & how fields are delineated
Semantics of the fields, i.e., meaning of information in fields
Rules for when and how processes send & respond to messages
Public-domain protocols:
defined in RFCs allows for
interoperability eg, HTTP, SMTPProprietary protocols: eg, KaZaA
Application Layer 2-8
Application Client - Server
CLIENT : “active open”• invoked directly by user• local on user’s personal computer• actively initiates contact with server• one session at a time• access multiple services as needed• simple hardware and software• e.g. : Eudora, Internet Explorer
SERVER : “passive open”• special purpose program for one service• can handle multiple remote clients at same time• runs on a shared computer• waits passively for contact from arbitrary remote client• powerful hardware and sophisticated operating system• server program also called daemon (e.g. FTP daemon)• e.g.: Apache, Sendmail
• Information can flow in both directions between client and server• An application program can act as client and server
application
transportnetworkdata linkphysical
application
transportnetworkdata linkphysical
reply
request
Application Layer 2-9
CLIENT 2CLIENT N
server
request reception and thread creation
request handler 1
network
request handler 2 ... request
handler N
IP address: 157.193.122.12TCP protocol: 6HTTP port: 1173
IP address: 157.193.122.112TCP protocol: 6HTTP port: 1212
IP address: 134.182.113.65TCP protocol: 6HTTP port: 1540
CLIENT 1
IP address: 148.35. 2.205TCP protocol: 6HTTP port: 80
thre
ad
pool
Dynamic Server Process creation
Application Layer 2-10
What transport service does an app need?
Data loss some apps (e.g., audio)
can tolerate some loss other apps (e.g., file
transfer, telnet) require 100% reliable data transfer
Timing some apps (e.g.,
Internet telephony, interactive games) require low delay to be “effective”
Bandwidth some apps (e.g.,
multimedia) require minimum amount of bandwidth to be “effective”
other apps (“elastic apps”) make use of whatever bandwidth they get
Application Layer 2-11
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
Application Layer 2-12
Internet transport protocols services
TCP service: connection-oriented: setup
required between client and server processes
reliable transport between sending and receiving process
flow control: sender won’t overwhelm receiver
congestion control: throttle sender when network overloaded
does not provide: timing, minimum bandwidth guarantees
UDP service: unreliable data
transfer between sending and receiving process
does not provide: connection setup, reliability, flow control, congestion control, timing, or bandwidth guarantee
Application Layer 2-13
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., Dialpad)
Underlyingtransport protocol
TCPTCPTCPTCPTCP or UDP
typically UDP
Internet apps: application, transport protocols
Application Layer 2-14
TCP connectionTCP
Telnetclient
TCP
Telnetserver
Login shell(ksh, csh, command.com)
‘a’‘a’
‘a’‘a’
‘a’‘a’
ACK
‘a’
ACK
‘a’
‘a’
I/O : keyboard
screen
Telnetclient
program
socket interface
login shellTelnetserver
program
socket interface
‘a’
a
login on a remote machine(different location, different operating system)
Note : a socket connection has to be set up before info can be exchanged
Simple example : Telnet
Application Layer 2-15
Echo example$ telnet eduserv2 7Trying 157.193.40.10...Connected to eduserv2.rug.ac.be.HalloHallo^C
Daytime example$ telnet eduserv2 13Trying 157.193.40.10...Connected to eduserv2.rug.ac.be.Mon Oct 2 14:27:43 1998Connection closed by foreign host.
• standard Telnet port : 23==> in general response is prompt for “login: ” and “password: ”
(does not belong to Telnet protocol)• also other ports possible (server side should not run Telnet deamon)
example : ECHO (port 7), DAYTIME (port 13), HTTP (80), …
Telnet client : - send characters from keyboard- show received characters on display
Ask creation of a socket to eduserv2 at port 7first name to address translation is done : 157.193.40.10
then connection is set-up
We type Hallo and see it on the display (Telnet operation)We receive it a second time on the display (Echo operation)
^C will close the connection
Simple example : Telnet
Application Layer 2-16
Chapter 2 outline
2.1 Principles of app layer protocols 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail 2.5 DNS
Application Layer 2-17
First some jargon Web page consists of objects Object can be HTML file, JPEG image, Java
applet, audio file,… Web page consists of base HTML-file which
includes several referenced objects Each object is addressable by a URL Example URL:
www.ibcn.intec.UGent.be/courses/CommNet.html
host name path name
Web and HTTP
Application Layer 2-18
HTTP: hypertext transfer protocol
Web’s application layer protocol
client/server model client: browser that
requests, receives, “displays” Web objects
server: Web server sends objects in response to requests
HTTP 1.0: RFC 1945 HTTP 1.1: RFC 2068
PC runningExplorer
Server running
Apache Webserver
HTTP requestHTTP response
Mac runningNavigator
HTTP request
HTTP response
HTTP overview
Application Layer 2-19
HTTP overview (continued)
Uses TCP: server is listening (open
socket) client initiates TCP connection
(creates socket) to server, port 80
server accepts TCP connection from client
HTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server)
TCP connection closed
HTTP is “stateless” server maintains no
information about past client requests
Protocols that maintain “state” are complex!
past history (state) must be maintained
if server/client crashes, their views of “state” may be inconsistent, must be reconciled
aside
Application Layer 2-20
Web page example CommNet.html
ietf.gif
rug.gif
atlantis.gif
intec.gif
(contains text, references to 4
gif images)
Application Layer 2-21
HTTP connections
Nonpersistent HTTP At most one object is
sent over a TCP connection.
HTTP/1.0 uses nonpersistent HTTP
Persistent HTTP Multiple objects can
be sent over single TCP connection between client and server.
HTTP/1.1 uses persistent connections in default mode
Application Layer 2-22
Suppose user enters URL www.ibcn.intec.UGent.be/courses/CommNet.html
1a. HTTP client initiates TCP connection to HTTP server (process) at www.ibcn.intec.UGent.be on port 80
1b. HTTP server at host www.ibcn.intec.UGent.be waiting for TCP connection at port 80 “accepts” connection, notifying client
3. HTTP server receives request message, forms response message containing requested object, and sends message into its sockettime
2. HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants object courses/CommNet.html
Nonpersistent HTTP
Application Layer 2-23
5. HTTP client receives response message containing html file, displays html and closes TCP connection. Parsing html file, finds 4 referenced .gif objects
6. Steps 1-5 repeated for each of 4 gif objects
time
4. HTTP server closes TCP connection.
Nonpersistent HTTP (cont.)
Application Layer 2-24
Response time modeling
one RTT to initiate TCP connection
one RTT for HTTP request and first few bytes of HTTP response to return
file transmission timetotal = 2RTT+transmit
time
initiate TCPconnection
RTT
requestfile
RTT time to transmit filefile
received
time time
Definition of RTT (Round Trip Time) : time to send a small packet to travel from client to server and back.
e.g.: 50 msec RTT, 1 kB (1000 x 8)/0.1 = 80 kb/s
Application Layer 2-25
Nonpersistent HTTP issues: requires 2 RTTs per object OS must work and allocate
host resources for each TCP connection
but browsers often open parallel TCP connections to fetch referenced objects
Persistent HTTP server leaves connection
open after sending response
subsequent HTTP messages between same client/server are sent over connection
Persistent without pipelining: client issues new request
only when previous response has been received
one RTT for each referenced object
Persistent with pipelining: default in HTTP/1.1 client sends requests as
soon as it encounters a referenced object
as little as one RTT for all the referenced objects
Persistent HTTP
Application Layer 2-26
HTTP : Request Messagemethod URL versionSP CR/LFSP
header field name valueCO CR/LF
CR/LF
Entity Body
header field name valueCO CR/LF
...request line
new line
header lines
method : GET, POST, HEAD (e.g.: GET http://www.ietf.org/ HTTP/1.0)
header : connection : indicate if the TCP connection should be closed after the transfer
user-agent : software used on client side (e.g. Mozilla/4.0)
accept : list of what formats are acceptable (e.g. text/html, image/gif, image/jpeg)
accept-language : preferred language to receive information (e.g.: fr)
used with POST(e.g. when a form is filled and transferred with the request)
GET http://www.ietf.org/ HTTP/1.0Connection: closeUser-agent: Mozilla/4.0Accept: text/html, image/gif, image/jpegAccept-language: fr
Application Layer 2-27
Uploading form input
Post method: Web page often
includes form input Input is uploaded to
server in entity body
URL method: Uses GET method Input is uploaded in
URL field of request line:
www.somesite.com/animalsearch?monkeys&banana
Application Layer 2-28
Method types
HTTP/1.0 GET POST HEAD
asks server to leave requested object out of response
HTTP/1.1 GET, POST, HEAD PUT
uploads file in entity body to path specified in URL field
DELETE deletes file specified
in the URL field
Application Layer 2-29
HTTP : Response Message
version : HTTP/1.0 or HTTP/1.1status code : numberphrase : explanation of status codeheader : Connection: , Date: , Server: , Last-Modified: ,
Content-Length: , Content-Type: , ...
version Status code phraseSP CR/LFSP response line
CR/LF new line
header field name valueCO CR/LF
header field name valueCO CR/LF
... header lines
Entity Body the requested information
HTTP/1.1 200 OKDate: Fri, 18 Feb 2000 15:46:11 GMTServer: Apache/1.3.6 (Unix)Last-Modified: Tue, 21 Dec 1999 13:44:47 GMTETag: "a-8ae-385f844f"Accept-Ranges: bytesContent-Length: 2222Connection: closeContent-Type: text/html
Application Layer 2-30
HTTP response status codes
200 OK request succeeded, requested object later in this
message
301 Moved Permanently requested object moved, new location specified later
in this message (Location:)
400 Bad Request request message not understood by server
404 Not Found requested document not found on this server
505 HTTP Version Not Supported
In first line in server->client response message.A few sample codes:
Application Layer 2-31
HTTP example$ telnet www.UGent.be 80Trying 157.193.40.33...Connected to sangoku.ugent.be.GET HTTP://www.UGent.be/ HTTP/1.0 HTTP/1.1 200 OKDate: Fri, 18 Feb 2000 15:46:11 GMTServer: Apache/1.3.6 (Unix)Last-Modified: Tue, 21 Dec 1999 13:44:47 GMTETag: "a-8ae-385f844f"Accept-Ranges: bytesContent-Length: 2222Connection: closeContent-Type: text/html <html> <head> <title>UNIVERSITEIT GENT - UNIVERSITY OF
GHENT</title> <style type="text/css"> ... </style></head>
<body bgcolor="#000066" link="#cccccc" vlink="#cccccc" alink="#666666">
...</body></html>Connection closed by foreign host
connection set-up
request to get UGent homepage
reply header
HTML documentUGent homepage
close connection
Application Layer 2-32
User-server interaction: authorization
Authorization : control access to server content
authorization credentials: typically name, password
stateless: client must present authorization in each request authorization: header line in
each request if no authorization: header,
server refuses access, sends WWW authenticate:
header line in response
usual http request msg401: authorization req.
WWW authenticate:
usual http request msg
+ Authorization: <cred>usual http response
msg
usual http request msg
+ Authorization: <cred>usual http response
msg
client server
time
Application Layer 2-33
Cookies: keeping “state”
Many major Web sites use cookies
Four components:1) cookie header line in
the HTTP response message
2) cookie header line in HTTP request message
3) cookie file kept on user’s host and managed by user’s browser
4) back-end database at Web site
Example: Susan access Internet
always from same PC She visits a specific e-
commerce site for first time
When initial HTTP requests arrives at site, site creates a unique ID and creates an entry in backend database for ID
Application Layer 2-34
Cookies: keeping “state” (cont.)
client server
usual http request msgusual http response
+Set-cookie: 1678
usual http request msg
cookie: 1678usual http response
msg
usual http request msg
cookie: 1678usual http response msg
cookie-specificaction
cookie-spectificaction
servercreates ID
1678 for user
access
acce
ss
Cookie file
amazon: 1678ebay: 8734
Cookie file
ebay: 8734
Cookie file
amazon: 1678ebay: 8734
one week later:
entry in backend
database
CP_GUTC128.107.241.139.211311061359797259cisco.com/0203749184031418710307135939229583073*
Application Layer 2-35
Cookies (continued)
What cookies can bring:
authorization shopping carts recommendations user session state
(Web e-mail)
Cookies and privacy: cookies permit sites to
learn a lot about you you may supply name
and e-mail to sites search engines use
redirection & cookies to learn yet more
advertising companies obtain info across sites
aside
Application Layer 2-36
Goal: don’t send object if client has up-to-date cached version
client: specify date of cached copy in HTTP requestIf-modified-since: <date>
server: response contains no object if cached copy is up-to-date: HTTP/1.0 304 Not Modified
client server
HTTP request msgIf-modified-since:
<date>
HTTP responseHTTP/1.0
304 Not Modified
object not
modified
HTTP request msgIf-modified-since:
<date>
HTTP responseHTTP/1.0 200 OK
<data>
object modified
Conditional GET: client-side caching
Application Layer 2-37
Chapter 2 outline
2.1 Principles of app layer protocols 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail 2.5 DNS
Application Layer 2-38
FTP: the file transfer protocol
transfer file to/from remote host client/server model
client: side that initiates transfer (either to/from remote)
server: remote host ftp: RFC 959 ftp server: port 21 (control), port 20 (data)
file transfer FTPserver
FTPclient
local filesystem
remote filesystem
FTPuser
interfaceuser
at host
Application Layer 2-39
FTP: separate control, data connections FTP client contacts FTP server
at port 21, specifying TCP as transport protocol
Client obtains authorization over control connection
Client browses remote directory by sending commands over control connection.
When server receives a command for a file transfer, the server opens a TCP data connection to client
After transferring file, server closes data connection
Server opens a new TCP data connection to transfer another file.
FTPclient FTP
server
TCP control connection
port 21
TCP data connection
port 20
Control connection: “out of band”
FTP server maintains “state”: current directory, earlier authentication
USER, PASS, PWD, CWD, LIST, PORT, RETR, STOR, QUIT
Application Layer 2-40
FTP commands, responses
Sample commands: sent as ASCII text over
control channel USER username PASS password LIST return list of file in
current directory RETR filename retrieves
(gets) file STOR filename stores
(puts) file onto remote host
Sample return codes status code and phrase
(as in HTTP) 331 Username OK,
password required 125 data connection
already open; transfer starting
425 Can’t open data connection
452 Error writing file
Application Layer 2-41
FTP example
$ Telnet ftp.microsoft.com 21220 CPMSFTFTPA06 Microsoft FTP Service (Version 5.0).Connected to: MicrosoftUSER anonymous331 Anonymous access allowed, send identity (e-mail name) as password.PASS230-This is FTP.MICROSOFT.COM Please see the dirmap.txt230-file for more information.230 Anonymous user logged in.SYST215 Windows2000PWD257 "/" is current directory.TYPE A200 Type set to A.PORT 157,193,122,155,4,18200 PORT command successful.LIST150 Opening ASCII mode data connection for /bin/ls.226 Transfer complete.
CWD /products/250 CWD command successful.TYPE A200 Type set to A.PORT 157,193,122,155,4,19200 PORT command successful.LIST150 Opening ASCII mode data connection for /bin/ls.226 Transfer complete.
Application Layer 2-42
FTP example
Application Layer 2-43
Chapter 2 outline
2.1 Principles of app layer protocols 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail
SMTP, POP3, RFC822, IMAP 2.5 DNS
Application Layer 2-44
Electronic mail
SMTPPort 25
SMTPPort 25
POP3Port 110
User agent (UA)Email client
(e.g. Pine, Eudora)
Internet SMTP
Simple Mail Transfer Protocol
Post Office Protocol
there may be intermediate
MTA’s
Message Transfer Agent (MTA)Email server, SMTP server(e.g. sendmail)
mailserver
mailserver
user mailbox
outgoing message queue
SMTP
POP3
Application Layer 2-45
SMTP (Simple Mail Transfer Protocol) : transfer e-mail message from UA to MTA or between MTAs
POP3 (Post Office Protocol 3)retrieve e-mail from MTA
IMAP (Internet Message Access Protocol)advanced retrieve of e-mail from MTAintelligence in MTA (also advanced database structure)
RFC 822 (message format)format of a plain text message
MIME (Multipurpose Internet Mail Extensions)format and coding of non plain text messages (e.g. JPEG, Word) and split into several sub-messages (e.g. attachments)
Electronic mail protocols/formats
Application Layer 2-46
telnet mailserver 25
Trying 157.193.84.4...Connected to mailserver.intec.rug.ac.be.Escape character is '^]'.220 mailserver.intec.rug.ac.be ESMTP Sendmail 8.9.0/8.9.0; Fri, 11 Feb 2000 10:36:18 +0100 (MET)
acnet0:/home/staff/janedoe$
HELO intec.rug.ac.be250 mailserver.intec.rug.ac.be Hello acnet0.intec.rug.ac.be [157.193.84.63], pleased to meet you
MAIL FROM:<[email protected]>
250 <[email protected]>... Sender ok
RCPT TO:<[email protected]>
250 <[email protected]>... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
Subject: example messageJohn,hier een kleine test-boodschap..250 KAA29013 Message accepted for delivery
Electronic mail : SMTP
Application Layer 2-47
intec2:home/staff/johndoe$ telnet allserv 110
Trying 157.193.40.42...Connected to allserv.rug.ac.be.Escape character is '^]'.+OK QPOP (version 2.2) at allserv.rug.ac.be starting. <[email protected]>USER johndoe
+OK Password required for johndoe.
PASS <right password>
+OK johndoe has 145 messages (8421978 octets).
STAT
+OK 145 8421978
LIST 125
+OK 125 1596
RETR 125
+OK 1596 octets< RFC822-headers + MIME-headers + message contents> (see next slide)
POP3 (also HTTP) : pull protocol <> SMPT : push protocol
Electronic mail : POP3
Application Layer 2-48
IMAP (Internet Message Access Protocol)
Keep all messages in one place: the server
Allows user to organize messages in folders
IMAP keeps user state across sessions: names of folders and mappings between
message IDs and folder name
IMAP3 (port 220) SMTP(port 25)IMAPmail
server+ archive
Web based e-mail access : HTTP protocol
Application Layer 2-49
Mail message format
RFC 822: standard for text message format:
header lines, e.g., To: From: Subject:different from SMTP commands
! body
the “message”, ASCII characters only
header
body
blankline
Application Layer 2-50
MIME (Multipurpose Internet Mail Extensions) : multimedia mail extension, RFC 2045, 2056
additional lines in msg header declare MIME content type
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
MIME version
method usedto encode data
multimedia datatype, subtype,
parameter declaration
encoded data
Message format: multimedia extensions
Application Layer 2-51
Mail message format exampleReturn-Path: <[email protected]>Delivered-To: [email protected]: from mserv.rug.ac.be (mserv.rug.ac.be [157.193.40.37]) by allserv.rug.ac.be (8.9.3/8.9.3) with ESMTP id RAA19192 for <[email protected]>; Fri, 11 Feb 2000 10:39:45 +0100
(MET)Received: from mailserver.intec.rug.ac.be (mailserver.intec.rug.ac.be
[157.193.84.3]) by mserv.rug.ac.be (8.9.3/8.9.3) with ESMTP id RAA21860 for <[email protected]>; Fri, 11 Feb 2000 10:39:19 +0100 (MET)Received: from acnet0.intec.rug.ac.be (acnet0.intec.rug.ac.be
[157.193.84.63]) by mailserver.intec.rug.ac.be (8.9.3/8.9.3) with SMTP id RAA19039 for <[email protected]>; Fri, 11 Feb 2000 10:38:41 +0100 (MET)Date: Fri, 11 Feb 2000 10:38:41 +0100 (MET)From: Jane Doe <[email protected]>Subject: example messageMessage-Id: <[email protected]>MIME-Version: 1.0Content-Type: textContent-Length: 34
John,hier een kleine test-boodschap..
RFC 822headers
MIMEheaders
Message
Application Layer 2-52
<RFC822 headers left away>Mime-Version: 1.0Content-Type: multipart/mixed; boundary="=====================_909671503==_"X-UIDL: 8adae81620fdf73614975fcaa08a3ed5Status: OX-Status: --=====================_909671503==_Content-Type: text/plain; charset="us-ascii"
John,This is an email message with two attached MS-Word documents.
--=====================_909671503==_Content-Type: application/msword; name="MIMEtest1.doc"; x-mac-type="42494E41"; x-mac-creator="4D535744"Content-Transfer-Encoding: base64Content-Disposition: attachment; filename="MIMEtest1.doc"
0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAABAAAAIQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...AAAAAAAAAAAAAAAAAAAAAAAAAA==--=====================_909671503==_Content-Type: application/msword; name="MIMEtest2.doc"; x-mac-type="42494E41"; x-mac-creator="4D535744"Content-Transfer-Encoding: base64Content-Disposition: attachment; filename="MIMEtest2.doc"
0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAABAAAAIQAAAAAAAAAAEAAAIwAAAAEAAAD+////AAAAACAAAAD/////////////////////////////////////////////...AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==--=====================_909671503==_--.
RFC 822 headers
MIMEheader
Message
Attachment1
Attachment2
MIMEheader
MIMEheader
End Of Message
Mail message format example
Les 3-4
Application Layer 2-53
Chapter 2 outline
2.1 Principles of app layer protocols 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail 2.5 DNS
Application Layer 2-54
DNS : application layer protocol using distributed database to provide name to address translation
• Two possible identifications : name or address• Name : used by Internet users• Address : used by Internet hardware
Address : 4 bytes (4 numbers with values between 0 and 255)example : 157.193.40.7 (corresponding to inf6serv.ugent.be server)
advantage : fixed limited length, hierarchical, easy to handle in the network, physical structure of the network
Name : mnemonic : xxx.xxx. … .xxx- example : intec.ugent.be- advantage : readable, independence of name and address,
logical structure of an organization
Some examples (at INTEC): www.intec.ugent.be <==> 157.193.173.228 (Web server) [<==> webserver3.intec.ugent.be]mail.intec.ugent.be <==> 157.193.172.4 (Mail server) [<==> mail-tech.intec.ugent.be]mail2.intec.ugent.be <==> 157.193.214.4 (Mail server) [<==> plinius.intec.ugent.be]plato.intec.ugent.be <==> 157.193.173.140 (a host)
DNS : Domain Name System
Application Layer 2-55
rug.ac.be
• hierarchical• distributed assignment• relative distinguished names• logical structure of organization
root
com edu org fr... be
ac alcatelgov
rug vub kuleuven
intec2 elistelin
ac comlucent alcatel
beckket ovidius
dom
ain
host
ovidius.intec2.rug.ac.be
recently : rug.ac.be ugent.be
DNS : Domain Name System
Application Layer 2-56
• different names for same IP address : aliaseswww.intec.ugent.be and webserver3.intec.ugent.be
• different IP addresses for one namewww.cnn.com : Addresses: 64.236.24.20, 64.236.24.28, 64.236.16.20, 64.236.16.52,
64.236.16.84, 64.236.16.116, 64.236.24.4, 64.236.24.12
• absolute name : intec.ugent.be.full name specification (up to highest level) : end with a “.”
• relative name : intec.ugentonly lower level specified (higher level is known from the context)
• location of name server should not be within the domaine.g. ugent.be has a (back-up) name server at ns.belnet.be (193.190.198.10)
• transport layer : UDP for DNS queries and answers• transport layer : TCP for zone transfers
(=exchange of data between name servers)
DNS : Domain Name System
Application Layer 2-57
Questions to be answered : -1- What is the IP address of tacitus.intec.ugent.be ?-2- Who is the name server for the “ugent.be” domain ?-3- Who is the mail server for [email protected] ?-4- What is the canonical name of mail.intec.ugent.be ?
DNS : Domain Name System
Application Layer 2-58
• Resolver : local program (client side) sending out a mapping request
(allserv.ugent.be ?) to local name server
resolver
client
LocalDNS server
16
RootDNS server
2
5
AuthoritativeDNS server
3
recursive
• Local name server (default name server) : handles request from client
contacts other name server(s) to resolve the name• Root name server : top level root server (13 in total)• Authoritative name server : where host (requested name) is registered
(at least two authoritative name servers for each host)
allserv.ugent.be ?
4157.193.40.42
b USC-ISI Marina del Rey, CAl ICANN Marina del Rey, CA
e NASA Mt View, CAf Internet Software C. Palo Alto, CA
i NORDUnet Stockholm
k RIPE London
m WIDE Tokyo
a NSI Herndon, VAc PSInet Herndon, VAd U Maryland College Park, MDg DISA Vienna, VAh ARL Aberdeen, MDj NSI (TBD) Herndon, VA
DNS : mapping name to address
Application Layer 2-59
resolver
client
LocalDNS server
18
RootDNS server2
3
AuthoritativeDNS server
67
iterative
IntermediateDNS server
4
5
DNS : mapping name to address
Application Layer 2-60
resolver
client
LocalDNS server
18
RootDNS server2
3
AuthoritativeDNS server
56
iterative + recursive
IntermediateDNS server
4
7
caching of name/address translation pairs• caching in intermediate name servers• improve delay performance of name/address translation• reduce number of DNS queries on the network• cached record is valid limited in time (few days)
DNS : mapping name to address
Application Layer 2-62
How to store information in the DNS databases ? Resource Record (RR) :
[name], [TTL], [class], record-type, record-data
name : name to be resolvedTTL : how long record may be cachedclass : IN (for Internet)record-type : e.g.: NS, A, MX, CNAMErecord-data : e.g.: IP address
What to store in a DNS :- list of the worldwide root servers - list of names (host, name server, …) and their corresponding address- alias names and their canonical name- list of addresses and their corresponding names (for inverse look-up)- ...
DNS : Resource Records (RR)
Application Layer 2-63
Record-Types / Record-Data :
A : the name is a hostname and the record-data is the IP-addressplinius.intec.ugent.be IN A 157.193.214.4
NS : the name is a domain and the record-data is the hostname of a server that knows how to obtain the IP addresses in that domain
ugent.be IN NS ugdns1.ugent.be (authoritative name server for ugent.be)
intec2.ugent.be IN NS ugdns1.ugent.be (intermediate name server for intec2.ugent.be)
CNAME : the name is an alias for a hostname and the record-data is the corresponding canonical hostname
mail2.intec.ugent.be IN CNAME plinius.intec.ugent.be
MX : the name is a domain name and the record-data is the corresponding name of a mail server (MTA), preference indicates the primary, secondary, … mail servers for the domain
intec.ugent.be IN MX preference=10 mail-tech.intec.ugent.be
preference=30 cedar.ugent.be
preference=30 pecan.ugent.be
DNS : Resource Records (RR)
Application Layer 2-64
header
questions
answers
authority
additional
QR|Op Code|AA|TC|RD|RA|Z|RCODE
ID
number of questions
number of answers
number of authority records
number of additional records
DNS : Messages
Application Layer 2-65
$ nslookup> set type=A> set d2> plinius.intec2.ugent.beServer: dns5.intec.ugent.beAddress: 157.193.122.2
------------SendRequest(), len 41 HEADER: opcode = QUERY, id = 111, rcode = NOERROR header flags: query, want recursion questions = 1, answers = 0, authority records = 0,
additional = 0
QUESTIONS: plinius.intec2.ugent.be, type = A, class = IN
Working on local PC
dns5.intec.ugent.be is the default DNS server
IP address for host plinius.intec2.ugent.be
debug mode
DNS : Message : Request
Application Layer 2-66
Got answer (162 bytes): HEADER: opcode = QUERY, id = 111, rcode = NOERROR header flags: response, auth. answer, want recursion, recursion avail. questions = 1, answers = 1, authority records = 1, additional = 1
QUESTIONS: plinius.intec2.ugent.be, type = A, class = IN ANSWERS: -> plinius.intec2.rug.ac.be type = A, class = IN, dlen = 4 internet address = 157.193.122.4 ttl = 86400 (1 day) AUTHORITY RECORDS: -> intec2.ugent.be type = NS, class = IN, dlen = 10 nameserver = tacitus.intec2.ugent.be ttl = 86400 (1 day) ADDITIONAL RECORDS: -> tacitus.intec2.ugent.be type = A, class = IN, dlen = 4 internet address = 157.193.122.1 ttl = 86400 (1 day)
This is the requested answer : plinius has IP address 157.193.122.4
(it is an A record)
This is the nameserver that was able to give the answer(it is an NS record)
This is the IP address of the nameserver(it is an A record)
DNS : Messages : Answer
Application Layer 2-67
MTA 4MTA 2
local DNS intec2
root DNS eduDNS
ucsc.eduDNS
cse.ucsc.eduDNS
email clientat intec2
email to jane.doe@
cse.ucsc.edu
.forward : jane.doe@
it.cse.ucsc.edu
resolve (MX)cse.ucsc.edu
resolve (MX)it.cse.ucsc.edu
1
2
34
5 10
6 78
9
11
14
13
2012
17
18
MTA 3
MTA2 = terra.cse.ucsc.eduMTA3 = sundance.cse.ucsc.eduMTA4 = mail.it.cse.ucsc.edu
it.cse.ucsc.eduDNS
15
16
Local MTAplinius.intec2
19
Example : DNS + e-mail
Application Layer 2-68
Received: by plinius (mbox pietdm)...Received: from mail-tech.intec.ugent.be
by plinius.intec2.ugent.be for <[email protected]
Received: from allserv.ugent.beby mail-tech.intec.ugent.befor <[email protected]>
Received: from mserv.ugent.beby allserv.ugent.befor <[email protected]>
Received: from plinius.intec2.ugent.beby mserv.ugent.befor <[email protected]>
Received: from ECO.intec2.ugent.beby plinius.intec2.ugent.befor <[email protected]>
SMTP server = mail.intec2.ugent.be(alias for plinius.intec2.ugent.be)
Example : multiple MTA’s
Application Layer 2-69
my computereco.intec2.ugent.be
email to piet.demeester@
ugent.be
mail.intec2.ugent.be=plinius.intec2.ugent.be mserv.ugent.be
allserv.ugent.bemail-tech.intec.ugent.be
my local mail serverat INTEC2 (Urbis)
mail server for ugent.be
Split mails to : eduserv1eduserv2allserv
.forwardto intec.ugent.be
mail serverfor intec.ugent.be
Split mails to : INTEC (local)
INTEC2 (Urbis)
Example : multiple MTA’s
Application Layer 2-70
application service requirements: reliability, bandwidth,
delay
client-server paradigm Internet transport
service model connection-oriented,
reliable: TCP unreliable, datagrams:
UDP
Our study of network apps now complete!
specific protocols: HTTP FTP SMTP, POP, IMAP DNS
Chapter 2 Summary
Application Layer 2-71
Chapter 2 Summary
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
Most importantly: learned about protocols
control vs. data msgs in-band, out-of-band
centralized vs. decentralized
stateless vs. stateful reliable vs. unreliable msg
transfer “complexity at network
edge” security: authentication
Application Layer 2-72
Table of contents
2.1 Principles of app layer protocols 3 2.2 Web and HTTP 16 2.3 FTP 37 2.4 Electronic Mail 43 2.5 DNS 53 Summary 70 Table of contents 72
Top Related