Chapter Objectives After completing this chapter you will
Chapter Objectives After completing this chapter you will be able to: l Understand remote command execution (Telnet and rlogin) l Understand remote file transfer protocol (FTP, TFTP, RPC) l Understand protocols for mail transfer (SMTP, POP 3, IMAP 4) l Understand NFS and HTTP protocols
Telnet l Remote terminal protocol which allows a user at one site to establish a TCP connection to a login server at another l Username and password are transferred unsecured (plain text) through the network l Defines a network virtual terminal that provides a standard interface to remote systems l Includes a mechanism that allows the client and server to negotiate options, and it provides a set of standard options l 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 system format used ASCII Control code NUL BEL BS HT LF VT FF CR TCP Connection Telnet Server NVT format used Decimal Assigned meaning value 0 7 8 9 10 11 12 13 No operation (has no effect on output) Produce audible signal Move left one character position Move right to the next horizontal tab stop Move down (vertically) to the next line Move down to the next vertical tab stop Move to the top of the next page 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 Echo Suppress-GA 0 1 3 856 857 858 Change transmission to 8 -bit binary Allow one side to echo data it receives Suppress go-ahead signal after data Status Timing-mark Terminal-type End-of-record Linemode 5 6 24 25 34 859 860 884 885 1116 Request for status of a Telnet option from remote site Request timing mark to be inserted in return stream Exchange info. . about the terminal type being used Terminate data sent with EOR code Send complete lines instead of individual characters
Rlogin l Rlogin is a more flexible implementation of Telnet for UNIX l Rsh invokes a command interpreter on the remote UNIX machine and passes the command line arguments to the command interpreter l The format of a command invocation using rsh is: – rsh <machine> <command> – rsh unixserver 1 ps l Rlogin understands the UNIX notions of standard input, standard output, and standard error, and uses TCP to connect them to the remote machine. – “rsh unixserver 1 ps > filename
File Transfer Protocol (FTP) l FTP is the Internet standard for file transfer. l FTP is used to copy a complete file from one system to another system. l 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 1 yz Positive preliminary reply. The action is being started, but expect another reply, before sending another command. 2 yz Positive completion reply. A new command can be sent. x 0 z 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 x 1 z Information x 2 z Connections; Replies referring to the control or data connections. x 3 z Authentication and accounting. Replies for the login or accounting commands. x 4 z Unspecified x 5 z Filesystem status 3 yz 4 yz 5 yz
FTP Example > ftp rs. internic. net Connected to rs. internic. net. 220 -*****Welcome to the Inter. NIC 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: xxxxxx 230 Guest login ok, access restrictions apply. ftp> cd rfc 250 CWD command successful. ftp> get rfc 1878. txt 200 PORT command successful. 150 Opening ASCII mode data connection for rfc 1878. txt (19414 bytes). 226 Transfer complete. ftp: 19865 bytes received in 85. 02 Seconds 0. 23 Kbytes/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 l TFTP is an extremely simple protocol to transfer files l Communication between a TFTP client and server uses UDP (port 69) not TCP l TFTP does not have authorisation l 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 2 octets Write request (2) 2 octets Data (3) 2 octets Ack (4) 2 octets Error (5) n octets Mode Up to 512 octets Block number Data 2 octets Block number 2 octets Error code n octets Error message 0 1 octet 0
Remote Procedure Call l 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 l RPC is a session layer protocol than can use either UDP or TCP transport. l 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) l SMTP is the Internet standard mail service l Uses TCP port 25 SMTP TCP IP Network Interface (data-link & physical)
SMTP Process l User – interactively creates the message l User agent – accepts the message and formats it – builds list of destinations – sends list and message to a queue for the client l Client – establishes TCP connection with remote SMTP servers – sends addresses to the relevant servers – sends single copy of message to each server l 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 l HELO – sent by an SMTP agent to initialise a connection and identify the SMTP client. – format: “HELO(SP){domain host name}(CRLF)”. l MAIL – identifies the sender – format: “MAIL(SP)<reverse path>(CRLF)”. l RCPT – identifies the recipient – format: “RCPT(SP)TO: <forward path>(CRLF)”.
SMTP Commands (Contd) l DATA – informs the SMTP server that the phase of sending forward paths is complete – implies the next communication is data. – format: “DATA(CRLF)” l SEND – identifies an individual terminal to receive the mail – format: “SEND(SP)TO: <reverse path>(CRLF)”. l QUIT – advises the SMTP server that the SMTP client is finished – format: “QUIT(CRLF)”.
Reply Codes 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> 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 5 6 7 Client Server MAIL FROM: <Smith@Test. sys> 250 OK RCPT TO: <Jones@Mfg. tst> 250 OK
SMTP Protocol Example (Contd) Number Client/Server Reply code communication 8 Client RCPT TO: <Williams@Mfg. tst> 9 Server 550 No such user here 10 Client RCPT TO: <Bob@Engr. dev> 11 Server 250 OK 12 Client DATA 13 14 15 16 17 18 Server Client Server 354 Start mail input; end with <CRLF> {ASCII character text} <CRLF> 250 OK QUIT 221 {Host Name B} Service closing channel
Post Office Protocol Version 3 (POP 3) User terminal A User terminal B POP 3 Client Port 110 POP 3 Server Port 25 SMTP Client SMTP Server SMTP System 1 Port 25 POP 3 Server SMTP Server TCP/IP Internet SMTP Client SMTP System 2
POP 3 Basic Operation TCP Connection to port 110 Greeting POP 3 Client POP 3 Server
POP 3 Basic Operation (Contd) Commands Replies POP 3 Client POP 3 Server 1. Authorisation State 2. Transaction State 3. Update State
POP 3 Commands l Valid in the Authorisation state – USER name – PASS string – QUIT
POP 3 Commands (Contd) l Valid in the Transaction state – STAT – LIST [msg] – RETR msg – DELE msg – NOOP – RSET – QUIT
POP 3 Commands Example S: C: S: S: 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 POP 3 server sends message 1>. DELE 1 +OK message 1 deleted RETR 2 +OK 200 octets <the POP 3 server sends message 2>. DELE 2 +OK message 2 deleted QUIT +OK dewey POP 3 server signing off (maildrop empty) <close connection>
Internet Message Access Protocol - Version 4 (IMAP 4) User terminal A User terminal B IMAP 4 Client Port 143 IMAP 4 Server Port 143 Port 25 SMTP Client SMTP Server SMTP System 1 IMAP 4 Client Port 25 IMAP 4 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 Server kernel Local file access Local disk NFS provides transparent file access for clients to files and file systems on a server
NFS Procedures l GETATTR – Return the attributes of a file l SETATTR – Set the attributes of a file l STAFS – Return the status of a file system l LOOKUP – Lookup a file l READ – Read from a file l WRITE – Write to a file l CREATE – Create a file
NFS Procedures (Contd) l REMOVE – Delete a file l RENAME – Rename a file l SYMLINK – Creates a symbolic link to a file l READLINK – Read a symbolic link l MKDIR – Create a directory l RMDIR – Delete a directory l READDIR – Read a directory
NFS Example SUN client Sun% cd /nfs/unix 1/usr/smith Sun% mkdir Mail Unix 1 1 2 3 4 5 6 7 8 9 10 Source Command sun Unix 1 sun Unix 1 104 getatttr Reply ok 96 104 getattr Reply ok 96 112 lookup “Mail” Reply ok 28 1144 mkdir “Mail” Reply ok 128
Hypertext Transfer Protocol l The standard communication protocol between Web servers and clients is the Hypertext Transfer Protocol (HTTP) l The standard language for writing Web documents is Hypertext Markup Language (HTML) l 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) Body
Web Operation Example Server www. w 3. org Client Hyperlink to www. w 3. org Server xyz. com Hyperlink to xyz. com Browser Program DISK HTTP used over this TCP connection Internet HTTP Server DISK HTTP Server
- Slides: 41