Anda di halaman 1dari 41

Application Layer

 DNS
 MAIL PROTOCOL (SMTP, POP, IMAP)
 WEB SERVICES (WWW, HTTP, HTTPS, FTP)
 TELNET
 CLIENT SERVER AND P2P APPLICATION
 RELATION BETWEEN APPLICATION LAYER AND
TRANSPORT LAYER.

Prepared By: Er. Bednidhi Rijal


Domain Name System (DNS)
2

 There are two ways to identify a host


 Host name
 IP address
 People prefer the hostname identifier whereas routers prefer
fixed-length, hierarchically structured IP address
 In order to reconcile these preferences, DNS translates
hostnames to IP addresses.
 The DNS is
 A distributed database implemented in a hierarchy of DNS servers, and
 An application-layer protocol that allows hosts to query the distributed
database.
 The DNS protocol runs over UDP and uses port 53
 Different application layer protocols including HTTP, SMTP, and
FTP use DNS to translate user supplied hostnames to IP
addresses.

Prepared By: Er. Bednidhi Rijal


How DNS Works? (How DNS translate hostname
to IP address?)
3

 Application program calls a library procedure called


the resolver, passing it the name as a parameter
 The resolver sends a UDP packet to a local DNS
server (at port 53)
 DNS server looks up the name and returns the IP
address to the resolver
 Resolver returns it to the application
 Armed with the IP address, the program can then
establish a TCP connection with the destination or
send it UDP packets
Prepared By: Er. Bednidhi Rijal
What happens when a browser running on some user’s host
requests www.NCC.edu.np/index.html ?
4

 The same user machine runs the client side of the DNS
application.
 The browser extracts the hostname,
www.NCC.edu.np, from the URL and passes the
hostname to the client side of the DNS application.
 The DNS client sends a query containing the hostname to
a DNS server.
 The DNS client eventually receives a reply, which
includes the IP address for the hostname.
 Once the browser receives the IP address from DNS, it
can initiate a TCP connection to the HTTP server process
located at port 80 at that IP address.

Prepared By: Er. Bednidhi Rijal


DNS Services
5

 Translating hostname to IP (Main services of DNS)


 Host Aliasing
 A host with a complicated hostname can have one or more
alias names
 Alias host-names are more mnemonic than canonical
hostnames
 Eg. relay1.west-coast.enterprise.com (Canonical host
names)enterprise.com (alias name)
 DNS can be invoked to obtain the canonical hostname for a
supplied alias hostname as well as the IP address of the host
 Mail server aliasing
 DNS can be invoked by a mail application to obtain the
canonical hostname for a supplied alias hostname as well as
the IP address of the host

Prepared By: Er. Bednidhi Rijal


Contd..
6

 Load distribution
 DNS is also used to perform load distribution among
replicated servers, such as replicated Web servers.
 For replicated Web servers, a set of IP addresses is thus
associated with one canonical hostname.
 The DNS database contains this set of IP addresses.

 When clients make a DNS query for a name mapped to a


set of addresses, the server responds with the entire set of
IP addresses, but rotates the ordering of the addresses
within each reply.

Prepared By: Er. Bednidhi Rijal


Name Space
7

 Maps each address to a unique name


 Can be categorized into:
 Flat name space
 Name (sequence of character without structure) is assigned to an
address
 E.g. Morgan, Kist college, tribhuvan university etc.
 Problem: cannot be used in a large system such as the Internet
because it must be centrally controlled to avoid ambiguity and
duplication
 Hierarchical name space
 Each name is of several parts. The first part can define nature of
organization, second part can the name of an organization, third part
can define departments in the organization and so on.
 E.g. www.morgan.edu.np, www.sciencedepart.tribhuvan.edu.np etc.
 In this case, the authority to assign and control the name spaces can
be decentralized

Prepared By: Er. Bednidhi Rijal


Domain Name
8

 Each domain name is a sequence of labels separated by


dots. The domain names are always read from the node
up to the root. The last label is the label of the root
(null)
 Domain Names are case insensitive.
 Can be:
 Fully qualified domain name (FQDN)
 If a label is terminated by a null string, it is called FQDN
 E.g. www.google.com. , www.henryford.edu.np. etc.

 Partially qualified domain name (PQDN)


 If a label is not terminated by a null string, it is called a PQDN
 E.g. www.google.com , www.henryford.edu.np etc.

Prepared By: Er. Bednidhi Rijal


