Link-Layer Protocol Lab. The Kermit File Transfer Protocol

Link-Layer Protocol Lab The Kermit File Transfer Protocol Name: ________________________________________ Date Experiment Performed: __________________...
Author: Mildred Lindsey
0 downloads 0 Views 244KB Size
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:



DATA

D

Data

Y S R F Z B A

Acknowledgment (ACK) Send Initiate (Send-Init) Receive Initiate File Header End of File (EOF) Break Transmission (EOT) File Attributes

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. 2.

Packet sequence number 0 (zero). 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 nonprintable 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 

data.

Many asynchronous communications channels do not provide an 8-bit wide path for



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…



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

RSV



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 PCs running Windows XP, as detailed below:

3

1 PC serving as a Kermit server. 1 PC serving as a Kermit client. 1 PC serving as the FELINE Protocol Analyzer.

2

Kermit v3.16 Software for MS-DOS

1

FELINE/ParaScope MP Pod

1

FELINE WinXL Protocol Analysis Software. Files to be Transferred using Kermit: DECODE.TXT, an ascii-text file used to decode packets.

3

ASCII.TXT, an ascii-text file used to test performance. BINARY.EXE, a binary-executable file used to test performance.

Setting up Kermit, Feline, and the ParaScope MP Pod: The outer PCs are configured with Kermit software to transfer files over the serial cable, and the center PC is configured with the FELINE WinXL software and the ParaScope Pod to monitor and examine the transfer. A standard serial cable is connected between the 9-pin RS-232 port on one of the Kermit PCs and one of the 25-pin RS-232 ports on the ParaScope Pod. A standard serial cable is then connected from the other 25-pin RS-232 port on the ParaScope Pod and the 9-pin RS-232 port on the other Kermit PC. The PCMCIA Adaptor attached to the ParaScope pod is connected to the FELINE PC's card reader. Check to make sure that the AC-adapter is plugged into the ParaScope Pod and into the 110-volt AC outlet. Finally, check that the power switch on the ParaScope Pod is turned on. Note: Please do not attach or detach any of the serial or parallel cables while the PCs are powered on. This can damage the serial port on the PC. Turn the power off, or ask the TA for assistance in moving any cabling.

Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 9

Procedures Part I – Decoding Kermit Packets Overview A short ASCII text file will be transferred between the sending and server PCs by Kermit. A PC running the FELINE Protocol Analyzer will monitor the transfer of the file and will capture it into data buffers. By examining the data in FELINE's capture buffer, you will decode a Kermit packet, and you will analyze the sequence of Kermit packets sent between sender and server during the file transfer. As you transfer, capture, decode, and analyze the Kermit file transfer, think about how a protocol that only transfers printable ASCII characters can send non-printable ASCII characters such as carriage returns.

Step 1 Kermit's default settings will be used for this transfer. Load Kermit on the outer PCs: Click on the “KERMIT” application icon on the Desktop 

The PC on the left will be used as a Kermit server. Place it in server mode.

MS-KERMIT> SERVER The receiving PC should now display the server message.

Step 2 Start FELINE on the center PC to monitor the file transfer. Click on the “WinXL” icon on the Desktop FELINE should automatically load the hardware configuration and program files. Make sure that the appropriate hardware (i.e. ParaScope MP) is chosen in the hardware option. To place FELINE in monitor mode, click on “Setup” at the top of the resulting window and choose Asynchronous File Transfer. The port settings on this window, the Kermit applications and the COM ports of the Client and Server PCs should be exactly the same. For example: Data size = 8, Parity = none, Flow Control = None, Speed = 9600 bps Once you have completed the above, click “Apply” followed by “Run” to start traffic capture.

Step 3 Send the file from the right PC. MS-KERMIT> SEND DECODE.TXT

Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 10

Step 4 While we are most interested in the analysis of protocols in terms of their performance and efficiency, any such study must begin with a thorough understanding of the underlying structure and details of its operation. In Part 1 of the lab, you will "decode" the contents of a Kermit Send-INIT packet as captured during the transfer of the ASCII text file decode.txt. While interpreting packets captured by a protocol analyzer can be a lesson in tedium; it is, nonetheless, an important skill for both the designer and troubleshooter of communications protocols.  (4.1) In order to complete Table 2, which is at the end of this lab write-up, you will need to place FELINE into examine mode. In examine mode, you will be able to scroll through the contents of FELINE's capture buffer, which contains the record of the file transfer that was just captured. You will also need to refer to an ASCII table and your notes on the structure of Kermit packets. 

Place FELINE in Examine Mode:

“Exit” monitor mode and click on “Examine” and choose “Buffer”

Step 5 In Table 2, in the results section, list the contents of the SEND INIT packet. Identify each field in both the header and the data section. Along with the identification, indicate the actual decoded value which is being transferred from the sender to the server. The Mark (Start-of-packet) character has been done for you already, use this as a guide. The column headings indicate what you should enter in each cell. Hex-Value is the actual value read from the raw protocol analyzer output (you can toggle between hex and char view of the capture). Encoding describes the type of encoding Kermit used to transmit the character. Possible values are: literal, excess-32, and XOR-64. Field Name and Description are self-explanatory. Decoded Value should be the decoded value which Kermit is sending end-to-end from sender to server. To determine the actual value you must undo the encoding used by the transmitting Kermit. In some cases, this may be an ASCII character; in other cases, it may be a decimal numeral. 

