2.2 TCP-IP Applications

70
ICS312- 2008 1 2. TCP/IP Applications

Transcript of 2.2 TCP-IP Applications

Page 1: 2.2 TCP-IP Applications

ICS312- 2008 1

2. TCP/IP Applications

Page 2: 2.2 TCP-IP Applications

ICS312- 2008 2

2.2 Domain Name System

Chapter 26;

Douglas Commer, Computer Networks and Intranets

Page 3: 2.2 TCP-IP Applications

ICS312- 2008 3

Domain Name System

Internet communication requires IP addresses

Humans prefer to use computer namesAutomated system available to translate

names to addressesKnown as Domain Name System (DNS)

Page 4: 2.2 TCP-IP Applications

ICS312- 2008 4

DNS Functionality

GivenName of a computer

ReturnsComputer’s internet address

MethodDistributed lookupClient contacts server(s) as necessary

Page 5: 2.2 TCP-IP Applications

ICS312- 2008 5

Domain Name Syntax

Alphanumeric segments separated by dots

Exampleswww.netbook.cs.purdue.edu

www.eg.bucknell.eduMost significant part on right

Page 6: 2.2 TCP-IP Applications

ICS312- 2008 6

Obtaining a Domain Name

OrganizationChooses a desired nameMust be uniqueRegisters with central authorityPlaced under one top-level domain

Names subject to international law forTrademarksCopyright

Page 7: 2.2 TCP-IP Applications

ICS312- 2008 7

Top-Level Domains

Meaning assigned to each

Page 8: 2.2 TCP-IP Applications

ICS312- 2008 8

Example Name Structure

First level is .comSecond level is company nameThird level is division within companyFourth level either

Company subdivision Individual computer

Page 9: 2.2 TCP-IP Applications

ICS312- 2008 9

An Example

AssumeCompany is UnileverHas two divisions

Soap divisionCandy division

Candy division has subdivisionsSoap Division has no subdivisions

Page 10: 2.2 TCP-IP Applications

ICS312- 2008 10

An Example (continued)

Names in soap division have form

Names in candy division have formcomputer.soap.unilever.com

computer.subdivision.candy. unilever.com

Page 11: 2.2 TCP-IP Applications

ICS312- 2008 11

DNS Client-Server Interaction

Resolution – translation of a domain name into an equivalent IP address

The software that performs resolution is known as resolver

Each resolver is configured with an address of a local domain server

Multiple DNS servers arranged in hierarchy are used

Each server corresponds to contiguous part of naming hierarchy

Page 12: 2.2 TCP-IP Applications

ICS312- 2008 12

Two Possible DNS Hierarchies

Choice made by organization

Page 13: 2.2 TCP-IP Applications

ICS312- 2008 13

Inter-Server Links

All domain name servers are linked together to form a unified system. Each server knows how to reach a root server and how to reach servers that are authorities for names further down the hierarchy.

Page 14: 2.2 TCP-IP Applications

ICS312- 2008 14

In Practice

DNS uses backup server(s)ISPs and other organizations

Offer DNS service to subscribersSmall organizations and individuals

Only need domain names for computers running servers

Contract with an ISP for domain service

Page 15: 2.2 TCP-IP Applications

ICS312- 2008 15

DNS Lookup An application becomes DNS client and

Sends request to local DNS server Local server

If answer known, returns response If answer unknown

Starts at top-level serverFollows linksReturns response

This process is called name resolution – translation of a domain name in its equivalent IP address

Page 16: 2.2 TCP-IP Applications

ICS312- 2008 16

Caching in DNS

Server always caches answersHost can cache answersCaching

Improves efficiencyEliminates unnecessary searchWorks well because high locality of reference

Page 17: 2.2 TCP-IP Applications

ICS312- 2008 17

DNS Types

Each entry in server consists of Domain name DNS type for name Value to which name corresponds

During lookup, client must supply Name Type

Server Matches both name and type

Page 18: 2.2 TCP-IP Applications

ICS312- 2008 18

Example DNS Types

Type A (Address) Value is IP address for named computer

