Lab 6 - Transport layer I#
The aim of this lab is to study the differences between UDP and TCP transport
protocols, both in terms of performance and reliability. For this purpose, the
nc tool will be used to transfer some files, as well as the Wireshark tool
to make the corresponding captures.
More specifically, during this session you are going to send several files
between two processes on your computer usiing the loopback (lo) interface.
Text and sound files will be handled in this lab, using TCP and UDP transport
protocols.
Assessment#
This session will be graded (1/6 of the lab grade), so you must complete the corresponding questionnaire in Campus Virtual, answering the questions. The questions will be available during the session and must be submitted before it ends. Each wrong answer will be penalized with 1/3 of the assigned value.
Setup#
The network connection must be correctly configured to carried out the lab:
Aspects already seen in previous labs are assumed to be known, for example, the command to know the own IP and the usage of Wireshark or Tshark.
Prepare your working directory:
Create the
p6directory in/home/alumno. Assuming your current directory is/home/alumno, the command would be:mkdir p6If it already exists, remove it and create it again:
rm -rf p6 mkdir p6
Go to this directory and do the tasks from there:
cd p6Check that you are in the correct directory with:
pwdIt should show:
/home/alumno/p6
Create a directory to run the clients from there and another one for the servers:
mkdir client serverHave two different terminals ready: go to the client directory in one of them and to the server directory in the other:
cd ~/p6/client pwd
cd ~/p6/server pwd
UDP#
A text file will be transmitted between 2 programs on the same computer, using the local network interface or loopback, to analyze the operation of the UDP protocol. You will run the client and the server simultaneously, and you will capture the UDP packets with the tool of your choice: Wireshark or Tshark.
udp-uuid.pcapng#
First, prepare the file to be sent from the client to the server. This file must contain a “Universally Unique IDentifier” (UUID). This type of identifier is composed of 32 hexadecimal characters grouped in 5 groups of different sizes, using the hyphen as a separator. To generate it, run the following on the client terminal:
cat /proc/sys/kernel/random/uuid > uuid.txtThe file must have a size of 37 bytes (36 bytes of the UUID and the newline character). You can check it with:
$ ls -l uuid.txt -rw-rw-r--. 1 alumno alumno 37 Mar 20 16:58 uuid.txt
Run the capture with
Wireshark. If you wish, save it asudp-uuid.pcapngfor its later analysis.Note
You can specify to listen only in the “lo” interface (loopback) and use a “udp” capture filter, so that only the traffic that travels using UDP as transport protocol is captured.
In the server terminal, run the following command:
nc -l -u -p 8888 > received-uuid.txtTe data received by
ncwill be redirected to thereceived-uuid.txtfile.In the client terminal, run the following command:
nc -q 2 -u 127.0.0.1 8888 < uuid.txtIn this exercise we use
127.0.0.1, which is the IP address assigned to the local interface or loopback. That way we will communicate with another process inside our machine through the network protocol stack.End the server execution by pressing Ctrl c in the corresponding window.
Stop the capture. Check that the transmission appears on it.
Answer the questions related to this capture.
udp-quijote.pcapng#
In this exercise we are going to use the following capture: download the capture udp-quijote.pcapng. In it, the client sends the text file
quijote.txtvia the local interface or loopback, using the UDP transport protocol.Open the capture with
wireshark.Answer the questions related to this capture.
TCP#
Now, we are going to do the equivalent work of the previous section, but this time using TCP as transport protocol and using a text file and sound file instead of text files.
tcp-quijote.pcapng#
For this exercise we are going to use the following capture: Download the capture tcp-quijote.pcapng. The trasmission of the previous exercise is replicated on it, but using TCP transport protocol.
Open the capture with
wireshark.Answer the questions related to this capture.
tcp-mp3.pcapng#
Dowload the MP3 audio in the client directory. The file must be called
p6audio.mp3:wget https://uclm-esi.github.io/redes1-lab/assets/p6audio.mp3Run the capture with
Wireshark. If you wish, save it astcp-mp3.pcapngfor its later analysis.Note
You can specify to listen only in the “lo” interface (loopback) and use a “tcp” capture filter, so that only the traffic that travels using TCP as transport protocol is captured.
In the server terminal, run the following command:
nc -l -p 8888 > audio_tcp_received.mp3In the client terminal, run the following command:
nc -q 2 127.0.0.1 8888 < p6audio.mp3In this exercise, we use
127.0.0.1again to use the local interface or loopback.Stop the capture. Check that both the packets sent by the client and those sent by the server appear in the capture.
Note
Look at the source and destinaton ports to know wich packets belong to each process.
Answer the questions related to this capture using as a display filter
tcp.port == 8888.
Cleanup#
Finally, remove the created directory /home/alumno/p6 with:
rm -rf /home/alumno/p6