Skip to content

Instantly share code, notes, and snippets.

@TvL2386
Created October 2, 2014 12:57
Show Gist options
  • Save TvL2386/1230a2be23d2b9d8352f to your computer and use it in GitHub Desktop.
Save TvL2386/1230a2be23d2b9d8352f to your computer and use it in GitHub Desktop.
Convert bind zone file to powerdns gmysql
root@pollux:/etc/powerdns/bind# cat 0.168.192.ip-addr.arpa.zone
$ORIGIN 0.168.192.in-addr.arpa. ; start of this zone file in the name space, not necessary if included from named.conf
$TTL 1d ; default expiration time of all resource records without their own TTL value
@ IN SOA ns.example.com postmaster.example.com. ( ; @ is replaced with . in email address
2014022602 ; serial number of this zone file
1d ; slave refresh (1 day)
2h ; slave retry time in case of a problem (2 hours)
4w ; slave expiration time (4 weeks)
1h ; minimum caching time in case of failed lookups (1 hour)
)
IN NS ns.example.com.
1 IN PTR ns.example.com.
root@pollux:/etc/powerdns/bind# zone2sql --gmysql --zone=0.168.192.ip-addr.arpa.zone
insert into records (domain_id, name,type,content,ttl,prio) select id ,'0.168.192.in-addr.arpa', 'SOA', 'ns.example.com.0.168.192.in-addr.arpa. postmaster.example.com. 2014022602 86400 7200 2419200 3600', 86400, 0 from domains where name='';
insert into records (domain_id, name,type,content,ttl,prio) select id ,'0.168.192.in-addr.arpa', 'NS', 'ns.example.com', 86400, 0 from domains where name='';
insert into records (domain_id, name,type,content,ttl,prio) select id ,'1.0.168.192.in-addr.arpa', 'PTR', 'ns.example.com', 86400, 0 from domains where name='';
1 domains were fully parsed, containing 3 records
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment