Application Layer Functionality and Protocols

58
1 Application Layer Functionality and Protocols IT305: Computer Networks – Chapter 3

description

Application Layer Functionality and Protocols. IT305: Computer Networks – Chapter 3. 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. - PowerPoint PPT Presentation

Transcript of Application Layer Functionality and Protocols

Page 1: Application Layer Functionality and Protocols

1

Application Layer Functionality and Protocols

IT305: Computer Networks – Chapter 3

Page 2: Application Layer Functionality and Protocols

2

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

Page 3: Application Layer Functionality and Protocols

3

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

Page 4: Application Layer Functionality and Protocols

4

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).

Page 5: Application Layer Functionality and Protocols

5

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

Page 6: Application Layer Functionality and Protocols

6

OSI and TCP/IP Models – Application Layer

Page 7: Application Layer Functionality and Protocols

7

Applications – The Interface Between Human and Data Networks

Page 8: Application Layer Functionality and Protocols

8

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

Page 9: Application Layer Functionality and Protocols

9

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.

Page 10: Application Layer Functionality and Protocols

10

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.

Page 11: Application Layer Functionality and Protocols

11

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.

Page 12: Application Layer Functionality and Protocols

12

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

Page 13: Application Layer Functionality and Protocols

13

Application Layer Protocol Functions

Page 14: Application Layer Functionality and Protocols

14

Application Architectures

Client-Server

Peer-to-Peer (P2P)

Hybrid of Client-Server and P2P

Page 15: Application Layer Functionality and Protocols

15

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.

Page 16: Application Layer Functionality and Protocols

16

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.

Page 17: Application Layer Functionality and Protocols

17

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

Page 18: Application Layer Functionality and Protocols

18

Servers

Page 19: Application Layer Functionality and Protocols

19

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.

Page 20: Application Layer Functionality and Protocols

20

Peer-to-Peer Model

Page 21: Application Layer Functionality and Protocols

21

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.

Page 22: Application Layer Functionality and Protocols

22

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

Page 23: Application Layer Functionality and Protocols

23

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

Page 24: Application Layer Functionality and Protocols

24

NsLookup

Page 25: Application Layer Functionality and Protocols

25

Resolving DNS Addresses

Page 26: Application Layer Functionality and Protocols

26

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.

Page 27: Application Layer Functionality and Protocols

27

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

Page 28: Application Layer Functionality and Protocols

28

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.

Page 29: Application Layer Functionality and Protocols

29

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

Page 30: Application Layer Functionality and Protocols

30

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 runningFirefox browser

server running

Apache Webserver

iphone runningSafari browser

HTTP requestHTTP response

HTTP request

HTTP response

Page 31: Application Layer Functionality and Protocols

31

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

Page 32: Application Layer Functionality and Protocols

32

HTTP connections

non-persistent HTTP

at most one object sent over TCP connection

–connection then closed

downloading multiple objects required multiple connections

persistent HTTP

multiple objects can be sent over single TCP connection between client, server

Page 33: Application Layer Functionality and Protocols

33

Non-persistent HTTPsuppose user enters URL:

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 someDepartment/ho

me.index

1b. HTTP server at host www.someSchool.ed

u waiting for TCP connection at port

80. “accepts” connection, notifying

client3. HTTP server receives request message, forms response

message containing requested object,

and sends message into its socket

time

(contains text, references to 10

jpeg images)www.someSchool.edu/someDepartment/home.index

Page 34: Application Layer Functionality and Protocols

34

Non-persistent HTTP (cont.)

5. HTTP client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects

6. Steps 1-5 repeated for each of 10 jpeg

objects

4. HTTP server closes TCP connection.

time

Page 35: Application Layer Functionality and Protocols

352-35

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

file transmission time

non-persistent HTTP response time =

2RTT+ file transmission time

time to transmit

file

initiate TCPconnection

RTT

requestfile

RTT

filereceived

time time

Page 36: Application Layer Functionality and Protocols

