Find the answer to your Linux question:
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 ...
  1. #1
    Just 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

  2. #2
    Just Joined!
    Join Date
    Aug 2010
    Posts
    18

  3. #3
    Just 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.

  4. #4
    Just Joined!
    Join Date
    Sep 2010
    Posts
    36
    Quote Originally Posted by abarclay View Post
    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.
    What I want is to build both the server and the client, should have been more clear about it. After I build the server the getip should use my DNS server to get an ip from a domain I want.

  5. #5
    Just Joined!
    Join Date
    Sep 2010
    Posts
    36
    Quote Originally Posted by barbus View Post
    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

  6. #6
    Just 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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •