Results 1 to 6 of 6
Hello, I'm looking forward to writing a DNS server from scratch. I'm looking for a good simple open sourced DNS server. I want my code to do all the work ...
- 10-14-2010 #1Just Joined!
- Join Date
- Sep 2010
- Posts
- 36
Writing my own little DNS server
Hello, I'm looking forward to writing a DNS server from scratch. I'm looking for a good simple open sourced DNS server. I want my code to do all the work from the first to the last layer, like it is explained here:
Domain Name System - Wikipedia, the free encyclopedia
If you know a good book or guide that might help me it will be excellent too.
In the end I want to make it a linux command that I write for example:
#getip Google
#The IP adress of the domain "www.google.com" is 66.102.13.104
Thanks in advance
- 10-14-2010 #2Just Joined!
- Join Date
- Aug 2010
- Posts
- 18
- 10-14-2010 #3Just Joined!
- Join Date
- Dec 2009
- Location
- California
- Posts
- 68
I'm a bit confused.
You said you wanted to write a DNS server, but then you talk about that "getip" command which is a client.
If you want to write a DNS server, you'll probably want to look at the RFCs.
RFC 882 and RFC1034 and 1035 are good starts.
You won't need to write getip or anything like that because you could use standard commands to talk to your dns server - commands like nslookup, dig, host, etc.
If what you actually want to do is write a client which uses a resolver library (the getip command), then that is pretty easy - probably 15 lines of C code. If you want to implement your own resolver, then that gets a bit trickier.
- 10-15-2010 #4Just Joined!
- Join Date
- Sep 2010
- Posts
- 36
- 10-20-2010 #5Just Joined!
- Join Date
- Sep 2010
- Posts
- 36
I'm really lost here, I already got to chapter 3 in DNS for rocket scientists and I already spent hours to get there. It's very complicated and all those RFC explanations and stuff are just not for newbies... I don't see me writing a DNS server when I don't even understand what is the point of Zone Files and why do we need them, and I got hundreds more questions of that kind that I can't figure out because everything is written in such an unreadable language for a newbie.... All I was thinking is writing a reverse mapping algorythm like in chapter 3 but all these Zone files are so fricking confusing like I said before. I finally stopped reading the guide after realizing that I spent over an hour of reading stuff I don't understand at all. Any suggestions would be accepted
- 04-27-2011 #6Just Joined!
- Join Date
- Dec 2009
- Location
- California
- Posts
- 68
Did you ever make any progress on this?
"Basic" DNS is very simple. You send a DNS packet to a server. The server looks up the answer from a zone file (or from another DNS server), fills in the answer section of the dns packet, flips a couple of bits in the header section (AA, QR, etc), and then returns the packet.
Zone files are simply the data to be loaded into the dns server - you could have one zone file containing all the data from the internet (the zone name would be "."), but that is not practical, so the solution was to distribute the data in a tree like structure. The way the distribution works is to use NS records to delegate authority for a part of the tree. So if you look at ".", you will find there are 13 name servers responsible for it. if you ask one of those servers to give you an answer for something in "com", they will not fetch you the answer, they will return you the list of name servers for "com" - that is a referral. In this case, the zone files for com are located on the com name servers, not on the root server.... and that process repeats itself on down the tree.


Reply With Quote

