2g1305/2e1605 internetworking - kth · appendix a gives an outline of the lab report. the output...

23
Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1 1 2G1305/2E1605 Internetworking Laboration 2: Transport Protocols: TCP and UDP 1 Goals................................................................................................................................... 3 2 Lab report ........................................................................................................................... 3 3 Lab Preparation .................................................................................................................. 4 3.1 Software tools ............................................................................................................. 4 3.2 Read-list ..................................................................................................................... 4 3.3 Preparation Questions ................................................................................................ 4 3.4 Ethereal....................................................................................................................... 5 4 Lab equipment .................................................................................................................... 8 5 Lab setup ............................................................................................................................ 9 5.1 Connecting the network ............................................................................................. 9 5.2 Configuring the hosts ................................................................................................. 9 5.3 Configuring the routers ............................................................................................ 10 6 Measuring with ttcp and ethereal ..................................................................................... 11 6.1 UDP measurements .................................................................................................. 11 6.2 TCP measurements ................................................................................................... 12 7 TCP connections .............................................................................................................. 13 7.1 Connection establishment and termination .............................................................. 13 7.2 Connecting to a non-existing port ............................................................................ 13 7.3 Connecting to a non-existing host ............................................................................ 14 8 Fragmentation................................................................................................................... 15 8.1 UDP and fragmentation............................................................................................ 15 8.2 TCP and fragmentation ............................................................................................ 15 9 TCP data transfer .............................................................................................................. 17 9.1 Interactive application – fast link ............................................................................. 17 9.2 Bulk transfer – fast link ............................................................................................ 18

Upload: others

Post on 17-Oct-2019

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

1

2G1305/2E1605 Internetworking

Laboration 2: Transport Protocols: TCP and UDP

1 Goals................................................................................................................................... 3 2 Lab report ........................................................................................................................... 3 3 Lab Preparation .................................................................................................................. 4

3.1 Software tools............................................................................................................. 4 3.2 Read-list ..................................................................................................................... 4 3.3 Preparation Questions ................................................................................................ 4 3.4 Ethereal....................................................................................................................... 5

4 Lab equipment.................................................................................................................... 8 5 Lab setup ............................................................................................................................ 9

5.1 Connecting the network ............................................................................................. 9 5.2 Configuring the hosts ................................................................................................. 9 5.3 Configuring the routers ............................................................................................ 10

6 Measuring with ttcp and ethereal ..................................................................................... 11 6.1 UDP measurements .................................................................................................. 11 6.2 TCP measurements................................................................................................... 12

7 TCP connections .............................................................................................................. 13 7.1 Connection establishment and termination .............................................................. 13 7.2 Connecting to a non-existing port ............................................................................ 13 7.3 Connecting to a non-existing host ............................................................................ 14

8 Fragmentation................................................................................................................... 15 8.1 UDP and fragmentation............................................................................................ 15 8.2 TCP and fragmentation ............................................................................................ 15

9 TCP data transfer.............................................................................................................. 17 9.1 Interactive application – fast link ............................................................................. 17 9.2 Bulk transfer – fast link ............................................................................................ 18

Page 2: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

2

9.3 Interactive application – slow link ........................................................................... 18 9.4 Bulk transfer – slow link .......................................................................................... 19

10 TCP retransmission ...................................................................................................... 20 10.1 TCP Retransmission exercise................................................................................... 20

11 TCP congestion control ................................................................................................ 21 11.1 TCP congestion control exercise.............................................................................. 21

12 Completing the lab ....................................................................................................... 22 Appendix A: Example lab report outline ................................................................................. 23

Page 3: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

3

1 Goals

The objectives of this lab are to get an insight into the following:

o The difference between UDP and TCP data transmission o The effect of fragmentation in UDP and TCP o Measurement of TCP and UDP connections o Understanding of TCP congestion and flow control o The difference between TCP bulk and interactive data transfer

In order to pass the lab, you need to fulfill the following: o Make the preparations in advance of the lab. Show your result before starting the lab. o Make the lab. You need to be present during the lab session. o Write and submit a lab report per group. The report should be submitted one week

