Application Layer Protocols Overview
Application Layer Protocols Overview
The Application layer, Layer seven, is the top layer of both the OSI and
TCP/IP models.
Provides the interface between the applications we use to communicate and
the underlying network.
3
Email
HTTP HTTP
HTTP
(www)
4
Application Layer: OSI and TCP/IP Models
Functionality of the TCP/IP application layer protocols fit roughly into the
framework of the top three layers of the:
OSI model: Application, Presentation and Session layers.
Most early TCP/IP application layer protocols were developed before the
emergence of:
personal computers, graphical user interfaces and multimedia objects.
These protocols implement very little of the functionality that is specified in
the OSI model Presentation and Session layers. 5
The Presentation Layer
The protocols in the TCP/IP suite are generally defined by Requests for
Comments (RFCs).
Maintained by IETF (Internet Engineering Task Force)
There are a few in there for fun -
[Link]
9
Application Layer
Software User
applications
Network-Aware Applications
Applications are the software programs used by people to
communicate over the network.
They implement the application layer protocols and are able to
communicate directly with the lower layers of the protocol stack.
Email Clients
Web Browsers 10
Application Layer Software
User
applications
Services
System
Operations
Bottom line:
When discussing an application like "Telnet" we could be referring to the
application, the service, or the protocol. 12
Application Layer Protocol Functions
Application layer protocols are used by both the source and destination
devices during a communication session.
The application layer protocols implemented on the source and destination
host must match.
Protocols: (This will become clearer later! Herding cats.)
Establish consistent rules for exchanging data.
Specify the structure and type of messages that are exchanged.
Types: Request, response, acknowledgement, error message, etc.
Defines the dialogues, ensuring with transmissions met by expected
responses, and with the correct service invoked. 13
Application Layer Protocol Functions
14
Client Server Model
FTP
(file transfer) DNS
(domain name
resolution)
SMTP SMB
(email) (file sharing)
P2P
Telnet (file sharing)
(remote login)
20
Reminder of encapsulation/decapsulation
Data Link IP TCP HTTP Data Link
Data Trailer
Header Header Header Header
21
Focus on Application Header and/or Data
HTTP
HTTP
HTTP
HTTP
Client
Server
23
HTTP (HyperText Transfer Protocol)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Paul Morris, MHCC</title><style type="text/css">
<!--
body {
margin-left: 0px;
The base HTML file references other objects
margin-top: 0px; in the page.
margin-right: 0px;
margin-bottom: 0px;
CIS151
Web page (also called a html document)
Web page consists of objects CIS152
Objects (examples):
CIS154
HTML file
JPEG image
GIF image
JAVA applet
Audio file
24
Web Browser - Client
HTTP
Client
HTTP
Server
26
HTTP Request Message
GET /[Link] / HTTP/1.1 Some data omitted for brevity
Accept-Language: en-us
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET
CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; InfoPath.1)
Host: [Link]
Connection: Keep-Alive
HTTP
Serve
r
HTTP
Request Message Client
Request line
Header lines
ASCII Text
Request line: Method field
GET, POST and HEAD
The great majority of Requests are GETs 27
HTTP Request Message
GET /[Link]/ HTTP/1.1
Accept-Language: en-us
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET
CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; InfoPath.1)
Host: [Link]
Connection: Keep-Alive
Request Line
GET - Browser/client is requesting an object
/[Link] / - Browser is requesting this object in this
directory (default is [Link])
HTTP/1.1 - Browser implements the HTTP/1.1 (1.1 is
backwards compatible with 1.0)
Note: HTTP GET is also used by some P2P applications like Gnutella
and Bittorrent.
28
HTTP Request Message
GET /[Link]/ HTTP/1.1
Accept-Language: en-us
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET
CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; InfoPath.1)
Host: [Link]
Connection: Keep-Alive
Request Line
GET: - Used by browser/client to request an object.
POST: - Used when user has filled out a form and sending
information to the server. (Forms do not have to
use POST.)
- Example: words in a search engine
HEAD: - Similar to a GET, but the server responds with a
HTTP message but leaves out the requested
object.
PUT: - Used with Web publishing tools, upload objects.
29
DELETE: - Used with Web publishing tools, delete objects.
HTTP Request Message
GET /[Link]/ HTTP/1.1
Accept-Language: en-us
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET
CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; InfoPath.1)
Host: [Link]
Connection: Keep-Alive
Header Lines
Accept-Language:- User prefers this language of the object
User-Agent: - The browser type making the request
Host: - Host on which the object resides
Connection: - Client/browser is telling the server to keep
this TCP connection Open, known as a
persistent connection.
- We will talk about this later in TCP
(transport layer)
30
HTTP Response Message
HTTP/1.1 200 OK Some data omitted for brevity
Date: Fri, 22 Feb 2008 [Link] GMT
Server: Apache/2.0.52 (Red Hat)
Last-Modified: Thu, 15 Nov 2007 [Link] GMT
Content-Length: 15137
Connection: close
Content-Type: text/html
HTTP
Server
HTTP Client
31
HTTP Response Message
HTTP/1.1 200 OK
Date: Fri, 22 Feb 2008 [Link] GMT
Server: Apache/2.0.52 (Red Hat)
Last-Modified: Thu, 15 Nov 2007 [Link] GMT
Content-Length: 15137
Connection: close
Content-Type: text/html
Response message:
Status line
Header lines
Entity body
32
HTTP Response Message
HTTP/1.1 200 OK
Date: Fri, 22 Feb 2008 [Link] GMT
Server: Apache/2.0.52 (Red Hat)
Last-Modified: Thu, 15 Nov 2007 [Link] GMT
Content-Length: 15137
Connection: close
Content-Type: text/html
Status Line
HTTP/1.1 – Server is using HTTP/1.1
200 OK - Status code, request succeeded and information is
returned in response
33
HTTP Response Message
HTTP/1.1 404
Status Codes
200 OK
- Status code, request succeeded and information is returned in response.
301 Moved Permanently
- Requested object has been permanently moved.
400 Bad Request
- Generic error message, request not understood by server.
404 Not Found:
-The requested document does not exist on server.
505 HTTP Version Not Supported 34
HTTP Response Message
HTTP/1.1 200 OK
Date: Fri, 22 Feb 2008 [Link] GMT
Server: Apache/2.0.52 (Red Hat)
Last-Modified: Thu, 15 Nov 2007 [Link] GMT
Content-Length: 15137
Connection: close
Content-Type: text/html
Header Lines
Date: – Server is using HTTP/1.1
Server: - Status code, request succeeded and
information is returned in response
Last-Modified: – Date/time when object created or
modified
Content-Length: – Number of bytes in object being sent
Connection: – Server going to close TCP connection
after 35
HTTP Response Message
HTTP/1.1 200 OK
Date: Fri, 22 Feb 2008 [Link] GMT
Server: Apache/2.0.52 (Red Hat)
Last-Modified: Thu, 15 Nov 2007 [Link] GMT
Content-Length: 15137
Connection: close
Content-Type: text/html
Entity Body
36
HTTP Request and Response Messages
GET /[Link] / HTTP/1.1
Accept-Language: en-us
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET
CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; InfoPath.1)
Host: [Link]
Connection: Keep-Alive
HTTP
HTTP
HTTP
Server
HTTP Client
HTTP/1.1 200 OK
Date: Fri, 22 Feb 2008 [Link] GMT
Server: Apache/2.0.52 (Red Hat)
Last-Modified: Thu, 15 Nov 2007 [Link] GMT
Content-Length: 15137
Connection: close
Content-Type: text/html
38
User-Server Interaction: Cookies
HTTP Requests: GET
(first time)
HTTP
HTTP data customized
Server
for Rick Graziani
HTTP Client
HTTP/1.1 200 OK
Date: Fri, 22 Feb 2008 [Link] GMT
Server: Apache/1.3.34 (Unix)
Last-Modified: Fri, 22 Feb 2008 [Link] GMT
ETag: "760a31-18ce-47bf19c3"
Accept-Ranges: bytes
Content-Length: 6350
Keep-Alive: timeout=15, max=257
Connection: Keep-Alive 40
Content-Type: text/plain <information omitted>
Web Caching Web
Cache or HTTP Client
HTTP
Request
Proxy Request
Origin Server
Server HTTP Response
HTTP Response
HTTP
HTTP Request
Request
Orgin HTTP Response
Server HTTP Response
Client
Web cache or proxy server – Web cache satisfies HTTP requests on the
behalf of the Origin Web server.
Own disk storage
Keeps copies of recently requested objects
Typically installed at ISP or larger institutions.
Advantages:
Reduces the response time for client requests, especially if there are
any bottlenecks in the network.
Reduces traffic on institution’s access link to the ISP (Internet). 41
Web Caching Web
Cache or HTTP Client
HTTP
Request
Proxy Request
Origin Server
Server HTTP Response
HTTP Response
HTTP
HTTP Request
Request
Origin HTTP Response
Server HTTP Response
Client
43
FTP (File Transfer Protocol)
FTP FTP
Client Server
FTP was developed to allow for file transfers between a client and a server.
Used to push and pull files from a server running the FTP daemon (FTPd).
Uses get and put commands.
RFC 959 44
FTP (File Transfer Protocol)
TCP control connection port 21
Username and password
Change directory on Server
46
SMTP – Simple Mail Transfer Protocol
POP3
IMAP
POP3
IMAP
SMTP
RFC 2821
Transfers messages from sender’s mail server to recipient’s mail
server
Push protocol, not a pull protocol
Push (from client to server or server to server)
Pull (from server to client)
Retrieving email
Historically, users would log into local mail server to read mail.
Since early 1990’s, clients use mail access protocols:
POP3
IMAP
HTTP
48
SMTP – Simple Mail Transfer Protocol
IMAP
HTTP
Web-based email
Introduced with Hotmail in mid-1990’s
Communicates with remote mailbox using HTTP
HTTP is used to push (client to server) and pull the email (server to
client) 50
SMTP
MTA
receives email from the
client's MUA
passes email to the MDA
for final delivery
uses SMTP to route email
between servers
Server
52
Telnet
Telnet Telnet
Server
54
DHCP – Dynamic Host Configuration Protocol
57
DNS – Domain Name System
58
Name Resolution
Resolver
DNS client programs used to look up DNS name information.
Name Resolution
The two types of queries that a DNS resolver (either a DNS client or another
DNS server) can make to a DNS server are the following:
Recursive queries
Queries performed by Host to Local DNS Server
Iterative queries
Queries performed Local DNS server to other servers
59
DNS Name Resolution
Step 1.
The DNS resolver on the DNS client sends a recursive query to its
configured Local DNS server.
Requests IP address for "[Link]".
The DNS server for that client is responsible for resolving the name
Cannot refer the DNS client to another DNS server.
60
2
3 2
Step 2.
Local DNS Server forwards the query to a Root DNS server.
Step 3.
Root DNS server
Makes note of .com suffix
Returns a list of IP addresses for TLD (Top Level Domain Servers)
responsible for .com.
61
DNS Name Resolution
Step 4.
The local DNS server sends query for [Link] to one of the
TLD servers.
Step 5.
TLD Server
Makes note of [Link]
Returns IP address for authoritative server [Link] (such as
[Link] server)
63
DNS Name Resolution
6
6
7
Step 6.
Local DNS server sends query for [Link] directly to DNS
server for [Link]
Step 7.
[Link] DNS server responds with its IP address for
[Link]
64
DNS Name Resolution
8
Step 8.
Local DNS server sends the IP address of [Link] to the DNS
client.
DNS Caching
When a DNS server receives a DNS reply (mapping hostname to an IP
address) it can cache the information in its local memory.
DNS servers discard cached information after a period of time (usually 2
days)
A local DNS server can cache TLD server addresses, bypassing the root
DNS servers in the query chain. 65
DNS Name Resolution
In the worst cases, you'll get a dialog
box that says the domain name
doesn't exist - even though you know it
does.
This happens because the
authoritative server is slow replying to
the first, and your computer gets tired
of waiting so it times-out (drops the
connection) or the domain name does
not exist.
But if you try again, there's a good
chance it will work, because the
authoritative server has had enough
time to reply, and your name server
has stored the information in its cache.
66
nslookup
nslookup
Displays default DNS server for your host
Can be used to query a domain name and get the IP address
67
DNS Name
Resolution
ipconfig /displaydns
After a certain amount of time, specified in the Time to Live (TTL)
associated with the DNS resource record, the resolver discards the
record from the cache.
ipconfig /flushdns – Manually deletes entries
The default TTL for positive responses is 86,400 seconds (1 day).
The default TTL for negative responses is 300 seconds.
68
(Missing Info) DNS: [Link]
69
70
71
72
SMB – Server Message Block Protocol
73
SMB
Request-response protocol .
Unlike FTP, clients establish a long term connection to servers.
Client can access the resources on the server as if the resource is local to
the client host.
SMB is sent over TCP
Prior to Windows 2000 windows used a proprietary protocol (NETBIOS)
to send SMB.
Linux/UNIX have similar protocol: SAMBA
74
SMB
75
Peer-to-Peer (P2P) Networking and
Applications
P2P (Peer-to-Peer) file sharing accounts for more traffic on the Internet than
any other application (2004).
Peers (hosts) act as both clients and servers.
No centralized file server.
HTTP GET and responses are commonly used. 77
By Peter Svensson
The Associated Press
Oct. 19, 2007
“Peer-to-peer applications account for between 50 percent and 90
percent of overall Internet traffic, according to a survey this year by
78
ipoque GmbH, a German vendor of traffic-management equipment.”
P2P – Centralized Directory Peer
te
r m a nd Upda
1 – Info Peer
d Update
Centralized 1 – Inform an Peer
Directory
1 – Inform and Update 3 – File Transfer
Server
1 – Inform
and Upda Peer
te
2 – Query
for conte
nt
Napster
te
r m a nd Upda
1 – Info Peer
d Update
Centralized 1 – Inform an Peer
Directory
1 – Inform and Update 3 – File Transfer
Server
1 – Inform
and Upda Peer A
te
2 – Query
for conte
nt
1. Peer A starts P2P application
2. Informs centralized directory server of its:
IP address
Names of objects making available for sharing (MP3, videos, etc.)
3. Directory server collects information from each peer that becomes active.
Dynamic database
Maps IP addresses with object names
4. Peer A queries directory server for IP addresses of other peers for specific
content
Directory Server returns IP addresses for those peers (Peer B)
5. Peer A establishes TCP connection and downloads file (i.e. HTTP GET) from
other peer, Peer B.
6. Directory server removes Peer from database when Peer closes application 80
or disconnects from Internet (periodic messages – pings – from server).
P2P – Query Query
Flooding Que
ry
it Peer B
Query hit
Peer C
u e ry h File tra
ns f er
Q
Query
Query
Peer A Peer D
Que Peer E
ry
Que
ry h
it
Peer F
Gnutella
81
P2P – Query Query
Flooding Que
ry
it Peer B
Query hit
Peer C
u e ry h File tra
ns f er
Q
Query
Query
Peer A Peer D
Que Peer E
ry
Que
ry h
it
Query Flooding
Non-scalable and causes a significant amount of traffic on Internet.
Gnutella modified it to limited-scope flooding which limits how many peers 82
away the query is sent to, usually 7 to 10. (similar to TTL – later).
P2P – Query Query
Flooding Que
ry
it Peer B
Query hit
Peer C
u e ry h File tra
ns f er
Q
Query
Query
Peer A Peer D
Que Peer E
ry
Que
ry h
it
Kazaa
Query Group
Leader
Query
y Reply
Q uer
File Transfer