Note: you need not decode the CAPAs, MAXL1 and MAXL2 fields, just note their presence.

Step 6 While in examine mode, use Table 3 to record all the packets that were transferred while Kermit transferred the file decode.txt. After completing the experiments, you will create a time-sequence diagram from the contents of Table 3 to illustrate the dialog between the Kermit sender and the Kermit server while performing a Kermit file transfer session. Starting with the SEND INIT packet and ending with the BREAK packet, draw the time-sequence diagram on a separate sheet of paper and hand it in with your lab write-up. Clearly indicate the following information for each packet in the exchange: the packet-type, the sequence-number, and the direction of travel (i.e. who is the sender and who is the receiver).

Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 11

Part II – Transferring ASCII Text Files Overview An ASCII text file will be transferred between the sender and server PCs by Kermit. Using FELINE, the file transfer time of the file will be measured. A number of transfers will be made while varying two Kermit-configurable parameters: 1) the maximum size of a Kermit packet; and 2) the use or non-use of Kermit's sliding-window protocol extension. You should observe that certain configurations of the two parameters will have significantly better or poorer performance than other configurations will. While you perform each of the experiments, you should consider why certain configurations perform better than other configurations, and you should also consider the effect on performance of the interaction between the frame size and the use or non-use of sliding windows. In the analysis section, you will be asked to calculate the effective transfer rate achieved by Kermit during these file transfers, so that while you perform each experiment, consider how much time is spent waiting for acknowledgments and how much time is spent constructing packets. Any insight you gain while performing these experiments will be very helpful in your analysis of the lab.

Step1 On the Server, exit Server Mode to set the Kermit parameters by typing: +

Step 2 Because the PC on the left will again be used as a Kermit server, (The Receiver of Kermit packets) set the server's parameters for the file transfer and place it in server mode. MS-KERMIT> SET WINDOW 1 MS-KERMIT> SET RECEIVE PACKET-LENGTH 50 MS-KERMIT> SERVER

Step 3 The PC on the right will send files to the server. Set the sender's parameters. MS-KERMIT> SET WINDOW 1 MS-KERMIT> SET SEND PACKET-LENGTH 50

Step 4 Prepare FELINE to monitor the file transfer as was explained in Part I. Remember to check the port settings on WinXL software, Kermit applications and the COM ports on the Server and Client PCs for consistency.

Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 12

Step 5 The first set of Kermit file transfers will use an ASCII text file called ASCII.TXT. If you have not placed FELINE in monitor mode, do so before you begin the first file transfer on the sending PC. At the Kermit prompt on the sender, type: MS-KERMIT> SEND ASCII.TXT  Both Kermit PCs will show a status screen, which reports the percentage of the file transferred, the number of packets transferred, and the packet size along with other information. The PCs will beep when the transfer is complete.

Step 6 When the file transfer is complete, find the number of frames used and the number of bytes transferred by Kermit on the Kermit server's display, and enter the values into the appropriate cells of the data sheet.

Step 7 Shift your attention to the center PC and FELINE. You will read the file transfer time from the FELINE Display: Switch to “Examine” mode, as explained earlier, and click on the timer start icon. Drag the timer end icon to the end of the file transfer and click on delta. That should give you the transfer time. ► Clear the client and server caches to prepare for the next transfer. This can be done by typing MS-KERMIT> CLEAR BOTH ► Repeat the file transfer with the same settings at least three times and take the average value. Remember to clear the caches between runs in order not to skew the results.

Step 8 Change the Kermit parameters for the next trial of the timing test. (On the Server, you must exit Server Mode before changing the parameters.) + MS-KERMIT> SET WINDOW 7 MS-KERMIT> SET RECEIVE PACKET-LENGTH 50 MS-KERMIT> SERVER 

On the Sender, simply change the parameters.

MS-KERMIT> SET WINDOW 7 MS-KERMIT> SET SEND PACKET-LENGTH 50

Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 13

Step 9 Prepare FELINE for the next file transfer: Exit Line Monitor mode. Enter Line Monitor mode to capture the next transfer.

Step 10 Send the ASCII.TXT file again. MS-KERMIT> SEND ASCII.TXT

Step 11 Repeat (Part II) Steps 6 through 10 and record the results when using the other values of packet and window sizes in the appropriate cells of the data sheet. (See Table 4 in the results section.)

