[Twisted-Python] Re: simple dns server with twisted.names

Yves Glodt y.glodt at sitasoftware.lu
Sun Jan 15 10:45:42 EST 2006


On Fri, 13 Jan 2006 13:49:17 +0100, Yves Glodt <y.glodt at
sitasoftware.lu> wrote:
> On Fri, 13 Jan 2006 13:49:17 +0100, Yves Glodt <y.glodt at
> sitasoftware.lu> wrote:
>> Hi,
>> 
>> I have read about twisted.names and I guess it can help me in what
>> I have to achieve..
>> 
>> I have a database which contains a list of ip-addresses and
>> corresponding hostnames.
>> 
>> Now, how could I do to, e.g., write a daemon which would, on dns
>> queries, query the database to resolve the name?
>> 
> 
> Twisted Names isn't exactly done, as far as pleasant pluggable
> backend support goes.  Take a look at twisted/names/authority.py and
> twisted/names/common.py.  The hook you are probably interested in is
> the _lookup method

Ok.

I have to admit I am completely new to twisted...

I am also not sure whether I explained myself good in what I want to do...

Basically, I need a replacement for /etc/hosts.

I have a daemon running on my box, and was thinking about adding a 
thread to it which could serve as a simple local dns server.

Right now, my /etc/hosts gets updated by a cronjob every now and then. 
The cronjob fetches IP-addresses and hostnames from a firebird DB and 
writes them to the hosts file.

What I was thinking to do with my daemon is, having in memory a 
list/hashtable of hosts with their IPs. If an IP changes I get a 
firebird event and I can updated it in my list.

Now twisted.names would only have to listen to dns requests (I have e.g. 
wget and openvpn which want to resolve names from my hosts right now 
periodically), lookup the IPs of the requested names in my in-memory 
list of hosts/ips, and answer as a normal dns server.

isn't twisted/names/server what I need for that?

thanks and best regards,
Yves

p.s.
Is there any more documentation available apart of this:
http://twistedmatrix.com/projects/names/
http://twistedmatrix.com/projects/names/documentation/howto/names.html


> Jean-Paul





More information about the Twisted-Python mailing list