TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 21 File Transfer: FTP and TFTP
TCP/IP Protocol Suite 2OBJECTIVES: To discuss FTP and two connections used in this protocol: control connection and data connection. To discuss six classes of commands sent by the client to establish communication with the server. To explain three types of file transfer transferred by FTP. To show some user-friendly commands used by some FTP interfaces. To discuss anonymous FTP and its application. To discuss how file transfer can be done using a secure channel. To discuss TFTP as a simple file transfer protocol without the complexities and sophistication of FTP.
TCP/IP Protocol Suite 3 OBJECTIVES (continued): To discuss five types of TFTP messages and their applications. To discuss the sorcerer’s apprentice bug related to TFTP’s flow- and error-control mechanisms. To show how TFTP can be used in conjunction with DHCP to initialize devices by downloading configuration files.
TCP/IP Protocol Suite 4 Chapter Outline 21.1 FTP 21.2 TFTP
TCP/IP Protocol Suite FTP File Transfer Protocol (FTP) is the standard mechanism provided by TCP/IP for copying a file from one host to another. Although transferring files from one system to another seems simple and straightforward, some problems must be dealt with first. For example, two systems may use different file name conventions. Two systems may have different ways to represent text and data. Two systems may have different directory structures. All of these problems have been solved by FTP in a very simple and elegant approach.
TCP/IP Protocol Suite 6 Topics Discussed in the Section Connections Communication Command Processing File Transfer Anonymous FTP Security for FTP The sftp Program
TCP/IP Protocol Suite 7 FTP uses the services of TCP. It needs two TCP connections. The well-known port 21 is used for the control connection and the well-known port 20 for the data connection. Note
TCP/IP Protocol Suite 8 Figure 21.1 FTP GUI/UI Control: put, get, … Data: file contents
TCP/IP Protocol Suite 9 Figure 21.2 Opening the control connection PI user DTP user client PI server DTP server server (1) passive open (2) active open Control connection: ftp 전 과정에서 항상 연결되어 있음
TCP/IP Protocol Suite 10 Figure 21.3 Creating the data connection PI user DTP user client PI server DTP server server (1) passive open (2) PORT (3) active open Data connection: 사용자의 요구가 있는 경우에만, 연결이 설정되었다가, 해당 명령의 처리가 끝나면, 연결이 해제됨 예 : 파일을 전송하는 경우, 파일 데이터를 전송하는 동안에만 연결이 설정되어 있음
TCP/IP Protocol Suite 11 Figure 21.4 Using the control connection 명령들
TCP/IP Protocol Suite 12 Figure 21.5 Using the data connection
TCP/IP Protocol Suite 13 Figure 21.6 Command processing
TCP/IP Protocol Suite 14
TCP/IP Protocol Suite 15
TCP/IP Protocol Suite 16
TCP/IP Protocol Suite 17
TCP/IP Protocol Suite 18
TCP/IP Protocol Suite 19
TCP/IP Protocol Suite 20
TCP/IP Protocol Suite 21
TCP/IP Protocol Suite 22 Figure 21.7 File transfer
TCP/IP Protocol Suite 23 Figure 21.8 shows an example of using FTP for retrieving a list of items in a directory. Example Example 21.1
TCP/IP Protocol Suite 24 Figure 21.8 Example 21.1 ls close No error control. Why? PI user DTP user client PI server DTP server server (1) passive open (2) PORT (3) active open Use sftp
TCP/IP Protocol Suite 25 ftp ftp.gnu.org
TCP/IP Protocol Suite 26 The following shows an actual FTP session that parallels Example The colored lines show the responses from the server control connection; the black lines show the commands sent by the client. The lines in white with black background show data transfer. Example Example 21.2
TCP/IP Protocol Suite 27 Figure 21.9 shows an example of how an image (binary) file is stored. Example Example 21.3
TCP/IP Protocol Suite 28 Figure 21.9 Example 21.3 put …
TCP/IP Protocol Suite 29 We show an example of anonymous FTP. We assume that some public data are available at internic.net. Example Example 21.4
TCP/IP Protocol Suite TFTP There are occasions when we need to simply copy a file without the need for all of the features of the FTP protocol. For example, when a diskless workstation or a router is booted, we need to download the bootstrap and configuration files. Here we do not need all of the sophistication provided in FTP. We just need a protocol that quickly copies the files.
TCP/IP Protocol Suite 31 Topics Discussed in the Section Messages Connection Data Transfer UDP Ports TFTP Example TFTP Options Security Applications
TCP/IP Protocol Suite 32 TFTP uses the services of UDP on the well-known port 69. Note
TCP/IP Protocol Suite 33 Serial cable Console For Target Board Embedded System 커널 컴파일 다운로드
TCP/IP Protocol Suite 34 Figure Message categories
TCP/IP Protocol Suite 35 Figure RRQ format "netascii” “octet” (binary)
TCP/IP Protocol Suite 36 Figure WRQ format
TCP/IP Protocol Suite 37 Figure Data Format Seq #
TCP/IP Protocol Suite 38 Figure ACK format Seq #
TCP/IP Protocol Suite 39 Figure ERROR format
TCP/IP Protocol Suite 40
TCP/IP Protocol Suite 41 Figure Connection establishment UDP 상위에서 동작하므로, 원래는 연결 설정 과정이 없음
TCP/IP Protocol Suite 42 Figure Server’s apprentice bug
TCP/IP Protocol Suite 43 Figure UDP port numbers used by TFTP
TCP/IP Protocol Suite 44 Figure TFTP example FTP 는 에러제어 과정이 없는데, TFTP 는 왜 에러제어 동작이 있을까 ? Implicit idle-RQ 방식
TCP/IP Protocol Suite 45 Figure Use of TFTP with DHCP