# Micro authoritative dns server

**URL:** <https://www.ruby-forum.com/t/micro-authoritative-dns-server/99488>\
**Category:** Ruby\
**Created:** [July 23, 2006, 12:23pm UTC](https://www.ruby-forum.com/t/micro-authoritative-dns-server/99488 "2006-07-23T12:23:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 23, 2006, 12:23pm UTC](https://www.ruby-forum.com/t/micro-authoritative-dns-server/99488/1 "2006-07-23T12:23:17Z")

</div>

Hi,

I’m new in ruby. I know that there is a class called Resolv.rb for  
writing dns servers, but it’s not well documented.

I just want to know if anyone could help me in writing a code for  
minimal authoritative dns server. I would like that anyone show me the  
code, minimal, for learn how expand it.

The code I desireed should do the following:

1. It has an hash:  
hosts = { “myhost” =\> 84.34.56.67  
“localhost” =\> 127.0.0.1,  
“blue” =\> fe80::20f:b0ff:fef2:f106  
}
2. If any application asks if know any hosts, say nothing if this host  
is not in the hash (hosts). If this host is in the hash, return the ip
3. And not do anything more

So if we put this server in /etc/resolv.conf then the browsers only  
recognize the hosts we want

Thanks in advance,  
Xan.

PS: For personal communication, DXpublica @@@@@ [telefonica.net](http://telefonica.net)

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 25, 2006, 12:03am UTC](https://www.ruby-forum.com/t/micro-authoritative-dns-server/99488/2 "2006-07-25T00:03:12Z")

</div>

The class something like:

- Domserv is the authoritative dns server

Domserv d

d.hostsips() //prints the lists of all hosts and ip  
d.hosts() //prints the lists of all hosts  
d.add(192.26.0.2,[www.google.com](http://www.google.com)) //add this host to the list of hosts  
d.del(127.26.0.1) //delete this ip and the corresponding hosts from  
hosts  
d.del([www.google.com](http://www.google.com)) //idem

d only answer if know the hosts apps ask.

Nothing else,  
Xan.

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 29, 2006, 3:57am UTC](https://www.ruby-forum.com/t/micro-authoritative-dns-server/99488/3 "2006-07-29T03:57:39Z")

</div>

On Jul 23, 2006, at 3:20 AM, removed\_email\_address@domain.invalid wrote:

> I’m new in ruby. I know that there is a class called Resolv.rb for  
> writing dns servers, but it’s not well documented.

resolv.rb is for writing clients. It is documented on the HEAD  
branch, but the documentation hasn’t been backported.

–  
Eric H. - removed\_email\_address@domain.invalid - [http://blog.segment7.net](http://blog.segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)
