Lecture 12 Overview - PowerPoint PPT Presentation

1 / 68
About This Presentation
Title:

Lecture 12 Overview

Description:

Title: Lecture 1 Internet Author: mgunes Last modified by: mgunes Created Date: 10/8/1999 7:08:27 PM Document presentation format: On-screen Show (4:3) – PowerPoint PPT presentation

Number of Views:105
Avg rating:3.0/5.0
Slides: 69
Provided by: mgunes
Learn more at: https://www.cse.unr.edu
Category:

less

Transcript and Presenter's Notes

Title: Lecture 12 Overview


1
Lecture 12 Overview
2
TELNET
  • TELNET is a protocol that provides
  • general,
  • bi-directional,
  • eight-bit byte oriented communications
  • Over TCP connection
  • data and control over the same connection
  • Many application protocols are built upon the
    TELNET protocol
  • Used to test HTTP, FTP, SMTP, POP3, IRC, etc.

3
Network Virtual Terminal
  • intermediate representation of a generic terminal
  • provides a standard language for communication of
    terminal control functions

Server Process
NVT
NVT
TCP
TCP
4
Control Functions
  • TELNET includes support for a series of control
    functions commonly supported by servers
  • This provides a uniform mechanism for
    communication of (the supported) control functions

5
Command Structure
  • Commands start with a special character called
    the Interpret as Command escape character
  • The IAC code is 255
  • If a 255 is sent as data, it must be followed by
    another 255
  • If IAC is found and the next byte is IAC
  • a single byte is presented to application/terminal
  • If IAC is followed by any other code
  • the TELNET layer interprets this as a command

6
A Typical Mail Environment
Interactive Mail Access Protocol
SMTP
IMAP
Mail Server
Mail Server
Mail Client
IMAP store
POP Store
SMTP
POP
SMTP
Mail Client
7
Terminology
  • User Agent
  • end-user mail program
  • Message Transfer Agent
  • responsible for communicating with remote hosts
    and transmitting/receiving email
  • both a client and server
  • Mail Exchanger
  • host that takes care of email for a domain

8
SMTP
  • Used to exchange mail messages between mail
    servers (Message Transfer Agents)

MTA
MTA
MTA
SMTP
SMTP
File System
UA
UA
9
SMTP Protocol
  • SMTP sender is the client
  • SMTP receiver is the server
  • Alternating dialogue
  • client sends command and server responds with
    command status message
  • Order of the commands is important!
  • Status messages include
  • ASCII encoded numeric status code (like HTTP,FTP)
    and
  • text string

10
Data Format
  • ASCII only
  • must convert binary to an ASCII representation to
    send via email
  • What if we want to send a line containing only a
    period?
  • Sender prepends a period to any line staring with
    a period (in the message)
  • Receiver strips the leading period in any line
    that starts with a period and has more stuff

11
Message Progress
TCP Connection Establishment
TCP Connection Termination
12
Reply Codes
  • Contain a Lot of Information
  • Only the reply codes count
  • Other information in a reply is purely for humans

The first digit indicates success, failure, or
incomplete
The third digit is the specific message for that
category
The second digit is the category of error message
13
SMTP Extensions (EHLO)
  • A mailer supporting extensions uses EHLO instead
    of HELO in the greeting

telnet mail.unr.edu 25 Trying
134.197.1.112... 220 smtp.unr.edu ESMTP
Postfix EHLO 250-smtp.unr.edu 250-PIPELINING 250-S
IZE 30720000 250-VRFY 250-ENHANCEDSTATUSCODES 250-
8BITMIME 250 DNS
A mailer that supports extensions responds with a
list of which ones it can do
14
Mail Headers
  • Email messages contain many headers
  • some headers are created by the UA
  • some are automatically added by the MTA
  • Every MTA adds (at least) a Received header
  • Some of the headers are parsed by intermediate
    MTAs
  • but the message content is ignored and passed on
    transparently

15
Multipurpose Internet Mail Extensions
  • Defines extensions to support binary attachments
    of arbitrary format
  • Images, Audio, Video and multi-media messages
  • Text having unlimited line length or overall
    length
  • Multiple objects in a single message
  • Character sets other than ASCII
  • Multi-font messages
  • Requires more capable UAs to interpret messages

