CIS-3152 Homework #4 (DNS Server)

Due: Wednesday, February 28, 2018

Read Chapter 8 in the text on UDP. Also read over parts of RFC-1035 on implementing the domain name system. Section 4 of the RFC is of particular interest since it details the format of the datagrams used. Also review the DNS client program that is part of my DNS GitHub repository.

This assignment is more complex than the previous ones and so it is worth 30 points instead of the usual 20. Do not wait until the last minute to start working on this assignment!.

The goal of this assignment is to write a simplistic DNS server that follows RFC-1035 as closely as feasible. Here are a few simplifying assumptions you can make, however:

  1. Your server can always return the same address, 127.0.0.1, for any name. It need not manage a database of name to IP address mappings nor communicate with other name servers. As a consequence, it does not need to implement "recursive" lookups.

  2. If your server receives an invalid datagram, or a datagram asking for a feature it can't handle or doesn't understand, your server can just ignore the datagram. In particular, it doesn't need to send back datagrams with error codes. Note that if the client requests recursion your server should reply, as usual, with the address of 127.0.0.1 as if it got that address from the recursive process (which it doesn't have to implement).

  3. Your server only needs to implement support for A (QTYPE == 1) records using Internet addressing (QCLASS == 1). It can ignore any other kind of query.

  4. Your server does not need to "compress" the reply. Although it is common for real servers to do this, a properly written client shouldn't have an issue with an uncompressed reply. In particular, the client in the same GitHub repository should work with such replies fine.

  5. Your server only needs to handle queries with a single question. It can ignore queries with multiple questions.

In addition to implementing the protocol properly, your server has a few other requirements:

  1. For each query received it should print the address and port number on the client, a note indicating if the query is valid or not (i. e., malformed or not), and, for valid queries, the text of the domain name requested

The purpose of the requirement to print the domain name is to force you to decode the name as it exists in the query (the format is a bit unusual). A real server that needed to consult a database would likely have to do this.

Submit your final dnsserver.c to Moodle.


Last Revised: 2018-02-09
© Copyright 2018 by Peter C. Chapin <pchapin@vtc.edu>