Application Layer 2-1 Chapter 2 Application Layer Part of slides provided by J.F Kurose and K.W. Ross, All Rights Reserved Communication Networks P. Demeester Computer networking - A top-down approach featuring the internet 4th Edition, 2008 Addison Wesley James F. Kurose, Keith W. Ross ISBN 0-321-49770-8
71
Embed
Application Layer2-1 Chapter 2 Application Layer Part of slides provided by J.F Kurose and K.W. Ross, All Rights Reserved Communication Networks P. Demeester.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
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
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
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
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)
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
• 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
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)