Type MX (Mail eXchanger) Value is IP address of computer with mail server for

name; matches the computer name found in a n email address to an IP address.

Type CNAME (Computer NAME) Value is another domain name Used to establish alias (www)

Page 19: 2.2 TCP-IP Applications

ICS312- 2008 19

2.3 Electronic Mail

Chapter 27;

Douglas Commer, Computer Networks and Intranets

Page 20: 2.2 TCP-IP Applications

ICS312- 2008 20

Electronic Mail

OriginallyMemo sent from one user to another

NowMemo sent to one or more mailboxes

MailboxDestination point for messages Can be storage or programGiven unique address

Page 21: 2.2 TCP-IP Applications

ICS312- 2008 21

E-mail Address

Text string Specifies mail destination General form mailbox@computer computer

Domain name of computer Actually type MX

mailbox Destination on the computer

Page 22: 2.2 TCP-IP Applications

ICS312- 2008 22

Use of E-mail Address

Each electronic mailbox has a unique address, which is divided into two parts: the first identifies a user’s mailbox, and the second identifies a computer on which the mailbox resides. E-mail software on the sender’s computer uses the second part to select a destination; e-mail software on the recipient’s computer uses the first part to select a particular mailbox.

Page 23: 2.2 TCP-IP Applications

ICS312- 2008 23

Mail Message Format

Header Identifies sender, recipient(s), memo

contentsLines of form

keyword:informationBlank lineBody

Contains text of message

Page 24: 2.2 TCP-IP Applications

ICS312- 2008 24

Example E-mail Header Fields

Most header lines optional

Page 25: 2.2 TCP-IP Applications

ICS312- 2008 25

Extending E-mail

Original e-mailSMTP - message restricted to ASCII text

Users desire to send Image filesAudio clipsCompiled (binary) programs

SolutionMulti-purpose Internet Mail Extensions

(MIME)

Page 26: 2.2 TCP-IP Applications

ICS312- 2008 26

MIME

Allows transmission ofBinary dataMultimedia files (video/audio clips)Multiple types in single messageMixed formats

Backward compatible

Page 27: 2.2 TCP-IP Applications

ICS312- 2008 27

MIME Encoding

Sender Inserts additional header linesEncodes binary data in (printable) ASCII

Sent like standard messageReceiver

Interprets header linesExtracts and decodes parts

Separate standards for content and encoding

Page 28: 2.2 TCP-IP Applications

ICS312- 2008 28

Example of MIME

Header lines added

MIME-Version: 1.0

Content-Type: Multipart/Mixed; Boundary=Mime_sep

SpecifiesUsing MIME version 1.0Line Mime_sep appears before each

message part

Page 29: 2.2 TCP-IP Applications

ICS312- 2008 29

MIME

Although Internet e-mail only transfers text, MIME can be used to transport binary data by encoding it in printed characters. A MIME mail message includes additional information that a receiving application uses to decode the message.

Page 30: 2.2 TCP-IP Applications

ICS312- 2008 30

Example E-mail Header Fields -A Sample Return-Path: <[email protected]> X-Original-To: [email protected] Delivered-To: [email protected] Received: from rv-out-0708.google.com (rv-out-0708.google.com [209.85.198.240]) by mail.uonbi.ac.ke (Postfix) with ESMTP id 66E8FAF771 for <[email protected]>; Fri, 16 May 2008 15:09:42 +0300 (EAT) Received: by rv-out-0708.google.com with SMTP id c5so126019rvf.24 for <[email protected]>; Fri, 16 May 2008 05:09:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-

version:content-type; bh=vuO6Yw9ySGu3aK/rmktFRLiFoBajB2qO9TKX19POGlQ=;

b=jilcBcPNN5XKansiyEqats/3wQkc7zwcFr+qZzukAlKWZGHUUqhFJgj2BhUd44G7N6qLcF70SZLouU4yjJ5MC73xAbNHwDaOsA6doNcIYXlngCgp2n1re3vZbXDyAWgIaAmU9302oGxWmxIDE6P8zlMQwQhufF4QnXxVTcJqu30=

DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type;

Page 31: 2.2 TCP-IP Applications

ICS312- 2008 31

Example E-mail Header Fields A Sample -Continued

b=HJvgasben0tqEHvhUtfEM6zzH32pQI+qHUal+ocLi5jwCUpZJPUOdh8Yp/1j4SFY7OW3m6G26V7Rw3VaSoiWi8JdJ316ymh9h8rtH8A3ZWr4ayGjdj0zXH8m+Ks/QBpc0xly6r8tEmd4pWdKTWuL7nCtr9+nrnECukRuDLB3YVo=

Received: by 10.140.164.6 with SMTP id m6mr1728223rve.210.1210938280674; Fri, 16 May 2008 04:44:40 -0700 (PDT) Received: by 10.140.226.20 with HTTP; Fri, 16 May 2008 04:44:39 -0700 (PDT) Message-ID: <[email protected]> Date: Fri, 16 May 2008 14:44:39 +0300 From: "Fred Mwongella" <[email protected]> To: [email protected] Subject: Change of website url MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_8326_1778508.1210938280644" X-www.uonbi.ac.ke-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: 66E8FAF771.E63BB X-www.uonbi.ac.ke-MailScanner: Found to be clean X-www.uonbi.ac.ke-MailScanner-From: [email protected] X-Spam-Status: No

Page 32: 2.2 TCP-IP Applications

ICS312- 2008 32

Mail Transfer

Protocol is Simple Mail Transfer Protocol (SMTP)

Runs over TCP Used between

Mail transfer program on sender’s computer Mail server on recipient’s computer

Specifies how Client interacts with server Recipients specified Message is transferred

Page 33: 2.2 TCP-IP Applications

ICS312- 2008 33

[muthoni@proxy3 ~]$ telnet 10.2.21.6 25Trying 10.2.21.6...Connected to mail.uonbi.ac.ke (10.2.21.6).Escape character is '^]'.220 mail.uonbi.ac.ke ESMTP PostfixEHLO mail.uonbi.ac.ke250-mail.uonbi.ac.ke250-PIPELINING250-SIZE 60200000250-VRFY250-ETRN250-AUTH PLAIN LOGIN250-AUTH=PLAIN LOGIN250 8BITMIME

Example SMTP Commands

Page 34: 2.2 TCP-IP Applications

ICS312- 2008 34

MAIL FROM:[email protected] OkRCPT TO:[email protected] OkDATA354 End data with <CR><LF>.<CR><LF>SUBJECT:TESTING SMTP FROM @UONBI.AC.KEI am just testing the SMTP protocolplease confirm receiptThank you.250 Ok: queued as 73187B035Cquit221 ByeConnection closed by foreign host.[muthoni@proxy3 ~]$

Example SMTP Commands (Cont.)

Page 35: 2.2 TCP-IP Applications

ICS312- 2008 35

Illustration of Mail Transfer

ServerRequired to receive mailPlaces message in user’s mailbox

Page 36: 2.2 TCP-IP Applications

ICS312- 2008 36

Terminology

Mail exploderProgram that accepts incoming messageAnd delivers to multiple recipients

Mailing listDatabaseUsed by exploder

Mail gatewayConnects two mail systems

Page 37: 2.2 TCP-IP Applications

ICS312- 2008 37

Illustration of a Mail Gateway

Page 38: 2.2 TCP-IP Applications

ICS312- 2008 38

Automated Mailing Lists

Automated program to handle routine chores of maintaining mailing list: list manager

Used in conjunction with exploderExample expected command:

add mailbox to list

Page 39: 2.2 TCP-IP Applications

ICS312- 2008 39

Computers Without Mail Servers

TypicallySmall, personal computerNot continuously connected to Internet

To receive e-mail, user mustEstablish mailbox on large computerAccess mailbox as necessary

Post Office Protocol (POP) used

Page 40: 2.2 TCP-IP Applications

ICS312- 2008 40

Illustration of POP

Current version named POP3 Exercise: Please validate this information

Page 41: 2.2 TCP-IP Applications

ICS312- 2008 41

