Starting from:

$24.99

COMP9331 Lab 4-Exploring TCP Solution


Lab Exercise 4: Exploring TCP

There are 6 labs during this course. For each student, the 5 best performing labs will contribute to your final lab mark.
Objectives:
gain insights into the operation of TCP.
get familiar with the ns-2 simulator (as preparation for the next two labs)
Prerequisites and Links:
Week 5 Lectures
Relevant Parts of Chapter 3 of the textbook
Introduction to Tools of the Trade (https://webcms3.cse.unsw.edu.au/COMP3331/20T3/resources/51942)
Basic understanding of Linux. A good resource is here (http://www.ee.surrey.ac.uk/Teaching/Unix/) but there are several other resources online:
tcp-wireshark-trace-1 (https://webcms3.cse.unsw.edu.au/COMP3331/20T3/resources/52082) NS2 overview slides (https://webcms3.cse.unsw.edu.au/COMP3331/20T3/resources/52081) simpleSim.tcl (https://webcms3.cse.unsw.edu.au/COMP3331/20T3/resources/52083)
Explanation of script simpleSim.tcl (https://webcms3.cse.unsw.edu.au/COMP3331/20T3/resources/52080)
Marks: 10 marks.
This lab comprises of a number of exercises. Pl note that not all the exercises for this lab are marked. You have to submit a report containing answers for all questions in Exercise 1 and 2 only. Please attend the lab in your allocated lab time slot.
We expect the students to go through as much of the lab exercises as they can at home and come to the lab for clarifying any doubts in procedure/specifications.
Late penalty will be applied as follows:
Note that the above penalty is applied to your final mark. For example, if you submit your lab work 2 days late and your score on the lab is 8, then your final mark will be 8 - 3.2 (40% penalty) = 4.8.
Submission Instructions:
Submit a PDF document Lab4.pdf with answers to all questions for Exercise 1 & 2 only. There is no need to create an archive. Submit the PDF directly.
1. When you are ready to submit, at the bash prompt type 3331
2. Next, type: give cs3331 Lab4 Lab4.pdf Alternately submit the PDF file through WebCMS.
Original Work Only:
Exercise 1: Understanding TCP using Wireshark
For this particular experiment download the trace file: tcp-wireshark-trace-1 (https://webcms3.cse.unsw.edu.au/COMP3331/20T3/resources/52082) .
The following indicate the steps for this experiment:
Step 1: Start Wireshark by typing wireshark at the command prompt.
Step 2: Load the trace file tcp-ethereal-trace-1 by using the File pull down menu, choosing Open and selecting the appropriate trace file. This file captures the sequence of messages exchanged between a host and a remote server (gaia.cs.umass.edu). The host transfers a 150 KB text file, which contains the text of Lewis Carrol’s Alice’s Adventure in Wonderland to the server. Note that the file is being transferred from the host to the server using a HTTP POST message.
Step 3: Now filter out all non-TCP packets by typing “tcp” (without quotes) in the filter field towards the top of the Wireshark window. You should see a series of TCP segments between the host in MIT and gaia.cs.umass.edu. The first three segments of the trace consist of the initial three-way handshake containing the SYN, SYN ACK and ACK messages. You should see an HTTP POST message in the 4 th segment of the trace being sent from the host in MIT to gaia.cs.umass.edu (check the contents of the payload of this segment). You should observe that the text file is transmitted as multiple TCP segments (i.e. a single POST message has been split into several TCP segments) from the client to the server (gaia.cs.umass.edu). You should also see several TCP ACK segments been returned in the reverse direction.
IMPORTANT NOTE: Do the sequence numbers for the sender and receiver start from zero? The reason for this is that Wireshark by default scales down all real sequence numbers such that the first segment in the trace file always starts from 0. To turn off this feature, you have to click Edit-
>Preferences>Protocols->TCP (or Wireshark->Preferences->Protocols->TCP) and then disable the “Relative Sequence Numbers” option. Note that the answers in the solution set will reflect this change. If you conduct the experiment without this change, the sequence numbers that you observe will be different from the ones in the answers. Also, set the time shown in the 2nd column as the "Seconds since beginning of capture" under view->Time display format.
Question 1 . What is the IP address of gaia.cs.umass.edu? On what port number is it sending and receiving TCP segments for this connection? 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?
Question 2. 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.
Question 3. 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) sent from the client to the web server (Do not consider the ACKs received from the server as part of these six segments)? 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 relevant parts of Section 3.5 or lecture slides) after the receipt of each ACK? Assume that the initial value of EstimatedRTT is equal to the measured RTT ( SampleRTT ) for the first segment, and then is computed using the EstimatedRTT equation for all subsequent segments. Set alpha to 0.125.
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 . However, do not use this graph to answer the above question.
Question 4. What is the length of each of the first six TCP segments? (same six segments as Q3)
Question 5. What is the minimum amount of available buffer space advertised at the receiver for the entire trace? Does the lack of receiver buffer space ever throttle the sender?
Question 6. Are there any retransmitted segments in the trace file? What did you check for (in the trace) in order to answer this question?
Question 7. How much data does the receiver typically acknowledge in an ACK? Can you identify cases where the receiver is ACKing every other received segment (recall the discussion about delayed acks from the lecture notes or Section 3.5 of the text).
Question 8. What is the throughput (bytes transferred per unit time) for the TCP connection? Explain how you calculated this value.
Exercise 2: TCP Connection Management
Consider the following TCP transaction between a client (10.9.16.201) and a server (10.99.6.175).

Answer the following questions:
Question 1 . What is the sequence number of the TCP SYN segment that is used to initiate the TCP connection between the client computer and server?
Question 2. What is the sequence number of the SYNACK segment sent by the server to the client computer in reply to the SYN? What is the value of the Acknowledgement field in the SYNACK segment? How did the server determine that value?
Question 3 . What is the sequence number of the ACK segment sent by the client computer in response to the SYNACK? What is the value of the Acknowledgment field in this ACK segment? Does this segment contain any data?
Question 4 . Who has done the active close? client or the server? how you have determined this? What type of closure has been performed? 3 Segment (FIN/FINACK/ACK), 4 Segment (FIN/ACK/FIN/ACK) or Simultaneous close?
Question 5 . How many data bytes have been transferred from the client to the server and from the server to the client during the whole duration of the connection? What relationship does this have with the Initial Sequence Number and the final ACK received from the other side?
Exercise 3: Getting familiarised with ns-2 simulator (not marked, do not include in your report)
ns-2 (http://www.isi.edu/nsnam/ns/) is a powerful simulator that provides substantial support for simulating TCP, routing and multicast protocols, among other things. It is capable of simulating the conditions that occur in wired or wireless networks. It is widely used in the research community and also in industry.
The simulator is written in C++. However, it uses OTcl as its command and configuration interface. In our lab exercises, we will use scripts written in OTcl. You will not be required to write any C++ code for any of the lab exercises. You will also not be required to write OTcl scripts from scratch. All scripts will be provided and at most ask you change a line or two in the scripts with proper instructions. To complete the lab exercises, you can safely assume ns-2 to be a black box. However, for those who are interested in finding out a bit more about ns-2, please refer to the following overview slides (https://webcms3.cse.unsw.edu.au/COMP3331/20T3/resources/52081) which offers a good introduction.
We will also use a network animator tool: Nam (http://www.isi.edu/nsnam/nam/) . This allows us to visualise the topology and the transmission of packets during the experiments.
Illustrative Example: 2 nodes communicating directly over UDP
We will use this example to get acquainted with ns-2. The OTcl script for the first experiment is simpleSim.tcl
(https://webcms3.cse.unsw.edu.au/COMP3331/20T3/resources/52083) . It creates two nodes and simulates the sending of data packets from one node to the other over UDP. The full explanation of the script can be found here. (https://webcms3.cse.unsw.edu.au/COMP3331/20T3/resources/52080) We strongly recommend you read through it as it will be helpful for you for future exercises. It doesn't go over all details but rather gives you an overview of how to setup a topology, create traffic and run an experiment.
You can run the script by typing the following command:
$ ns simpleSim.tcl
This will start the nam tool and you will see the nam window (http://www.isi.edu/nsnam/ns/tutorial/nsbasic.html#nam) . When you click on the 'play' button in the window, you will see that after 0.5 seconds of simulated time, node 0 starts sending data packets to node 1. The transmission stops at t = 1.5 seconds and the simulation stops at time t = 2 seconds. You might want to slow nam down by using the 'Step' slider at the top right.
Once the experiment has concluded close nam. You will find an output trace file named 'out.tr' in your current directory. The format is as follows:
event time src dest PktType PktSize Flags Fid SrcSddr DestAddr SeqNum PktId
where:
event:
r: receive at dest
+: enqueue -: dequeue d: drop
ScrAddr and DestAddr :
node.port (e.g., 0.1 means node 0 , port 1 ) Example trace:
r 0.519 0 1 cbr 500 ------- 0 0.0 1.0 1 1 + 0.52 0 1 cbr 500 ------- 0 0.0 1.0 4 4
- 0.52 0 1 cbr 500 ------- 0 0.0 1.0 4 4
We will use ns-2 in the next lab to run some experiments with TCP flows.
Comments   (/COMP3331/20T3/forums/search?forum_choice=resource/51950)  (/COMP3331/20T3/forums/resource/51950)
 Add a comment

similar to past labs. A few should suffice
Reply
Hi Salil,
For exercise 2 , why is the sequence number in transaction 304 same as the sequence number in transaction 306? Does SYN consume 1 sequence number? So why is the sequence number in 306 not 2818463652 + 1 = 2818463653?
Reply
Yes it does. You should review all discussions about sequence numbers and TCP in general before answering these questions. Reply
The host sends two packets to the server with sequence numbers (232129013, 232129578) and receives one ACK packet back with the value of 232129578 and received time of 0.053937. This makes sense as TCP uses cumulative ACK.
However, how can I determine when the first packet (232129013) was received if I don't have an ACK message to review?
Reply
When we're asked to find the 'number of data bytes', do the 1 bytes taken up FIN and SYN need to be subtracted? Or are they included in the count?
Reply
Reply
Thanks,
Reply
Reply
Q7 - After typing the first 25 sequence numbers for which the acknowledgements were missed, I used Export as CSV option and manipulated the columns in Excel. Hope that helps or other students.
Sir, Are we even supposed to mention all cases with this feature (delayed ACKs) ?
Reply
You can mention a few specific cases and provide a summary in general. No need to list each and every one. Reply
In Q4 of Exercise 1, is it asking for the first 6 segment lengths with the segment containing the HTTP POST as the first segment like in Q3 or does it just mean the first segment ?
Thank you !!

Reply
Same as Q3
Reply
Reply
Quoting from the spec - "(Do not consider the ACKs received from the server as part of these six segments)?"
Reply
Thank you ! Was just unsure if this applied to Q4 as well Reply
Reply
It is there. Quoting from the spec - "(check the contents of the payload of this segment)". So see the contents (i.e. the data) in the bottom window.
Reply
Reply
It is not mistake but as per the closure sequence in action here. See the lecture slides where I go over different ways that closure can take place
Reply
In exercise 1, is it necessary to use the raw sequence numbers in our answers? I already did it with the relative seq numbers and it is a lot easier to read.
Reply
Reply

More products