Network代写:CNT4713 DNS Lookup

实现DNS协议,根据RFC1035实现Lookup命令。

DNS

Overview

The goal of this project is to understand UDP socket programing by developing a simplified DNS lookup client. You must create your own socket and cannot use any existing DNS library. You may use Python 3, Java, or C++/C as the programming language.

Instructions

The DNS lookup client uses iterative queries to resolve a given domain name. It should start with the following command:

mydns(or java mydns or python mydns.py) domain-name root-dns-ip

Please make sure that your program name is exactly mydns. Submissions will be graded by a script. Other names will not be recognized, resulting in a zero score. where domain-name is the domain name to be resolved and rootdns-ip is the IP address of a root DNS server on the Internet. The list of current root

Your DNS lookup client should first query the specified root DNS server, which will return one or more intermediate DNS servers (in the Authority and Additional Information sections of the reply). Your client must automatically pick one intermediate server and query it. This process should continue until one or more IP address of the specified domain name are obtained (the IPs are in the Answers section of the reply). Then your DNS client should stop.

This DNS iterative resolution process is explained in Chapter 2.4 of the textbook, and is illustrated below.

The DNS message formats are explained in Chapter 2.4 of the textbook. To simplify the programming tasks, your DNS lookup client only needs to understand two types of resource records in the reply:

  • NS, which means the record contains an intermediate name server for the domain name being queried. In this case, your client must also check the Additional Information section to find out the IP of the intermediate name server, in order to send a query to the server. If multiple intermediate name servers are included, your client only needs to pick one to query.
  • A, which means the record contains the IP of the domain name being queried; your DNS client can stop once such a reply is received.

Your DNS lookup client should print all the intermediate results on the screen. For each iterative step, your client must clearly display the content of the reply message, and the
DNS server chosen to query next. A sample output is attached in the appendix.

You may focus on only IPv4 and ignore IPv6.

Test

Verify the correctness of the lookup results by typing

nslookup domain-name 8.8.8.8

You can use Wireshark to analyze the DNS query sent by your program and verify if its format is correct.

References

Group

You can either work in a group of up to three or independently. Only one submission is necessary for a group.

Submission

Host your code as a git repo at github.com, and invite the instructor [email protected] as a collaborator before submission. Group members with no commit record will receive a zero for the project.

Submit a copy of your final code to Canvas. (Source code only, no NetBeans/Eclipse project files)

Submit a readme.txt to Canvas with the following information:

  1. Member names and IDs
  2. GitHub link
  3. Language used: Python3/Java/C++/C
  4. Compiling instructions (not necessary for Python): command-line compiling instructions only, no NetBeans/Eclipse compiling.