On this page
|
| SUMMARY | |
| Protocol |
: |
Trivial File Transfer Protocol |
| Protocol suite |
: |
TCP/IP |
| Layer |
: |
Application Layer |
| Type |
: |
File transfer protocol |
| Ports |
: |
69 (UDP) server; 1758 (UDP) multicast |
| URI |
: |
tftp |
| Working groups |
: |
TFTPEXTS, TFTP Extensions |
|
| DESCRIPTION |
Trivial File Transfer Protocol (TFTP) is a very simple file transfer protocol akin to a basic version of FTP. TFTP is often used to transfer small files between hosts on a network.
Any transfer begins with a request to read or write a file, which also serves to request a connection. If the server grants the request, the connection is opened and the file is sent in fixed length blocks of 512 bytes. Each data packet contains one block of data, and must be acknowledged by an acknowledgment packet before the next packet can be sent. A data packet of less than 512 bytes signals termination of a transfer. If a packet gets lost in the network, the intended recipient will timeout and may retransmit his last packet (which may be data or an acknowledgment), thus causing the sender of the lost packet to retransmit that lost packet. The sender has to keep just one packet on hand for retransmission, since the lock step acknowledgment guarantees that all older packets have been received. Notice that both machines involved in a transfer are considered senders and receivers. One sends data and receives acknowledgments, the other sends acknowledgments and receives data.
TFTP recognizes only one error condition that does not cause termination, the source port of a received packet being incorrect. In this case, an error packet is sent to the originating host.
The order of contents of packet
Local Medium | Internet | Datagram | TFTP |
As shown in the above illustration: local medium header, if used, Internet header, Datagram header, TFTP header, followed by the remainder of the TFTP packet. (This may or may not be data depending on the type of packet as specified in the TFTP header.) TFTP does not specify any of the values in the Internet header. On the other hand, the source and destination port fields of the Datagram header (its format is given in the appendix) are used by TFTP and the length field reflects the size of the TFTP packet. The transfer identifiers (TID's) used by TFTP are passed to the Datagram layer to be used as ports; therefore they must be between 0 and 65,535. The initialization of TID's is discussed in the section on initial connection protocol.
The TFTP header consists of a 2 byte opcode field which indicates the packet's type (e.g., DATA, ERROR, etc.). These opcodes and the formats of the various types of packets are discussed further in the section on TFTP packets.
TFTP Packets
TFTP supports five types of packets, all of which have been mentioned above:
- Opcode operation
16 bits, unsigned. Specifies the format of the TFTP message.
Opcode | Description | 1 | RRQ. Read request. | 2 | WRQ. Write request. | 3 | DATA. Read or write the next block of data. | 4 | ACK. Acknowledgment. | 5 | ERROR. Error message. | 6 | OACK. Option acknowledgment. |
The TFTP header contains the opcode associated with the packet.
- RRQ/WRQ Packet
2 bytes | string | 1 byte | string | 1 byte | Opcode | Filename | 0 | Mode | 0 |
- Data Packet
2 bytes | 2 bytes | up to 512 bytes of data | Opcode | Block# | Data |
- ACK Packet
2 bytes | 2 bytes | | Opcode | Block# |
- ERROR Packet
2 bytes | 2 bytes | string | 1 byte | Opcode | Block# | ErrMsg | 1 |
Error codes
Error | Description | 0 | No error. | 1 | File not found. | 2 | Access violation. | 3 | Disk full or allocation exceeded. | 4 | Illegal TFTP operation. | 5 | Unknown transfer ID. | 6 | File already exists. | 7 | No such user. | 8 | Terminate transfer due to option negotiation. |
- Parameters
TFTP Read and Write Request commands use the following parameters:
| Parameter | Description | Filename | The name of the file, expressed in quotes, where the protocol is to perform the read or write operation. | Mode | Datamode. The format of the file data that the protocol is to transfer. The following formats are possible:
*NetASCII Standard ASCII character format.
*Octet Eight-bit binary data.
*Mail Standard ASCII character format with username in place of filename. |
- COMMAND
TFTP data and data acknowledge commands use the following parameters:
Command | Description | Block | Block number or sequence number of the current frame of file data. | Data | First part of the file data displayed for TFTP data frames. | TFTP Errors | TFTP error frames contain an error code in parentheses followed by the error message, as follows: | (0000) | Unknown Error. | (0001) | File not found. | (0002) | Access violation. | (0003) | Out of disk space. | (0004) | Illegal TFTP operation. | (0005) | Unknown Transfer ID. | (0006) | Filename already exists. | (0007) | Unknown user. |
Data Modes
Three modes of transfer are currently defined in RFC 1350
- NetASCII
US-ASCII as defined in USA Standard Code for Information Interchange with modifications specified in RFC 854 - Telnet Protocol Specification and extended to use the high order bit. That is, it is an 8-bit character set, unlike US-ASCII which is 7-bit.
- Octet
Raw 8-bit bytes, also called binary.
- Mail
This mode was originally defined in RFC 783 and was declared obsolete by RFC 1350. It allowed for sending mail to a user rather than transferring to a file.
|
Top of Page
|
| EXAMPLES |
Example 1
tftp://example.com/myconfigurationfile;mode=netascii
This example references file "myconfigurationfile" on server "example.com" and requests
that the transfer occur in netascii mode. Example 2
tftp://example.com/mystartupfile
This file references file "mystartupfile" on server "example.com". The transfer should
occur in octet mode, since no other mode was specified. |
Top of Page
|
| PROTOCOL RELATIONS |
■ Parent layer
■ Child layer
UDP
|  | TFTP | |
Top of Page
|
| GLOSSARY |
|
ASCII ASCII (American Standard Code for Information Interchange) is the most common format for text files in computers and on the Internet. In an ASCII file, each alphabetic, numeric, or special character is represented with a 7-bit binary number (a string of seven 0s or 1s). 128 possible characters are defined.
Unix and DOS-based operating systems use ASCII for text files. Windows NT and 2000 uses a newer code, Unicode. IBM's S/390 systems use a proprietary 8-bit code called EBCDIC. Conversion programs allow different operating systems to change a file from one code to another.
ASCII was developed by the American National Standards Institute (ANSI).
FTP FTP (File Transfer Protocol) is the protocol for exchanging files over the Internet. FTP works in the same way as HTTP for transferring Web pages from a server to a user's browser and SMTP for transferring electronic mail across the Internet in that, like these technologies, FTP uses the Internet's TCP/IP protocols to enable data transfer.
FTP is most commonly used to download a file from a server using the Internet or to upload a file to a server (e.g., uploading a Web page file to a server).
Packet A packet is the unit of data that is routed between an origin and a destination on the Internet or any other packet-switched network. When any file (e-mail message, HTML file, Graphics Interchange Format file, Uniform Resource Locator request, and so forth) is sent from one place to another on the Internet, the Transmission Control Protocol (TCP) layer of TCP/IP divides the file into "chunks" of an efficient size for routing. Each of these packets is separately numbered and includes the Internet address of the destination. The individual packets for a given file may travel different routes through the Internet. When they have all arrived, they are reassembled into the original file (by the TCP layer at the receiving end).
Timeout An interrupt signal generated by a program or device that has waited a certain length of time for some input but has not received it. Many programs perform time-outs so that the program does not sit idle waiting for input that may never come. For example, automatic bank-teller machines perform a time-out if you do not enter your password quickly enough.
|
Top of Page
|
| REFERENCES |
RFCs:
[IEN 133] The TFTP Protocol.
[ RFC 906] Bootstrap Loading using TFTP.
[ RFC 1123] Requirements for Internet Hosts -- Application and Support.
Section 4.2.
[ RFC 1350] THE TFTP PROTOCOL (REVISION 2).
Obsoletes: RFC 783.
[ RFC 1785] TFTP Option Negotiation Analysis.
[ RFC 2090] TFTP Multicast Option.
[ RFC 2347] TFTP Option Extension.
Obsoletes: RFC 1782.
[ RFC 2348] TFTP Blocksize Option.
Obsoletes: RFC 1783.
[ RFC 2349] TFTP Timeout Interval and Transfer Size Options.
Obsoletes: RFC 1784.
[ RFC 3617] Uniform Resource Identifier (URI) Scheme and Applicability Statement for the Trivial File Transfer Protocol (TFTP).
Defines URI scheme tftp:. Obsolete RFCs:
[ RFC 783] THE TFTP PROTOCOL (REVISION 2).
Obsoleted by: RFC 1350.
Updates: IEN 133.
[ RFC 1782] TFTP Option Extension.
Obsoleted by: RFC 2347.
Updates: RFC 1350.
[ RFC 1783] TFTP Blocksize Option.
Obsoleted by: RFC 2348.
Updates: RFC 1350.
[ RFC 1784] TFTP Timeout Interval and Transfer Size Options.
Obsoleted by: RFC 2349.
Updates: RFC 1350
|
Top of Page
|
| OTHER PROTOCOLS OF TCP/IP SUITE |
|
|
|
|
|