after the lab. 2 Lab report To pass the lab, one lab report shall be written per group. You will probably not have time to write the report during the lab. Instead, save the logs from Ethereal and complete the report after the lab. The lab report shall be written in English and contain the following:

o Number of the group, the names and social security numbers (personnummer) of each participant

o Answers to the preparation questions in Section 3.3. o Answers to the questions given in the exercises in Sections 6-11. o Ethereal output from the exercises in Sections 6-11, including summary data, detailed

data, and graphs. It is explicitly noted in the exercises when data should be saved.

Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After the lab, the data is merged into one archive and transferred so that you can analyze and incorporate the output in the report. An internet connection will be provided, so that the archive can be sent using web-mail, for example. Send the completed lab report to [email protected], please add 2G1305 on the subject line. The report should be submitted at most one week after the lab.

Page 4: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

4

3 Lab Preparation In order to prepare for the lab, read the items in the read list and answer the questions below. The lab is limited in time, so it is required that the preparations are made in advance to the scheduled lab. The schedule is tight.

3.1 Software tools The following software tools will be used in the lab. Manual pages are available on the course web. Read the manual pages for these commands. It is even better, if the software is installed on your own computer and you learn to use them.

o ttcp – Test TCP and UDP performance. o telnet – An application and a protocol to communicate with another host using

TCP. o slattach – Attach a network interface to a serial line using SLIP. o ifconfig – Configure a network Interface. o route – Manipulate the routing table. o import – Tool to dump a window to a bitmap. o ethereal – An interactive and graphical network traffic analyzer. Read more about

Ethereal in Section 3.4.

3.2 Read-list o Forouzan, “TCP/IP Protocol Suite”, Chapter 8, 11, 12.

o Fragmentation o UDP o TCP

o 2G1305 Lecture Notes, lecture 4: Transport protocols Note especially the sections on TCP retransmission and congestion control.

3.3 Preparation Questions Below are a number of preparation questions to complete before the lab. The lab assistants will examine the answers before the lab starts. The read-list and the manual pages of the commands can help you in answering these questions. The preparation questions should also be included in your lab report.

1) Explain the role of port numbers in the transport protocols. 2) Write the command to configure a network interface eth0 to 10.0.0.1 with subnet

mask 255.255.255.0 and with an MTU of 600. 3) Write the commands to add/delete 10.0.1.2 as your default gateway. 4) Write the commands to add/delete 10.0.2.2 as your route to the 10.0.3.0/24 network. 5) Write the ttcp commands for both sender and receiver, which executes the following

scenario: Send a TCP stream from host 10.2.3.4 to 10.4.5.6 on port 3333. The sender should send 4000 bytes with four datagrams of 1000 bytes in each datagram.

6) Write the command to start an Ethereal session that captures packets on Ethernet interface eth0. The session should not do DNS name lookup, and should only capture traffic with destination IP address 10.0.0.1. It should also make live capturing and update the display as packets are captured in real-time.

7) Which fields in the IP header are related to fragmentation and what role does each of these fields have?

Page 5: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

5

8) Suppose a TCP sender receives an ACK where the acknowledgement number is set to 12345 and the window size is 2048. Which sequence numbers can the sender transmit?

9) Briefly describe the following algorithms and when they are used: a. Nagle’s algorithm. b. Karn’s algorithm. c. Delayed acknowledgement. d. Piggybacked acknowledgement.

10) How is the retransmission timeout (RTO) value computed in TCP? 11) Explain the following TCP mechanisms:

a. Sliding window flow control. b. Slow start and congestion avoidance. c. Fast retransmit and fast recovery.

3.4 Ethereal

Figure 1 Main Ethereal window containing three frames

Ethereal is a traffic analyzer with a graphical interface. It is the main tool used in this lab. In this section, some Ethereal functions necessary for the lab are described. Figure 1 shows the main Ethereal window as shown after an experiment. The window consists of three frames. A list of the captured packets is shown in the top frame. When a packet in the list is marked, the content is shown in the middle and lower frames. The middle frame shows the packet in symbolic form, while the lower frame shows the packet in raw, hexadecimal format. In the middle frame, the fields may be expanded to show a more detailed view.

