application layer chapter-9

91
© Oxford University Press 2011 Computer Networks Computer Networks Bhushan Trivedi, Director, MCA Programme, at the GLS Institute of Computer Technology, Ahmadabad

Upload: student

Post on 16-Apr-2017

174 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Application layer chapter-9

© Oxford University Press 2011

Computer NetworksComputer Networks

Bhushan Trivedi, Director, MCA Programme, at the GLS Institute of

Computer Technology, Ahmadabad

Page 2: Application layer chapter-9

© Oxford University Press 2011

Chapter 9

Computer NetworksThe Application Layer

Page 3: Application layer chapter-9

© Oxford University Press 2011

The application layer

• A layer interacting with the user• Applications run at application layer• Use TCP or UDP to get their job done• SOCKET API is used for interaction• Varieties of applications to deal with• Users expect similar behavior for Internet

based applications like browsers

Page 4: Application layer chapter-9

© Oxford University Press 2011

The DNS

Page 5: Application layer chapter-9

© Oxford University Press 2011

Domain namespace requirements

• Efficient• Continue working despite break downs• Should not introduce additional overheads• Information available from the nearby servers• Contain a few additional information• A single server can manage multiple

networks.• It should be secure enough (not provided)

Page 6: Application layer chapter-9

© Oxford University Press 2011

Labels and domains

Page 7: Application layer chapter-9

© Oxford University Press 2011

Page 8: Application layer chapter-9

© Oxford University Press 2011

Domains and

hierarchy:

lower level

domains are part of higher

level domains

Page 9: Application layer chapter-9

© Oxford University Press 2011

Domains and

hierarchy:

lower level

domains are part of higher

level domains

Page 10: Application layer chapter-9

© Oxford University Press 2011

Domain names

• Partially and fully qualified names• Resolver• Resolution process

Page 11: Application layer chapter-9

© Oxford University Press 2011

Advantages of hierarchy

• Space constraint • Processing time constraint• Congestion near the server• Organized form of information• Efficient resolution of domain names

Page 12: Application layer chapter-9

© Oxford University Press 2011

Advantages of hierarchy

• A comparatively static database is better to be organized this way

• Clear cut controlling infrastructure• Delegation of authority is clearly defined• Autonomous control

Page 13: Application layer chapter-9

© Oxford University Press 2011

Distributed database

• Most of the queries in DNS are resolved within the local server’s scope

• It reduces the network traffic • No single point of failure• Easy maintenance• Can be easily managed

Page 14: Application layer chapter-9

© Oxford University Press 2011

Distributed databases

Database for ‘in’ac Address of acmil Address of miledu Address of edu… …

Database for ‘ac’A Address of ABC… …

Database for ‘ABC’ict Address of ictibm Address of ibmica Address of ica

Table 9.4 Database for ‘ict’Lara Resource records

for LaraPonting Resource records

for PontingVishwanath Resource records

for Vishwanath

Page 15: Application layer chapter-9

© Oxford University Press 2011

Iterative Name

Resolution

Page 16: Application layer chapter-9

© Oxford University Press 2011

Recursive name resolutio

n

Page 17: Application layer chapter-9

© Oxford University Press 2011

Zones

Page 18: Application layer chapter-9

© Oxford University Press 2011

The registration process

Page 19: Application layer chapter-9

© Oxford University Press 2011

Domain Name

servers, root,

TLD and Local

servers

Page 20: Application layer chapter-9

© Oxford University Press 2011

Type Meaning ValueA IPv4 address 32-bit value

AAAA IPv6 address 128-bit valueCNAME Canonical Name Alias name for host

PTR Pointer IP address (IPv4 or IPv6)NS Name Server Name server(s)

SOA Start of Authority Zone name etcMX Mail Exchanger mail server/exchanger

HINFO Host Info Optional informationSPF Sender Policy

FrameworkIdentify mail servers

TXT Text Text informationDNSKEY DNS Key Public key of domain

RRSIG R R Signature Resource Record Signature

Page 22: Application layer chapter-9

© Oxford University Press 2011

abcict.org. 172800 IN MX (10) mail.abcict.org.172800 IN MX (20) Vishwanath.abcic

t.org172800 IN MX (30) Ponting.abcict.org

mail.abcict.org.

172800 IN A 207.118.130.194

www.abcict.org.

172800 IN CNAME Ponting.abcict.org

www.abcict.org.

172800 IN CNAME abcict.org.

Page 23: Application layer chapter-9

© Oxford University Press 2011

Ponting.abcict.org.

172800 IN A 208.118.130.194

Ponting.abcict.org.

172800 IN HINFO HP laptop with RHEL 9

Vishwanath.abcict.org.

172800 IN A 209.118.130.194

172800 IN HINFO HP I3laser.abcict.org

172800 IN A 210.118.130.194

