04 -FTP Email and DNS04 FTP, Email, and DNS2: Application Layer1Chapter 2Chapter 2Application Layerpp yC mp t N t kin : A note on the use of these ppt slides:We’re making these slides freely available to all (faculty, students, readers). Computer Networking: A Top Down Approach Featuring the Internet, 3rdedition. gy(y )They’re in PowerPoint form so you can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following: If you use these slides (e.g., in a class) in substantially unaltered form, th t ti th i ( ft ll ’d lik l t b k!)Jim Kurose, Keith RossAddison-Wesley, July 2004. that you mention their source (after all, we’d like people to use our book!) If you post any slides in substantially unaltered form on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material.Thanks and enjoy! JFK/KWR2: Application Layer2Thanks and enjoy! JFK/KWRAll material copyright 1996-2004J.F Kurose and K.W. Ross, All Rights ReservedFTP: the File Transfer ProtocolFF ffl ffile transferFTPserverFTPuserinterfaceFTPclientll filremote fileuser transfer file to/from remote hostlocal filesystemremote filesystemat hosttransfer file to/from remote host client/server modelclient:side that initiates transfer (either to/from mt)remote)server:remote host ftp: RFC 9592: Application Layer3 ftp server: port 21FTP: separate control, data connectionsp, FTP client contacts FTP TCP control connectionport 21server at port 21, specifying TCP as transport protocol Client obtains authorization FTPFTPTCP data connectionport 20over control connection Client browses remote directory by sending clientserverp Server opens a second TCP data connection to transfer commands over control connection. When server receives a data connection to transfer another file. Control connection: “out of band”command for a file transfer, the server opens a TCP data connection to clientband FTP server maintains “state”: current directory, earlier authentication2: Application Layer4 After transferring one file, server closes connection.authenticationSample commandsSample commands sent as ASCII text over control channel Authentication USER: specify the user name to log in as PASS: specify the user’s password Exploring the files LIST: list the files for the given file specification CWD: change to the given directory Downloading and uploading files TYPE: set type to ASCII (A) or binary image (I) RETR: retrieve the given file STOR: upload the given file Closing the connection QUIT: close the FTP connection2: Application Layer5Sample return codesSample return codes status code and phrase (as in HTTP)331 Username OK password required331 Username OK, password required 125 data connection already open; transfer startingtransfer starting 425 Can’t open data connection452 Error writing file452 Error writing file2: Application Layer6Why two connections?Why two connect ons? Avoids need to mark the end of the data transfer Data transfer ends by closing of data connection Yet, the control connection stays upAborting a data transferAborting a data transfer Can abort a transfer without killing the control connection… which avoids requiring the user to log in again… which avoids requiring the user to log in again Done with an ABOR on the control connection Third-party file transfer between two hostsData connection could go to a different hostData connection could go to a different host … by sending a different client IP address to the server E.g., user coordinates transfer between two serversB t: this is l n d d nd p s nts s it iss s2: Application Layer7But: this is rarely needed, and presents security issuesFTP, SFTPFTP, SFTPFTP is not secure –nothing is encrypted!FTP is not secure nothing is encrypted! SFTP uses SSH, and should be used instead of FTP when possible.fF p .2: Application Layer8Electronic Mailoutgoing message queueEThree major components:user mailboxmessage queueuseragentjp user agents mail servers simple mail transfer useragentmailserveragentSMTPsimple mail transfer protocol: SMTPUser AgentmailserveruseragentSMTPSMTPUser Agent a.k.a. “mail reader” composing, editing, reading mail messagesuseragentmailserverSMTPmail messages e.g., Eudora, Outlook, elm, Netscape Messengerti i i useragentuser2: Application Layer9outgoing, incoming messages stored on serveragentElectronic Mail: mail serversEmMail Serversuseragent mailbox contains incoming messages for usermessagequeueof outgoing useragentmailserveragentSMTPmessagequeueof outgoing (to be sent) mail messages SMTP protocol between mail servers to send email mailserveruseragentSMTPSMTPservers to send email messages client: sending mail serveruseragentmailserverSMTPserver “server”: receiving mail serverserveruseragentuser2: Application Layer10useragentScenario: Alice sends message to Bob1) Alice uses UA to compose message and “to” bob@someschool edu4) SMTP client sends Alice’s message over the TCP [email protected]) Alice’s UA sends message to her mail server; message placed in message queueconnection5) Bob’s mail server places the message in Bob’s mailbox6) B b inv k s his us r nt placed in message queue3) Client side of SMTP opens TCP connection with Bob’s mail server6) Bob invokes his user agent to read messagemail serveruseragentmailservermailserveruseragent1234562: Application Layer115Electronic Mail: SMTP [RFC 2821]E[F ] uses TCP to reliably transfer email message from client yto server, port 25 direct transfer: sending server to receiving server three phases of transferpff handshaking (greeting) transfer of messagesclosureclosure command/response interaction commands: ASCII text response: status code and phrase messages must be in 7-bit ASCII2: Application Layer12Sample SMTP interactionmp>telnet hamburger.edu 25S: 220 hamburger.edu C: HELO crepes.fr S: 250 Hello crepes.fr, pleased to meet you C: MAIL FROM: <[email protected]> S 250 li @ f S d kHandshakeS: 250 [email protected]... Sender ok C: RCPT TO: <[email protected]> S: 250 [email protected] ... Recipient ok C:DATAC: DATAS: 354 Enter
View Full Document