0% found this document useful (0 votes)
39 views3 pages

NTAssignment 2

This document provides instructions for completing 3 tasks that involve using the networking tool Netcat to experiment with TCP and UDP connections. Task 1 explains how to use Netcat to establish a TCP connection between 2 nodes to enable chat functionality, and how to transfer a file between nodes. Task 2 builds on this by having the student capture a file transfer using Wireshark, transfer the file over both TCP and UDP, and observe the effects of packet loss on transfer times. Task 3 instructs the student to analyze a TCP connection trace in Wireshark's flow graph display in order to understand the TCP handshake process and sequence/acknowledgment numbers.

Uploaded by

Dorinel33
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views3 pages

NTAssignment 2

This document provides instructions for completing 3 tasks that involve using the networking tool Netcat to experiment with TCP and UDP connections. Task 1 explains how to use Netcat to establish a TCP connection between 2 nodes to enable chat functionality, and how to transfer a file between nodes. Task 2 builds on this by having the student capture a file transfer using Wireshark, transfer the file over both TCP and UDP, and observe the effects of packet loss on transfer times. Task 3 instructs the student to analyze a TCP connection trace in Wireshark's flow graph display in order to understand the TCP handshake process and sequence/acknowledgment numbers.

Uploaded by

Dorinel33
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

NT Assignment 2

TCP/UDP

Task 1: TCP in Netcat


To do this assignment we will use Netcat tool which is provided in Kathara.
Netcat makes it possible to create and use TCP/UDP connections. If you want
more info about Netcat you can consult Internet.

To make this assignment you should be able to communicate between two


interconnected Kathara nodes.

Let’s start a chat session by connecting 2 Kathara nodes via a TCP connection, e.g.
Laptop and Router1.

To listen to the TCP connections, go to one of your simulated nodes (e.g. Router1)
and issue the following command:

nc –l –p <port_nr>

This will make Netcat listen to port number that you have specified in port_nr
and accept connections.
Note: Any port number should be ok, as long as it is not used by another
application.

To establish a TCP connection you can issue the following command from
another simulated node (e.g. Laptop)

 nc <IP address of the “listening” node> <port_nr of the “listening


node”>

This will make a TCP connection with the listening Netcat instance.
Now you can chat from one Netcat instance to the another. Try it out!

Netcat can also be used to copy the contents of a file from one place (file, folder,
computer) to another. Your version of netcat does it in this way:

1. server : nc –l –p <port_nr> < file1


2. client : nc <ip_address_of_server> <port_nr of server> > file2

Try it with some file. You can put a file to the home directory of your guest Linux
machine and then you can access it from a Kathara node by going to /hosthome
directory.
Task 2: TCP/UDP Experiments
In the previous task you’ve learned how to send a file with Netcat.
You’re going to use this knowledge to do a few TCP/UDP experiments.

1. Send fi le with TCP and UDP

Take provided file alice.txt and send it through Netcat. To do this, you should
reuse knowledge from the first task.

Now we’d like to see the TCP communication in Wireshark. To do that, we’ll use
tcpdump command which will write all packets received on a network interface
(default is network interface eth0) to a file. A file should have extension .pcap.

A command like this should achieve it:

tcpdump –w <filename>.pcap -s 0 &

as it was already explained in assignment 1.

Linux tip: The above mentioned command will run in background (as you use &).
You can see all tasks running in background by issuing command : jobs. Each jobs
has its number. You can put a job back to foreground like it was explained in
assignment 1 (fg %<nr_of_job>.

Provide a screenshot of the Wireshark showing your captured file when you did
Netcat file transfer with TCP.

How long did it take to transfer the file? How can you read this time from the
Wireshark file?

Find out how to use Netcat with UDP. Try it out. Repeat the above mentioned
experiment with UDP.

Provide a screenshot of the Wireshark showing your captured file when you did
Netcat file transfer with UDP.

How long did it take to transfer the file? How can you read this time from the
Wireshark file?

Was the transfer successful? If not, what do you think was the reason?
2. Send fi le on TCP/UDP on a lossy link

Repeat subtask 1 but now on a faulty link. To simulate a faulty link you can use
netem tool.

Issue the following command on the sending site.

tc qdisc add dev eth0 root netem loss 10%

This command simulates 10% packet loss on an eth0 link.

To test whether your command successfully created 10% packet loss on the link,
you can run a ping to an existing address for some time and look at the result.

After creation of 10% loss probability on your link repeat the experiment from
subtask 1 again.

Answer the following questions:


1. How long did the transfer take with TCP? Provide a screenshot from
Wireshark where you can see it.
2. How long did the transfer take with UDP? Provide a screenshot from
Wireshark where you can see it.
3. Were both transfers successful?
4. What can you tell about the differences with subtask 1?

Task 3: Flow Graph


Take any TCP wireshark trace, e.g. one used in the previous task. Go to
Wireshark and select ‘Statistics > Flow Graph’ and then choose flowtype ‘TCP
flow’ to draw a Sequence Diagram of the TCP message interaction that you see in
Wireshark.

Provide a screenshot of this Flow Graph.

Explain what is happening during various stages (begin, middle, end) of the
communication. Explain SYN, SYNACK and ACK. Explain the Len, Seq and Ack
numbers.

You might also like