Assignment 3: Returned

I have emailed your Assignment 3 scripts back to you to your NUS email account.

Due to a bug in the process, however, a small number of scripts are scanned twice, and so some of you received two emails. Sorry about this.

More seriously, a small number of you did not have your scripts scanned initially. I have tried to check through everyone and rescan/email back those that I missed the first round.

If by now you still have not received your Assignment 3 by email, please let me know.

Assignment 3: Common Mistakes

Hi, These are the common mistake for assignment 3:

Q1-a) Do not explaining about the MAC address. For example, some student wrote “To obtain the IP address”.

Q1-c) Some students just wrote that they could not find the response to packet 9 but did not explain why.

Q2-b) Some students wrote that since the DHCP servers and capturing host have IP addresses with different prefix, they should be in two different subnets. However, we need to have the subnet mask to be able to jugde. The good news is that we did not deduct the mark for those without mentioning msubnet mask.

Q3-b) There were a confussion for this part with iterative and recursive queries in DNS. However, the question was about the reason that a client contacts three different DNS servers instead of one.

Q3-c) There were students which wrote the TTL of IP layer.

Q4-b) The man in the middle attack was mentioned by some student as the vulnerability of self-signed certificate. However, since the self-signed certificate is from a root CA, it is trustable.

Assignment 3: Solutions

Q1:

a. To obtain the mac address of 172.26.190.1.

b. The host with IP address of 172.26.191.183 and MAC address of d4:be:d9:9d:97:e8. Each of them is fine.

c. No. Because 172.26.190.1 directly responds within a standard frame to the 172.26.191.183 not in the broadcast manner.

d. To query for the mac address of the IP 172.26.190.1.

e. 127. The Mac address of IP 172.26.190.1 which is 00:00:0c:07:ac:02.

f. The packet is a Gratuitous ARP message which is useful for the purposes below:

  • detect IP conflicts. When a machine receives an ARP request containing a source IP that matches its own, then it knows there is an IP conflict.
  • assist in the updating of other machines’ ARP tables.  Clustering solutions utilize this when they move an IP from one NIC to another, or from one machine to another. Other machines maintain an ARP table that contains the MAC associated with an IP. When the cluster needs to move the IP to a different NIC, be it on the same machine or a different one, it reconfigures the NICs appropriately then broadcasts a gratuitous ARP reply to inform the neighboring machines about the change in MAC for the IP. Machines receiving the ARP packet then update their ARP tables with the new MAC.
  • inform switches of the MAC address of the machine on a given switch port, so that the switch knows that it should transmit packets sent to that MAC address on that switch port.
  • Every time an IP interface or link goes up, the driver for that interface will typically send a gratuitous ARP to preload the ARP tables of all other local hosts. Thus, a gratuitous ARP will tell us that that host just has had a link up event, such as a link bounce, a machine just being rebooted or the user/sysadmin on that host just configuring the interface up. If we see multiple gratuitous ARPs from the same host frequently, it can be an indication of bad Ethernet hardware/cabling resulting in frequent link bounces.

Mentioning the Gratuitous ARP message and one of the above purpose is fine.

g. d4:be:d9:9d:b4:ba. This can be acheived from sender MAC address of any packet which has the source IP address of capturing host (172.26.191.153).

Q2:

a. 137.132.83.7 and 137.132.83.6

b. No. By finding the DHCP ack packets, we can find 137.132.83.7 and 137.132.83.6 as the source IP address. By finding the subnet mask for  172.26.191.153 which is 255.255.254.0, we can find that they are not in the same subnet.

c. Two. We can obtain this by list all the DHCP Discover messages and then count the number of different mac address.

d. Because the capturing host wants to keep its previous IP address if it is possible.

Q3:

a. 137.132.87.2, 137.132.85.2 and 137.132.94.2

b. The client may contacts several DNS server in parallel to save the time in the case of failure of one or when an address may not be cached in one DNS
server but may be cached in another.