2.4 FTP

Page 42: 2.2 TCP-IP Applications

ICS312- 2008 42

File Transfer

File sharing can take place in two forms: access a remote file as if it is on a local disk; or copy a file from remote host to local host and

then use it. The first form of sharing is done through file

system sharing such as NFS. The second form is done through file transfer such as FTP.

FTP is another example of client-server program paradigm. An FTP server waits on a host for an FTP client to connect and make request. The server program finds and sends the file back to the client.

Page 43: 2.2 TCP-IP Applications

ICS312- 2008 43

FTP Features Interactive access Format (representation) specification (e.g. binary or text) Authentication control (user login, as well as anonymous ftp) Ftp control program uses port 21, ftp data transfer uses port 20.

We really can't use the same port for data transfer. Why? Consider what if you want to terminate in the middle of transfer. Would the program consider this is a part of the data or a command?

Ftp offers a number of different commands to manipulate directories, files, and to control the transfer process.

The following is a screen-dump of the result of the help command ftp> help

Page 44: 2.2 TCP-IP Applications

ICS312- 2008 44

FTP Paradigm

! cr macdef proxy send $ delete mdelete sendport

status account debug mdir put struct append dir mget pwd

sunique ascii disconnect mkdir quit tenex bell form mls quote trace binary get mode recv type bye glob mput remotehelp

user case hash nmap rename

verbose cd help ntrans reset ? cdup lcd open rmdir close ls prompt runique ftp> bye

Page 45: 2.2 TCP-IP Applications

ICS312- 2008 45

FTP Paradigm

Command-line interfaceUser

Forms TCP connection to server (called control connection)

Logs in and enters commands to list directories, transfer files

ServerEstablished new TCP connection for each

transfer

Page 46: 2.2 TCP-IP Applications

ICS312- 2008 46

Illustration of TCP Connections During an FTP File Transfer

Two TCP connections used

Page 47: 2.2 TCP-IP Applications

ICS312- 2008 47

TFTP

Second file transfer service in TCP/IP: Trivial File Transfer Protocol (TFTP)

Uses UDP instead of TCP Only supports file transfer Does not allow ls Does not support interaction and does not have

large have a large set of commands Does not have authorization; only for files with

global access Useful for bootstrapping a hardware device that

has no disk for system software

Page 48: 2.2 TCP-IP Applications

ICS312- 2008 48

Exercise

1. Explain two advantages of using two connections

2. Explain two advantages of TFTP

Page 49: 2.2 TCP-IP Applications

ICS312- 2008 49

Page 50: 2.2 TCP-IP Applications

ICS312- 2008 50

Page 51: 2.2 TCP-IP Applications

ICS312- 2008 51

2.7 World Wide Web

Major application protocol used on the Internet WWW is a large-scale, online repository of information

that user can access using an interactive program called browser

Most browsers have a point and click interface. Hypertext and hypermedia – stored a set of

documents; a document can contain pointer to other documents. Hypertext – only text Hyper media – additional information such as images

The web is a distributed hypermedia system that supports interactive access

Page 52: 2.2 TCP-IP Applications

ICS312- 2008 52

Web Components

Browser – an interactive program that permits a user to view information from the web.

Web server Hypermedia links Document representation

Web pages, home page, HTML – a mark-up language; allows a document to

contain general guidelines for display and allows a browser to choose details.

Transfer protocol

Page 53: 2.2 TCP-IP Applications

ICS312- 2008 53

Browser

Application programUser’s interface to WebBecomes Web client to fetch information

from Web serverDisplays information for user

Page 54: 2.2 TCP-IP Applications

ICS312- 2008 54

Web Server

Running programStores set of Web documentsResponds to request from browser by

sending copy of document

Page 55: 2.2 TCP-IP Applications

ICS312- 2008 55

Hypermedia Concept

Web document contains mixture ofText ImagesSelectable pointers to other Web pages

Known as hypermedia

Page 56: 2.2 TCP-IP Applications

ICS312- 2008 56

Hypermedia Link On A Web Document

Associated with object or area on screenInternally like a symbolic linkAdvantage

