Application Layer Functionality and Protocols Md. Asif Hossain
-
Upload
zephania-camacho -
Category
Documents
-
view
13 -
download
0
description
Transcript of Application Layer Functionality and Protocols Md. Asif Hossain
Application Layer Functionality and Protocols
Md. Asif Hossain
2
Typically the applications that we use are intuitive, meaning we can access and use them without knowing how they work. However, for network professionals, it is important to know how an application is able to format, transmit and interpret messages that are sent and received across the network.
3
Applications – The Interface between the Networks
The Application layerLayer seven, is the top layer of both the OSI and TCP/IP models. It is the layer that provides the interface between the applications we use to communicate and the underlying network over which our messages are transmitted.
Application layer protocols are used to exchange data between programs running on the source and destination hosts. There are many Application layer protocols and new protocols are always being developed.
4
Applications – The Interface between the Networks
The Presentation Layer
The Presentation layer has three primary functions:
• Coding and conversion of Application layer data to ensure that data from the source device can be interpreted by the appropriate application on the destination device.
• Compression of the data in a manner that can be decompressed by the destination device.
• Encryption of the data for transmission and the decryption of data upon receipt by the destination.
5
Applications – The Interface between the Networks
The Presentation Layer
Some well-known standards for video:QuickTime and Motion Picture Experts Group (MPEG). QuickTime is an Apple Computer specification for video and audio, and MPEG is a standard for video compression and coding. Among the well-known graphic image formats are: Graphics Interchange Format (GIF)Joint Photographic Experts Group (JPEG)Tagged Image File Format (TIFF). GIF and JPEG are compression and coding standards for graphic images, and TIFF is a standard coding format for graphic images
6
Applications – The Interface between the Networks
The Session Layer
As the name of the Session layer implies, functions at this layer create and maintain dialogs between source and destination applications.
The Session layer handles the exchange of information to initiate dialogs, keep them active, and to restart sessions that are disrupted or idle for a long period of time.
7
Applications – The Interface between the Networks
8
Application Layer Protocol Functions
9
Making Provision for Applications and Services
The Client-Server Model• The device requesting the information is called a client and the device responding to the request is called a server.
• Client and server processes are considered to be in the Application layer.
• The client begins the exchange by requesting data from the server, which responds by sending one or more streams of data to the client. Application layer protocols describe the format of the requests and responses between clients and servers.
• In addition to the actual data transfer, this exchange may also require control information, such as user authentication and the identification of a data file to be transferred.
10
Making Provision for Applications and Services
The Client-Server Model
11
Making Provision for Applications and Services
Servers
• In a general networking context, any device that responds to requests from client applications is functioning as a server.
• A server is usually a computer that contains information to be shared with many client systems. • For example, web pages, documents, databases, pictures, video, and audio files can all be stored on a server and delivered to requesting clients.
• In other cases, such as a network printer, the print server delivers the client print requests to the specified printer.
12
Making Provision for Applications and Services
Servers
•In a client/server network, the server runs a service, or process, sometimes called a server daemon.
• Like most services, daemons typically run in the background and are not under an end user's direct control.
• Daemons are described as "listening" for a request from a client, because they are programmed to respond whenever the server receives a request for the service provided by the daemon.
• When a daemon "hears" a request from a client, it exchanges appropriate messages with the client, as required by its protocol, and proceeds to send the requested data to the client in the proper format.
13
Making Provision for Applications and Services
14
Peer-to-Peer Networking and Applications (p2p)
Peer-to-Peer NetworksIn a peer-to-peer network, two or more computers are connected via a network and can share resources (such as printers and files) without having a dedicated server. Every connected end device (known as a peer) can function as either a server or a client. One computer might assume the role of server for one transaction while simultaneously serving as a client for another. The roles of client and server are set on a per request basis.
15
Peer-to-Peer Networking and Applications (p2p)
Peer-to-Peer Applications
A peer-to-peer application (P2P), unlike a peer-to-peer network, allows a device to act as both a client and a server within the same communication. In this model, every client is a server and every server a client. Both can initiate a communication and are considered equal in the communication process. However, peer-to-peer applications require that each end device provide a user interface and run a background service. When you launch a specific peer-to-peer application it invokes the required user interface and background services. After that the devices can communicate directly.
16
DNS Services and Protocol
• In data networks, devices are labeled with numeric IP addresses, so that they can participate in sending and receiving messages over the network. However, most people have a hard time remembering this numeric address.
• Hence, domain names were created to convert the numeric address into a simple, recognizable name.
• On the Internet these domain names, such as www.cisco.com , are much easier for people to remember than 198.132.219.25, which is the actual numeric address for this server.
17
DNS Services and Protocol
• When networks were small, it was a simple task to maintain the mapping between domain names and the addresses they represented. However, as networks began to grow and the number of devices increased, this manual system became unworkable.
• The Domain Name System (DNS) was created for domain name to address resolution for these networks. DNS uses a distributed set of servers to resolve the names associated with these numbered addresses.
• The DNS protocol defines an automated service that matches resource names with the required numeric network address. It includes the format for queries, responses, and data formats.
18
19
DNS Services and Protocol
DNS server provides the name resolution using the name daemon, which is often called named, (pronounced name-dee). The DNS server stores different types of resource records used to resolve names. These records contain the name, address, and type of record.
2: Applicatio
n Layer
20
DNS records
DNS: distributed db storing resource records (RR)
• Type=NS– name is domain (e.g.
foo.com)– value is IP address of
authoritative name server for this domain
RR format: (name, value, type, ttl)
Type=A name is hostname
value is IP address
Type=CNAME name is alias name for some
“cannonical” (the real) name www.ibm.com is really
servereast.backup2.ibm.com value is cannonical name
Type=MX value is name of mailserver
associated with name
21
DNS Services and Protocol
When a client makes a query, the server's "named" process first looks at its own records to see if it can resolve the name. If it is unable to resolve the name using its stored records, it contacts other servers in order to resolve the name. The request may be passed along to a number of servers, which can take extra time and consume bandwidth. Once a match is found and returned to the original requesting server, the server temporarily stores the numbered address that matches the name in cache. If that same name is requested again, the first server can return the address by using the value stored in its name cache. Caching reduces both the DNS query data network traffic and the workloads of servers higher up the hierarchy. The DNS Client service on Windows PCs optimizes the performance of DNS name resolution by storing previously resolved names in memory, as well.
22
DNS Services and Protocol
The Domain Name System uses a hierarchical system to create a name database to provide name resolution. The hierarchy looks like an inverted tree with the root at the top and branches below. At the top of the hierarchy, the root servers maintain records about how to reach the top-level domain servers, which in turn have records that point to the secondary level domain servers and so on. The different top-level domains represent the either the type of organization or the country or origin. Examples of top-level domains are:.au - Australia .bd - Bangladesh .com - a business or industry.jp - Japan.org - a non-profit organization; .edu-Educational After top-level domains are second-level domain names, and below them are other lower level domains. Each domain name is a path down this inverted tree starting from the root.
23
DNS Services and Protocol
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, CAl ICANN Los Angeles, CA
e NASA Mt View, CAf Internet Software C. Palo Alto,
CA (and 17 other locations)
i Autonomica, Stockholm (plus 3 other locations)
k RIPE London (also Amsterdam, Frankfurt)
m WIDE Tokyo
a Verisign, Dulles, VAc Cogent, Herndon, VA (also Los Angeles)
d U Maryland College Park, MDg US DoD Vienna, VAh ARL Aberdeen, MD
j Verisign, ( 11 locations)
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
25
26
HTTP overviewHTTP: 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
Mac runningNavigator
HTTP request
HTTP request
HTTP response
HTTP response
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
27
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
28
29
WWW Service and HTTP
Browsers can interpret and present many data types, such as plain text or Hypertext Markup Language (HTML, the language in which web pages are constructed). Other types of data, however, may require another service or program, typically referred to as plug-ins or add-ons. To help the browser determine what type of file it is receiving, the server specifies what kind of data the file contains.
To better understand how the web browser and web client interact, we can examine how a web page is opened in a browser. For this example, we will use the URL: http://www.cisco.com/web-server.htm.
First, the browser interprets the three parts of the URL: 1. http (the protocol or scheme)2. www.cisco.com(the server name)3. web-server.htm (the specific file name requested).
30
WWW Service and HTTP
• The browser then checks with a name server to convert www.cisco.com <http://www.cisco.com > into a numeric address, which it uses to connect to the server. • Using the HTTP protocol requirements, the browser sends a GET request to the server and asks for the file web-server.htm.
• The server in turn sends the HTML code for this web page to the browser. •Finally, the browser deciphers the HTML code and formats the page for the browser window.
31
32
WWW Service and HTTP
•The Hypertext Transfer Protocol (HTTP), one of the protocols in the TCP/IP suite, was originally developed to publish and retrieve HTML pages and is now used for distributed, collaborative information systems.
•HTTP is used across the WWW for data transfer and is one of the most used application protocols. • HTTP specifies a request/response protocol. When a client, typically a web browser, sends a request message to a server, the HTTP protocol defines the message types the client uses to request the web page and also the message types the server uses to respond.
• The three common message types are GET, POST, and PUT.
33
WWW Service and HTTP
• GET is a client request for data. A web browser sends the GET message to request pages from a web server. As shown in the figure, once the server receives the GET request, it responds with a status line, such as HTTP/1.1 200 OK, and a message of its own, the body of which may be the requested file, an error message, or some other information.
• POST and PUT are used to send messages that upload data to the web server. For example, when the user enters data into a form embedded in a web page, POST includes the data in the message sent to the server.
• PUT uploads resources or content to the web server.
HTTP response message
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 …... Content-Length: 6821
Content-Type: text/html
data data data data data ...
status line(protocol
status codestatus phrase)
header lines
data, e.g., requested
HTML file
34
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:
35
36
WWW Service and HTTP
37
Response time modeling
Definition of RTT: time to send a small packet to travel from client to server and back.
Response time:• one RTT to initiate TCP
connection• one RTT for HTTP request
and first few bytes of HTTP response to return
• file transmission time
total = 2RTT+transmit time
time to transmit
file
initiate TCPconnection
RTT
requestfile
RTT
filereceived
time time
User-server state: cookies
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
38
Web caches (proxy server)
• user sets browser: Web accesses via cache
• browser sends all HTTP requests to cache– object in cache: cache
returns object
– else cache requests object from origin server, then returns object to client
Goal: satisfy client request without involving origin server
client
Proxyserver
client
HTTP request
HTTP request
HTTP response
HTTP response
HTTP request
HTTP response
origin server
origin server
39
More about Web caching
• Cache acts as both client and server
• Typically cache is installed by ISP (university, company, residential ISP)
Why Web caching?• Reduce response time for client
request.• Reduce traffic on an institution’s
access link.• Internet dense with caches
enables “poor” content providers to effectively deliver content (but so does P2P file sharing)
40
41
WWW Service and HTTP
• Although it is remarkably flexible, HTTP is not a secure protocol. The POST messages upload information to the server in plain text that can be intercepted and read. Similarly, the server responses, typically HTML pages, are also unencrypted.
• For secure communication across the Internet, the Secure HTTP (HTTPS) protocol is used for accessing or posting web server information. •HTTPS can use authentication and encryption to secure data as it travels between the client and server.
• e.g. www.mail.yahoo.com
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
file transferFTP
server
FTPuser
interface
FTPclient
local filesystem
remote filesystem
user at host
42
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 one file, server closes connection.
FTPclient
FTPserver
TCP control connectionport 21
TCP data connectionport 20
Server opens a second TCP data connection to transfer another file.
Control connection: “out of band” FTP server maintains “state”:
current directory, earlier authentication
43
Electronic Mail
Three major components: • user agents • mail servers • simple mail transfer protocol:
SMTP
User Agent• a.k.a. “mail reader”• composing, editing, reading
mail messages• e.g., Eudora, Outlook, elm,
Netscape Messenger• outgoing, incoming messages
stored on server
user mailbox
outgoing message queue
mailserver
useragent
useragent
useragent
mailserver
useragent
useragent
mailserver
useragent
SMTP
SMTP
SMTP
44
Electronic Mail: mail servers
Mail Servers • mailbox contains incoming
messages for user• message queue of outgoing
(to be sent) mail messages• SMTP protocol between mail
servers to send email messages– client: sending mail server– “server”: receiving mail
server
mailserver
useragent
useragent
useragent
mailserver
useragent
useragent
mailserver
useragent
SMTP
SMTP
SMTP
45
Scenario: Alice sends message to Bob1) 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
46
SMTP: final words
• SMTP uses persistent connections
• SMTP requires message (header & body) to be in 7-bit ASCII
• SMTP server uses CRLF.CRLF to determine end of message
Comparison with HTTP:
• HTTP: pull• SMTP: push
• both have ASCII command/response interaction, status codes
• HTTP: each object encapsulated in its own response msg
• SMTP: multiple objects sent in multipart msg
47
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: Hotmail , Yahoo! Mail, etc.
useragent
sender’s mail server
useragent
SMTP SMTP accessprotocol
receiver’s mail server
48