CSC 145/290 Assignment: DNS Client Due Tuesday 12/4/2001 For this assignment you are to write a *practical* DNS client. It should resemble the /usr/sbin/nslookup utility in function. You must use UDP packets and conform to the DNS specification as described in RFC 1035. DNS is a very complex protocol - you only need to write a simple client, therefore, you should not have to read the entire RFC. BUT YOU NEED TO READ THE RELEVANT PARTS VERY CAREFULLY!! The name servers your machine uses are listed in /etc/resolv.conf The DNS port is 53. I've done the first part, which you can use as a guide. But you need to: 1. extract the answer from the format returned by the server. That is, you can't just print the entire packet you got from the server; you need to understand the protocol format it's storeed in. This part also includes the ability to process multiple ip's returned. That is, if you query "www.microsoft.com", you should get back several ip's - you need to extract and display all of them. (But first make sure it at least works for single responses). 2. Be able to decode the compression mechanism used by the DNS protocol. You don't have to compress your queries, but you should be able to interpret responses that uses the compression format. 3. Be able to send the DNS server a reverse query (an ip address) and display the response (extract the domain name from the packet returned by the server). ************* -------- New Instructions for doing inverse queries: -------- Apparently some name servers do not support inverse queries. To be able to look up the host name corresponding to an ip address, send the server a normal (forward) query but set the QTYPE field of the question set to PTR (value 0x0C). Ip-to-host mappings are accomplished by using the "in-addr-arpa" domain. for example, if you want to look up the name for 147.4.150.248, you will send a PTR query for the name 248.150.4.147.in-addr.arpa That's right, the ip numbers are reversed. There is a very logical reason for this for in-addr.arpa is also used to mapp to gateways of networks and sub-networks. Putting the numbers in reverse makes it easier (don't need a separate subnet mask). Once again, to perform inverse queries, use a QTYPE of PTR and write the ip in the form of an in-addr.arpa domain name. IF you've already used the old method I suggested, and show that it works with SOME name server, I will accept that also. (the new way I suggested is easier though). *** This is a Group Assignment *** This doesn't mean it's ok to just let that "really smart person" in your group do all the work. It means dividing the tasks among yourselves. This assignment may be too big for one person, and unless you think you are a programming "god" please don't wait til the last minute (don't say I didn't warn you). The three parts above can be divided into tasks for separate individuals. Practice good software engineering principles so your codes will work together (don't use global variables!). In fact, I would want to know who's working on what aspect of the assignment. Please also note that the due date for this assignment WILL BE ENFORCED, for we will have another assignment after this one, which will be due on the date of the scheduled final exam.