Very simple DNS server

I have a linux server that has a dedicated wireless network for connecting clients. After connecting, I want users to always be redirected to their own web server no matter what URL they type. A great solution would be to set up a complete DNS server (with BIND or equivalent), but this seems like overkill. All I need is a simple program that will listen to any DNS request and always respond with the same IP address.

I looked around, but could not find him. It is advisable to write it in C or Perl, because I do not want to install any other scripting languages.

+7
source share
4 answers
+9
source

I would suggest using dnsmasq . It is more fully functional than you absolutely need, but it is very well written, small and easy to install, and the only configuration you need to provide is --address='/#/1.2.3.4' so that it --address='/#/1.2.3.4' everything requests (which do not correspond to another rule) with the address 1.2.3.4. dnsmasq is well known and maintained, and probably a more reliable server than Net :: DNS :: Nameserver.

+7
source

As I answered in another question related to this, I wrote a basic C ++ DNS server for an interview with a BSD license.

I think the code was pretty clean, although I did not do unit tests :-( I tested it with dig, and it took about a week to understand the DNS + + protocol documentation.

If someone wants to expand it, I think it will not be very difficult. Because I think that it only supports reverse queries, as was set in the exercise.

The code can be found here: http://code.google.com/p/dns-server/

It was ported to: https://github.com/tomasorti/dns-server

+2
source

I used fakedns.py when handling malware. This may be too limited for your situation.

+1
source

All Articles