36Application Layer

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

Page 37: Application Layer Functionality and Protocols

37

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 startof line indicates

end of header lines

GET /index.html HTTP/1.1\r\nHost: www-net.cs.umass.edu\r\nUser-Agent: Firefox/3.6.10\r\n

Accept: text/html,application/xhtml+xml\r\nAccept-Language: en-us,en;q=0.5\r\nAccept-Encoding: gzip,deflate\r\n

Accept-Charset: ISO-8859-1,utf-8;q=0.7\r\nKeep-Alive: 115\r\n

Connection: keep-alive\r\n\r\n

carriage return character

line-feed character

Page 38: Application Layer Functionality and Protocols

38Application Layer 2-38

HTTP request message: general format

requestline

headerlines

body

method sp sp cr lfversionURL

cr lfvalueheader field name

cr lfvalueheader field name

~~ ~~

cr lf

entity body~~ ~~

Page 39: Application Layer Functionality and Protocols

39Application Layer 2-39

HTTP response messagestatus line(protocol

status codestatus phrase)

header lines

data, e.g., requestedHTML file

HTTP/1.1 200 OK\r\nDate: Sun, 26 Sep 2010 20:09:20 GMT\r\n

Server: Apache/2.0.52 (CentOS)\r\nLast-Modified: Tue, 30 Oct 2007 17:00:02

GMT\r\nETag: "17dc6-a5c-bf716880"\r\n

Accept-Ranges: bytes\r\nContent-Length: 2652\r\n

Keep-Alive: timeout=10, max=100\r\nConnection: Keep-Alive\r\n

Content-Type: text/html; charset=ISO-8859-1\r\n

\r\ndata data data data data ...

Page 40: Application Layer Functionality and Protocols

40Application Layer 2-40

HTTP response status 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

status code appears in 1st line in server-to-client response message. some sample codes:

Page 41: Application Layer Functionality and Protocols

41Application Layer 2-41

Cookies: keeping “state”

client server

usual http response msg

usual http response msg

cookie file

one week later:

usual http request msgcookie: 1678 cookie-

specificaction

access

ebay 8734usual http request msg Amazon server

creates ID1678 for user create

entry

usual http response set-cookie: 1678 ebay 8734

amazon 1678

usual http request msgcookie: 1678 cookie-

specificaction

access

ebay 8734amazon 1678

backenddatabase

Page 42: Application Layer Functionality and Protocols

42Application Layer 2-42

Cookies (continued)

what cookies can be used for:

authorization shopping carts recommendations user session state

(Web e-mail)

cookies and privacy: cookies permit sites

to learn a lot about you

you may supply name and e-mail to

sites

aside

how to keep “state”: protocol endpoints: maintain

state at sender/receiver over multiple transactions

cookies: http messages carry state

Page 43: Application Layer Functionality and Protocols

43Application Layer 2-43

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 response

HTTP request HTTP request

origin server

origin server

HTTP response HTTP response

Page 44: Application Layer Functionality and Protocols

44Application Layer 2-44

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 sharing)

Page 45: Application Layer Functionality and Protocols

56

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.

Page 46: Application Layer Functionality and Protocols

57

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

Page 47: Application Layer Functionality and Protocols

58

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.

Page 48: Application Layer Functionality and Protocols

59

Email Services & SMTP/POP Protocols

Page 49: Application Layer Functionality and Protocols

60

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.

Page 50: Application Layer Functionality and Protocols

61

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.

Page 51: Application Layer Functionality and Protocols

62

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.

Page 52: Application Layer Functionality and Protocols

63

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.

Page 53: Application Layer Functionality and Protocols

64

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.

Page 54: Application Layer Functionality and Protocols

65

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.

Page 55: Application Layer Functionality and Protocols

66

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.

Page 56: Application Layer Functionality and Protocols

67

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

Page 57: Application Layer Functionality and Protocols

68

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.

Page 58: Application Layer Functionality and Protocols

69

Summary