Domain names and Labels
9

Prepared By: Er. Bednidhi Rijal


The Web and HTTP
10

 The World Wide Web (WWW) is a repository of


information in which the documents (called web pages)
are distributed all over the world and related documents
are linked together.
 The WWW project was initiated by CERN (European
Laboratory for Particle Physics) to create a system to
handle distributed resources necessary for scientific
research.
 Besides retrieving of linked documents, WWW can be
used to provide electronic shopping, gamming, radio
programs, or television program etc.
 HTTP is the protocol used to retrieve
information from the Web.
Prepared By: Er. Bednidhi Rijal
Overview of HTTP (HyperText Transfer Protocol)
11

 HTTP is the Web’s application layer protocol and


is used to retrieve the content from the web
 HTTP is used to define how the client-server programs
can be written to retrieve web pages from the web
 An HTTP client sends a request; an HTTP server returns
a response
 The server uses the port number 80; the client uses a
temporary port number
 HTTP uses the services of TCP
 HTTP is stateless protocol because it does not
maintain any information about clients.

Prepared By: Er. Bednidhi Rijal


HTTP request-response behavior
12

 When user requests a Web page (for example, clicks on a hyperlink),


the browser sends HTTP request messages for the objects in the page to
the server. The server receives the requests and responds with HTTP
response messages that contain the objects.

Prepared By: Er. Bednidhi Rijal


Non-Persistent versus Persistent Connections
13

 If multiple objects of the web page need to be


retrieved are located at different server, than it
requires to create multiple new connections
 However if some of the objects are located on the
same server, than we have two choices
 To retrieve each object using a new TCP connection. This
method is called non-persistent connections
 To make a (one) TCP connection and retrieve them all.
This method is called persistent connections

Prepared By: Er. Bednidhi Rijal


Web Caching (Proxy server)
14

 A Web cache---also called a proxy server---is a


network entity that satisfies HTTP requests on the
behalf of an origin Web server.
 The Web cache has its own disk storage and keeps
copies of recently requested objects in this storage.
 A user’s browser can be configured so that all of the
user’s HTTP requests are first directed to the Web
cache.
 Once a browser is configured, each browser request
for an object is first directed to the Web cache

Prepared By: Er. Bednidhi Rijal


Contd..
15

 Advantage:
 Highly reduce the response time for a client request

 Reduces the web traffic in the Internet as a whole,


thereby improving performance for all applications
 Problem:
 The copy of an object residing in the cache may be stale

Prepared By: Er. Bednidhi Rijal


Contd..
16

Prepared By: Er. Bednidhi Rijal


HTTPS (HyperText Transfer Protocol, secured)
17

 HTTP does not provide security but HTTPS does.


 When HTTP run over the Secure Socket Layer (SSL)
then it is called HTTPS
 It provides confidentiality, client and server
authentication, and data integrity

Prepared By: Er. Bednidhi Rijal


File Transfer: FTP (file transfer protocol)
18

 FTP is an application layers protocol used to transfer files


to or from a remote host
 FTP is better choice for transferring large files or to
transfer files using different format.
 FTP uses TCP services
 The user interacts with FTP through an FTP user agent.
 The user first provides the hostname of the remote host,
causing the FTP client process in the local host to
establish a TCP connection with the FTP server process
in the remote host.
 The user then provides the user identification and
password, which are sent over the TCP connection as
part of FTP commands.

Prepared By: Er. Bednidhi Rijal


Contd..
19

 Once the server has authorized the user, the user


copies one or more files stored in the local file system
into the remote file system (or vice versa)

Prepared By: Er. Bednidhi Rijal


FTP connection
20

 FTP uses two parallel TCP connections to transfer a


file:
 control connection, and
 used for sending control information between the two hosts—
information such as user identification, password, commands to
change remote directory, and commands to “put” and “get” files
 Use port number 21

 data connection
 The data connection is used to actually send a file.
 Use port number 20.

 Because FTP uses a separate control connection, FTP


is said to send its control information out-of-band.

Prepared By: Er. Bednidhi Rijal


Contd..
21

Prepared By: Er. Bednidhi Rijal


How Data transfer takes place using FTP?
22

 When a user starts an FTP session with a remote


host, the client side of FTP (user) first initiates a
control TCP connection with the server side (remote
host) on server port number 21.
 The client side of FTP sends the user identification,
password, commands to change the remote directory
over this control connection.
 When the server side receives a command for a file
transfer over the control connection (either to, or
from, the remote host), the server side initiates a
TCP data connection to the client side.

Prepared By: Er. Bednidhi Rijal


Contd..
23

 FTP sends exactly one file over the data connection


and then closes the data connection.
 If, during the same session, the user wants to
transfer another file, FTP opens another data
connection.
 Thus, with FTP, the control connection remains open
throughout the duration of the user session, but a
new data connection is created for each file
transferred within a session (i.e., the data
connections are non-persistent)

Prepared By: Er. Bednidhi Rijal


Electronic Mail (e-mail)
24

 It allows user to exchange messages


 Architecture
 A simple e-mail consists of three components
A user agent (UA)
 A message transfer agent (MTA)
 A message access agent (MAA)

Prepared By: Er. Bednidhi Rijal


User agent (UA)
25

 UA is the first component of E-mail system


 It provides service to the user to make the process of
sending and receiving a message easier
 It is a software package that composes, reads, replies
to, and forwards messages.
 It also handles local mailboxes on the user
computers
 Two types:
 Command driven UA (e.g. mail, pine and elm)
 GUI-based UA (e.g. Eudora and Outlook)
 The user through the UA creates mail for sending

Prepared By: Er. Bednidhi Rijal


Contd..
26

 UA notifies the user of new receiving mail


 UA usually displayed a list of mail in which each line contains
a summary of the information about a particular message in
the mailbox
 Summary of information includes: sender mail address, the
subject, and the time the mail was received or sent
 Mail address:
 Used to deliver e-mail to its destination
 Consists of two parts: local parts (defines the name of special
file called the user mailbox where all mail received for the user
is stored) and domain name (defines mail servers or
exchangers) and is separated by @ sign
 Eg. morgan@gmail.com (morgan—local parts and gmail.com—
domain name)
Prepared By: Er. Bednidhi Rijal
Message Transfer Agent (MTA)
27

 MTA is involved during transferring or sending mail.


 Formal protocol that defines the MTA in the internet is
called SMTP
 Mail transfer phase: The process of transferring a message occurs in
three phase
 Connection Establishment:
 After a client has made TCP connection 0n port 25, the SMTP
server starts the connection phase
 Message Transfer:
 After connection has been established between the SMTP client and
server, a single message between a sender and one or more
recipients can be exchanged
 Connection Termination:
 After the message is transferred successfully, the client terminates
the connection
Prepared By: Er. Bednidhi Rijal
Message Access Agent (MAA)
28

 MAA is used for pulling or retrieving mail from mail


box
 Two protocols are available: Post Office Protocol
(POP3) version 3, and Internet Mail Access Protocol
version 4 (IMAP4)

Prepared By: Er. Bednidhi Rijal


SMTP (Simple Mail Transfer Protocol)
29

 SMTP is used for sending Mail


 SMTP accepts incoming connections and copies
messages from them into the appropriate mailboxes.
 If a message cannot be delivered, an error report
containing the first part of the undeliverable message
is returned to the sender.
 SMTP is a simple ASCII protocol (i.e. cannot be used
for sending image, video, Unicode etc.)
 Transferring of mail occurs in three phases (i.e.
connection establishment, mail transfer, and
connection termination) which is described below:
Prepared By: Er. Bednidhi Rijal
Contd..
30

 After establishing the TCP connection to port 25, the sending


machine waits for the receiving machine to talk first. The
server starts by sending its identity and telling whether it is
prepared to receive mail.
 If it is not, the client releases the connection and tries again
later.
 If the server is willing to accept e-mail, the client announces
whom the e-mail is coming from and whom it is going to.
 If such a recipient exists at the destination, the server gives the
client the go-ahead to send the message. Then the client sends
the message and the server acknowledges it.
 When all the e-mail has been exchanged in both directions, the
connection is released.

Prepared By: Er. Bednidhi Rijal


MIME (Multipurpose Internet Extension)
31

 This protocol is used along with SMTP and it extends


the capability of SMTP hence called a supplementary
protocol
 It allows non-ASCII data (image, audio, video, non-
Latin alphabets, text in different language like
newari, japnese, chinese etc.) to be sent through e-
mail
 MIME transforms non ASCII data to standard ASCII
data at the sender site and transforms back to the
original data at the receiving site

Prepared By: Er. Bednidhi Rijal


POP3 (Post Office Protocol version 3)
32

 POP3 is simple but limited in functionality


 It is used to pull or retrieve messages from mail server
 The client POP3 software is installed on the recipient
computer, the server POP3 software is installed on the
mail server.
 Mail access starts with the clients when the user needs to
download its e-mail form the mailbox on the mail server
 The client opens a connection to the server on TCP port
110
 It then sends its user name and password to access to the
mailbox
Prepared By: Er. Bednidhi Rijal
Contd..
33

 The user can then list and retrieve the mail


messages, one by one
 POP3 has two modes:
 Delete mode:
 The mail is deleted from the mailbox after each retrieval
 Keep mode:
 The mail remains in the mailbox after retrieval
 Limitation
 It does not allow the user to organize mail on the server
 The user cannot have different folders on the server
 It does not allow the user to partially check the contents of the
mail before downloading

Prepared By: Er. Bednidhi Rijal


Internet Mail Access Protocol, version 4 (IMAP4)
34

 IMAP4 is more powerful and more complex than


POP3
 It completely fulfill the deficiency exist in POP3 and
provides additional functionality which are listed
below:
 A user can check the e-mail prior to downloading
 A user can search the contents of the e-mail for a specific string
of characters prior to downloading
 A user can partially download e-mail
 A user can create, delete or remove mailboxes on the mail
server
 A user can create a hierarchy of mailboxes in a folder for e-
mail storage
Prepared By: Er. Bednidhi Rijal
TELNET (Terminal NETwork)
35

 It allows a user on one computer to log into the


remote computer and use the services available there
 Although it requires logging name and password, it
is vulnerable to hacking because it sends all data
including the password in plaintext (not encrypted)

Prepared By: Er. Bednidhi Rijal


Secure Shell (SSH)
36

 It is also used for remote logging (alternative of


TELNET and is used when security is concerned) and is
more secured (i.e. less vulnerable to hacking)
 It sends all data including the password in encrypted
form

Prepared By: Er. Bednidhi Rijal


Network Application Architecture
37

 Possible structure of applications:


 client-server Architecture
 peer-to-peer (P2P) Architecture

Prepared By: Er. Bednidhi Rijal


Client-server architecture
38

 server:
 always-on host
 Services requests from many other hosts, called clients
 permanent IP address
 data centers for scaling
 clients:
 communicate with server
 may be intermittently connected
 may have dynamic IP addresses
 do not communicate directly with each other
 Client server architecture are often infrastructure intensive, since
they require service providers to purchase, install, and maintain
server farms.
 Example of Client server architecture: Web application, FTP,
Telenet, and e-mail.
Prepared By: Er. Bednidhi Rijal
Peer-to-Peer (P2P) Architecture
39

 Minimal or no reliance on always-on servers


 Arbitrary end systems directly communicate
 peers request service from other peers, provide service in
return to other peers
 self-scalability – new peers bring new service capacity, as well as new
service demands
 P2P architectures are cost effective, since they do not
require power-full server.
 peers are intermittently connected and change IP addresses
 complex management
 P2P application includes: Bit Torrent, eMule and
LimeWire, Internet Telephony (Eg. Skype), and IPTV (eg.
PPLive)
Prepared By: Er. Bednidhi Rijal
Relationship between Application layer and
Transport layer
40

 Transport layer distinguish each process running at


application layer uniquely with port number.
 Transport layer encapsulate the data either in UDP
datagram or TCP segment received from the
Application layer and send it to the Network layer at
the source and at the destination it generates the
original data and send to the appropriate process at
the application layer.
 Transport layer provides logical connection between
processes.

Prepared By: Er. Bednidhi Rijal


ASSIGNMENT
41

 Why HTTP is called stateless protocol?


 What is web? How WWW works?
 What is DNS? Explain the importance of DNS.
 What are function of DNS? Explain how it works?
 What is E-mail? Explain its merit and demerit. Explain the
architecture of e-mail
 What is the difference between SMTP and MIME?
 What is the difference between POP3 and IMAP4?
 What is the difference between SSH and TELNET?
 What is FTP? Explain how data transfer takes place using FTP?
 Differentiate between persistence and non persistence connection.
 Write the standard port number for FTP, DNS, SMTP, POP3,
IMAP4, SSH, TELNET, HTTP, HTTPS.
 Write one-one example of FQDNS and PQDNS.

Prepared By: Er. Bednidhi Rijal

Anda mungkin juga menyukai