Almost everything on the Internet involves DNS resolution. If DNS is slow, the performance of your application is going to suffer. The goal of this homework is write your own DNS resolver, and compare its performance with other existing DNS resolvers.
Part A (70 points)
You will be implementing a DNS resolver. The resolver takes as input a query in a format given below. Your resolver resolves this query by first contacting the root server, the top-level domain, all the way until the authoritative name server.
You can assume that you have access to a library that can resolve a single iterative DNS query. The set of libraries that you may use are given in the Appendix. The libraries also perform complete DNS resolution, but you are not allowed to use that.
- You can access the IP address of the root servers from https://www.iana.org/domains/root/servers.
- Build a “dig”-like tool called “mydig”. The mydig tool takes as input: (1) name of the domain you want to resolve. You should resolve the “A” record for the query.
When run as “./mydig <name>”, your tool should display the following
Query time: 24 msec
WHEN: Fri Feb 2 10:26:27 2018
MSG SIZE rcvd: 84
Along with the code, you need to submit an output file called “mydig_output.txt”, that contains the expected output for running your mydig program for the 3 types mentioned above. Please specify the input to your program.
- You will use two APIs to create a DNS request to each individual server. The first is a “make_query” In python the API is dns.message.make_query. The second is to actually send this query over UDP. In python, the API is dns.query.udp. The query you will send to each server is a “NS” query since you need to get the name server, until you get the authoritative name server. (We can provide the corresponding APIs in Java and C/C++ in Piazza if needed.
Bonus (10%): In some cases, you may need additional resolution. For example, google.co.jp will often not resolve to an IP address in one pass. For bonus points, you can handle this case.
PART B (30 points)
Your next task is to measure the performance of your DNS resolver from Part A for resolving A records. Take the top 25 Websites from alexa.com (http://www.alexa.com/topsites.)
Experiment 1: Run your DNS resolver on each website 10 times and find the average time, 25th percentile, and 75th percentile to resolve the DNS for each of the 25 websites.
Experiment 2: Now use your local DNS resolver and repeat the experiment (state the name of the DNS resolver you used). Find the average time to resolve the address for the 25 websites, computed as the average over 10 runs.
Experiment 3: Change the DNS resolver to Google’s public DNS (The IP address of this public DNS is often 184.108.40.206, or 220.127.116.11, but you need to verify). Repeat the experiment one more time.
You can use the dig command for experiments 2 and 3.
For each of the 25 Website, plot the average, 25th percentile and 75 th percentile values over the 10 runs and draw a graph. The x axis is the website, named 1 to 25. The y axis is the time taken to resolve the query. Each point will have three bars corresponding to the three experiments.
Explain your result as best as you can.
You need to submit your homework in a single zip file as follows:
- The zip file and (the root folder inside) should be named using your last name, first name, and the assignment name, all separated by a dash (‘-‘)
The zip file should contain your code corresponding to Part A and your answer in Part B. Please be sure to put both the code in the root folder rather than in separate folders. Provide sufficient comments to your code.
- Include the expected output file “mydig_output.txt” as specified in Part A.
- You should provide a README.txt file describing:
- External libraries used.
- Instructions on how to run your programs.
All README and your answer to Part B should be in pdf.
- You may write your programs in the following languages: python, Java, and C/C++. For
each language, you can use the corresponding DNS library to perform the single DNS
resolution. The recommended libraries are:
python —> dnspython
Java —> dnsjava (org.xbill.DNS)
C/C++ —> DSNQuery
If you choose to write your program using any other language or using a different DNS library, you should get permission from the instructor first. Remember that you cannot use these libraries to perform the entire resolution.
A note on running your code using the Universities network
If you are not able to connect to the root servers on campus, this is because the campus network blocks access to the root servers (but the CS department network does not do so). You can work around this by using a VPN.