16
A sample MIME message
  • From trumbo_at_Opus1.COM (Jan Trumbo)
  • Subject small message with Word attachment
  • To trumbo_at_Opus1.COM
  • MIME-version 1.0
  • Content-type MULTIPART/MIXED BOUNDARY"Boundary_
    ID_nf99lkyavAuSoClF/HeK0Q"
  • --Boundary_ID_nf99lkyavAuSoClF/HeK0Q
  • Content-type text/plain charsetus-ascii
  • Joel, attached is a Word document. - Jan
  • --Boundary_ID_nf99lkyavAuSoClF/HeK0Q
  • Date Thu, 19 Sep 1996 164952 -0700
  • Content-type application/mac-binhex40
    nametiny_text_Word_doc.doc
  • Content-disposition attachment
    filenametiny_text_Word_doc.doc
  • ltWord document and more stuff below heregt

This identical boundary marker separates the
parts of the mail message
17
Pulling Emails
  • Offline (POP3 model)
  • Client connects to server and pulls all email
    down to client
  • Everything is stored on the client
  • Online (Original IMAP model)
  • Client connects to server for every transaction
  • Everything is stored on the server
  • Disconnected (Later IMAP model)
  • Client and server share storage burden
  • Server is always authoritative and client must
    synchronize to server

18
POP Post Office Protocol
  • Used to transfer mail from a mail server to a
    User Agent

Mail Server
POP
UA
File System
19
POP (version 3)
  • Similar to SMTP command/reply lockstep
  • Minimizes server resources
  • Used to retrieve mail for a single user
  • requires authentication
  • Commands and replies are ASCII lines
  • Replies start with OK or -ERR
  • Replies may contain multiple lines
  • POP has no security
  • Except when used with SSL, TLS

20
A POP3 Exchange
  • gt telnet monte pop3
  • Trying 128.213.8.110...
  • Connected to monte.cs.rpi.edu (128.213.8.110).
  • Escape character is ''.
  • OK POP3 monte.cs.rpi.edu v7.59 server ready
  • user joe
  • OK User name accepted, password please
  • pass joepw
  • OK Mailbox open, 1 messages
  • stat
  • OK 1 412
  • list
  • OK Mailbox scan listing follows
  • 1 412
  • .

21
POP3 Example Continued
  • retr 1
  • OK 412 octets
  • Return-Path lthollingdgt
  • Received (from hollingd_at_localhost)
  • by monte.cs.rpi.edu (8.9.3/8.9.3) id
    NAA06943
  • for joe Mon, 20 Mar 2000 134954 -0500
  • Date Mon, 20 Mar 2000 134954 -0500
  • From Dave Hollinger lthollingd_at_monte.cs.rpi.edugt
  • Message-Id lt200003201849.NAA06943_at_monte.cs.rpi.ed
    ugt
  • To joe_at_monte.cs.rpi.edu
  • Status O
  • blah
  • .

22
Internet Message Access Protocol
  • On-line, off-line, or disconnected mode operation
  • Server-side Mailbox Manipulation
  • Multiple mailbox support
  • Control of all folders everywhere
  • Online performance optimization
  • User can check email header or search a string
    before downloading
  • Real authentication

23
POP vs. IMAP
POP3
All Messages
Whole message
IMAP
Dr.Amer
Friends
.
headers
24
WebMail
  • Web-base email access
  • User agent -gt web browser
  • User agent-mail server communication based on
    HTTP
  • HTTP to send messages from user to the mail
    server of the user
  • HTTP to get mail from the mail server of the
    destination

25
Lecture 13File Transfer Protocols
  • CPE 401 / 601
  • Computer Network Systems

slides are modified from Dave Hollinger
slides are modified from Dave Hollinger and
Michael
26
File Transfer Protocols
  • File Transfer Protocol (RFC 959)
  • Why FTP?
  • FTPs connections
  • FTP in action
  • FTP commands/responses
  • Trivial File Transfer Protocol (RFC 1350)
  • TFTP and TFTPs message formats
  • FTP and TFTP compared

27
Why do we need a FTP Service?
  • Purpose To Transfer files between two computers
  • Goals of FTP Service
  • Promote sharing of files (programs and/or data)
  • Encourage indirect/implicit use of remote
    computers
  • Shield users from variations in file storage
    among hosts
  • Transfer data reliably and efficiently

28
Problems of File Transfer
  • At first, file transfer may seem simple
  • Heterogeneous systems use different
  • Operating Systems
  • Character Sets
  • Naming Conventions
  • Directory Structures
  • File Structures and Formats
  • FTP need to address and resolve these problems

29
File Transfer Protocol
  • Exchange and manipulate files over TCP
  • Separate control and data connections between the
    client and server applications
  • RFC 959 includes information and details
  • parameters for commands
  • lists of reply status codes
  • protocol state diagrams
  • support for a variety of file structures
  • sample sessions

