Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Develop a basic DNS server (in C#) [closed]

Tags:

I am developing a very basic DNS server for my own purpose. The way I understand it, the DNS server receives UDP packets containing the requested domain name and returns the corresponding IP under some kind of standard form.

There is a standard library for reading/writing UDP packets from/to binary format. But where can I find a C# library for serialising/deserialising DNS requests/responses?

like image 248
Régis B. Avatar asked Jan 11 '11 13:01

Régis B.


2 Answers

The open source ARSoft.Tools.Net library contains a DNS Server component (see documentation).

You could use this library directly, or just use the source as a starting point for building your own DNS request serializer.

like image 55
Chris Shouts Avatar answered Sep 21 '22 10:09

Chris Shouts


As far as I can tell, I couldn't find a library for C# which handles DNS packet serialization/deserialization, which means it's likely you'll have to roll your own.

Edit: I came across this network packet sniffer project on Code Project which might have what you need. Claims to be able to to parse TCP/UDP/DNS

I did find this very helpful site for TCP/IP which has a pretty comprehensive set of pages describing DNS packet types including the general message format.

There might be some additional help from this previous SO question though.

like image 33
RobS Avatar answered Sep 18 '22 10:09

RobS