File - FCI-ZU
Download
Report
Transcript File - FCI-ZU
Application Layer
Functionality and
Protocols
IT305: Computer Networks – Chapter 3
1
Course Info
Dr. Walid Khedr, Ph.D.
–Email: [email protected]
–Web: www.staff.zu.edu.eg/wkhedr
–Department of Information Technology
Course Group
–http://groups.yahoo.com/group/IT305_Computer_Networks
2
Application Layer Functionality and Protocols
This chapter explains how the human network
interacts with the data network.
How data that is understood by humans is
transformed into data that is understandable by the
network.
The first step in the process occurs at the Application
layer, which is where data enters the network.
There are three key concepts in this chapter:
1. Applications and the Application Layer
2. Server and Client Roles
3. Application Layer Services and Protocols
3
Objectives
Define the application layer as the source and
destination of data for communication across
networks.
Explain the role of protocols in supporting
communication between server and client
processes.
Describe the features, operation, and use of
well-known TCP/IP application layer services
(HTTP, DNS, SMTP).
4
OSI and TCP/IP Models – Application Layer
The Application layer, Layer seven, is the top layer of
both the OSI and TCP/IP models.
It 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
5
OSI and TCP/IP Models – Application Layer
6
Applications –
The Interface Between Human and Data Networks
7
Applications –
The Interface Between Human and Data Networks
The 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
8
Applications –
The Interface Between Human and Data Networks
The Presentation layer (of OSI model) has 3
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.
9
Applications –
The Interface Between Human and Data Networks
The Session Layer
–It creates and maintains dialogs between source
and destination applications.
–It 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
Most applications, like web browsers or e-mail
clients, incorporate functionality of the OSI
layers 5, 6 and 7.
10
Applications –
The Interface Between Human and Data Networks
The most widely-known TCP/IP Application layer protocols are
those that provide for the exchange of user information.
These protocols specify the format and control information
necessary for many of the common Internet communication
functions.
11
Application Layer Software
Within the Application layer,
there are two forms of
software programs or
processes that provide
access to the network.
–Network-Aware
Applications Ex: web
browser
–Application layer
Services: Applications
may need the assistance
of Application layer
services to use network
resources
12
Application Layer Protocol Functions
13
Application Architectures
Client-Server
Peer-to-Peer (P2P)
Hybrid of Client-Server and P2P
14
The Client-Server Model
In 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.
Data transfer from a client to a server is referred to as an upload
and data from a server to a client as a download.
15
Client-Server Architecture
Server:
–always-on host
–permanent IP address
Clients:
–communicate with server
–may be intermittently connected
–may have dynamic IP addresses
–do not communicate directly with each other
The client begins the exchange by requesting data from the server.
Server 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.
16
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.
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
17
Servers
18
Peer-to-Peer Model
In 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.
Peer-to-peer networks decentralize the resources
on a network without using a centralized server.
19
Peer-to-Peer Model
20
Hybrid of Client-Server and P2P
Some P2P applications use a hybrid system where
resource sharing is decentralized but the indexes that
point to resource locations are stored in a centralized
directory
–In a hybrid system, each peer accesses an index server to get
the location of a resource stored on another peer.
–The index server can also help connect two peers, but once
connected, the communication takes place between the two
peers without additional communication to the index server.
Peer-to-peer applications can be used on peer-to-peer
networks, client/server networks, and across the
Internet.
21
Some Specific Used Protocols (F3.1.1.3)
The Transport layer uses an addressing scheme called a
port number. Port numbers identify applications and
Application layer services that are the source and
destination of data
Domain Name System (DNS) - TCP/UDP Port 53
Hypertext Transfer Protocol (HTTP) - TCP Port 80
Simple Mail Transfer Protocol (SMTP) - TCP Port 25
Post Office Protocol (POP) - UDP Port 110
Telnet - TCP Port 23
Dynamic Host Configuration Protocol - UDP Port 67
File Transfer Protocol (FTP) - TCP Ports 20 and 21
22
DNS
The Domain Name System (DNS) was created for
domain name to address resolution for these networks.
DNS is a client/server service but a bit different from
others
The DNS client runs as a service itself.
The DNS client, sometimes called the DNS resolver,
supports name resolution for our other network
applications and other services that need it
Try nslookup
23
NsLookup
24
Resolving DNS Addresses
25
DNS
A DNS server provides the name resolution using the
name daemon, which is often called named, (pronounced
name-dee).
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
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.
ipconfig /displaydns command displays all of the cached
DNS entries on a Windows XP or 2000 computer system.
26
DNS
The DNS server stores different types of resource
records used to resolve names. These records contain
the name, address, and type of record.
Some of these record types are:
–A - an end device address
–NS - a name server
–CNAME - the canonical name (or Fully Qualified Domain
Name) for an alias; used when multiple services have the single
network address but each service has its own entry in DNS
–MX - mail exchange record; maps a domain name to a list of
mail exchange servers for that domain
foo.example.com.
CNAME
bar.example.com.
bar.example.com.
A
192.0.2.23
27
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.
28
Web and HTTP
First, a review…
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, e.g.,
www.someschool.edu/someDept/pic.gif
host name
path name
29
HTTP overview
HTTP: hypertext
transfer protocol
Web’s application layer
protocol
client/server model
–client: browser that
requests, receives,
(using HTTP protocol)
and “displays” Web
objects
–server: Web server
sends (using HTTP
protocol) objects in
response to requests
PC running
Firefox browser
server
running
Apache Web
server
iphone running
Safari browser
30
HTTP overview (continued)
uses TCP:
HTTP is “stateless”
client initiates TCP
connection (creates socket)
to server, port 80
server maintains no
information about
past client requests
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
aside
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
31
HTTP connections
non-persistent HTTP
persistent HTTP
at most one object sent multiple objects can be
over TCP connection
sent over single TCP
connection between
–connection then
client, server
closed
downloading multiple
objects required
multiple connections
32
Non-persistent HTTP
suppose user enters URL:
(contains text,
references to 10
www.someSchool.edu/someDepartment/home.index
jpeg images)
1a. HTTP client initiates TCP
connection to HTTP server
(process) at
www.someSchool.edu on port 80
2. HTTP client sends HTTP
request message
(containing URL) into TCP
connection socket.
Message indicates that
client wants object
time someDepartment/home.in
dex
1b. HTTP server at host
www.someSchool.edu
waiting for TCP
connection at port 80.
“accepts” connection,
notifying client
3. HTTP server receives
request message, forms
response message
containing requested
object, and sends message
into its socket
33
Non-persistent HTTP (cont.)
5. HTTP client receives response
4. HTTP server closes TCP
connection.
message containing html file, displays
html. Parsing html file, finds 10
referenced jpeg objects
time
6. Steps 1-5 repeated for
each of 10 jpeg objects
34
Non-persistent HTTP: response time
RTT (definition): time for a
small packet to travel from
client to server and back
HTTP response time:
one RTT to initiate TCP
connection
one RTT for HTTP request
and first few bytes of HTTP
response to return
initiate TCP
connection
RTT
request
file
time to
transmit
file
RTT
file
received
file transmission time
non-persistent HTTP
response time =
2RTT+ file transmission time
time
time
2-35
35
Persistent HTTP
non-persistent HTTP issues:
requires 2 RTTs per object
OS overhead for each TCP
connection
browsers often open
parallel TCP connections to
fetch referenced objects
persistent HTTP:
server leaves connection
open after sending
response
subsequent HTTP
messages between same
client/server sent over
open connection
client sends requests as
soon as it encounters a
referenced object
as little as one RTT for all
the referenced objects
Application Layer
36
HTTP request message
two types of HTTP messages: request, response
HTTP request message:
–ASCII (human-readable format)
request line
(GET, POST,
HEAD commands)
header
lines
carriage return,
line feed at start
of line indicates
end of header lines
carriage return character
line-feed character
GET /index.html HTTP/1.1\r\n
Host: www-net.cs.umass.edu\r\n
User-Agent: Firefox/3.6.10\r\n
Accept: text/html,application/xhtml+xml\r\n
Accept-Language: en-us,en;q=0.5\r\n
Accept-Encoding: gzip,deflate\r\n
Accept-Charset: ISO-8859-1,utf-8;q=0.7\r\n
Keep-Alive: 115\r\n
Connection: keep-alive\r\n
\r\n
37
HTTP request message: general
format
method
sp
URL
header field name
sp
value
version
cr
cr
value
cr
request
line
header
lines
~
~
header field name
lf
lf
~
~
~
~
cr
lf
lf
entity body
~
~
body
Application Layer
2-38
38
HTTP response message
status line
(protocol
status code
status phrase)
header
lines
data, e.g.,
requested
HTML file
HTTP/1.1 200 OK\r\n
Date: Sun, 26 Sep 2010 20:09:20 GMT\r\n
Server: Apache/2.0.52 (CentOS)\r\n
Last-Modified: Tue, 30 Oct 2007 17:00:02
GMT\r\n
ETag: "17dc6-a5c-bf716880"\r\n
Accept-Ranges: bytes\r\n
Content-Length: 2652\r\n
Keep-Alive: timeout=10, max=100\r\n
Connection: Keep-Alive\r\n
Content-Type: text/html; charset=ISO-88591\r\n
\r\n
data data data data data ...
Application Layer
2-39
39
HTTP response status codes
status code appears in 1st line in server-toclient response message.
some sample codes:
200 OK
–request succeeded, requested object later in this msg
301 Moved Permanently
–requested object moved, new location specified later in this msg
(Location:)
400 Bad Request
–request msg not understood by server
404 Not Found
–requested document not found on this server
505 HTTP Version Not Supported
Application Layer
2-40
40
Cookies: keeping “state”
client
ebay 8734
server
usual http request msg
cookie file
usual http response
ebay 8734
amazon 1678
set-cookie: 1678
usual http request msg
cookie: 1678
usual http response msg
Amazon server
creates ID
1678 for user
cookiespecific
action
one week later:
ebay 8734
amazon 1678
create backend
entry database
access
access
usual http request msg
cookie: 1678
usual http response msg
cookiespecific
action
Application Layer
2-41
41
Cookies (continued)
what cookies can be used
for:
authorization
shopping carts
recommendations
aside
cookies and privacy:
cookies permit sites to
learn a lot about you
you may supply name and
e-mail to sites
user session state (Web email)
how to keep “state”:
protocol endpoints: maintain state at
sender/receiver over multiple
transactions
cookies: http messages carry state
Application Layer
2-42
42
Web caches (proxy server)
goal: satisfy client request without involving origin server
user sets browser: Web
accesses via cache
browser sends all HTTP
requests to cache
proxy
server
client
origin
server
–object in cache: cache
returns object
–else cache requests
object from origin
server, then returns
object to client
client
origin
server
Application Layer
2-43
43
More about Web caching
cache acts as both
client and server
–server for original requesting
client
–client to origin 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
(so too does P2P file
2-44
sharing) Application Layer
44
WWW Service and HTTP
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
HTTP Secure (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.
56
Email Services & SMTP/POP Protocols
E-mail, the most popular network service, has revolutionized how
people communicate through its simplicity and speed.
To run on a computer or other end device, e-mail requires several
applications and services.
–Post Office Protocol (POP)
–In order to receive e-mail from an e-mail server, the e-mail client can use
POP.
–Simple Mail Transfer Protocol (SMTP)
–Sending e-mail from either a client or a server uses formats and command
defined by the SMTP protocol.
When people compose e-mail messages, they typically use an
application called a Mail User Agent (MUA), or e-mail client.
–The MUA allows messages to be sent and places received messages
into the client's mailbox
57
Email Services & SMTP/POP Protocols
E-mail Server Processes - MTA and MDA
The e-mail server operates two separate
processes:
–Mail Transfer Agent (MTA)
–The MTA process is used to forward e-mail.
–The MTA receives messages from the MUA or from
another MTA on another e-mail server. Based on the
message header, it forwarded to reach its destination.
–Mail Delivery Agent (MDA)
–If the mail is addressed to a user whose mailbox is on the
local server, the mail is passed to the MDA.
58
Email Services & SMTP/POP Protocols
59
File Transfer Protocol (FTP)
FTP was developed to allow for file transfers between a
client and a server.
An FTP client is an application that runs on a computer that
is used to push and pull files from a server running the FTP
daemon (FTPd).
The client establishes the first connection to the server on
TCP port 21. This connection is used for control traffic,
consisting of client commands and server replies.
The client establishes the second connection to the server
over TCP port 20. This connection is for the actual file
transfer and is created every time there is a file transferred.
The file transfer can happen in either direction. The client
can download (pull) a file from the server or, the client can
upload (push) a file to the server.
60
Dynamic Host Configuration Protocol (DHCP)
The DHCP service enables devices on a network to
obtain IP addresses and other information from a
DHCP server.
–This service automates the assignment of IP addresses,
subnet masks, gateway and other IP networking parameters.
When the DHCP server is contacted and an address
requested.
–The DHCP server chooses an address from a configured
range of addresses called a pool and assigns ("leases") it to the
host for a set period.
–If the host is powered down or taken off the network, the
address is returned to the pool for reuse.
–This is especially helpful with mobile users that come and go
on a network.
61
Dynamic Host Configuration Protocol (DHCP)
Dynamic and static addressing both have their places
in network designs.
–Many networks use both DHCP and static addressing.
–DHCP is used for general purpose hosts such as end user
devices,
–Fixed addresses are used for network devices such as
gateways, switches, servers and printers.
62
Dynamic Host Configuration Protocol (DHCP)
The DHCP server maintains a pool of IP addresses and
leases an address to any DHCP-enabled client when the
client is powered on.
DHCP DISCOVER packet to identify any available DHCP
servers on the network
A DHCP server replies with a DHCP OFFER.
The client may receive multiple DHCP OFFER packets if
there is more than one DHCP server on the local network,
so it must choose between them, and broadcast a DHCP
REQUEST packet that identifies the explicit server and lease
offer that the client is accepting.
63
Dynamic Host Configuration Protocol (DHCP)
Assuming that the IP address requested by the client, or
offered by the server, is still valid, the server would return a
DHCP ACK message that acknowledges to the client the
lease is finalized.
If the offer is no longer valid - perhaps due to a time-out or
another client allocating the lease - then the selected server
will respond with a DHCP NAK message (Negative
Acknowledgement).
If receive DHCP NAK, begin again with a new DHCP
DISCOVER.
64
File Sharing Services and SMB Protocol
The Server Message Block (SMB) is a client/server file
sharing protocol.
Unlike the file sharing supported by FTP, clients establish
a long term connection to servers.
Once the connection is established, the user of the client
can access the resources on the server as if the resource
is local to the client host.
SMB file-sharing and print services have become the
mainstay of Microsoft networking.
65
P2P Service and Gnutella Protocol
Sharing files over the Internet has become extremely
popular. With P2P applications based on the Gnutella
protocol, people can make files on their hard disks
available to others for downloading.
–Gnutella-compatible client software allows users to connect to
Gnutella services over the Internet and to locate and access
resources shared by other Gnutella peers.
–Many client applications are available for accessing the
Gnutella network, including: BearShare, Gnucleus, LimeWire,
Morpheus, WinMX and XoloX.
66
P2P Service and Gnutella Protocol
Many P2P applications do not use a central database to record all the files
available on the peers.
–Instead, the devices on the network each tell the other what files are available
when queried and use the Gnutella protocol and services to support locating
resources.
When a user is connected to a Gnutella service, the client applications will
search for other Gnutella nodes to connect to.
–These nodes handle queries for resource locations and replies to those
requests.
–They also govern control messages, which help the service discover other
nodes.
–The actual file transfers usually rely on HTTP services.
The Gnutella protocol defines five different packet types:
–ping - for device discovery
–pong - as a reply to a ping
–query - for file location
–query hit - as a reply to a query
–push - as a download request
67
Telnet Service and Protocol
Telnet provides a standard method of emulating text-based
terminal devices over the data network.
A connection using Telnet is called a Virtual Terminal (VTY)
session, or connection.
Rather than using a physical device to connect to the server,
Telnet uses software to create a virtual device that provides
the same features of a terminal session with access to the
server command line interface (CLI).
To support Telnet client connections, the server runs a
service called the Telnet daemon. A virtual terminal
connection is established from an end device using a Telnet
client application.
If security is a concern, the Secure Shell (SSH) protocol
offers an alternate and secure method for server access.
68
Summary
69