30
The FTP Model
PI Protocol Interpreter DTP Data Transfer
Protocol
User Interface
User
Control
Server PI
User PI
Data
File System
File System
User DTP
Server DTP
31
Control and Data Connections
  • Control functions (commands) and reply codes are
    transferred over the control connection.
  • All data transfer takes place over the data
    connection.
  • The control connection must be up while data
    transfer takes place.

32
Control Connection
  • The control connection is the well known
    service.
  • The control connection uses the TELNET protocol.
  • Commands and replies are all line oriented text
    (default is ASCII).

33
FTPs Connections
client
User Interface
server
User Protocol Interpreter
Server Protocol Interpreter
Control Connection
21
User Data Transfer Function
Server Data Transfer Function
Data Connection
20
34
FTP - Connection Establishment
ftpgt open cse.unr.edu
Connected to cse.unr.edu 220 cse FTP server
ready. 530 Please login with USER and PASS
client
331 Password req for mgunes. Password
User Interface
230 User mgunes logged in. ftpgt
USER mgunes
PASS mypass
server
User Protocol Interpreter
Server Protocol Interpreter
Control Connection
User Data Transfer Function
Server Data Transfer Function
Data Connection
35
FTP - Data Transfer
client
ls client.txt
-rw-r--r-- mgunes client.txt
User Interface
226 Closing Data Connection
PORT 192,168,100,173,19,137
200 Port Command Sucessful
LIST client.txt
150 Data Connection will be open shortly

server
User Protocol Interpreter
Server Protocol Interpreter
User Protocol Interpreter
Server Protocol Interpreter
Control Connection
Passive open on Port 5001
User Data Transfer Function
Server Data Transfer Function
Data Connection
Establish Data Connection
36
FTP - Connection Closing
bye
client
User Interface
221 Service Closing
QUIT

server
User Protocol Interpreter
Server Protocol Interpreter
Control Connection
User Data Transfer Function
Data Connection
Server Data Transfer Function
37
FTP Connections
38
FTP Client Commands
Command Description
get filename Retrieve file from server
mget filename Retrieve multiple files from server
put filename Copy local file to server
mput filename Copy multiple local files to server
open server Begin login to server
bye / close / exit Logoff server
ls / dir List files in current remote dir on server
lcd Change local directory
cd Change remote directory
rhelp / remotehelp Lists commands the server accepts
Sent to server as multiple command by User
Protocol Interpreter
39
Data Transfer Modes
  • STREAM
  • file is transmitted as a stream of bytes
  • BLOCK
  • file is transmitted as a series of blocks
    preceded by headers containing count and
    descriptor code
  • COMPRESSED
  • uses a simple compression scheme on transmitted
    blocks

40
FTP Replies
  • All replies are sent over control connection.
  • Replies are a single line containing
  • 3 digit status code (sent as 3 numeric chars).
  • text message.
  • The FTP spec. includes support for multiline text
    replies.

41
FTP Reply Status Code
  • First digit of status code indicates type of
    reply
  • 1 Positive Preliminary Reply (got it, but
    wait).
  • 2 Positive Completion Reply (success).
  • 3 Positive Intermediate Reply (waiting for
    more information).
  • 4 Transient Negative Completion (error - try
    again).
  • 5 Permanent Negative Reply (error - cant do).

42
FTP Reply Status Code
  • 2nd digit indicates function groupings.
  • 0 Syntax (problem with command syntax).
  • 1 Information (reply to help or status cmds).
  • 2 Connections (problem with a connection).
  • 3 Authentication (problem with login).
  • 4 Unspecified.
  • 5 File system (related to file system).
  • 3rd digit indicates specific problem within
    function group.

43
Example FTP Responses
  • 120 Service will be ready shortly
  • 200 Command OK
  • 230 User login OK
  • 331 User name OK password is needed
  • 421 Service not available
  • 530 User not logged in
  • 552 Requested action aborted exceeded
    storage allocation

44
Trivial FTP
45
Trivial FTP (TFTP)
  • Simple and small
  • 5 message formats
  • Runs on UDP
  • Designed to fit in ROM
  • Uses a stop and wait protocol
  • NO BUILT IN SECURITY FEATURES (login)
  • Used only to read and write files from/to a
    server
  • Cannot list directories
  • Useful for bootstrapping diskless systems
  • Workstations
  • X terminals

46
Diskless Workstation Booting 1
  • The call for help

