1.Capturing a bulk TCP transfer from your computer to a remote server

按照下述步骤使用wireshark进行抓包

• Start up your web browser. Go the http://gaia.cs.umass.edu/wiresharklabs/alice.txt and retrieve an ASCII copy of Alice in Wonderland. Store this file somewhere on your computer.

• Next go to http://gaia.cs.umass.edu/wireshark-labs/TCP-wireshark-file1.html.

• You should see a screen that looks like:

• Use the Browse button in this form to enter the name of the file (full path name) on your computer containing Alice in Wonderland (or do so manually). Don’t yet press the “Upload alice.txt file” button.

• Now start up Wireshark and begin packet capture (Capture->Start) and then press OK on the Wireshark Packet Capture Options screen (we’ll not need to select any options here).

• Returning to your browser, press the “Upload alice.txt file” button to upload the file to the gaia.cs.umass.edu server. Once the file has been uploaded, a short congratulations message will be displayed in your browser window.

• Stop Wireshark packet capture. Your Wireshark window should look similar to the window shown below.

抓包结果如下

【Wireshark Lab v8.0】Lab4:TCP - 图1

2.A first look at the captured trace

  1. What is the IP address and TCP port number used by the client computer (source) that is transferring the file to gaia.cs.umass.edu? To answer this question, it’s probably easiest to select an HTTP message and explore the details of the TCP packet used to carry this HTTP message, using the “details of the selected packet header window” (refer to Figure 2 in the “Getting Started with Wireshark” Lab if you’re uncertain about the Wireshark windows.
    【Wireshark Lab v8.0】Lab4:TCP - 图2

  2. What is the IP address of gaia.cs.umass.edu? On what port number is it sending and receiving TCP segments for this connection?
    【Wireshark Lab v8.0】Lab4:TCP - 图3

  3. What is the IP address and TCP port number used by your client computer (source) to transfer the file to gaia.cs.umass.edu?
    【Wireshark Lab v8.0】Lab4:TCP - 图4

3.TCP Basics

  1. What is the sequence number of the TCP SYN segment that is used to initiate the TCP connection between the client computer and gaia.cs.umass.edu? What is it in the segment that identifies the segment as a SYN segment?
    【Wireshark Lab v8.0】Lab4:TCP - 图5

  2. What is the sequence number of the SYNACK segment sent by gaia.cs.umass.edu to the client computer in reply to the SYN? What is the value of the Acknowledgement field in the SYNACK segment? How did gaia.cs.umass.edu determine that value? What is it in the segment that identifies the segment as a SYNACK segment?
    acknowledgement = sequence number+1
    【Wireshark Lab v8.0】Lab4:TCP - 图6

  3. What is the sequence number of the TCP segment containing the HTTP POST command? Note that in order to find the POST command, you’ll need to dig into the packet content field at the bottom of the Wireshark window, looking for a segment with a “POST” within its DATA field.
    【Wireshark Lab v8.0】Lab4:TCP - 图7

  4. Consider the TCP segment containing the HTTP POST as the first segment in the TCP connection. What are the sequence numbers of the first six segments in the TCP connection (including the segment containing the HTTP POST)? At what time was each segment sent? When was the ACK for each segment received? Given the difference between when each TCP segment was sent, and when its acknowledgement was received, what is the RTT value for each of the six segments? What is the EstimatedRTT value (see Section 3.5.3, page 242 in text) after the receipt of each ACK? Assume that the value of the EstimatedRTT is equal to the measured RTT for the first segment, and then is computed using the EstimatedRTT equation on page 242 for all subsequent segments. Note: Wireshark has a nice feature that allows you to plot the RTT for each of the TCP segments sent. Select a TCP segment in the “listing of captured packets” window that is being sent from the client to the gaia.cs.umass.edu server. Then select: Statistics->TCP Stream Graph- >Round Trip Time Graph. (带计算)
    【Wireshark Lab v8.0】Lab4:TCP - 图8
    segments 1-6
    No.4 No.5 No.7 No.8 No.10 No.11
    0.026477 0.041737 0.054026 0.054690 0.077405 0.078157
    【Wireshark Lab v8.0】Lab4:TCP - 图9
    No.6 No.9 No.12 No.14 No.15 No.16
    0.053937 0.077297 0.124085 0.169118 0.217299 0.267802 | | Sent time | ACK received time | RTT(seconds) | | :—- | :—- | :—- | :—- | | segment 1 | 0.026477 | 0.053937 | 0.02746 | | segment 2 | 0.041737 | 0.077297 | 0.03556 | | segment 3 | 0.054026 | 0.124085 | 0.070059 | | segment 4 | 0.054690 | 0.169118 | 0.114428 | | segment 5 | 0.077405 | 0.217299 | 0.139894 | | segment 6 | 0.078157 | 0.267802 | 0.189645 |


EstimatedRTT计算公式为:
EstimatedRTT = 0.875 EstimatedRTT + 0.125 SampleRTT
EstimatedRTT after the receipt of the ACK of segment 1:
EstimatedRTT = RTT for Segment 1 = 0.02746 second
EstimatedRTT after the receipt of the ACK of segment 2:
EstimatedRTT = 0.875 0.02746 + 0.125 0.035557 = 0.0285
EstimatedRTT after the receipt of the ACK of segment 3:
EstimatedRTT = 0.875 0.0285 + 0.125 0.070059 = 0.0337
EstimatedRTT after the receipt of the ACK of segment 4:
EstimatedRTT = 0.875 0.0337+ 0.125 0.11443 = 0.0438
EstimatedRTT after the receipt of the ACK of segment 5:
EstimatedRTT = 0.875 0.0438 + 0.125 0.13989 = 0.0558
EstimatedRTT after the receipt of the ACK of segment 6:
EstimatedRTT = 0.875 0.0558 + 0.125 0.18964 = 0.0725 second
【Wireshark Lab v8.0】Lab4:TCP - 图10

  1. What is the length of each of the first six TCP segments?
    第一个长度是565,第2个和第6个长度均是1460
    【Wireshark Lab v8.0】Lab4:TCP - 图11
    【Wireshark Lab v8.0】Lab4:TCP - 图12

  2. What is the minimum amount of available buffer space advertised at the received for the entire trace? Does the lack of receiver buffer space ever throttle the sender?
    Solution:
    The minimum amount of buffer space (receiver window) advertised at gaia.cs.umass.edu for the entire trace is 5840 bytes, which shows in the first acknowledgement from the server. This receiver window grows steadily until a maximum receiver buffer size of 62780 bytes. The sender is never throttled due to lacking of receiver buffer space by inspecting this trace.
    【Wireshark Lab v8.0】Lab4:TCP - 图13
    【Wireshark Lab v8.0】Lab4:TCP - 图14
    【Wireshark Lab v8.0】Lab4:TCP - 图15

  3. Are there any retransmitted segments in the trace file? What did you check for (in the trace) in order to answer this question?
    Solution:
    There are no retransmitted segments in the trace file. We can verify this by checking the sequence numbers of the TCP segments in the trace file. In the TimeSequence-Graph (Stevens) of this trace, all sequence numbers from the source (192.168.1.102) to the destination (128.119.245.12) are increasing monotonically with respect to time. If there is a retransmitted segment, the sequence number of this retransmitted segment should be smaller than those of its neighboring segments.
    【Wireshark Lab v8.0】Lab4:TCP - 图16

  4. How much data does the receiver typically acknowledge in an ACK? Can you identify cases where the receiver is ACKing every other received segment (see Table 3.2 on page 250 in the text).
    Solution: The acknowledged sequence numbers of the ACKs are listed as follows. | | acknowledged sequence numbez | acknowledged data | | —- | —- | —- | | ACK 1 | 566 | 566 | | ACK 2 | 2026 | 1460 | | ACK 3 | 3486 | 1460 | | ACK 4 | 4946 | 1460 | | ACK 5 | 6406 | 1460 | | ACK 6 | 7866 | 1460 | | ACK 7 | 9013 | 1147 | | ACK 8 | 10473 | 1460 | | ACK 9 | 11933 | 1460 | | ACK 10 | 13393 | 1460 | | ACK 11 | 14853 | 1460 | | ACK 12 | 16313 | 1460 | | … | … | … |


The difference between the acknowledged sequence numbers of two consecutive ACKs indicates the data received by the server between these two ACKs. By inspecting the amount of acknowledged data by each ACK, there are cases where the receiver is ACKing every other segment. For example, segment of No. 80 acknowledged data with 2920 bytes = 1460*2 bytes.

  1. What is the throughput (bytes transferred per unit time) for the TCP connection? Explain how you calculated this value.
    Solution:
    The computation of TCP throughput largely depends on the selection of averaging time period. As a common throughput computation, in this question, we select the average time period as the whole connection time. Then, the average throughput for this TCP connection is computed as the ratio between the total amount data and the total transmission time. The total amount data transmitted can be computed by the difference between the sequence number of the first TCP segment (i.e. 1 byte for No. 4 segment) and the acknowledged sequence number of the last ACK (164091 bytes for No. 202 segment). Therefore, the total data are 164091 - 1 = 164090 bytes. The whole transmission time is the difference of the time instant of the first TCP segment (i.e., 0.026477 second for No.4 segment) and the time instant of the last ACK (i.e., 5.455830 second for No. 202 segment). Therefore, the total transmission time is 5.455830 - 0.026477 = 5.4294 seconds. Hence, the throughput for the TCP connection is computed as 164090/5.4294 = 30.222 KByte/sec.
    也可以通过流量图来验证:
    【Wireshark Lab v8.0】Lab4:TCP - 图17

4.TCP congestion control in action

  1. Use the Time-Sequence-Graph(Stevens) plotting tool to view the sequence number versus time plot of segments being sent from the client to the gaia.cs.umass.edu server. Can you identify where TCP’s slowstart phase begins and ends, and where congestion avoidance takes over? Comment on ways in which the measured data differs from the idealized behavior of TCP that we’ve studied in the text.
    【Wireshark Lab v8.0】Lab4:TCP - 图18
    【Wireshark Lab v8.0】Lab4:TCP - 图19
    0-0.3s为slow-start阶段,然后进入congestion avoidance阶段。书上说“在慢启动状态,cwnd的值以1个MSS开始并且每当传输的segment首次被确认时就增加一个MSS”。为了分析的更清晰,我们同时观察抓包结果和时间序列。观察抓到的包,在三次握手后,客户相继发送了frame4 和frame5,frame 5是图中横坐标接近0.05s的那个点,注意此时是相继发送,说明cwnd为一个包大小左右。接着往下看,frame 6即是对frame 4的ACK,所以在接收到frame 6之后,cwnd增加到了2个MSS,同时发送了frame 7 和frame 8,即图中横坐标刚过0.05s的那两个stack在一列上的点,这个cwnd持续了一段时间。继续往下看,frame14-17连续ACK了4次,所以cwnd的值从2加到了6,所以客户直接同时发送了frame18-23这六个包,即图中横坐标为0.3s的那6个叠在一起的点。继续往下看,后面都是,发6个收6个,说明cwnd遇到了ssthresh,进入congestion avoidance阶段,cwnd不再增加(但是书上写得是会线性增加直到遇到超时,可能这里有别的机制)。

  2. Answer each of two questions above for the trace that you have gathered when you transferred a file from your computer to gaia.cs.umass.ed

参考文章:

————————————————

Microsoft Word - Wireshark_TCP_Solution_July_22_2007.doc (utk.edu)

(80条消息) Wireshark Labs(4): TCP v7.0_沉鱼叶的博客-CSDN博客