Page 6: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

6

A session is started by clicking on Capture>>Start. This brings up a capture options window. Typically, the display option “Update list of packets in real time” and “Automatic Scrolling in live capture” should be selected. When started, the packets are shown in the main area, and a capture window is shown. To stop the capture, click on the “stop” button in this window. Some statistics can be shown by choosing Tools>>Summary.

3.4.1 Saving Ethereal output Data is saved in two formats: summary and detailed, as follows:

o Click the File>>Print on the menu bar. o Choose Plain Text format. o Choose Print to file. o Name a file (typically in the /home/2g1305_lab1 directory). o For saving a summary, choose Print summary. o For saving detailed data, choose Print details.

3.4.2 Graphs

Figure 2 Example of a tcptrace graph

Figure 2 illustrates a TCP trace graph. After a TCP experiment, this graph is shown by clicking the Tools>>tcptrace on the menu bar. The figure shows the time in seconds on the x-

Page 7: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

7

axis, and the segment number on the y-axis. The plots illustrate the segments, and the advertised window. Unfortunately, Ethereal does not allow you to save the graphs to a file. However, by using the import function, the graph can be dumped to a bitmap. This is done by typing the following in a terminal window: # import graph.jpg The window containing the TCP graph is then clicked on. This saves the graph to file with the corresponding image format. There are also other useful graphs, including throughput plotted as a function of time.

Page 8: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

8

4 Lab equipment Every lab group consists of 2-4 people. We will provide the following equipment:

1) Two end-hosts, Dell Latitude D500 running Linux/RedHat 9 equipped with one Ethernet interface and the software listed in Section 3.1.

2) Two Microstar routers running Linux/RedHat 9 with four Ethernet interfaces and one serial interface.

3) One cross-wired serial cable (null-modem). 4) Three crossed Ethernet cables. 5) One straight Ethernet cable. (Used to connect to the Internet at the end of the lab)

Page 9: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

9

5 Lab setup

Figure 3 Two hosts, A and B, interconnected by router A and B. Router A and Router B are connected by an Ethernet cable and a serial cable (cross-connect).

Figure 4 Illustration of port numbering on Router. View is from the backside of the router.

5.1 Connecting the network In the lab set up, host A and host B are connected to one router each according to Figure 3. The two routers are connected with one Ethernet cable and with one serial cable. Use the interfaces as specified in Figure 3. Interface numbering on the router are depicted in Figure 4.

5.2 Configuring the hosts Turn on power on the hosts. Choose boot partition 2G1305. The hosts will boot Linux and start a window system. Log in as root:

login: root password: qwerty

Open up a terminal window (right click on the desktop and choose “New Terminal”).

Page 10: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

10

To make it easy to remember which host you are working on, set the prompt to reflect the name of the host according to Figure 3. [root@localhost root]# cat >> /root/.bashrc export PS1=”Host A# “ ctrl-D [root@localhost root]# source /root/.bashrc Host A# On both hosts, change directory to /home/2g1305_lab1, if it doesn’t exist, create it. Next step is to configure the Ethernet interfaces. The router has the IP address 10.0.0.1/24 pre-configured at eth0, set the IP address of the Ethernet interface of the host so that you can communicate with the router via ssh.

The final step is to ensure that the host will not make DNS lookups. A straightforward way to do this is to remove the /etc/resolv.conf file. Repeat this procedure for Host B.

5.3 Configuring the routers The Ethernet interfaces for router A and router B are already configured. After connecting the cables you should be able to login to router A from host A. Start a new terminal window and use ssh to connect to the router. Remove the /root/.ssh/known_hosts file first if it exisits.

Host A# rm /root/.ssh/known_hosts Host A# ssh 10.0.0.1 Router A# password for root: qwerty

