G22.2262: Data Communications and Network Design

Homework 2.

 

Due Date: Thursday, November 29

 

Part 1.

 

Please read Chapter 5 in the textbook.  Then please answer and the following questions at the end of the chapter:

 

5.2, 5.3, 5.6, 5.7, 5.9, 5.10, 5.11

 

Part 2.

 

The ARP implementation is very straightforward. The ARP code can be called from the IP layer or from the Ethernet layer. For this part, you must write a program that implements ARP!

 

You will assume you have an IP address of 201.19.107.72 and Ethernet address of 08:00:20:98:F7:35.

Your program should take a single parameter, and that parameter is the name of a file. The file contains lines of the following form:

 

IP:IP_Address:Broadcast_flag:Data

Or
                                    Ether:Data

 

Each line represents data passed down to ARP from IP or up to ARP from Ethernet. After reading each line of the file, you must show the ARP table and any packets that ARP tells Ethernet to send. You must assume that every line arrives 15 seconds apart, and you must delete entries from the ARP table if they have not been accessed IP in 20 minutes.

 

For example, the file can contain the following lines:

 

IP:201.19.107.8:0:IPdatagram1
IP:201.19.107.15:0:IPdatagram2
Ether:0001 0800 06 04 0002 08 00 20 11 F1 A6 201.19.107.8 08 00 20 98 F7 35 201.19.107.72
IP:201.19.107.255:1:IPdatagram3
IP:201.19.107.15:0:IPdatagram4
IP:201.19.107.15:0:IPdatagram2
Ether:0001 0800 06 04 0002 08 00 20 15 19 87 201.19.107.15 08 00 20 98 F7 35 201.19.107.72
IP:201.19.107.8:0:IPdatagram1
IP:201.19.107.8:0:IPdatagram5
Ether:0001 0800 06 04 0001 08 00 20 61 73 A4 201.19.107.18 00 00 00 00 00 00 201.19.107.72
Ether:0001 0800 06 04 0001 08 00 20 F7 C3 4F 201.19.107.19 00 00 00 00 00 00 201.19.107.32
IP:201.19.107.19:0:IPdatagram6
Ether:0001 0800 06 04 0001 08 00 20 F7 C3 4F 201.19.107.19 00 00 00 00 00 00 201.19.107.32
Ether:0001 0800 06 04 0002 08 00 20 F7 C3 4F 201.19.107.19 08 00 20 98 F7 35 201.19.107.72

 

Your program should be invoked as follows:

 

$ myarp filename

 

Your program should print the following output:

 

Arp Table:

201.19.107.8 0

Tell Ethernet to send:

FF FF FF FF FF FF 08 00 20 98 F7 35 0806

0001 0800 06 04 0001 08 00 20 98 F7 35 201.19.107.72 00 00 00 00 00 00 201.19.107.8

 

Arp Table:

201.19.107.8 0

201.19.107.15 0

Tell Ethernet to send:

FF FF FF FF FF FF 08 00 20 98 F7 35 0806

0001 0800 06 04 0001 08 00 20 98 F7 35 201.19.107.72 00 00 00 00 00 00 201.19.107.15

 

Arp Table:

201.19.107.8 08 00 20 11 F1 A6

201.19.107.15 0

Tell Ethernet to send:

08 00 20 11 F1 A6 08 00 20 98 F7 35 0800

IPdatagram1

 

Arp Table:

201.19.107.8 08 00 20 11 F1 A6

201.19.107.15 0

Tell Ethernet to send:

FF FF FF FF FF FF 08 00 20 98 F7 35 0800

IPdatagram3

 

Arp Table:

201.19.107.8 08 00 20 11 F1 A6

201.19.107.15 0

Tell Ethernet to send:

Nothing

 

Arp Table:

201.19.107.8 08 00 20 11 F1 A6

201.19.107.15 0

Tell Ethernet to send:

FF FF FF FF FF FF 08 00 20 98 F7 35 0806

0001 0800 06 04 0001 08 00 20 98 F7 35 201.19.107.72 00 00 00 00 00 00 201.19.107.15

 

Arp Table:

201.19.107.8 08 00 20 11 F1 A6

201.19.107.15 08 00 20 15 19 87

Tell Ethernet to send:

08 00 20 15 19 87 08 00 20 98 F7 35 0800

IPdatagram2

08 00 20 15 19 87 08 00 20 98 F7 35 0800

IPdatagram4

 

Arp Table:

201.19.107.8 08 00 20 11 F1 A6

201.19.107.15 08 00 20 15 19 87

Tell Ethernet to send:

08 00 20 11 F1 A6 08 00 20 98 F7 35 0800

IPdatagram1

 

Arp Table:

201.19.107.8 08 00 20 11 F1 A6

201.19.107.15 08 00 20 15 19 87

Tell Ethernet to send:

08 00 20 11 F1 A6 08 00 20 98 F7 35 0800

IPdatagram5

 

Arp Table:

201.19.107.8 08 00 20 11 F1 A6

201.19.107.15 08 00 20 15 19 87

201.19.107.18 08 00 20 61 73 A4

Tell Ethernet to send:

08 00 20 61 73 A4 08 00 20 98 F7 35 0806

0001 0800 06 04 0002 08 00 20 98 F7 35 201.19.107.72 08 00 20 61 73 A4 201.19.107.18

 

Arp Table:

201.19.107.8 08 00 20 11 F1 A6

201.19.107.15 08 00 20 15 19 87

201.19.107.18 08 00 20 61 73 A4

Tell Ethernet to send:

Nothing

 

 

 

 

Arp Table:

201.19.107.8 08 00 20 11 F1 A6

201.19.107.15 08 00 20 15 19 87

201.19.107.18 08 00 20 61 73 A4

201.19.107.19 0

Tell Ethernet to send:

FF FF FF FF FF FF 08 00 20 98 F7 35 0806

0001 0800 06 04 0001 08 00 20 98 F7 35 201.19.107.72 00 00 00 00 00 00 201.19.107.19

 

Arp Table:

201.19.107.8 08 00 20 11 F1 A6

201.19.107.15 08 00 20 15 19 87

201.19.107.18 08 00 20 61 73 A4

201.19.107.19 08 00 20 F7 C3 4F

Tell Ethernet to send:

08 00 20 F7 C3 4F 08 00 20 98 F7 35 0800

IPdatagram6

 

Arp Table:

201.19.107.8 08 00 20 11 F1 A6

201.19.107.15 08 00 20 15 19 87

201.19.107.18 08 00 20 61 73 A4

201.19.107.19 08 00 20 F7 C3 4F

Tell Ethernet to send:

Nothing

 

 

 

Here are some notes:

 

 

Students with last names starting with A through H should e-mail their homework to Aristotle Tsirigos tsirigos@cs.nyu.edu

Students with last names starting with I through N should e-mail their homework to Vikram Sharma sharma@cs.nyu.edu

Students with last names starting with O through T should e-mail their homework to Lenny Satya  ls548@nyu.edu

Students with last names starting with U through Z should e-mail their homework to Yongchun Zhao  yz266@nyu.com