Help! I don't know who I am! My Ethernet address
is 4C231777A603
Diskless Workstation
RARP
47
The answer from the all-knowing
RARP Server
I know all! You are to be know as 128.113.45.211
Diskless Workstation
RARP REPLY
48
The request for instructions
I need the file named boot-128.113.45.211
Diskless Workstation
TFTP Request (Broadcast)
49
The dialog
TFTP Server
here is part 1
I got part 1
here is part 2
Diskless Workstation
boot file
TFTP File Transfer
50
TFTP Protocol
  • 5 message types
  • Read request
  • Write request
  • Data
  • ACK (acknowledgment)
  • Error
  • Each is an independent UDP Datagram
  • Each has a 2 byte opcode (1st 2 bytes)
  • The structure of the rest of the datagram depends
    on the opcode

51
TFTP Message Formats
52
TFTP transfer modes
  • octet for transferring binary files.
  • no translation done.
  • netascii for transferring text files.
  • all lines end with \r\n (CR,LF).
  • provides standard format for transferring text
    files.
  • both ends responsible for converting to/from
    netascii format.

53
NetAscii Transfer Mode
  • Unix - end of line marker is just '\n'
  • receiving a file
  • you need to remove '\r' before storing data.
  • sending a file
  • you need to replace every '\n' with "\r\n" before
    sending

54
Read Request
01
filename
0
mode
0
null terminated ascii string containing name of
file
null terminated ascii string containing transfer
mode
2 byte opcode network byte order
variable length fields!
55
Write Request
02
filename
0
mode
0
null terminated ascii string containing name of
file
null terminated ascii string containing transfer
mode
2 byte opcode network byte order
variable length fields!
56
TFTP Data Packet
03
block
data 0 to 512 bytes
2 byte block number network byte order
2 byte opcode network byte order
all data packets have 512 bytes except the last
one.
57
TFTP Acknowledgment
04
block
2 byte block number network byte order
2 byte opcode network byte order
58
TFTP Error Packet
05
errcode
errstring
0
null terminated ascii error string
2 byte opcode network byte order
2 byte error code network byte order
59
TFTP Error Codes (16 bit int)
  • 0 - not defined
  • 1 - File not found
  • 2 - Access violation
  • 3 - Disk full
  • 4 - Illegal TFTP operation
  • 5 - Unknown port
  • 6 - File already exists
  • 7 - No such user

60
TFTP Connection Establishment
61
TFTP Session
62
Lost Data Packets
  • Original Protocol Specification
  • Sender uses a timeout with retransmission.
  • sender could be client or server.
  • Duplicate data packets must be recognized and ACK
    retransmitted.
  • This original protocol suffers from the
    "sorcerers apprentice syndrome".

63
Sorcerers Apprentice Syndrome
send DATAn (time out) retransmit
DATAn receive ACKn send DATAn1 receive
ACKn (dup) send DATAn1(dup) ...
receive DATAn send ACKn receive DATAn
(dup) send ACKn (dup) receive DATAn1 send
ACKn1 receive DATAn1 (dup) send ACKn1
(dup)
64
The Fix
  • Sender should not resend a data packet in
    response to a duplicate ACK.
  • If sender receives ACKn
  • dont send DATAn1 if the ACK was a duplicate.

65
Concurrency
  • TFTP servers use a "well known address"
  • UDP port number
  • How would you implement a concurrent server?
  • forking (alone) may lead to problems!
  • Can provide concurrency without forking, but it
    requires lots of bookkeeping.

66
TFTP Concurrency
  • According to the protocol, the server may create
    a new udp port and send the initial response from
    this new port.
  • The client should recognize this, and send all
    subsequent messages to the new port.

67
When is it over?
  • There is no length of file field sent!
  • All data messages except the last one contain 512
    bytes of data.
  • message length is 2 2 512 516
  • The last data message might contain 0 bytes of
    data!

68
Issues
  • What if more than 65535 chunks are sent?
  • 65536 blocks x 512 bytes/block 33,554,432
    bytes.
  • The RFC does not address this issue!
  • Remember that the network can duplicate packets!

69
FTP vs. TFTP
  • FTP provides (minimal) security through login
    procedure
  • TFTP has NO login procedure
  • FTP Provides a reliable service through its use
    of TCP
  • TFTP must handle its own retransmissions since it
    uses UDP
  • FTP uses two connections
  • TFTP uses one connection (stop and wait)
  • FTP provides many commands
  • TFTP can only read and write files
Write a Comment
User Comments (0)
About PowerShow.com