Login to router B from host B in the same way. After the login, at the routers, you should change the IP address of eth0 according to Figure 3. Note, after that you must change the IP address in your hosts again to match the new network. At the hosts, add your router’s new IP address as you default gateway. Use the ssh again to connect to the router. In the router, change directory to /home/2g1305_lab1, if it doesn’t exist, create it. Then you should add the routes to the 10.0.3.0/24 network for router A and the routes to the 10.0.1.0/24 network for router B. Make the router to forward traffic by writing the following line at the routers: Router A# echo “1” > /proc/sys/net/ipv4/ip_forward Router B# echo “1” > /proc/sys/net/ipv4/ip_forward After that, verify that the setup is correct by issuing a ping command from Host A to Host B. When connectivity has been verified, attach the serial line and assign IP addresses to the serial interfaces. The name of the serial line interface is sl0.

Page 11: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

11

Router A# slattach –p slip –s 4800 /dev/ttyS0 & Router B# slattach –p slip –s 4800 /dev/ttyS0 &

Router A# ifconfig sl0 10.0.4.1 pointopoint 10.0.4.2 up mtu 600 Router B# ifconfig sl0 10.0.4.2 pointopoint 10.0.4.1 up mtu 600

Verify that you can ping from 10.0.4.1 on router A to 10.0.4.2 on router B. At this point, the traffic between the two hosts goes over the fast Ethernet link. You can make the traffic to go through the serial line by updating the routes on Router A and Router B respectively. Do not change the routes at this step. The arp tables at the hosts and the routers will timeout every minute, this may affect your measurements. So for all the routers and all the hosts, do the following: # echo 30000 > /proc/sys/net/ipv4/neigh/default/gc_interval 6 Measuring with ttcp and ethereal An introduction to measuring UDP and TCP traffic.

6.1 UDP measurements This lab exercise looks at sending UDP data between two hosts and observing the traffic. 1) On Host B, start ethereal to measure traffic on interface eth0, add a filter so it will only

measure the traffic from and to host 10.0.1.1 2) Click Capture>>Start on the menu bar to start capture the traffic (see Section 3.4) 3) On Host B, start a ttcp receiver to receive UDP traffic at port number 1234. 4) On Host A, start a ttcp sender to send 10 UDP packets with the length of 1000 bytes to

Host B at port number 1234. 5) When transfer is completed (ttcp tells you when the transfer is completed), stop the

capturing of packets by pressing Stop in the “Ethereal Capture” window. You should now have a packet trace in the main window. Make sure that you recognize the Ethernet header fields, the IP header fields, and the UDP header fields in the mid section.

6) Observe the traffic and answer the following questions:

a. How many packets are transferred in both directions? Observe that the ttcp always transfer six extra UDP packets when testing UDP packets. One of the six packets is at the beginning of the transmission and the other five packets are at the end of the transmission. You should always exclude these packets when doing measurements.

b. Check the statistics summary by choosing Tools>>Summary. Find the total number of bytes transmitted in the recorded transfer (note that this includes

Page 12: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

12

Ethernet, IP, and UDP headers as well as application data). You have to subtract the six extra UDP packets, which constitute 360 bytes. You should also calculate the amount of user data that was transmitted (or find out by looking at the statistics from ttcp).

c. Inspect the UDP header fields. Which fields do not change in the different packets? (Note that you should disregard from the 6 extra packets).

d. What is the UDP port number in host A? 7) Save the output (detailed and summary) to file output_6_1_detail and

output_6_1_summary. Section 3.1 shows in detail how to do it.

6.1.1 Lab report Use the captured data to answer the questions above. Support your answers with the saved Ethereal data. Append the file output_6_1_summary to the report.

6.2 TCP measurements Repeat the previous experiment, but for TCP instead of UDP. Note that ttcp does not send any extra packets when running TCP.

1) On Host B, start capturing packets with Ethereal 2) On Host B, start a ttcp receiver to receive TCP traffic at port number 1234 3) On Host A, start a ttcp sender to send 10 packets with the length of 1000 bytes using

TCP to Host B, at port number 1234

4) When transfer is completed, stop capturing

5) Observe the traffic and answer the following questions: a. How many packets are transferred in total (i.e., count both directions)? b. What is the range of the sequence numbers used by the sender (Host A)? c. How many packets do not carry a data payload? d. Find the total number of bytes transmitted in the recorded transfer. Calculate the

amount of user data that was transmitted. e. Compare the total amount of data transmitted in the UDP and TCP data transfers.

Which of the protocols is more effective? What is the efficiency in percentage for these two protocols?

6) Save the output (detailed and summary) to file output_6_2_detail and

output_6_2_summary.

6.2.1 Lab report Use the captured data to answer the questions above. Support your answers with the saved Ethereal data. Append the file output_6_2_summary to the report.

Page 13: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

13

7 TCP connections This exercise gives an insight in connection establishment and termination. In this exercise we use the telnet application to establish and terminate TCP connections.

7.1 Connection establishment and termination 1) Start capturing packets on Host B with Ethereal. 2) Establish a telnet connection from Host A to Host B.

3) On Host A, terminate the connection. Type ctrl-] (ctrl+AltGr+9) at the telnet prompt

and then type “quit”. 4) Stop the Ethereal capturing.

5) Study the captured list of packets. Observe the TCP connection establishment and

answer the following questions: a. Which segments constitute the three-way handshake?

Which flags are set in the headers of these packets? b. What are the initial sequence numbers used by the client and the server,

respectively? c. Which packet contains the first application data? d. Determine the initial window sizes for the client and server, respectively. e. How long does it roughly take to open the TCP connection?

6) Study the captured list of packets. Observe the TCP connection termination and

answer the following questions: a. Which packets are involved in closing the connection? Which flags are set in

these packets?

7) Save a summary Ethereal output to file output_7_1_summary.

7.1.1 Lab report Use the captured data to answer the questions above. Support your answers with the saved Ethereal data. Append the file output_7_1_summary.

7.2 Connecting to a non-existing port 1) Start capturing packets with Ethereal on Host B. 2) Try to make a telnet connection from Host A to a port on Host B without listeners.

3) Stop capturing packets.

4) Study the captured list of packets. Observe the TCP segments that are transmitted.

a. How does the server host (Host B) close the connection? b. How long does the process of ending the connection take?

5) Save a summary Ethereal output to file output_7_2_summary.

Page 14: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

14

7.2.1 Lab report Use the captured data to answer the questions above. Support your answers with the saved Ethereal data. Append the file output_7_2_summary.

7.3 Connecting to a non-existing host 1) On Host A, start capturing packets with Ethereal. 2) Set a static ARP entry to a non-existent host. Without this fix, no TCP packets will be

sent. Instead, Host A would start sending ARP requests and receive no answers. Host A# arp –s 10.0.1.42 1:2:3:4:5:6

3) Try to make a telnet connection to that host from host A:

4) Study the captured packets and observe the TCP segments that are transmitted

a. How often does the client try to open a connection? Note the interval between tries.

b. Wait for max 5 minutes, does the client terminate the connection at last? If so, after how many tries?

5) Stop the capturing of packets and save the ethereal output to file

output_7_3_summary.

7.3.1 Lab report Use the captured data to answer the questions above. Support your answers with the saved Ethereal data. Append the file output_7_3_summary.

Page 15: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

15

8 Fragmentation In this exercise, the effects of fragmentation in UDP and TCP are observed. Fragmentation occurs in the network layer, when the transport layer sends a packet of data to the IP layer that exceeds the Maximum Transmission Unit (MTU) of the underlying link.

8.1 UDP and fragmentation In this exercise, you investigate how IP fragmentation works for UDP traffic

1) Start capturing packets with Ethereal on Host B. For this exercise it is convenient to set Display options “Update list of packets in real time” and “Automatic scrolling in live capture”.

2) Send packets from Host A. Increase the size of the UDP datagrams (the –l option)

until fragmentation occurs. Note that when ttcp runs UDP, it is not necessary to start a receiving ttcp. You can work solely on the sending ttcp in this exercise and increase the packet size gradually. A hint is to start with sending 1470 bytes size and work upwards.

a. What is the largest UDP data length you can send without fragmentation? b. Can you explain this length (given an MTU of 1500). c. What is the largest UDP data length the system can send, regardless of

fragmentation? Hint: the largest possible IP packet is 216 –1. ttcp will return “Message too long” for over-sized packets.

