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:

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

  2. Prepare your working directory:

    • Create the p6 directory in /home/alumno. Assuming your current directory is /home/alumno, the command would be:

      mkdir p6
      
    • If 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 p6
      
    • Check that you are in the correct directory with:

      pwd
      

      It should show:

      /home/alumno/p6
      
  3. Create a directory to run the clients from there and another one for the servers:

    mkdir client server
    
  4. Have 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#

  1. 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.txt
    

    The 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
    
  2. Run the capture with Wireshark. If you wish, save it as udp-uuid.pcapng for 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.

  3. In the server terminal, run the following command:

    nc -l -u -p 8888 > received-uuid.txt
    

    Te data received by nc will be redirected to the received-uuid.txt file.

  4. In the client terminal, run the following command:

    nc -q 2 -u 127.0.0.1 8888 < uuid.txt
    

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

  5. End the server execution by pressing Ctrl c in the corresponding window.

  6. Stop the capture. Check that the transmission appears on it.

  7. Answer the questions related to this capture.

udp-quijote.pcapng#

  1. 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.txt via the local interface or loopback, using the UDP transport protocol.

  2. Open the capture with wireshark.

  3. 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#

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

  2. Open the capture with wireshark.

  3. Answer the questions related to this capture.

tcp-mp3.pcapng#

  1. 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.mp3
    
  2. Run the capture with Wireshark. If you wish, save it as tcp-mp3.pcapng for 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.

  3. In the server terminal, run the following command:

    nc -l -p 8888 > audio_tcp_received.mp3
    
  4. In the client terminal, run the following command:

    nc -q 2 127.0.0.1 8888 < p6audio.mp3
    

    In this exercise, we use 127.0.0.1 again to use the local interface or loopback.

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

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