c. 9 min and 31 second comes form 137.132.85.2 DNS server.

Q4:

a. The first certificate certifies the public key of diasy.ubuntu.com, signed by “Go Daddy Secure Certificate Authority”. The second certificate certifies the
public key of “Go Daddy Secure Certificate Authority”, signed by “Go Daddy Root Certificate Authority”. The third certificate certifies the public key of “Go Daddy Root Certificate Authority”, signed by “Go Daddy Class 2 Certification Aut”.

b. Yes. A root CA can sign itself.

c. Packet 211 contains the master key encrypted with the public key of diasy.ubuntu.com.

Assignment 3 Submission Log

Some of you are anxious if we have received your Assignment 3 submission or not, especially those who slipped the answer sheet under my door.

This is good, because this means you understand well how reliable protocol works, and you are waiting for an ACK from the receiver! You are also worried that Trudy might have intercepted your submission.

Instead of sending back an ACK to individual students, I will broadcast the ACK periodically. So here is the Google Doc that lists the hardcopy answer sheets to Assignment 3 that we have received. The list will be updated a few more times until the deadline.

List of Assigment 3 Received (Hardcopy Submission Only)

Assignment 3: Update on Submission Instructions

Since the deadline falls on a public holiday, we have decided to allow softcopy submission in addition to hardcopy.

If you decide to submit a hardcopy, you can still pass them to either Wei Tsang or Saeid as per instructions.

If you wish to submit a softcopy, please read and following the instructions below carefully.

  1. A PDF answer form has been made available.
  2. Use any decent PDF viewer/editor to fill up the form with your answers. Remember to save the form after you fill it up with your answers.
  3. Rename the form a3-A1234567X.pdf, replacing A1234567X with your matriculation number.
  4. Submit the form into IVLE workbin here, before the deadline.

WARNING:

  1. Please do not submit any other forms of softcopy (e.g., something scanned from a scanner, an image of the answer sheet taken with your phone, a text file edited with vim, etc.) Only the filled up version of the PDF form above is acceptable.
  2. Please do not email us the softcopy. Do not submit a floppy disk containing the softcopy either!
  3. Please name the PDF file according to the convention a3-<matric number>.pdf. Do NOT name it as a3-<nusnet ID>.pdf. (Your matriculation number ends with an alphabet).

There is a 1-point penalty for each violation of instruction above.

Assignment 2 Solution

I have finished grading Assignment 2.

There are couple of common mistakes that worth highlighting here:

  1. If you receive a corrupted packet, you should not look at the content of the packet, since you cannot tell which bit is corrupted! Many of you still assume that p.seq is valid even when p.isCorrupted is true. For this, I takes off two points.
  2. Another common bug is that you did not make sure that all timers are cancelled when the connection is closed. As a result, the sender goes into infinite loop sending forever (and encountering exceptions forever).
  3. The last packet should be treated as any other packet. This means the sender should still ensure that it is received correctly, by repeated retransmitting until it does. Some of you forgot about this and only ensures that the packets are sent correctly, except the last one!

Assignment 3: Clarification 1

Dear Students,

There were three typos in the pdf file of Assignment 3. We updated the pdf file and uploaded on the blog. Please either re-download the pdf file here or consider the three below points:

1. Question 3 – part (c) – second and third line: the correct URI is daisy.ubuntu.com instead of diasy.ubuntu.com

2.Question 4 – second line: the correct sentence is “Right click on Packet 145 and choose ..” instaed of “Right click on Packet 36 and choose ..”

3. Question 4 – forth line: the correct IP addres is “172.26.191.153″ instead of “172.126.187.16”

Thanks!

Saeid

Assignment 3

Here’s your Assignment 3 on understanding packet traces.

This is an INDIVIDUAL assignment, due 18 April 2014, 6:00pm.

Please write your answers in the answer sheet and submit a hardcopy to Wei Tsang before the deadline.

