Link-Layer Protocol Lab the Kermit File Transfer Protocol
Total Page:16
File Type:pdf, Size:1020Kb
Link-Layer Protocol Lab The Kermit File Transfer Protocol Name: ________________________________________ Date Experiment Performed: ______________________ Group Members: ______________________ ______________________ ______________________ Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 1 Introduction The study of the operation of Kermit, a simple character-oriented file-transfer protocol, in this laboratory will provide you with the opportunity to observe and understand several basic communication protocol fundamentals including error control, flow control, framing and data transparency. Understanding why they are important, how they operate, and how they impact protocol performance is an essential prerequisite for a complete understanding of more complex internetworking protocols. By studying Kermit file transfers, you will enhance your understanding of link-layer protocols and their role in reliable data transport. You should give careful consideration to the tradeoffs being made and to the effect that the environment and the application may have on the design and implementation of communication protocols. The first part of this laboratory will require you to: 1) transfer an ASCII-text file using Kermit, 2) monitor the transfer using the FELINE protocol analyzer, 3) decode the contents of several packets 4) analyze the exchange of packets. Your goal should be to understand what elements a protocol must have to accomplish reliable file transfers and achieve data transparency. In the second half of this lab, you will analyze the performance of Kermit by repeatedly transferring an ASCII-text file and a binary file. For each transfer, you will vary both the maximum size of the Kermit packets and the use of Kermit's sliding window extension. You will measure the transfer delays and observe how the data is packetized, encoded and transmitted. You will also observe a Kermit file transfer at extremely high serial-port rates, which will provide an opportunity to judge the Kermit protocol's ability to operate in a high speed environment. While performing the steps of this lab, you should consider why the Kermit protocol behaves in the manner you observe. In so doing, you will gain insight into the tradeoffs that protocol designers and users must make when they design and use communications protocols. Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 2 Overview of Kermit Block Diagram of a Kermit File Transfer Begin Send INIT Packet Get Receiver’s INIT Packet Send File Header Send Data Packet No File Done? Yes Send EOF Packet Yes More Files? No Send EOT Packet End Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 3 Kermit Packet Format Mark Char (LEN) Char (SEQ) Type Data Check NP Excess-32 Excess-32 Literal varies Excess-32 MARK SOH Identifies start of packet LEN The number of ASCII characters following this field within the packet, i.e. packet length minus two SEQ Packet sequence number, modulo-64 TYPE Packet type, for example: D Data Y Acknowledgment (ACK) S Send Initiate (Send-Init) R Receive Initiate F File Header Z End of File (EOF) B Break Transmission (EOT) A File Attributes DATA Content varies by packet type: D packet contains file contents F packet contains name of file S packet contains parameter values CHK Checksum can be 1, 2, or 3 characters Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 4 Data-Link Encoding To achieve data transparency, Kermit transmits only printable ASCII characters, except the SOH. Three techniques are used to convert control characters into printable ASCII depending upon where the character is located in the packet. Control Fields: Characterization Data Fields: “Controlified” Prefix Encoding High-Order Bit: HOB Prefix Encoding Control Characters in Control Fields Control characters are promoted to printable form prior to transmission, and demoted at the receiver using the following functions: At the sender: char(x) = x + 20h At the receiver: unchar(x) = x - 20h Example: 1. Packet sequence number 0 (zero). 2. SEQ = 0 is not printable, it must be promoted. 3. char(0h) = 20h which is the SP character. 4. A space (SP) is transmitted in the SEQ field. 5. At the receiver unchar(20h) yields 0 (zero) Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 5 Control Character Encoding in Data Fields char(x) limits the values to the range 0 - 94. Anything above 94 will promote to a non- printable character. Kermit cannot limit the range of values within the data field as it can with control fields. The solution: Convert the control character to printable form by flipping the 7th bit (XOR with 40h), and prefix this converted character with a special character, typically “# ”. At the sender: ctl(x) = x XOR 40h At the receiver: ctl(ctl(x)) = x Example: 1. Sender wants to send ctrl-A : 0000 0001 2. ctl(ctrl-A) yields “A”: 0100 0001 3. Transmit #A 4. Receiver drops the # and 5. ctl(A) yields ctrl-A again: 0000 0001 Example: The following is a sample Kermit packet. ^AE&D of#M#Jconstructing a theory conta5 Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 6 High-Order Bit Encoding For Sending Binary Files Many asynchronous communications channels do not provide an 8-bit wide path for data. With binary files data often contains bytes with the high-order bit (8th) set. To accommodate 8-bit transfer on 7-bit channels Kermit uses a prefix encoding technique as follows: At the sender: If the 8th bit is set, send the prefix character, typically &, followed by the 7-bit printable character. At the receiver: If you detect the prefix character, drop it and set the 8th bit high on the next character. Parameter Initialization Send-Init Packet Prior to transferring any files, two peer Kermits must negotiate several parameters which govern both ends for the duration of a file transfer session. Kermit does this by exchanging Send-Init packets at the start of each session. The session initiator requests values for parameters including: Maximum packet length Send time-out End-of-packet delimiter Prefix encoding character HOB prefix encoding character Type of checksum Window size ... and more The receiver responds with the values it is willing to accept. Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 7 Parameter Initialization Send-Init Packet Format MAXL TIME NPAD PADC EOL QCTL QBIN CHKT REPT CAPA… RSV The data field of the ‘S' packet contains parameters as illustrated above: Each parameter is encoded using one printable ASCII character. The encoding used varies per parameter and is described below: 1. MAXL Maximum packet length characterized 2. TIME Receive time-out characterized 3. NPAD Number of padding characters characterized 4. PADC Control character for padding controlified 5. EOL End of packet delimiter characterized 6. QCTL Prefix encoding character literal 7. QBIN High-order prefix encoding literal, ‘Y', or ‘N' 8. CHKT Type of checksum used ‘1','2' or ‘3' 9. REPT Repeat count prefix character literal Extensions to Kermit have allowed for sliding windows, large packets and the use of an optional attributes packet to exchange additional information about files. The CAPA field consists of a bit mask that indicates which of these advanced features the sender is willing to use. Setting a bit in the appropriate position indicates a willingness to use a feature, and determines the processing of the final three fields. 10. CAPA Advanced capability field (for options like sliding window) 11. WINDOW Indicates window size if window bit is set in CAPA 12. MAXL1 Used in conjunction with MAXL2 to determine the max 13. MAXL2 packet length if bits are set CAPA. Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 8 Equipment and Setup Two Kermit setups will be available for you to use. You may work in groups of no more than two persons. A sign-up sheet for the lab equipment will be posted outside the lab. Estimated Time: One to Two Hours. Table 1 is a list of the equipment required for this lab. The equipment should be pre-configured for you before coming to the lab. Consult with the on-duty TA if you have any difficulty identifying or operating the correct equipment. Table 1: Hardware and Software required for the Kermit/Link-Layer lab. Qty Equipment Description Setting up Kermit, Feline, and PCs running Windows XP, as detailed the ParaScope MP Pod: below: 1 PC serving as a Kermit server. The outer PCs are configured with 3 Kermit software to transfer files over the serial 1 PC serving as a Kermit client. cable, and the center PC is configured with the 1 PC serving as the FELINE FELINE WinXL software and the ParaScope Protocol Analyzer. Pod to monitor and examine the transfer. A 2 Kermit v3.16 Software for MS-DOS standard serial cable is connected between the 9-pin RS-232 port on one of the Kermit PCs and 1 FELINE/ParaScope MP Pod one of the 25-pin RS-232 ports on the FELINE WinXL Protocol Analysis ParaScope Pod. A standard serial cable is then 1 Software. connected from the other 25-pin RS-232 port on Files to be Transferred using Kermit: the ParaScope Pod and the 9-pin RS-232 port on the other Kermit PC. The PCMCIA Adaptor DECODE.TXT, an ascii-text file attached to the ParaScope pod is connected to used to decode packets. the FELINE PC's card reader. Check to make 3 ASCII.TXT, an ascii-text file used to sure that the AC-adapter is plugged into the test performance. ParaScope Pod and into the 110-volt AC outlet. BINARY.EXE, a binary-executable Finally, check that the power switch on the file used to test performance.