Part III – Transferring Binary Files Overview Because Kermit is designed to transfer ASCII files, special measures must be taken while using Kermit to transfer binary files. Kermit will assume that it has an 8-bit wide channel to send packets over. This can be a problem if Kermit is communicating over a 7-bit channel, which has one parity bit. In such a situation, any binary data that uses the eighth bit will lose the contents of that bit when the parity bit is set or reset, therefore the binary data will be corrupted by the transfer process. By telling Kermit to add a parity bit to every byte of data, binary files can be transferred reliably through the use of Kermit's control-character encoding and high-order bit encoding. As you transfer binary files, observe the data stream being captured by FELINE. Notice the use of prefix characters for encoding. While you observe, consider the combinations of prefix encoding that are possible and the effect that this encoding has on the effective transfer rate.

Step 1 Make certain that the server is at the Kermit prompt by typing + , and then type at the prompt on both Server and Sender: MS-KERMIT> SET FILE TYPE BINARY

Step 2 Set the packet length and the window size back to 50 and 1, respectively. MS-KERMIT> SET WINDOW 1 MS-KERMIT> SET RECEIVE (or SEND) PACKET-LENGTH 50 Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 14



On the server, type

MS-KERMIT> SERVER

Step 3 Prepare FELINE to monitor the file transfer.

Step 4 The Kermit binary file transfers will use a file called BINARY.EXE. Begin sending the file by typing on the sending PC: MS-KERMIT> SEND BINARY.EXE  (4.1) Take a minute to observe the contents of a few data packets involved in a binary transfer. Look for the presence of control character and high-order bit prefix characters. Compare this to what you observed when transferring ASCII.TXT.

Step 5 Repeat (Part III) Steps 2 through 4 and record the results when using the other values of packet and window sizes in the appropriate cells of the data sheet (See Table 4 in the results section.). Do not forget to clear the client and server caches between trials in order to get accurate results. This can be done by typing MS-KERMIT> CLEAR BOTH

Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 15

Part IV – High Speed Serial Transfers Overview In this part of the lab, you will observe the serial transfer of the text file, ascii.txt, using a high serial-port rate and with sliding windows set to seven. No data will be taken, but your observations will help you answer the questions that follow.

Step 1 Make certain that the server is at the Kermit prompt by typing + , and then type at the prompt on both Server and Sender: MS-KERMIT> SET PARITY NONE MS-KERMIT> SET SEND PACKET-LENGTH 94 MS-KERMIT> SET RECEIVE PACKET-LENGTH 94 MS-KERMIT> SET WINDOWS 7 MS-KERMIT> SET SPEED 57600  On the server, type MS-KERMIT> SERVER

Step 2 The Kermit text file transfer will use the ASCII.TXT file. Begin sending the file by typing on the sending PC: MS-KERMIT> SEND ASCII.TXT

Step 3 During and after the file transfer, observe the number of packets sent, and the number of retries which occurred.

Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 16

Results Hex

Encoding

Field Name

Description

01h

literal

SOH

Start-of-header

0dh

literal

CR

end-of-packet delimiter

Value

Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 17

Decoded Value

Table 2: Decoded Contents of the Send-INIT Packet. Packet #

Sequence #

Sent By

Sent To

Packet Type

Notes

1

0

Sender

Server

S

Send-INIT Packet

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Table 3: Packet Traffic for Kermit Transfer of decode.txt. Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 18

Kermit Parameters

ASCII.TXT

BINARY.EXE

Packet

Window

# of

# of

Time

# of

# of

Time

Size

Size

Packets

KBytes

(sec)

Packets

KBytes

(sec)

50

1

50

7

94

1

94

7

285

1

2000

1

Table 4: Kermit File Transfer Times

Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 19

Kermit Values Packet Size

Window Size

50

1

50

7

94

1

94

7

285

1

2000

1

ASCII.TXT

BINARY.EXE

Link Utilization (%)

Link Utilization (%)

Table 5: Effective Link Utilization (See Question 5)

Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 20

Questions 1. Answer the following questions: a) What is the purpose of the SEND INIT packet exchange between the sender and receiver? b) What problems does it solve? c) What problems cannot be solved by exchanging configuration information in this manner?

2. Clearly define each of the initialization parameters included in the SEND INIT packet.

3. Briefly describe the functionality of the packet types identified in the time-sequence diagram you created in Step 6 of Part I.

4. Using your observations of the file transfer, your knowledge of Kermit and information from problem (3),explain how Kermit handles control characters in the data field (i.e. how does Kermit achieve data transparency?)

5. Calculate the effective link utilization as seen by the user for each of the (14) trials in Table 4 for both the ASCII and the binary file. You will require the following additional information to make the calculations: data-rate = 9600 bps, ascii.txt - 12255 bytes, binary.exe - 12288 bytes, assume 8 bits/byte. Hint: An effective rate of 9600 bps yields a link utilization of 100%. Please use a separate sheet for the calculations, and place your answers in Table 5 in the results section.

6. Using your observations of binary and ASCII file transfers, and your data gathered in Table 2, explain what aspects of this protocol cause the difference in performance between text and binary file transfers?

7. As you did the lab, you should have noticed that some settings appear to be better in the situation that we created in the lab. Are there good reasons for using settings which appear to make the protocol less efficient?

Kermit/Link-Layer Lab – VER 1.2 January 2004 (1.2.0) 21

Suggest Documents