Final project for VE489 SU2020
Ubuntu Linux system, Mininet (see project description for details)
For convenience, in the following parts, I actually share the finalproject folder between my windows host and guest Linux OS in VirtualBox.
The examples given in the following steps assume the server runs at 10.0.0.1:8001 (h1:8001), and client runs at 10.0.0.2:8002 (h2:8002).
-
Compile using
Makefile, so thatftransis generated -
Launch the Mininet network topology
p1_topo.pysudo python p1_topo.py
-
Open two terminals for server and client, respectively
For example,
xterm h1 h2
-
Run the server in the current directory
./ftrans -s -p <port>
For example,
./ftrans -s -p 8001
-
Create a new directory for client and copy
ftransinto itFor example,
mkdir client
-
(Optional; For writing the report)
Capture the packets sent and received on client with
tcpdumpand dumping the output into a.pcapfiletcpdump tcp port 8002 -s 65535 -w <filename>.pcap
Then open the generated
.pcapfile in Wireshark -
Run the client in the
client/directory./ftrans -c -h <server's IP/hostname> -sp <server port> -f <filename> -cp <client port>
For example,
./ftrans -c -h 10.0.0.1 -sp 8001 -f 10MB.txt -cp 8002 ./ftrans -c -h 10.0.0.1 -sp 8001 -f file3.jpg -cp 8002
-
Check the difference between delivered and original files. They are expected to be the same.
For example,
diff 10MB.txt client/10MB.txt
In this project, test files with different sizes are needed. For instance, the following command could generate a test txt file whose size is about 1000KB.
cat /dev/urandom | sed 's/[^a-zA-Z0-9]//g'| strings -n 5 | head -n 160000 > 1000KB.txtTo know the exact file size, windows users may just check the file properties, or use
wc -c <filename>in Linux to see how many bytes the filename contains.
The 3 subparts in this part share the same format for running. Examples here assume the sender runs at 10.0.0.1:8001 (h1:8001), receiver runs at 10.0.0.2:8002 (h2:8002), and a man-in-the-middle proxy runs at 10.0.0.3:8003 (h3:8003). More details could be found in the project description.
-
Compile using
Makefile, so thatsrandmitmare generated -
Launch the Mininet network topology
normal_topo.pysudo python normal_topo.py
-
Open three terminals for server, client and the man-in-the-middle proxy, respectively
xterm h1 h2 h3
-
Run the man-in-middle proxy
./mitm <shuffle> <loss> <error> <receiver's ip> <receiver's port> <sender's ip> <sender's port>
For example, to simulate the case of reordering, 5% loss, 5% error
./mitm 1 5 5 10.0.0.2 8002 10.0.0.1 8001
-
Create a new directory for receiver and copy
srinto itFor example,
mkdir recv
Change directory to
recv/, and create a new directory for the output delivered filesFor example,
mkdir recv_dir
-
Run the receiver in the
recv/directory./sr -r <port> <window size> <recv dir> <log file>
For example,
./sr -r 8002 10 recv_dir/ recv.log
-
Run the sender in the original directory
./sr -s <receiver's IP> <receiver's port> <sender's port> <window size> <file to send> <log file>
For example,
./sr -s 10.0.0.3 8003 8001 10 10MB.txt send.log
In this case, sender actually transmit files to
mitm, andmitmrelay packets between sender and receiver.In addition, to measure the time on the sender side, use
time ./sr -s 10.0.0.2 8002 8001 10 file3.jpg send.logand find the
realtime printed on the terminal. -
Check the difference between delivered and original files. They are expected to be the same.
For example,
diff 10MB.txt recv/recv_dir/file_0.txt diff file3.jpg recv/recv_dir/file_1.txt
Additionally, view the
send.logandrecv.logfile to see the header information for checking the correctness.
.
├── README.md
├── part2
│ ├── 100B.txt
│ ├── 100KB.txt
│ ├── 10MB.txt // test files
│ ├── Makefile
│ ├── dump.pcap // output file for tcpdump
│ ├── file3.jpg // test file
│ ├── ftrans.cc // implemention of the TCP file transfer server
│ └── p1_topo.py // Mininet network topology used in this part
├── part3
│ ├── part3-1
│ │ ├── 1000KB.txt
│ │ ├── 100KB.txt
│ │ ├── 10MB.txt // test files
│ │ ├── Makefile
│ │ ├── SRHeader.h // definition of SRHeader used in sr.c
│ │ ├── crc32.h // crc32 function used in sr.c
│ │ ├── file3.jpg // test file
│ │ ├── lossy_topo.py
│ │ ├── mitm.c // man-in-the-middle (MITM) written by TA
│ │ ├── normal_topo.py // Mininet network topology used in this part
│ │ └── sr.c // implementation of the simple SR
│ ├── part3-2
│ │ ├── 1000KB.txt
│ │ ├── 100KB.txt
│ │ ├── 10MB.txt
│ │ ├── Makefile
│ │ ├── SRHeader.h
│ │ ├── crc32.h
│ │ ├── file3.jpg
│ │ ├── lossy_topo.py
│ │ ├── mitm.c
│ │ ├── normal_topo.py
│ │ └── sr.c
│ └── part3-3
│ ├── 1000KB.txt
│ ├── 100KB.txt
│ ├── 10MB.txt
│ ├── Makefile
│ ├── SRHeader.h
│ ├── crc32.h
│ ├── file3.jpg
│ ├── lossy_topo.py
│ ├── mitm.c
│ ├── normal_topo.py
│ └── sr.c
├── report.pdf // report
└── ve489_project.pdf // project description