d. What is the explanation for this length?

3) Save a summary Ethereal output to file output_8_1_summary.

8.1.1 Lab report Use the captured data to answer the questions above. Support your answers with the saved Ethereal data. Append the file output_8_1_summary to the report.

8.2 TCP and fragmentation Note that it is common to make a mistake in this lab. Please ensure that you have the correct results by showing your output to a lab assistant.

1) Start capturing packets with Ethereal on Host B. 2) Start Ethereal on Host A as well:

Host A# ethereal –ni eth0 –f “host 10.0.3.1 or icmp”&

3) Change the MTU of eth1 on Router A to 600

4) Repeat the ttcp measurement from before: Host B# ttcp –rs –p1234 Host A# ttcp –ts –l1000 –n10 –p 1234 10.0.3.1

5) When transfer is completed stop capturing packets on Host A and Host B. 6) Observe the traffic and answer the following questions.

a. Note that there are differences between these two Ethereal measurements How many packets did the Host A measure and how many packets did the

Page 16: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

16

Host B measure? Why?

b. Is the DF flag set in the datagrams? Why/why not? c. Do you observe fragmentation? If so, where does it occur? d. Study the ICMP messages recorded at Host A.

Which node is the source? What is the type and code of the messages?

7) Reset the MTU of eth1 on router A to 1500. 8) You must also update Host A to use the larger MTU again:

Host A# route del default Host A# route add default gw 10.0.1.2

9) Save the ethereal output to file output_8_2_A_summary, output_8_2_A_detail, and

output_8_2_B_summary.

8.2.1 Lab report Use the captured data to answer the questions above. Support your answers with the saved Ethereal data. Append the file output_8_2_A_summary and output_8_2_B_summary to the report. Append also the part of output_8_2_A_detail that shows one of the ICMP messages (you can edit the file in a text editor to cut out the required information).

Page 17: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

17

9 TCP data transfer In this exercise, TCP flow control and data transfers are studied. TCP consists of several heuristics to cope with different traffic cases. In particular, TCP has different behaviour for interactive applications and for bulk transfer. TCP also has different behaviour on a fast link and a slow link. Interactive application Bulk data transfer Fast link Telnet over Ethernet Ttcp over Ethernet Slow link Telnet over Serial Ttcp over Serial

Table 1 TCP data transfer classification.

The interactive application in this exercise is telnet, the bulk data is modelled by ttcp. The fast link is Ethernet; while the slow link is a SLIP serial link, see Table 1.

9.1 Interactive application – fast link 1) Establish a telnet connection from Host A to Host B on the fast link

Then login with qwerty as the root password.

2) Start capturing packets with Ethereal on Host A. 3) Type a few characters in the telnet application. The telnet client (Host A) sends each

character in a separate TCP segment to the server (Host B) which in turn echoes the character back to the client. Including echoes, we would therefore expect to see four TCP segments for each typed character.

a. How many segments can be seen? b. Describe the payload of each packet. c. Explain why you do not see four packets per typed character. d. When the client receives the echo, it waits a certain time before sending the

ACK. Why? How long is the delay? e. In the segments that carry characters, which is advertised by the telnet client

and server. Does the window vary as the connection proceeds?

4) Type many characters in the telnet applications, such as by pressing a key continuously.

a. Do you observe a difference in the transmission of segment payloads and ACKs?

5) Stop the capturing of packets. 6) Save the ethereal output to file output_9_1_summary.

9.1.1 Lab report Use the captured data to answer the questions above. Support your answers with the saved Ethereal data. Append the file output_9_1_summary to the report.

Page 18: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

18

9.2 Bulk transfer – fast link In this exercise, the behavior of TCP is examined when large amounts of data are transmitted. TCP uses the acknowledgements to limit the sending rate: flow control.

1) Start capturing packets with Ethereal on Host A. 2) Start a ttcp receiver on B and a sender on A, send 1000 packets of the length 1000

bytes for each packet.

3) Stop capturing packets.

4) Draw a tcptrace graph. Study the graph carefully.

5) Observe the sliding window protocol from the output of Ethereal. The sender transmits data up to the window size of the receiver.

a. How often does the receiver send ACKs? Can you see a rule on how TCP sends ACKs?

b. How many bytes of data does a receiver acknowledge in a typical ACK? c. How does the window size vary during the session? d. Select any ACK packet in the Ethereal trace and note its acknowledgement

number. Find the original segment in the ethereal output. How long did it take from the transmission until it was ACKed?

e. Does the TCP sender generally transmit the maximum number of bytes as allowed by the receiver?

6) Save the tcptrace graph to file output_9_2_tcptrace.jpg and save the Ethereal packet

trace to file output_9_2_summary.

9.2.1 Lab report Use the captured data to answer the questions above. Support your answers with the saved Ethereal data. Append the output_9_2_tcptrace.jpg to the report.

9.3 Interactive application – slow link

1) On router A and router B, change the routes so the traffic between the hosts will go through the slow link.

2) Establish a telnet connection from Host A to Host B on the slow link Then login with qwerty as the root password.

3) Start capturing packets with Ethereal on Host A. 4) Type a few characters in the telnet application. Vary the rate at which you type

characters. Observe the output from Ethereal. a. How many packets are transferred for each keystroke. Does this change when

you type faster? b. Do you observe delayed acknowledgements?

Page 19: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

19

c. Do you observe the effect of Nagle’s algorithm? How many characters can you see in a segment?

5) Stop capturing packets. 6) Save the Ethereal output to file output_9_3_summary.

9.3.1 Lab report Use the captured data to answer the questions above. Support your answers with the saved Ethereal data. Append the file output_9_3_summary to the report.

9.4 Bulk transfer – slow link

1) Start capturing packets with Ethereal on Host A. 2) Start a ttcp receiver on B and a sender on A, send 50 packets of the length 1000 bytes.

3) Stop capturing packets.

4) Draw a tcptrace graph. Study the graph carefully.

5) Observe the differences with the bulk data transfer on the fast link.

a. Look at the pattern of segments and ACKs, does the frequency of ACKs change compare to the bulk transfer on the fast link? How?

b. Are the window sizes advertised by the receiver different from the previous exercise?

c. Does the TCP sender generally transmit the maximum number of bytes as allowed by the receiver?

6) Save the tcptrace graph to file output_9_4_tcptrace.jpg and save the Ethereal packet trace to file output_9_4_summary.

9.4.1 Lab report Use the captured data to answer the questions above, with special emphasis on the difference with the bulk transfer on the fast link. Support your answers with the saved Ethereal data. Append the output_9_4_tcptrace.jpg to the report.

Page 20: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

20

10 TCP retransmission

10.1 TCP Retransmission exercise In this exercise, TCP retransmission is studied. TCP uses ACKs and timers to trigger retransmissions of lost segments. Continue to use the serial link between the routers, as configured in the previous exercise.

1) Start capturing packets with Ethereal on Host A. 2) Start a ttcp receiver on B and a sender on A, send 50 packets of the length 1000 bytes.

3) When at least 40 packets have been captured by Ethereal, disconnect the Ethernet

cable between Router B and Host B. Wait one minute (watch Ethereal and wait for a few packets to be transmitted) then reconnect the cable.

4) When the transfer is completed, stop capturing packets.

5) Study the list of captured packets. Draw a tcptrace graph.

a. Observe when retransmissions take place (during the disconnection of the Ethernet cable). How many packets are transmitted at retransmission timeout?

b. Does the retransmissions end at some point?

6) Save a summary Ethereal output to file output_10_1_summary. 7) Save the tcptrace graph to file output_10_1_tcptrace.jpg.

10.1.1 Lab report Use the captured data to answer the questions above. Support your answers with the saved Ethereal data. Append the Ethereal data (output_10_1_summary) and the tcptrace graph (output_10_1_tcptrace.jpg).

Page 21: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

21

11 TCP congestion control In this exercise, the behaviour of TCP congestion control is examined. TCP congestion control operates in two phases, called slow start and congestion avoidance.

11.1 TCP congestion control exercise Congestion is simulated by disconnecting the Ethernet cable between the routers.

1) Configure the routes so the traffic from Host A to Host B goes through the fast link and the traffic from Host B to Host A goes through the slow link.

2) Start capturing packets with Ethereal on Host A.

3) Start a ttcp receiver on Host B and a sender on Host A, send 1000 packets of the

length 1000 bytes.

4) When at least 200 packets have captured by Ethereal, disconnect the Ethernet cable between the routers. Wait a couple of seconds, and then reconnect the cable and wait until the transmission resumes. Repeat this for a few times, varying the durations when the cable is disconnected. Hopefully, this will cause Host B to send duplicate ACKs (3 in a row or more). If that is the case, TCP Fast Retransmit and Fast Recovery will come into play.

5) Draw a tcptrace graph in ethereal. Study the graph at the time instants when the cable

is reconnected and the TCP sender resumes transmission. a. Try to observe periods when TCP sender is in slow start phase and when the

sender switches to congestion control. Verify if the congestion window follows the rule of the slow-start phase.

b. Can you find occurrences of fast recovery?

6) Save a summary Ethereal output to file output_11_1_summary. 7) Save the tcptrace graph to file output_11_1_tcptrace.jpg.

8) Configure the routes so the traffic from Host B to Host A goes through the fast link

again.

11.1.1 Lab report Answer the questions in step 5 above. Include ethereal data and the tcptrace graph to support your answer. Annotate the events in the tcptrace graph, and explain the events that you observe.

Page 22: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

22

12 Completing the lab In the lab, some of the Ethereal output has been saved on Host A and some on Host B. This material needs to be transferred so that you can complete the lab report.

1. Collect the output into one common archive. One way to do this is to copy all files over to Host A, and then build an archive. Host A# scp 10.0.3.1:/home/2g1305_lab1/* . Host A# tar czf lab1.tgz *

2. Erase the files from the routers and power it down.

Router A# rm –rf /home/2g1305_lab1 Router B# rm –rf /home/2g1305_lab1 Router A# halt -p Router B# halt -p

3. Transfer this archive to your personal mailbox, or computer by connecting to the

Internet. You may use the wireless interface eth1 and the KTHOPEN. Run DHCP client:

Host A# dhclient eth1

4. Open the browser and login using your KTH account. Transfer the archive to a remote Internet site by using ftp, scp, mozilla, or some other tool.

5. Erase the files from the hosts.

Host # rm –rf /home/2g1305_lab1

6. Power down the nodes Host # halt -p

7. Wait a couple of minutes and then press the power button manually on the laptop. 8. Disconnect the cables and ensure the equipment is in the same state (or better) as when

you started.

Page 23: 2G1305/2E1605 Internetworking - KTH · Appendix A gives an outline of the lab report. The output from Ethereal is saved on the two laptops, in the /home/2g1305_lab1/ directory. After

Transport protocol lab, Internetworking, 2G1305/2E1605, Period 1, 2005, rev 1

23

Appendix A: Example lab report outline

2G1305/2E1605 Internetworking

Laboration 2: Transport Protocols: TCP and UDP

Preparation Questions Measurements o Measuring with ttcp and ethereal

o UDP measurements o TCP measurements

o TCP connections o Connection establishment and termination o Connecting to a non-existent port o Connecting to a non-existing host

o Fragmentation o UDP and fragmentation o TCP and fragmentation

o TCP data transfer o Interactive application – fast link o Bulk transfer – fast link o Interactive application – slow link o Bulk transfer – slow link

o TCP retransmission o TCP Retransmission exercise

o TCP congestion control o TCP congestion control exercise

o Appendix: Ethereal output (Please just include interesting parts from the files) o output_6_1_summary o output_6_2_summary o output_7_1_summary o output_7_2_summary o output_7_3_summary o output_8_1_summary o output_8_2_A_summary o output_8_2_B_summary o output_8_2_A_detail (subset) o output_9_1_summary o output_9_2_tcptrace.jpg o output_9_3_summary o output_9_4_tcptrace.jpg o output_10_1_summary o output_10_1_tcptrace.jpg o output_11_1_summary o output_11_1_tcptrace.jpg