172800 IN HINFO The laser printer

Page 24: Application layer chapter-9

© Oxford University Press 2011

Different types of resource records

DNS records for a big website with multiple serversDomain Time to

liveClass Type Value

www.TheBigWebsite.com

172800 IN A 1.2.3.4

www.TheBigWebsite.com

172800 IN A 2.3.4.5

www.TheBigWebsite.com

172800 IN A 3.4.5.6

www.TheBigWebsite.com

172800 IN A 4.5.6.7

www.TheBigWebsite.com

172800 IN A 5.6.7.8

Page 25: Application layer chapter-9

© Oxford University Press 2011

Name serversabcict.org. 172800 IN NS ns2.webmastersindia.com.abcict.org. 172800 IN NS ns1.webmastersindia.com.

Page 26: Application layer chapter-9

© Oxford University Press 2011

Load balancing in name servers

DomainTime to

liveClass Type Value

oracle.com. 172800 IN NS u-ns2.oracle.com.oracle.com. 172800 IN NS u-ns3.oracle.com.oracle.com. 172800 IN NS u-ns4.oracle.comoracle.com. 172800 IN NS u-ns5.oracle.comoracle.com. 172800 IN NS u-ns6.oracle.com.oracle.com. 172800 IN NS ns1.oracle.com.oracle.com. 172800 IN NS ns4.oracle.com.oracle.com. 172800 IN NS Ns1.oracle.com.

Page 27: Application layer chapter-9

© Oxford University Press 2011

CNAME to help

• www.gogol.com. 172800 IN CNAMEwww.google.com

• www.goggle.com. 172800 IN CNAME www.google.com

• abcict.org. 172800 IN CNAME www.abcict.org

• www.abcict.org. 172800 IN CNAME abcict.org

Page 28: Application layer chapter-9

© Oxford University Press 2011

Partially qualified domain nameswww 172800 IN CNAME Ponting ;canonical name

is Ponting.abcict.orgftp 172800 IN CNAME Vishwanath ;canonical

name is Vishwanath.abcict.org

ftp.abcict

172800 IN CNAME Vishwanath.abcict.org ;exactly as above

Resource records with blank namesabcict.org. 172800 IN MX (10) mail.abcict.org.

172800 IN MX (20) Vishwanath.abcict.org

Page 29: Application layer chapter-9

© Oxford University Press 2011

DNS query and resource record in response

Page 30: Application layer chapter-9

© Oxford University Press 2011

Dynamic DNS

Page 31: Application layer chapter-9

© Oxford University Press 2011

DNS Sec

• The DNS records are kept encrypted using the private key of the DNS. It can only be decrypted using the public key of the DNS itself.

• DNS resource records also contain a digital signature

• Name servers contain public keys for the zones they are responsible for

Page 32: Application layer chapter-9

© Oxford University Press 2011

Browser and server interacting

Page 33: Application layer chapter-9

© Oxford University Press 2011

The HTTP request exampleGET http://www.oup.co.in/category.php?cat_id=43

HTTP/1.1Host: www.oup.co.inUser-Agent: Mozilla/5.0; Accept: text/html,application/xhtml+xml,

