File Transfer: FTP and TFTP

10 

Loading....

Loading....

Loading....

Loading....

Loading....

Full text

(1)

1

File Transfer: FTP and TFTP

Exercises

1.

If the control connection is accidentally severed during an FTP transfer, there would be no problem until the data transfer completed and the client attempted to send another command.

2.

The client issues an active open for the control connection because it is the client who initiates the communication for the control process. The client issues a pas-sive open for the data connection because it is the server who initiates the commu-nication for data transfer after receipt of the ephemeral port number.

3.

There should be limitations on anonymous FTP because it is unwise to grant the public complete access to a system. If the commands that an anonymous user could use were not limited, that user could do great damage to the file system (e.g., erase it completely).

4.

FTP does not need a message format because there is no need to send additional information back and forth aside from the commands and responses, which use the control connection.

(2)

6. See Figure 19.2.

7. See Figure 19.3.

8.

If the file already exists, the file will be overwritten. If this is not what is desired, the STOU command should be used instead of the STOR command.

Figure 19.1 Exercise 5 Figure 19.2 Exercise 6 Figure 19.3 Exercise 7 5 "C" "O" "M" "M" "A" "N" "D" " " "a" "r" "g" "u" "m" "s" "e" CR LF "n" "t" Ephemeral port number 21

Sequence number Acknowledgment number

Reserved Flags Window size

Checksum Urgent Pointer

5 "x" "y" "z" " " "d" "e" "s" " c" "r" "i" "p" "t" "i" LF "o" "n" CR Ephemeral port number 21

Sequence number Acknowledgment number

Reserved Flags Window size

Checksum Urgent Pointer

5

Ephemeral port number 20 Sequence number Acknowledgment number

Reserved Flags Window size

Checksum

DATA

(3)

10. See Figure 19.5 Figure 19.4 Exercise 9 Figure 19.5 Exercise 10 Client Server 220 (Service ready) USER forouzan QUIT LIST /usr/user/reports PASS xxxx

125 (Data connection OK) 226 (Closing data connection)

221 (Service closing) 331 (User name OK. Password?)

PASV

227 (Entering passive mode, socket) 230 (User login OK)

DATA TRANSFER Passive open Active open Client Server 220 (Service ready) USER forouzan QUIT TYPE EBCDIC PASS xxxx 200 (Command OK) STRU R 200 (Command OK) STOU /usr/user/report 250 (Requested file action OK)

226 (Closing data connection) 221 (Service closing) 331 (User name OK. Password?)

PORT 1267 150 (Data connection will open)

230 (User login OK)

DATA TRANSFER

Passive open

Active open

(4)

12. Figure 19.7. Figure 19.6 Exercise 11 Figure 19.7 Exercise 12 Client Server 220 (Service ready) USER forouzan QUIT RETR/usr/user/report PASS xxxx

250 (Requested file action OK)

226 (Closing data connection)

221 (Service closing) 331 (User name OK. Password?)

PORT 1267 150 (Data connection will open)

230 (User login OK)

DATA TRANSFER Passive open Active open Client Server 220 (Service ready) USER forouzan QUIT PASS xxxx 221 (Service closing) 331 (User name OK. Password?)

HELP 214 (Help message) 230 (User login OK)

(5)

14. See Figure 19.9. Figure 19.8 Exercise 13 Figure 19.9 Exercise 14 Client Server 220 (Service ready) USER forouzan QUIT PASS xxxx 221 (Service closing) 331 (User name OK. Password?)

NOOP 211 (System status or help)

230 (User login OK)

Client Server 220 (Service ready) USER forouzan QUIT PASS xxxx 221 (Service closing) 331 (User name OK. Password?)

SYST

215 (Naming the system type) 230 (User login OK)

(6)

16. See Figure 19.11.

17. See Figure 19.12.

18. See Figure 19.13.

19.

TFTP needs to use RRQ and WRQ messages for connection establishment and to let the server know what kind of service is required. These functions are served by various commands in FTP using the FTP control connection.

Figure 19.10 Exercise 15 Figure 19.11 Exercise 16 Client Server 220 (Service ready) USER forouzan PASS xxxx 331 (User name OK. Password?)

MKD /usr/user/letters/Jan 200 (Command OK) 230 (User login OK)

Client Server 220 (Service ready) USER forouzan CDUP PASS xxxx 200 (Command OK) 331 (User name OK. Password?)

PWD

212 (Status) /usr/user/forouzan 230 (User login OK)

(7)

Figure 19.13 Exercise 18 Client Server 220 (Service ready) USER forouzan RNFR /usr/usrs/report/file1 PASS xxxx 200 (Command OK) RNTO /usr/usrs/letters/file1 200 (Command OK) 331 (User name OK. Password?)

PWD

212 (Status) /usr/user/forouzan 230 (User login OK)

Client Server 220 (Service ready) USER forouzan QUIT TYPE EBCDIC PASS xxxx 200 (Command OK) MODE C 200 (Command OK) RETR /usr/user/report/file1 125 (Data connection open)

226 (Closing data connection)

221 (Service closing) 331 (User name OK. Password?)

PORT 1267 150 (Data connection will open)

230 (User login OK)

DATA TRANSFER

Passive open

Active open

(8)

21. See Figure 19.15. The user datagram is 26 bytes.

22. See Figure 19.16. The user datagram is 524 bytes.

23. See Figure 19.17. 24. See Figure 19.18. Figure 19.14 Exercise 20 Figure 19.15 Exercise 21 Figure 19.16 Exercise 22 "p" "o" "R" "e" "n" "r" "t " "a" "s" "e" "t" "i" "c" "i" Ephemeral port number 69

26 1 0 0 Checksum "p" "o" "R" "e" "n" "r" "t " "a" "s" "e" "t" "i" "c" "i" Ephemeral port number 69

26 2

0

0

Checksum

Ephemeral port number(server)

512 bytes of data

Ephemeral port number(client) 524

3 7

(9)

Figure 19.18 Exercise 24 Host A Host B file1 ascii 1 3 1 1 3 3 4 3 2 3 2 ACK 3 4 4 Block 4 512 bytes 5 3 5 4 Block 5 102 bytes Block 3 512 bytes Block 1 512 bytes Block 2 512 bytes 4 4 4 "p" "o" "R" "e" "n" "r" "t " "a" "s" "e" "t" "i" "c" "i" 69 26 51235 1 0 0 Checksum 57122 512 bytes 51235 524 3 1 Checksum 51235 57122 12 4 1 Checksum a. read request

b.typical data block (block 5 only 102 bytes)

(10)

26. See Figure 19.20. Figure 19.19 Exercise 25 Figure 19.20 Exercise 26 Host A Host B file1 ascii 1 3 1 1 3 3 4 3 2 3 2 ACK 3 4 4 Block 4 512 bytes 5 3 5 4 Block 5 102 bytes Block 3 512 bytes Block 1 512 bytes Block 2 512 bytes 2 3 512 bytesBlock 2 4 4 4 Damaged Resent Timeout "p" "o" "R" "e" "n" "r" "t " "a" "s" "e" "t" "i" "c" "i" 69 26 51235 1 0 0 Checksum 57122 512 bytes 51235 524 3 1 Checksum 51235 57122 12 4 1 Checksum a. read request

Figure

Updating...

References

Updating...

Related subjects :