33
A brief tutorial for coursework UG3 Computer Communications & Networks (COMN) Myungjin Lee [email protected]

A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

A brief tutorial for coursework

UG3 Computer Communications & Networks(COMN)

Myungjin [email protected]

Page 2: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Coursework Overview

• Goal– Implementation and evaluation of three end-to-end

reliable data transfer protocols– Stop-and-Wait, Go-back-N, and Selective Repeat

• Assessment: 40% of course mark– Part 1 (30%)

• Part 1a (10%): rdt1.0• Part 1b (20%): rdt 3.0 (Stop-and-Wait)

– Part 2 (70%)• Part 2a (30%): Go-back-N• Part 2b (40%): Selective Repeat + iperf experiment

2

Page 3: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Virtual Machine (VM) Setup

• Need Oracle’s VirtualBox virtualization software

• VirtualBox exists by default on all DICE machines• List of DICE machines can be found at

• The VM image for the assignment– Can be accessed on DICE machines– Has dummynet link emulator and other relevant software

3

https://piazza.com/class/j7a9hnwbwr626j?cid=16

Page 4: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Creating VM

1. Log into a DICE machine2. Open a terminal3. Create a directory (e.g., comn-cwk) and ‘cd’ into it

4

mkdir comn-cwk

cd comn-cwk

Page 5: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

5

Page 6: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Creating VM

1. Log into a DICE machine2. Open a terminal3. Create a directory (e.g., comn-cwk) and ‘cd’ into it

4. Issue the following command:

6

mkdir comn-cwk

cd comn-cwk

/disk/scratch/dummynet/createdummynetvm

Page 7: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

7

Page 8: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

8

Page 9: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

9

Page 10: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

10

Page 11: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Creating and Starting VM

1. Log into a DICE machine2. Open a terminal3. Create a directory (e.g., comn-cwk) and ‘cd’ into it

4. Issue the following command:

5. Run the following command:

11

mkdir comn-cwk

cd comn-cwk

/disk/scratch/dummynet/createdummynetvm

./startvm.sh

Page 12: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

12

vmuserpw

Page 13: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

13

terminal

Page 14: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

14

Page 15: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

How to shut down VM

• Become a root using ‘su’– Root password: vmrootpw

• Run the following command:

15

su

shutdown –h now

Page 16: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Shared Folder

• When the VM is set up for you, a directory called "dummynetshared" gets created in your assignment directory

• You can mount this in the VM by (as root):

16

mount -t vboxsf dummynetshared /mnt/shared

Page 17: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Running VM on Your Computer

1. VirtualBox should be installed on your local machine

2. Download ‘comnvm.tar.gz’ from one of two places– /disk/scratch/dummynet/ on DICE machine– https://goo.gl/gcwQAT

3. Uncompress the file

17

Page 18: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Running VM on Your Computer

4. In the folder, open a terminal and run the following command:– For linux and Mac OS

– For MS Windows

• Make sure that your implementations run correctly on VM in DICE machine

• For more details, refer to README

18

./configvm.sh

./configvm.bat

Page 19: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Before Running configvm.sh (or .bat)

19

Page 20: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

After Running configvm.sh (or .bat)

20

Page 21: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Conceptual Structure

21

Dummynet emulated linkSender Receiver

Virtual Machine

- Dummynet- Creates emulated network link(s)- Configuration of link characteristics (BW, delay, loss)- Command-line program: ipfw

Page 22: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Conceptual Structure

22

- Sender- Reads a file and breaks it into a number of packets- Sends the packets to a receiver over a simulated

network link- Receiver

- Receives the packets; extracts data in the packets; and saves the data in a file

Dummynet virtual linkSender Receiver

Virtual MachineUnidirectional communication

Page 23: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Conceptual Structure

23

- Sender and Receiver- Support reliable data transfer protocol at the application

layer using UDP

Dummynet virtual linkSender Receiver

Virtual MachineUnidirectional communication

Page 24: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Dummynet Configuration Example

24

% ipfw add pipe 100 in% ipfw add pipe 200 out% ipfw pipe 100 config delay 1ms bw 10Mbits/s% ipfw pipe 200 config delay 5ms plr 0.005 bw 1Mbits/s

Pipe 100

Virtual MachineUnidirectional communication

Pipe 200Sender Receiver

1Mbps, 5ms, 0.5% loss

10Mbps, 1ms delay

Page 25: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Effect of Dummynet

25

User level

Sender Receiver

Kernel level

Network Interface Device Driver

% ipfw add pipe 100 in% ipfw add pipe 200 out% ipfw pipe 100 config delay 5ms% ipfw pipe 200 config delay 5ms

Pipe

200

Pipe

100

When processes within the same host (or virtual machine) communicate with each other

Page 26: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Miscellaneous

• Binary programs for the assignment are available at

– First read README file– Sender1b, Receiver1b, Sender2a, Receiver2a, Sender2b

and Receiver2b– Use these binary programs ONLY FOR debugging your

implementations– Using them for other purposes is completely prohibited

26

https://drive.google.com/drive/folders/0B6rUEJFM3QjTdkkxT21XclNtcUU?usp=sharing

Page 27: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Miscellaneous

• Some essential Java packages for the assignment– java.io.File– java.io.FileInputStream– java.io.FileOutputStream– java.net.DatagramPacket– java.net.DatagramSocket– java.net.InetAddress

• FAQs on the assignment available at

27

https://piazza.com/class/j7a9hnwbwr626j?cid=19

Page 28: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Header format

• The following formats should be used for both parts– Exception: no ACK packets for part1a

28

Offset Octet 0 1 2 3 ~ up to 1026

16-bit sequence number

8-bit EoF flag

Data

Data packet (sender à receiver)

ACK packet (receiver à sender)Offset Octet 0 1

16-bit sequence number

Page 29: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Example scenario for Part 1b

29

Dummynet emulated linkSender Receiver

Seq no. (=0) EoF Data (1024bytes)

Seq no. (= 0)

Page 30: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Example scenario for Part 1b

30

Dummynet emulated linkSender Receiver

Seq no. (=1) EoF Data (1024bytes)

Seq no. (= 1)

Page 31: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Example scenario for Part 1b

31

Dummynet emulated linkSender Receiver

Seq no. (=0) EoF Data (1024bytes)

Seq no. (= 0)XDiscard duplicate

Page 32: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Example scenario for Part 1b

32

Dummynet emulated linkSender Receiver

Seq no. (=0) EoF (=1) Data (< 1024bytes)

Seq no. (= 0)

Terminate receiverTerminate sender

Page 33: A brief tutorial for coursework€¦ · –Implementation and evaluation of three end-to-end reliable data transfer protocols –Stop-and-Wait, Go-back-N, ... 16-bit sequence number

Q&A

33