application/xml;q=0.9,*/*;q=0.8Accept-Language: en-us,en;q=0.5Accept-Encoding: gzip,deflateCookie:

PHPSESSID=c3a1082780a2c6621126fa3bd8ad11f1

Page 34: Application layer chapter-9

© Oxford University Press 2011

HTTP ResponseHTTP/1.0 200 OKDate: Mon, 19 Apr 2010 10:50:00 GMTServer: Apache/1.3.27 (Unix) PHP/4.2.3

mod_ssl/2.8.12 OpenSSL/0.9.7gX-Powered-By: PHP/4.2.3Expires: Thu, 19 Nov 2010 08:52:00 GMTCache-Control: no-store, no-cache, must-

revalidate, post-check=0, pre-check=0Content-Type: text/htmlConnection: close

Page 35: Application layer chapter-9

© Oxford University Press 2011

HTTP request and response

Page 36: Application layer chapter-9

© Oxford University Press 2011

The structure of request and response

Page 37: Application layer chapter-9

© Oxford University Press 2011

Components of request and response

Page 38: Application layer chapter-9

© Oxford University Press 2011

Complete request structure

Page 39: Application layer chapter-9

© Oxford University Press 2011

Complete response structure

Page 40: Application layer chapter-9

© Oxford University Press 2011

Method FunctionGET Retrieve a page from the server. A few

simple inputs can be provided. Body is always empty.

POST Provide information to the server. Nonempty body part contains the information.

HEADER Same as GET except the body of the page is not retrieved.

PUT Place the data at the user- specified URL.DELETE Remove an object from the web server.CONNECT Helps converting an HTTP request into

HTTPS.

Page 41: Application layer chapter-9

© Oxford University Press 2011

The persistent connection

• Often  , multiple requests are sent and responses are sought from a single connection

• When the connection does not need to be established afresh, the response time improves

• Pipelining also helps

Page 42: Application layer chapter-9

© Oxford University Press 2011

Persistent connection

Page 43: Application layer chapter-9

© Oxford University Press 2011

Cookies

Page 44: Application layer chapter-9

© Oxford University Press 2011

Session variables

• if   (username == “ ”),• //no username provided • Jump to login page• else if (user name != administrator)• Display “this page is restricted” message•  

Page 45: Application layer chapter-9

© Oxford University Press 2011

Conditional download: request

GET http://www.glsict.org/mcaregular.htm HTTP/1.1

Host: www.glsict.orgIf-modified-since: Thu, 29 Mar 2010 4:35:10

GMT

Page 46: Application layer chapter-9

© Oxford University Press 2011

Conditional download: Two responses

Response-1HTTP/1.1 304 Not Modified

Response-2HTTP/1.1 200 OKDate: Mon, 19 Apr 2010 10:50:00 GMTServer: ApacheLast-Modified: 15 Apr 2010 3:34:05 GMT

Page 47: Application layer chapter-9

© Oxford University Press 2011

Conditional Download-1

Page 48: Application layer chapter-9

© Oxford University Press 2011

Conditional download-2

Page 49: Application layer chapter-9

© Oxford University Press 2011

Conditional download-3

Page 50: Application layer chapter-9

© Oxford University Press 2011

Proxies as intermediaries

• Reduce load on web servers• Reduced response time• Traffic monitoring• Extending Internet access to others • Max-forwards header

Page 51: Application layer chapter-9

© Oxford University Press 2011

How Proxy works

Page 52: Application layer chapter-9

© Oxford University Press 2011

Dynamic Web, client and server side

Page 53: Application layer chapter-9

© Oxford University Press 2011

The email sending process

Page 54: Application layer chapter-9

© Oxford University Press 2011

The email receiving process

Page 55: Application layer chapter-9

© Oxford University Press 2011

Components of the email system

• The first component is known as the user agent.

• It is what the users interact with to send and receive mails.

• The second component is known as the message transfer agent which navigates the mails to their intended recipients.

• The third component is the mail itself.

Page 56: Application layer chapter-9

© Oxford University Press 2011

The complete mailing process

Page 57: Application layer chapter-9

© Oxford University Press 2011

Mail transfer using SMTP client and server

Page 58: Application layer chapter-9

© Oxford University Press 2011

Alias expansion while sending

Page 59: Application layer chapter-9

© Oxford University Press 2011

Alias expansion while recceiving

Page 60: Application layer chapter-9

© Oxford University Press 2011

Alias expansion in

web mail

Page 61: Application layer chapter-9

© Oxford University Press 2011

conventional mail

Example with the Email format

From: Lara BrianABC ICT AhmedabadTo:Gayle ChrisOBS

Content description

Example of content Name of content

Sender’s andReceiver’s mail address

[email protected]@OBS.com

Envelope

From: Lara BrianTo:Gayle Chris

Sender’s andReceiver’s name

Prof. Lara BrianGayle Chris

Header The message

Dear Gayle,Here is second bookRegardsLara

The content of the message

Dear Gayle,Here is second book RegardsLara

Body

Page 62: Application layer chapter-9

© Oxford University Press 2011

SMTP

Page 63: Application layer chapter-9

© Oxford University Press 2011

Client Server Communication SMTP

S: 220 OBS.com SMTP server readyC: HELO abcict.orgS: 250 Hello OBS.com, I

am glad to meet youC: MAIL FROM:[email protected]: 250 OkC: RCPT TO:[email protected]: 250 OkC: RCPT

TO:[email protected]: 250 OkC: RCPT TO:[email protected]

Page 64: Application layer chapter-9

© Oxford University Press 2011

Continue…

S: 550 No such user hereC: DATAS: 354 End data with <CR><LF>.<CR><LF>C: From: "LARA Brian" < [email protected] >C: To: “Gayle Chris” [email protected]: Cc: [email protected]: Subject: The Second BookC:

Page 65: Application layer chapter-9

© Oxford University Press 2011

Continue…

C: Hello Gayle.C: I will soon send you the second Book.C: regardsC: LaraC: .S: 250 Ok: C: QUITS: 221 Bye {The server closes the connection}

Page 66: Application layer chapter-9

© Oxford University Press 2011

Internet Media Types

From: [email protected] To: [email protected]: Thu, 29 APR 2010 16:02:43 -0500MIME-Version: 1.0Content-Type: image/jpegContent-Transfer-Encoding: base64< a blank line>………..binary data for the image in text form………

Page 67: Application layer chapter-9

© Oxford University Press 2011

Type and meaning

Content Type Meaningtext Text information, i.e. a notepad file.

image A photograph or graphicsaudio Recorded sound.video Recorded video.

application A binary file like a Word doc. multipart Message divided in multiple parts, each

with different type of datamessage A forwarded email or a reference linkX–…. Non-standard header.

Page 68: Application layer chapter-9

© Oxford University Press 2011

SMTP and HTTP comparison• Both of  them connects and transfer files• Considering HTTP 1.1, they use persistent

connection. • use headers and values in their messages• HTTP does not convert non-text data into text,

SMTP converts non-text data into 7-bit ASCII. • HTTP needs separate fetch for each object.

SMTP converts the non-text portion into text and send together

Page 69: Application layer chapter-9

© Oxford University Press 2011

SMTP and HTTP comparison

• In HTTP, the client fetches the data, while in SMTP, the client sends the data.

• As SMTP needs to covert other types of data into 7-bit ASCII, it needs MIME.

• HTTP does not require such service, as it transfers every object individually.

Page 70: Application layer chapter-9

© Oxford University Press 2011

Base 64 encoding

6-bit sequence

010100 010010 101010 101000 011100

Converted character

U S w o c

ASCII value

85 83 119 111 99

Value in binary

01010101

01010011

01110111

01101111

01100011

Page 71: Application layer chapter-9

© Oxford University Press 2011

Quoted printable encoding0000 0010

0000 0111

1100 1011

0100 1001

0101 0011

2 7 Non-ASCII

I S

0000 0010

0000 0111

00111101

01000011

(ASCII of C)

1000010

(ASCII of B)

0100 1001

0101 0011

2 7 = 1100, i.e. C (Hex)

1011, i.e. B (Hex)

I S

Page 72: Application layer chapter-9

© Oxford University Press 2011

Intermediaries in mailing

Page 73: Application layer chapter-9

© Oxford University Press 2011

Intermediary in web mail

Page 74: Application layer chapter-9

© Oxford University Press 2011

POP3 and IMAP

• Delete mail is default in POP3• IMAP can have multiple mailboxes• IMAP allows partial mail download• IMAP allows access by features and content• IMAP allows message status to be informed• IMAP is more complicated• Webmails provide everything IMAP provides

Page 75: Application layer chapter-9

© Oxford University Press 2011

Filters and SPAM

• Differentiating incoming mails– subject line– sender’s name– some specific words in the body

• Yahoo! And Gmail also provides filters• SPAM is one popular type of filter

Page 76: Application layer chapter-9

© Oxford University Press 2011

FTP Features

• Authentication is provided• Separates its control messages from the

actual data• interactive and providing format

specification• it is stateful

Page 77: Application layer chapter-9

© Oxford University Press 2011

FTP process

Page 78: Application layer chapter-9

© Oxford University Press 2011

Conventional FTP

connection

Page 79: Application layer chapter-9

© Oxford University Press 2011

Control connection open

Page 80: Application layer chapter-9

© Oxford University Press 2011

Data connection open

Page 81: Application layer chapter-9

© Oxford University Press 2011

The Passive

FTP connection

Page 82: Application layer chapter-9

© Oxford University Press 2011

Data connection open in Passive FTP

Page 83: Application layer chapter-9

© Oxford University Press 2011

Transfer between heterogeneous computers: control characters

Command Decimal value

Action

NUL 0 No operationBEL 7 bell-like sound.BS 8 Move left by one and deleteCR 13 Move to left margin

Page 84: Application layer chapter-9

© Oxford University Press 2011

The GUI version of FTP

Page 85: Application layer chapter-9

© Oxford University Press 2011

Secure FTP, SSL-FTP

• FTP sends and receives everything in plaintext

• SFTP is FTP over Secure TCP or SSH• Secure FTP is from IETF. This also uses

SSH• FTP based on SSL or FTPS is also popular• For simpler copy operations SCP also is

possible to be used

Page 86: Application layer chapter-9

© Oxford University Press 2011

BluetoothPiconets

and scatternet

Page 87: Application layer chapter-9

© Oxford University Press 2011

Bluetooth

• Architecture• Pairing• Applications• Profiles• Protocol stack

Page 88: Application layer chapter-9

© Oxford University Press 2011

Applications/ Profiles Application layer

Audio

OtherRFComm

.

Telephon

y

Serviced discovery

Control

Middleware layer

LLC

Data link layer

Logical link control adaptation protocol

Link ManagerBaseband Physical

layerPhysical Radio802.15 protocol stack

Page 89: Application layer chapter-9

© Oxford University Press 2011

Page 90: Application layer chapter-9

© Oxford University Press 2011

Most common frame format

Page 91: Application layer chapter-9

© Oxford University Press 2011

Header which is repeated three times