Coder Social home page Coder Social logo

chen-robert / simpledns Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mwarning/simpledns

0.0 1.0 0.0 54 KB

A very simple and small DNS Server to help understanding the protocol basics.

License: Creative Commons Zero v1.0 Universal

C 99.81% Makefile 0.19%

simpledns's Introduction

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
  • supports A, AAAA and TXT queries
  • 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 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:
;; -&gt;&gt;HEADER&lt;&lt;- 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 was very helpful for understanding the protocol.

simpledns's People

Contributors

mwarning avatar chmorgan avatar glennwang avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.