Task 2: DNS configuration (8 Marks)
Implement server a simple local DNS server called nsl.StudentLastName.org.au. The Local DNS accepts queries from clients and tries to resolve them, first by checking its local cache. The Local DNS must reply to A, NS, and CNAME requests. Before you start to implement your server, you should have a clear understanding of the DNS protocol and, specifically, of the message format. You can find good information online in Learning DNS by Cricket Liu or the textbook and the lecture slides.
Local DNS must be able to resolve queries iteratively starting from a given root name server. In other words, Local DNS must work even with a root server that does not support recursive queries. Local DNS must also correctly handle canonical names (www). This means that a server (the root server or others) might reply with a CNAME record in response to a request for the A record for www.nsl.studentLastName.org.au. In this case, Local DNS should first resolve the CNAME record and then reply to the original request with a DNS message that includes both the canonical-name record (CNAME) for the original name and the address record (A) for the canonical name.