Can reference document on another computer

DisadvantageCan become invalid

Page 57: 2.2 TCP-IP Applications

ICS312- 2008 57

Web Document

Called a web pageOne web page per fileCan contain

Binary imageText file

Text standardReadable representation ASCIISpecifies contents and layoutKnown as Hypertext Markup Language

(HTML)

Page 58: 2.2 TCP-IP Applications

ICS312- 2008 58

HTML Details

Document is free-formatEmbedded tags give display guidelinesTags often appear in pairsTag format

Beginning tag

Ending tag

<TAGNAME>

</TAGNAME>

Page 59: 2.2 TCP-IP Applications

ICS312- 2008 59

General Form of HTML Document<HTML><HEAD><TITLE>text that forms the document title

</TITLE></HEAD><BODY>body of the document appears here

</BODY></HTML>

Page 60: 2.2 TCP-IP Applications

ICS312- 2008 60

Example HTML Tags Begin paragraph

<P> Line break (force a new line)

<BR> Main heading (largest, boldest font)

<H1> … text … </H1> Next heading (next largest)

<H2> … text … </H2>

Page 61: 2.2 TCP-IP Applications

ICS312- 2008 61

General Form of URL

Only domain name requiredDefaults

Protocol is httpPort is 80Path is index.html

protocol :// domain_name : port / item_name

name of accessprotocol to use domain name of

server computer

protocol portnumber path name

of item

Page 62: 2.2 TCP-IP Applications

ICS312- 2008 62

Use of Client-Server Paradigm Web server

Makes set of pages available Uses port 80

Web client Called a browser Creates TCP connections to server; the connection

lasts only for the time required to fetch the document requested.

Sends requests for items

Page 63: 2.2 TCP-IP Applications

ICS312- 2008 63

Use of Client-Server Paradigm

Primary protocol used between browser and server known as HyperText Transfer Protocol (HTTP)

HTTP requests sent as text (ASCII) GET: request an item from the server HEAD: request status information about an item POST: send data to the server

Response from server begins with ASCII header Status code (200 = handled request)

Page 64: 2.2 TCP-IP Applications

ICS312- 2008 64

Inside a Browser

Main controller Receives input from user Invokes client and interpreter

Clients One or more built into browser; HTTP and optional

clients such as FTP and email. Note that the invocation of optional clients is hidden from the user.

Uses network to fetch items Interpreter

One or more built in Displays items

Page 65: 2.2 TCP-IP Applications

ICS312- 2008 65

Illustration of a Browser

Browser contains many components

Page 66: 2.2 TCP-IP Applications

ICS312- 2008 66

Alternative Protocol Example

File transfer serviceProtocol is FTP Example URL

ftp://ftp.cs.purdue.edu/pub/comer/netbook/client.c

Can be used in anchor tag

Page 67: 2.2 TCP-IP Applications

ICS312- 2008 67

Other Markup Languages

Extensible Markup Language (XML) does not specify layout

Tag names can be created as neededExample for a corporate phone book:

Page 68: 2.2 TCP-IP Applications

ICS312- 2008 68

Caching in Browsers

The client-server pattern in web browsing differs from others because: Users tend to view remote pages more frequently than local

pages Users do not search for same information repeatedly

Cache for recently accessed HTML pages Images

Item normally fetched from cache User can override HTTP can verify timestamp before fetching new copy

Page 69: 2.2 TCP-IP Applications

ICS312- 2008 69

Types of Web Pages

Static Stored in file Unchanging

Advantage – reliability and performance Disadvantage – inflexibility tedious to change

Dynamic Formed by server Created on demand Output from a program Use Common Gateway Interface (CGI) technology

Advantage – reports current information (e.g. current stock prices)

Disadvantage – increased cost and inability to display changing information

Page 70: 2.2 TCP-IP Applications

ICS312- 2008 70

Types of Web Pages (cont)

ActiveExecuted at clientConsists of a computer programCan interact with userMostly uses Java technology

Advantage – information is updated continuouslyDisadvantage – additional cost of creating and

running the documents; lack of security