Application Layer
End of Saga
Content
• Domain Name Service
• Electronic Mail
• World Wide Web
DNS
• What is DNS?
• What services does it provide?
• How does it operate?
• Message format
• Types of messages
What is DNS?
• DNS is a host name to IP address translation service
• DNS is
– a distributed database implemented in a hierarchy of name servers
– an application level protocol for messageexchange between clients and servers
Why DNS?
• It is easier to remember a host name than it is toremember an IP address.
• An name has more meaning to a user than a 4 bytenumber.
• Applications such as FTP, HTTP, email, etc., all requirethe user to input a destination.
• The user generally enters a host name.
• The application takes the host name supplied by theuser and forwards it to DNS for translation to an IPaddress.
DNS Services
• Besides the address translation service, DNS also provides the following services:– Host aliasing: a host with a complicated name can
have one or more aliases that are simpler toremember , e.g., relay1.west-coast.media.com ->media.com. The longer name is the canonicalhostname, the shorter the alias hostname.
DNS Services (cont’d)
– Mail server aliasing: same as above, aliases canexist for long canonical host names.
– Load Balancing: a set of servers can have onename mapped onto several machines. DNSprovides the full list of names to the end user’sapplication which generally takes the first one inthe list. DNS rotates the names on the list.
How does it work?
• DNS works by exchanging messages between client and server machines.
• A client application will pass the destination host name to the DNS process (in Unix referred to as the gethostbyname() routine) to get the IP address.
• The application then sits and waits for the response to return.
DNS
Why not centralize DNS?
• single point of failure
• traffic volume
• distant centralized database
• maintenance
doesn’t scale!
Root DNS Servers
com DNS servers org DNS servers edu DNS servers
poly.edu
DNS servers
umass.edu
DNS serversyahoo.com
DNS serversamazon.com
DNS servers
pbs.org
DNS servers
Distributed, Hierarchical Database
Client wants IP for www.amazon.com; 1st approx:
• client queries a root server to find com DNS server
• client queries com DNS server to get amazon.com DNS server
• client queries amazon.com DNS server to get IP address for www.amazon.com
DNS: Root name servers
• contacted by local name server that can not resolve name
• root name server:
– contacts authoritative name server if name mapping not known
– gets mapping
– returns mapping to local name server
13 root name servers worldwide
b USC-ISI Marina del Rey, CA
l ICANN Los Angeles, CA
e NASA Mt View, CA
f Internet Software C. Palo Alto,
CA (and 36 other locations)
i Autonomica, Stockholm (plus
28 other locations)
k RIPE London (also 16 other locations)
m WIDE Tokyo (also Seoul,
Paris, SF)
a Verisign, Dulles, VA
c Cogent, Herndon, VA (also LA)
d U Maryland College Park, MD
g US DoD Vienna, VA
h ARL Aberdeen, MDj Verisign, ( 21 locations)
TLD and Authoritative Servers
• Top-level domain (TLD) servers:– responsible for com, org, net, edu, etc, and all top-level
country domains uk, fr, ca, jp.
– Network Solutions maintains servers for com TLD
– Educause for edu TLD
• Authoritative DNS servers:– organization’s DNS servers, providing authoritative
hostname to IP mappings for organization’s servers (e.g., Web, mail).
– can be maintained by organization or service provider
Local Name Server
• does not strictly belong to hierarchy
• each ISP (residential ISP, company, university) has one.
– also called “default name server”
• when host makes DNS query, query is sent to its local DNS server
– acts as proxy, forwards query into hierarchy
DNS Queries
• Recursive:
– The client machine sends a request to the local name server, which, if it does not find the address in its database, sends a request to the root name server, which, in turn, will route the query to an intermediate or authoritative name server. Note that the root name server can contain some hostname to IP address mappings. The intermediate name server always knows who the authoritative name server is.
DNS Queries (cont’d)
• Iterative:– The local server queries the root server. If address
not in its database, will have the name/address of an intermediate or authoritative name server and forward that information to the local name server so that it can directly communicate with the intermediate or authoritative name server. This is to prevent the overloading of the root servers that handle millions of requests.
DNS: caching and updating records
• once (any) name server learns mapping, it cachesmapping
– cache entries timeout (disappear) after some time
– TLD servers typically cached in local name servers
• Thus root name servers not often visited
• update/notify mechanisms under design by IETF
– RFC 2136– http://www.ietf.org/html.charters/dnsind-charter.html
Operation of DNS
• DNS uses caching to increase the speed with which it does the translation.
• The DNS data is stored in the database in the form of resource records (RR). The RRs are directly inserted in the DNS messages.
• The RRs are a 4 tuple that consist of: {name, value, type, TTL}.
Resource Records
DNS: distributed db storing resource records (RR)
o Type=NS
o name is domain (eg.,
foo.com)
o value is hostname of
authoritative name
server for this
domain
RR format: (name, value, type, ttl)
o Type=A
o name is hostname
o value is IP address
o Type=CNAME
o name is alias name for some “canonical” (the real) name, eg., www.ibm.com is reallyservereast.backup2.ibm.com
o value is canonical name
o Type=MX
o value is name of mailserver associated with name
Summary
• DNS provides a mechanism for maintainingthe user friendliness of the Internet by hidingsome of the operational details.
• DNS servers have to be created manually.Recently an update protocol was introducedthat allows DNS to exchange data for additionsand deletions.
E - Mail
• Electronic mail is among the most widelyavailable application services. Each user, whointends to participate in emailcommunication, is assigned a mailbox, whereout-going and incoming messages arebuffered, allowing the transfer to take place inthe background.
Electronic Mail
Three major components: user agents
mail reader
composing, editing, reading mail messages
mail servers mailbox contains incoming
messages for user
message queue of outgoing (to be sent) mail messages
simple mail transfer protocol: SMTP to send email messages
between mail servers
user mailbox
outgoing message queue
mailserver
useragent
useragent
useragent
mailserver
useragent
useragent
mailserver
useragent
SMTP
SMTP
SMTP
Electronic Mail: SMTP [RFC 2821]
uses TCP to reliably transfer email message fromclient to server, port 25
direct transfer: sending server to receiving server
three phases of transfer
handshaking (greeting)
transfer of messages
closure
command/response interaction
commands: ASCII text
response: status code and phrase
messages must be in 7-bit ASCII
Scenario: Alice sends message to Bob
1) Alice uses UA to compose message and “to” [email protected]
2) Alice’s UA sends message to her mail server; message placed in message queue
3) Client side of SMTP opens TCP connection with Bob’s mail server
4) SMTP client sends Alice’s message over the TCP connection
5) Bob’s mail server places the message in Bob’s mailbox
6) Bob invokes his user agent to read message
useragent
mailserver
mailserver user
agent
1
2 3 4 56
Mail message format
SMTP: protocol for exchanging email msgs
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
Message format: multimedia extensions
MIME: multimedia mail extension, RFC 2045, 2056
additional lines in msg header declare MIME content type
From: [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
multimedia datatype, subtype,
parameter declaration
method usedto encode data
MIME version
encoded data
Mail access protocols
SMTP: delivery/storage to receiver’s server
Mail access protocol: retrieval from server
POP: Post Office Protocol [RFC 1939]
• authorization (agent <-->server) and download
IMAP: Internet Mail Access Protocol [RFC 1730]
• more features (more complex)
• manipulation of stored msgs on server
HTTP: gmail, Hotmail, Yahoo! Mail, etc.
useragent
sender’s mail server
useragent
SMTP SMTP accessprotocol
receiver’s mail server
Most Common Scenario
Web based E-mail
Post Office Protocol - 3
POP3 and IMAP
More about POP3
• Previous example uses “download and delete” mode.
• Bob cannot re-read e-mail if he changes client
• “Download-and-keep”: copies of messages on different clients
• POP3 is stateless across sessions
IMAP
• 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
WWW & HTTP
Web and HTTP
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.someschool.edu/someDept/pic.gif
host name path name
WWW Architecture
HTTP overview
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
PC runningExplorer
Server running
Apache Webserver
Mac runningNavigator
HTTP overview (continued)
Uses TCP:• 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
URLs – Uniform Resource Locaters
Some common URLs.
HTTP Command
Static Web Pages
Dynamic Pages
Dynamic Pages
Top Related