No Slide Title

Report
Chapter Objectives
After completing this chapter you will be able to:
 Understand remote command execution (Telnet and rlogin)
 Understand remote file transfer protocol (FTP, TFTP, RPC)
 Understand protocols for mail transfer (SMTP, POP3, IMAP4)
 Understand NFS and HTTP protocols
Telnet
 Remote terminal protocol which allows a user at one site to
establish a TCP connection to a login server at another
 Username and password are transferred unsecured (plain text)
through the network
 Defines a network virtual terminal that provides a standard interface
to remote systems
 Includes a mechanism that allows the client and server to negotiate
options, and it provides a set of standard options
 Treats both ends of the connection symmetrically
Telnet (Contd)
Local directly attached Client
Remote Telnet Client
Remote
Login
SERVER
LAN
Local
Login
Network Virtual Terminal (NVT)
Telnet
Client
Client system
format used
ASCII
Control
code
NUL
TCP Connection
Telnet
Server
NVT
format used
Decimal
Assigned meaning
value
0
No operation (has no effect on output)
BEL
7
Produce audible signal
BS
8
Move left one character position
HT
9
Move right to the next horizontal tab stop
LF
10
Move down (vertically) to the next line
VT
11
Move down to the next vertical tab stop
FF
12
Move to the top of the next page
CR
13
Move to the left margin on the current line
Server system
format used
Telnet Command Codes
Command
SE
NOP
DM
BRK
IP
AO
AYT
EC
EL
GA
SB
WILL
WONT
DO
DONT
IAC
Decimal
Assigned Meaning
Value
240
End of option sub-negotiation
241
No operation
242
Data mark
243
Break
244
Interrupt process
245
Abort output
246
Are you there
247
Erase character
248
Erase line
249
Go ahead
250
Begin sub-negotiation
251
Sender request enabling option
252
Sender rejects enabling option
253
Sender requests other side enabling option
254
Sender rejects other side enabling option
255
Interpret next octet as command
Telnet Options
Name
Code
RFC
Assigned meaning
Transmit Binary
0
856
Change transmission to 8-bit binary
Echo
1
857
Allow one side to echo data it receives
Suppress-GA
3
858
Suppress go-ahead signal after data
Status
5
859
Request for status of a Telnet option from remote site
Timing-mark
6
860
Request timing mark to be inserted in return stream
Terminal-type
24
884
Exchange info.. about the terminal type being used
End-of-record
25
885
Terminate data sent with EOR code
Linemode
34
1116
Send complete lines instead of individual characters
Rlogin
 Rlogin is a more flexible implementation of Telnet for UNIX
 Rsh invokes a command interpreter on the remote UNIX machine and
passes the command line arguments to the command interpreter
 The format of a command invocation using rsh is:
– rsh <machine> <command>
– rsh unixserver1 ps
 Rlogin understands the UNIX notions of standard input, standard
output, and standard error, and uses TCP to connect them to the
remote machine.
– “rsh unixserver1 ps > filename
File Transfer Protocol (FTP)
FTP is the Internet standard for file transfer.
FTP is used to copy a complete file from one system to
another system.
FTP also offers facilities other than the transfer function
itself:
– Interactive access
– Format specification
– Authentication control
File Transfer Protocol - (FTP)
FTP control (port 21)
FTP data (port 20)
FTP Commands
Command
Description
open
disconnect
user
cd
lcd
pwd
get/mget
put/mput
binary
ascii
dir/ls
help
delete
bye
connect to remote FTP
terminate FTP session
send new user info when already connected
change remote working directory
change local working directory
print working directory on remote machine
receive file/get multiple files
send file/send multiple files
set binary transfer type
set ascii transfer type
list contents of remote directory
get help
delete a file on the remote directory
terminate ftp session and exit
FTP Replies
Reply
Description
1yz
Positive preliminary reply. The action is being started, but expect another
reply, before sending another command.
2yz
Positive completion reply. A new command can be sent.
x0z
Positive intermediate reply. The command has been accepted but another
command must be sent.
Transient negative completion reply.The requested action did not take place,
but the error condition is temporary so the command can be reissued later.
Permanent negative completion reply. The command was not accepted and
should not be retried.
Syntax errors
x1z
Information
x2z
Connections; Replies referring to the control or data connections.
x3z
Authentication and accounting. Replies for the login or accounting commands.
x4z
Unspecified
x5z
Filesystem status
3yz
4yz
5yz
FTP Example
> ftp rs.internic.net
Connected to rs.internic.net.
220-*****Welcome to the InterNIC Registration Host *****
*****Login with username "anonymous"
*****You may change directories to the following:
policy
templates
netinfo
domain
- Registration Policies
- Registration Templates
- NIC Information Files
- Root Domain Zone Files
220 And more!
User (rs.internic.net:(none)): anonymous
331 Guest login ok, send your complete e-mail address as password.
Password:xxxxxxxxxxxx
230 Guest login ok, access restrictions apply.
ftp> cd rfc
250 CWD command successful.
ftp> get rfc1878.txt
200 PORT command successful.
150 Opening ASCII mode data connection for rfc1878.txt (19414 bytes).
226 Transfer complete.
ftp: 19865 bytes received in 85.02Seconds 0.23Kbytes/sec.
FTP Example (Contd)
Client
Server
USER
anonymous
PASS
guest
230 User logged in , access restrictions apply
TYPE ASCII
200 Command OK
MODE STREAM
200 Command OK
STRU FILE
200 Command OK
RETR
200 Port Command OK
150 Opening data connection for...
226 Transfer complete
QUIT
TFTP - Trivial File Transfer Protocol
 TFTP is an extremely simple protocol to transfer files
 Communication between a TFTP client and server uses UDP (port 69)
not TCP
 TFTP does not have authorisation
 TFTP always sends 512-byte blocks of data
TFTP Process
TFTP Client
TFTP Server
WRQ
(WRQ)
ACK
(ACK)
DATA
512 octets
(DATA)
ACK
(ACK)
DATA
< 512 octets
(ACK)
(DATA)
ACK
Format of TFTP Messages
2 octets
Read request (1)
n octets
1 octet
Filename
0
n octets
1 octet
Filename
0
2 octets
Write request (2)
2 octets
Data (3)
2 octets
Ack (4)
2 octets
Error (5)
n octets
Mode
n octets
Mode
Up to 512 octets
2 octets
Block number
Data
2 octets
Block number
2 octets
Error code
n octets
Error message
0
1 octet
0
1 octet
0
Remote Procedure Call
 RPC executes procedures (tasks, subroutines, and subprocedures) remotely.
– The client obtains control and forms a message to the server that
contains the arguments for the remote procedure
– The server unpacks the arguments, performs the procedure, packs the
results of the procedure in a message, and returns it to the client
– The client unpacks the message and returns control to the calling
program
 RPC is a session layer protocol than can use either UDP or TCP
transport.
 header contains the transaction ID, the identifier for the direction of
transfer, the protocol version number, the program number, the
procedure number, and the authorisation.
Simple Mail Transfer Protocol (SMTP)
 SMTP is the Internet standard mail service
 Uses TCP port 25
SMTP
TCP
IP
Network Interface
(data-link & physical)
SMTP Process
 User
– interactively creates the message
 User agent
– accepts the message and formats it
– builds list of destinations
– sends list and message to a queue for the client
 Client
– establishes TCP connection with remote SMTP servers
– sends addresses to the relevant servers
– sends single copy of message to each server
 Server
– constructs a header (which includes pointer to user’s text) for each
address
– places header in the queue of the appropriate mailbox
SMTP Process (Contd)
User terminal A
User terminal B
Port 25
SMTP
Client
SMTP
Server
SMTP System 1
Port 25
User terminal C
SMTP
Server
TCP/IP Internet
SMTP
Client
SMTP System 2
SMTP Commands and Replies
HELO
Initialise connection
MAIL
RCPT
SEND
DATA
QUIT
Terminate connection
SMTP Commands
 HELO
– sent by an SMTP agent to initialise a connection and identify the SMTP
client.
– format: “HELO(SP){domain host name}(CRLF)”.
 MAIL
– identifies the sender
– format: “MAIL(SP)<reverse path>(CRLF)”.
 RCPT
– identifies the recipient
– format: “RCPT(SP)TO:<forward path>(CRLF)”.
SMTP Commands (Contd)
 DATA
– informs the SMTP server that the phase of sending forward paths is
complete
– implies the next communication is data.
– format: “DATA(CRLF)”
 SEND
– identifies an individual terminal to receive the mail
– format: “SEND(SP)TO:<reverse path>(CRLF)”.
 QUIT
