# SimpleDNS **Repository Path**: nessan1987/SimpleDNS ## Basic Information - **Project Name**: SimpleDNS - **Description**: A very simple and small DNS Server to help understanding the protocol basics. - **Primary Language**: Unknown - **License**: CC0-1.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-11-11 - **Last Updated**: 2020-12-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### Introduction SimpleDNS is a very simple DNS server. It was made to learn the basics of the DNS protocol. Features: * very small * single-threaded * all necessary data structures for further features * very simplistic memory management * no full protection against malformed requests :| ### Build ``` git clone https://github.com/mwarning/SimpleDNS.git cd SimpleDNS make ``` ### Test Start SimpleDNS: ``` $./main Listening on port 9000. ``` In another console execute [dig](http://linux.die.net/man/1/dig) to make a DNS request: ``` $ dig @127.0.0.1 -p 9000 foo.bar.com A ; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @127.0.0.1 -p 9000 foo.bar.com ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15287 ;; flags: qr; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;foo.bar.com. IN A ;; ANSWER SECTION: foo.bar.com. 0 IN A 192.168.1.1 ;; Query time: 0 msec ;; SERVER: 127.0.0.1#9000(127.0.0.1) ;; WHEN: Mon Apr 15 00:50:38 2013 ;; MSG SIZE rcvd: 56 ``` Note: - On Debian Linux, dig is part of the dnsutils package. - Use AAAA instead of A in the dig command line to request the IPv6 address. ## Modify address entries The code maps the domain "foo.bar.com" to the IPv4 address 192.168.1.1 and IPv6 address fe80::1. It is easy to find it in the code and to add other entries. ### Recommended Reading The DNS section of the [TCP/IP-Guide](http://www.tcpipguide.com/free/t_TCPIPDomainNameSystemDNS.htm) was very helpful for understanding the protocol.