(Please ignore the Assignment 3 posted in IVLE — we were struggling to get online assignment working in IVLE, resulting in delay releasing the assignment.)

Assignment 1: Comments

The grades for Assignment 1 has been posted in your IVLE gradebook. Please take a look at the comments, and report back to us if there is anything surprising.

Some of the common mistakes are:

  • Returning incorrect HTTP response headers. Some of you return 200 OK, even if the request is incorrect (e.g., requesting for a non-existing file). Some of you return two HTTP status codes, or no HTTP status code, or two lines of content-type. Some of you return content-length with incorrect number of bytes. Despite being the easiest part of the assignment to get right (just following the format!), your submission is surprisingly buggy in this aspect.
  • Strong assumption about HTTP request headers. The HTTP request header format does not dictate the order of the fields, except that the first line must be the request line (with method, resource, and version). You cannot assume content-type and content-length appears in a certain order, nor can you assume that the last line in the header is of certain fields.
  • For a POST request, you should not assume that the body contains “——WebKitFormBoundary”. In fact, you need not know about the format of the POST body at all, as indicated in the assignment description.
  • Some of you did not follow the instructions, which require that you take in the port number as a command line argument. Those who hardcoded the port number loose one point needlessly for not following instructions.

Assignment 2: Test Your Code

I hope everyone is having fun writing your own reliable file transfer program in Assignment 2.

I am releasing the code we will use to test your program. You can use it to check if your code will survive our test cases.

To run the test, execute

~sadm/a2/check.sh <port>

on cs2105-z.comp.nus.edu.sg (replace <port> with your favourite port number).

Note that, passing the test cases just means that your code behaves correctly when tested, it does not mean that your code is correct.

The test script is experimental, so please report if it fails to run.

Assignment 2

Here’s your Assignment 2 on simulating alternating-bit protocol. This is a simple assignment (the solution is only ~40 lines of code) to be completed and submitted INDIVIDUALLY before 30 March, 2014, 11:59PM. Despite the simplicity, please start early!

Assignment 1 Q&A Schedule

This post will be updated at least once daily.

Wednesday, 5 March, 2014

The following takes place in MR6, AS6 #05-10

1100 OON ZI GUI, TAN MEI LING
1105 SUN HANG, GAO RISHENG
1110 WANG ZHE, KOH JUN XIANG
1115 DAO THAI DUY, HO TUAN DUONG
1120 NURWIDYA UTAMI JATI, LEWIS HARIS NATA
1130 LIM HONG HUI EUGENE, CAO YUBO
1135 TRAN THAI TRI TAN, NGUYEN VAN THE
1140 YANG HUIYU, YUEN SHU HUI
1145 LAI YIT HANN, TAN WEI YOUNG
1150 NGOC THANH, LIU PEIYU

The following takes place in Wei Tsang’s office, AS6 #05-14.

1040 SITI NORFAEQAH BINTE POWZAN, GANGADEVI D/O BALAKRISHNAN
1045 HUANG QINGHUI NICOLAS, CHENG WEN ZHAO
1050 SHIWANI AGARWAL, ASHISH TAYAL
1100 CHUA RUI JUN, LOW KIT YEE

1600 HUANG YUE, ZHOU WEI
1605 TAMANA ANNA THARAKAN, IPSITA MOHAPATRA
1610 JOANNE MAH JIA WEN, FAN YUXIN
1615 LIN BAOYU, LIM WEI KE
1620 CHIA WEI MENG ALEXANDER
1630 CHNG YUAN ZHANG MAURICE, GAN JIA HUI
1635 STEFANI LETICIA, LEE HUI SHAN
1640 TAN JUN KAI, QUEK JUN JIE
1645 XIE CHENHONG, SU HAN
1650 A YUSUF SHAMIR, ATUL NANDAKUMAR

