Question
Using UDP sockets, you will write a simplified version of a DNS server. The server will be authoritative for a single zone specified in the
Using UDP sockets, you will write a simplified version of a DNS server. The server will be authoritative for a single zone specified in the DNS Master file (e.g. student.test), and responsible for responding to iterative type A queries from a DNS client using the DNS protocol. The DNS client that is to be used to test your program is either the dig or nslookup utility. The DNS server will perform the following functions: 1. Read in the master file named dns-master.txt (See dns-master.txt format below) 2. Store the resource records (type A, CNAME and NS resource records) in data structures in main memory suitable for searching 3. Respond to type A requests from the DNS client for host names in the domain for which the name server is authoritative. 4. If the name being queried is a CNAME, find the real-name and return both the CNAME record and the corresponding A record in the answer section in the response 5. In responses, include NS resource records for the domain in the Authority section of the response and A resource records for those NS records in the Additional section of the response 6. Return an error if the name queried does not exist in the domain. 7. Messages exchanged must conform to a subset of the DNS Protocol (see DNS Message Format.doc for message format details) 8. The program should still work if the master file is modified to include a different zone, different hostnames, or IP addresses> The dns-master file that the server should be reading from has the following format:
# Example Master File for DNS Programming Assignment
# dns-master.txt # First, specify the domain that this name server is authoritative for
student.test
# Next, an integer specifies TTL to be used for all resource records (secs)
120
# List the hostnames of all name servers that are authoritative for domain "student.test" using NS resource records
student.test. NS ns1.student.test
student.test. NS ns2.student.test
# List IP address for each of above name servers using A resource records
ns1.student.test A 127.0.0.1
ns2.student.test A 192.168.10.11
# List IP addresses of all hosts in the domain and sub-domains
host1.student.test A 192.168.20.1
host2.student.test A 192.168.20.2
host3.student.test A 192.168.20.3
host11.student.test CNAME host1.student.test
host20.cs.student.test A 192.168.30.1
host21.ee.student.test A 192.168.40.1
Test Cases: 1. Using dig or nslookup utilities, look up the IP address of any host that exists in the domain e.g. host1.student.test. A successful response should include a header with the AA bit set (indicating answer is from authoritative server), along with the type A record containing the IP address in the answer section (192.168.20.1). The authority section should contain the NS records of the name servers responsible for the domain (ns1.student.test, ns2.student.test), and the type A records associated with these name servers in the additional section of the response (127.0.0.1, 192.168.10.11). A real-world example of expected dig output is shown below. 2. Look up the IP address of a hostname that is a CNAME e.g. host11.student.test. The response should be the same as the response in Question 1, the answer section also contains the CNAME record. 3. Look up the IP address of a domain name that does not exist in the domain. In such a case, the response will echo back the question in the question section, but there will be no records in any of the other sections. The RCODE in the header should indicate the error.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started