[Pdns-users] Documentation on populating backend database tables
Kenneth Marshall
ktm at rice.edu
Sun Apr 24 16:15:34 UTC 2011
On Sun, Apr 24, 2011 at 07:32:40AM +0000, Sebastian Tennant wrote:
> Quoth Kenneth Marshall <ktm at rice.edu>:
> > Here is a basic desciption of the fields and queries that PDNS uses:
> >
> > http://doc.powerdns.com/generic-mypgsql-backends.html#id587910
>
> Thanks. I see now. The first half of the 'Basic functionality' section
> describes the records table. It might help if the words 'records table' were
> mentioned there somewhere. The emphasis is very much on making queries rather
> than populating your database with answers.
>
> Here are my notes:
>
> -- file:///usr/share/doc/pdns-doc/html/generic-mypgsql-backends.html
>
> CREATE TABLE records (
> id INTEGER PRIMARY KEY, -- undocumented
> domain_id INTEGER DEFAULT NULL, -- references domains.id?
> name VARCHAR(255) DEFAULT NULL, -- FQDN
> type VARCHAR(6) DEFAULT NULL, -- (type=qtype?) A,MX,SOA,AAAA
> content VARCHAR(255) DEFAULT NULL, -- A=IP, NS=..
> ttl INTEGER DEFAULT NULL, -- time to live
> prio INTEGER DEFAULT NULL, -- MX priority
> change_date INTEGER DEFAULT NULL ); -- undocumented
>
> There are a couple of questions in there:
>
> 1. Does records.domain_id need to reference domains.id? The manual says that
> each domain *must* have a unique domain_id, yet the default value is NULL?
>
> 2. Does 'type' (used in the records table schema) mean 'qtype' (used in the
> manual)?
>
> My attempt to answer them:
>
> 1. Doesn't matter in a simple use case like mine. Forget about the other
> tables (domains & supermasters) and the domain_id column and just increment
> the id column manually on each insert.
>
> 2. It probably does, which means it's a bug, either in my schema file, or in
> the manual.
>
> > Consult your favorite DNS RFC/documentation to see what records you need to
> > set up a zone.
>
> Can you recommend one?
>
> Better still, as mine is such a simple use case, can you not just tell me
> whether or not these four INSERTS will do the job the comments optimistically
> claim they do:
>
> --8<---------------cut here---------------start------------->8---
> -- create nameservers
> INSERT INTO records (id, name, type, content, ttl) VALUES
> (1, 'foo.net', 'NS', 'ns1.foo.net', 25920);
> INSERT INTO records (id, name, type, content, ttl) VALUES
> (2, 'foo.net', 'NS', 'ns2.foo.net', 25920);
>
> -- publish ip addresses of nameservers
> INSERT INTO records (id, name, type, content, ttl) VALUES
> (3, 'ns1.foo.net', 'A', '207.210.96.211', 8640);
> INSERT INTO records (id, name, type, content, ttl) VALUES
> (4, 'ns2.foo.net', 'A', '207.210.106.146', 8640);
> --8<---------------cut here---------------end--------------->8---
>
> Do I need to do any more thatn this?
>
> Regards,
>
> Sebastian
The only thing missing is the SOA record to actually define your
domain and you should be good to go. The content field is set as
one string containing all the fields:
content = 'primary-nameserver email-address-for-problems serial-number \
refresh retry expire minimum-ttl'
some reasonable values:
content = 'ns1.foo.net me.foo.net 2011042400 10800 900 1200000 3600'
Email should be with dots, i.e. ktm at rice.edu -> ktm.rice.edu in the record.
Cheers,
Ken
More information about the Pdns-users
mailing list