– advises the SMTP server that the SMTP client is finished
– format: “QUIT(CRLF)”.
Reply Codes
Reply
Code
Meaning
Reply
Code
Meaning
211
System status
500
Syntax error, command unrecognised
214
Human information about how to use SMTP
501
Syntax error, in parameters or arguments
220
<domain> service ready
502
Command not implemented
221
<domain> service closing channel
503
Bad sequence number
250
Requested mail action okay, completed
504
Command parameter not implemented
251
User not local, forwarded to forward path
550
Requested action not taken; mailbox unavailable
354
Start mail input, end with <CRLF>.<CRLF>
551
Requested action not taken; error in processing
421
<domain> Service not available
552
User not local; please try <forward path>
450
Requested action aborted; mailbox unavailable
553
Action not taken; mailbox name not allowed
451
Requested action aborted; error in processing
554
Transaction failed
452
Requested action aborted; insufficient storage
SMTP Protocol Example
Number
Client/Server
Reply code communication
1
Server
220 {Server Name B} Mail Transfer Service Ready
2
Client
HELO {Host Name A}
3
Server
250 {Service Name B}
4
Client
MAIL FROM:<[email protected]>
5
Server
250 OK
6
Client
RCPT TO:<[email protected]>
7
Server
250 OK
SMTP Protocol Example (Contd)
Number
Client/Server
Reply code communication
8
Client
RCPT TO:<[email protected]>
9
Server
550 No such user here
10
Client
RCPT TO:<[email protected]>
11
Server
250 OK
12
Client
DATA
13
Server
354 Start mail input; end with <CRLF>.<CRLF>
14
Client
{ASCII character text}
15
Client
<CRLF>.<CRLF>
16
Server
250 OK
17
Client
QUIT
18
Server
221 {Host Name B} Service closing channel
Post Office Protocol Version 3 (POP3)
User terminal A
User terminal B
POP 3 Client
POP 3 Client
Port 110
Port 25
SMTP
Client
SMTP
Server
SMTP System 1
Port 25
POP 3 Server
Port 110
POP 3 Server
SMTP
Server
TCP/IP Internet
SMTP
Client
SMTP System 2
POP3 Basic Operation
TCP Connection to port 110
Greeting
POP 3 Client
POP 3 Server
POP3 Basic Operation (Contd)
Commands
Replies
POP 3 Client
POP 3 Server
1. Authorisation State
2. Transaction State
3. Update State
POP3 Commands
Valid in the Authorisation state
– USER name
– PASS string
– QUIT
POP3 Commands (Contd)
 Valid in the Transaction state
– STAT
– LIST [msg]
– RETR msg
– DELE msg
– NOOP
– RSET
– QUIT
POP3 Commands Example
S:
C:
S:
C:
S:
S:
S:
S:
C:
S:
S:
S:
C:
S:
C:
S:
S:
S:
C:
S:
C:
S:
C:
+OK mrose's maildrop has 2 messages (320 octets)
STAT
+OK 2 320
LIST
+OK 2 messages (320 octets)
1 120
2 200
.
RETR 1
+OK 120 octets
<the POP3 server sends message 1>
.
DELE 1
+OK message 1 deleted
RETR 2
+OK 200 octets
<the POP3 server sends message 2>
.
DELE 2
+OK message 2 deleted
QUIT
+OK dewey POP3 server signing off (maildrop empty)
<close connection>
Internet Message Access Protocol - Version 4 (IMAP4)
User terminal A
User terminal B
IMAP4 Client
Port 143 IMAP4 Server
Port 143
Port 25
SMTP
Client
SMTP
Server
SMTP System 1
IMAP4 Client
Port 25
IMAP4 Server
SMTP
Server
TCP/IP Internet
SMTP
Client
SMTP System 2
Network File System
User
process
Local file
access
Client
Kernel
Local disk
NFS
client
NFS
server
TCP/UDP
IP
TCP/UDP
IP
Server
kernel
Local file
access
Local disk
NFS provides transparent file access for clients to files and file systems on a server
NFS Procedures
 GETATTR
– Return the attributes of a file
 SETATTR
– Set the attributes of a file
 STAFS
– Return the status of a file system
 LOOKUP
– Lookup a file
 READ
– Read from a file
 WRITE
– Write to a file
 CREATE
– Create a file
NFS Procedures (Contd)
 REMOVE
– Delete a file
 RENAME
– Rename a file
 SYMLINK
– Creates a symbolic link to a file
 READLINK
– Read a symbolic link
 MKDIR
– Create a directory
 RMDIR
– Delete a directory
 READDIR
– Read a directory
NFS Example
SUN client
Unix1
Sun% cd /nfs/unix1/usr/smith
Sun% mkdir Mail
Source
Command
1
sun
104 getatttr
2
Unix1
Reply ok 96
3
sun
104 getattr
4
Unix1
Reply ok 96
5
sun
104 getattr
6
Unix1
Reply ok 96
7
sun
8
Unix1
9
sun
10
Unix1
112 lookup “Mail”
Reply ok 28
1144 mkdir “Mail”
Reply ok 128
Hypertext Transfer Protocol
 The standard communication protocol between Web servers and
clients is the Hypertext Transfer Protocol (HTTP)
 The standard language for writing Web documents is Hypertext
Markup Language (HTML)
 Every Web page is assigned a unique URL (Uniform Resource
Locator), for example:
– http://www.ericsson.com/datacom/solutions
HTTP Message Format
command
URL
GET http://server.name/path/file.type
protocol
HTTP server
domain name
path name
file name
GET http://www.ericsson.com/datacom/solutions
HTTP/1.0 Full Request
Method(SP)http://server.name/path/file.type(SP)HTTP/1.0(CR)(LF)
General-header (CR)(LF)
Request-header (CR)(LF)
Entity-header (CR)(LF)(CR)(LF)
Body
Web Operation Example
Server
www.w3.org
Server
xyz.com
Client
Hyperlink
to www.w3.org
Hyperlink
to xyz.com
Browser
Program
DISK
HTTP used over
this TCP connection
Internet
HTTP
Server
DISK
HTTP
Server

similar documents