1700 FLORENCE WAI TZE YUN, CHUA YI JING
1705 CHIAM ZHIJIE JONATHAN, IAN LEOW TZE WEI
1710 WANG YI, CHEN TONGTONG

The following takes place in DR5, AS6 #02-08.

1645 CHRISTOPHER MARSHALL LAIRD, AI YUE GUO
1650 ADINDA AYU SAVITRI, ONG CHEE CHIN

1700 CHU BING HAN BRYAN, SAN WENYIN
1705 KHAN SAIM SAEED, SENGUPTA DEBOPAM
1710 HE LINGFEI, XIA LU
1715 GUNESS VARSHA, MICHELLE SINN SHWE YE OO
1720 CHANG YAN QIAN, LIM YU DE
1730 SEAH SHAO CHENG, JACOB TAN JIA WEN
1735 LI HO YEUNG, KIN FUNG ANTONY TSE
1740 SONG YI, LI YUANDA
1745 WANG WENZHU, WANG GAOYING

1800 JOEY HOK WAI YI, JAYARAMAN ARCHANA
1805 YE SHUJIAN, LU XI
1810 ZHANG MENGDI, YEO JEONG HOUN

Continue reading

Assignment 1 Q&A

Please book your slots for Q&A here.

Here are the rules:

  1. Each team will indicate the one-hour slots where both team members are available, from which we will allocate 5 minutes for each team.
  2. We will need to stick to the clock exactly, so you must come on time and end on time.
  3. We will randomly ask each student to explain a random part of the code.  Your answer will constitute 2 marks of your individual Assignment 1’s grade.
  4. If you missed your slot or is late, there will be no rescheduling and no extra time.
  5. Both team members must show up on the same time slot.
  6. At the doodle site, in the column that says “Your Name”, please enter the matriculation numbers of both team members.
  7. You will receive an email confirming your slots. Further schedule will be updated in another blog post.
  8. The last slot will be 6pm, 5 March, 2014. After this time, no further booking online possible.

Assignment 1: Clarifications II

A few clarifications/tips related to Assignment 1.

  • You can assume that the browsers generate properly formatted HTTP requests. You only need to handle user errors, such as, when users enter a URL pointing to a non-existing file.
  • Beware of Runtime.exec(String[] cmdarray, String[] envp). If the standard environmental variables, such as HOME is missing from the parameter envp, the perl script will not run properly. The script expects that HOME to be set to the user’s home directory. The symptoms of this bug is that todo.pl tries to create a folder /a1/data, which it does not have permission to.
  • Beware of readline(). It returns only after it encounters a new line character. Note that neither HTTP request or response BODY guarantees that it ends with a new line character. If you use readline(), you may have to wait forever for it to return.
  • If you are ssh-ing into cs2105-z from Windows ssh client, you may have key mapping issues when you use vim. You can copy my .vimrc from ~ooiwt/.vimrc on cs2105-z, which maps the keys properly, to resolve this issue.

Assignment 1: Clarifications

We received several FAQs about Assignment 1 last week. Please take note of them.

1. Can we use existing libraries that handle HTTP / CGI for this assignment?

NO. The purpose of this assignment is for you to learn about how HTTP and CGI work together, and demonstrate that to us by solving the assignment. If you use existing libraries or wrapper class (such as HttpURLConnection) you will not learn (and showed us that you know how) the internals of how HTTP/CGI works.

2. We want to implement delete/edit first, before we implement add. How can we manually create TODO entries for testing?

I have edited the file “TODO” and the files under the “data” directory so that they have three items in the list. You can copy them over to your own a1 directory.

cp ~sadm/a1/TODO $HOME/a1
cp -r ~sadm/a1/data $HOME/a1

3. Where can we find WebServer.java? How to run WebServer.java?

Somehow many of you missed this blog post. The code from Lecture 3 is posted there. As to how to run (or compile), please refer to . If you not as comfortable with command line as you should, you are free to use your favorite IDE (Eclipse, NetBeans, etc) to compile and run the server.