Assignments‎ > ‎

Lab 2 - A DNS Client Using UDP

Due - Friday February 11, 2011 - 11:59PM

The goals of this assignment are (1) to give you experience using UDP and (2) to familiarize you with implementing communication protocols, specifically DNS.  For this assignment, you will implement a basic DNS client that will use UDP to communicate with a DNS server.

Your program will take as input at the command line the following items:
  1. the IP address of the DNS server
  2. the domain name to look up
  3. the type of query (e.g., [A, NS, MX])
I will run your program as follows (the command line items may take different values, including erroneous ones):

            java -cp lab2.jar DNSClient 8.8.8.8 www.cnn.com A

The output of your program will look similar to the output produced by dig.  You will print all of the data received in the query response.

Requirements

  1. You must use UDP for communication.
  2. You must use raw sockets for communication.
  3. You may not use any libraries for generating or parsing DNS packets.  You are required to generate the packets, in the correct format, on your own.

Suggestions

  1. You will need to familiarize yourself with Section 4 of RFC 1035 (http://www.ietf.org/rfc/rfc1035.txt).
  2. You may want to consult http://www.zytrax.com/books/dns/ch15/, particularly regarding the QNAME format.
  3. Consider testing your program using the CS DNS server or Google's Public DNS servers (http://code.google.com/speed/public-dns/).  
  4. Do not use port 5353.
  5. You are encouraged to create a modular library for generating/parsing DNS packets as you will use this code again in a later assignment.
  6. You may use any programming language for this assignment, but remember that you will not receive full credit if you use existing DNS libraries.

Submission

  1. By the deadline, all source code must be checked in to SVN at /<username>/cs621/lab2.
  2. Your class files must be packaged into a jar named lab2.jar.  This jar file must be at the top level of the lab2 directory (i.e., https://www.cs.usfca.edu/svn/user/cs621/lab2/lab2.jar).
  3. If you are not using Java, provide a README that clearly indicates how to compile and run your program and include a run script for running your program on the CS lab machines.
  4. Late projects will receive a score of 0.
  5. Projects that are submitted incorrectly will receive a deduction of up to 20%.  This includes incorrectly named directories and missing source files.  Double check your submission!

Comments