NTAssignment 2
NTAssignment 2
TCP/UDP
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)
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:
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.
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.
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.
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.
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.