FILE TRANSFER PROTOCOL ( FTP ) PART 2 - Cyber security & Technology

Breaking

Wednesday, June 6, 2018

FILE TRANSFER PROTOCOL ( FTP ) PART 2






FTP Operation

·      FTP uses client/server model for communication.

·      Two TCP connections are used for file transfer.

·      On one connection control signals ( commands and responses ) are exchanged and the other connection is used for signal for actual data transfer. These two connections are called control connection and data connection respectively.



        Control connection


The control connection has following features:

1.   It is used to transfer control signals (commands and responses) between the client and server.

2.   This connection is used by the Control process of client and server. The control process is called Protocol interpreter ( PI ).

3.   The TCP connection for control signal uses well known FTP server port 21.

4.   This control connection remains connected during the entire interactive FTP session.

5.   The control connection uses very simple rules of communication. We need to transfer onlu a line of command or a line of response at a time.

6.   The two control processes ( client & server ) or PI communication using NVY syntax.

7.   The pls are responsible for translating the local code or syntax. Into NVT syntax and vice versa.


Data connection

The data connection has following features:

1.   Data connection is used for actual data transfer.

2.   This connection is established between the data transfer process (DTP) of client and server.

3.   The server port used for data connection is port 20.

4.   The data connection is opened and then closed for each file transferred. It opens each  time connection that involve transferring files are used, and it closes when the file is transferred.

5.   File transfer occurs over the data connection under the control of the commands sent over the control connection.

6.   During the file transfer , the client must define the type of file to be transferred,the  structure of data and the transmission mode.


·      Thus file transfer in FTP means one of three things:

1.   A file is to be copied from the server to the client. This is called retrieving a file. It is done with help of RETR command.

2.   A file is to be copied from the client to the server. This is called storing a file. It is done with STOR command.

3.   A list of directory or file names is to be sent from the server to the client. This is done with LIST command.

Anonymous FTP

·      To use FTP, a user needs an account (user name) and a password on the remote server.

·      Some sites have a set of files available for public access; to enable anonymous FTP.

·      To access these files, a user does not need to have an account or password. Instead, the user can use ANONYMOUS as the user name and guest as the password.

Trivial file transfer protocol (TFTP)

·      Trivial file transfer protocol is suited for those applications that do not require complex procedures of FTP and do not have enough resources (RAM, ROM) for this purpose.

·      Typical applications of TFTP include laoding the image on  dislikes machine and upgrading the operating system in network devices such as routers.

·      The main features of TFTP are:

1.   TFTP is based on client/server principle.

2.   It uses well known UDP port number 69  for TFTP server.

3.   TFTP is unsecured protocol.

4.   It does not support authentication.

5.   Every TFTP data unit has a sequence number.

6.   Each data unit is individually acknowledged. After receiving the acknowledgement the next data unit is sent.

7.   Error recovery is by retransmission after timeout.

TFTP message formats

There are four types of TFTP messages.

2 octets                 variable                 1 octet                   variable                 1 octet 

Read request(1)
File name
0
Mode
0

(a) Type 1

2 octets                 variable                 1 octet                   variable                 1 octet 

Write request(1)
File name
0
Mode
0

(b)  Type 2

2 octets                                                         2 octets                                     upto 512 octets

Data (3)
Sequence number
Data

(c)  Type 3

2 octets                                                                   2 octets

ACK (4)
Sequence Number

(d)  Type 4

The first two octets indicate the type of message. Mode field defines the type of the data (ASCII, Binary, Mail). The filename and mode fields are delimited using an all zeroes octet.

1.    Read request ( Type 1). This is used by the client to get a copy of a file from the server.

2.    Write request ( Type 2). This command is used by the client to write a file into the server.

3.    Data ( Type 3). This command contains block of data (portion of the file being copied). This message contains the data block of fixed size of 512 octets. The session is terminated if a data message arrives with data octet less than 512 octets.

4.    Acknowledgement ( Type 4). The last data message can have data block with EOF having size less than 512 octets. This is used by the client and the server to acknowledge the received data unites.

TFTP Operation

·       The client sends a read or write request at the server`s UDP port 69.

·       The server accepts the request by sending data message in case of read request.

·       The server accepts the request by sending acknowledgement in case of write request.

·       In either case, the server selects a UDP port to be used for further dialogue and sends its first response to the client through the selected UDP port.

·       Each data message has fixed size of data block and is individually acknowledged.

·       The last data block containing EDF or a data block containing less than 512 octets terminates the session.

·       Error recovery is done using retransmission after timeout.

·       If TFTP message is lost and if there is no expected response, the message is repeated by the sender after time out.

·       If the next data message is not received after acknowledgement , the last acknowledgement is repeated after timeout.

No comments:

Post a Comment