PowerDNS: Difference between revisions

From Alpine Linux
(Created page with "Installing and managing PowerDNS on Alpine with SQLITE Backend 1. Enable the community repository 2. apk add pdns pdns-backend-sqlite 3. import the sql file (")
 
No edit summary
Line 1: Line 1:
Installing and managing PowerDNS on Alpine with SQLITE Backend
= General =
The PowerDNS Authoritative Server is a versatile nameserver which supports a large number of backends. These backends can either be plain zone files or be more dynamic in nature. PowerDNS has the concepts of ‘backends’. A backend is a datastore that the server will consult that contains DNS records (and some metadata). The backends range from database backends (MySQL, PostgreSQL) and BIND zone files to co-processes and JSON API’s.


1. Enable the community repository
Multiple backends can be enabled in the configuration by using the launch option. Each backend can be configured separately. In this howto we will focus on sqlite
2. apk add pdns pdns-backend-sqlite
   
3. import the sql file (
For a full list of features see the [https://doc.powerdns.com/ PowerDNS documentation website]
 
= Install =
 
{{Cmd|apk add pdns pdns-backend-sql3}}
{{Cmd|rc-service add pdns}}
 
= Configure =
 
Default location of the config file: {{Path|/etc/pdns/pdns.conf}} The default config is good to start using the DNS functions. To use the SQLite backend edit the config file and at the bottom add
<pre>
launch=gsqlite3
gsqlite3-database=/var/lib/powerdns/pdns.sqlite3
</pre>
 
Save this file to your local computer so we can import it to Power dns [https://raw.githubusercontent.com/PowerDNS/pdns/master/modules/gsqlite3backend/schema.sqlite3.sql|schema.sqlite3.sql]
Next we need to import it {{Cmd|sqlite3 /var/lib/powerdns/pdns.sqlite3 < /path/to/schema.sqlite3.sql}}
Then we need to set the correct permissions: {{Cmd|chown -R pdns:pdns /var/lib/powerdns}}
 
Now we can start the server and start adding records to it: {{Cmd|service pdns start}}
= Use =
Adding records is done through the commandline.
We first have to setup a dns zone:
{{Cmd|pdnsutil create-zone example.com ns1.example.com}} We also add one NS record.
 
To add a new record we execute the following command: {{Cmd|pdnsutil add-record example.com. www A 192.0.2.1}} where www is the subdomain, and 192.0.2.1 is the server we point it to.
 
== Controlling PowerDNS status ==
 
Stop, start and restart the daemon in the usual fashion:
{{Cmd|rc-service pdns start}}
 
{{Cmd|rc-service pdns stop}}
 
{{Cmd|rc-service pdns restart}}
 
== Auto-start pdns at boot ==
 
To add the daemon to the default runlevel so it auto-starts at boot, do: {{Cmd|rc-update add pdns}}
 
= Troubleshooting =
 
{{ TODO }}
 
* Ensure the daemon is running with {{Cmd|rc-status}}
 
 
[[Category:Server]]

Revision as of 19:01, 6 December 2022

General

The PowerDNS Authoritative Server is a versatile nameserver which supports a large number of backends. These backends can either be plain zone files or be more dynamic in nature. PowerDNS has the concepts of ‘backends’. A backend is a datastore that the server will consult that contains DNS records (and some metadata). The backends range from database backends (MySQL, PostgreSQL) and BIND zone files to co-processes and JSON API’s.

Multiple backends can be enabled in the configuration by using the launch option. Each backend can be configured separately. In this howto we will focus on sqlite

For a full list of features see the PowerDNS documentation website

Install

apk add pdns pdns-backend-sql3

rc-service add pdns

Configure

Default location of the config file: /etc/pdns/pdns.conf The default config is good to start using the DNS functions. To use the SQLite backend edit the config file and at the bottom add

launch=gsqlite3
gsqlite3-database=/var/lib/powerdns/pdns.sqlite3

Save this file to your local computer so we can import it to Power dns [1]

Next we need to import it

sqlite3 /var/lib/powerdns/pdns.sqlite3 < /path/to/schema.sqlite3.sql

Then we need to set the correct permissions:

chown -R pdns:pdns /var/lib/powerdns

Now we can start the server and start adding records to it:

service pdns start

Use

Adding records is done through the commandline. We first have to setup a dns zone:

pdnsutil create-zone example.com ns1.example.com

We also add one NS record. To add a new record we execute the following command:

pdnsutil add-record example.com. www A 192.0.2.1

where www is the subdomain, and 192.0.2.1 is the server we point it to.

Controlling PowerDNS status

Stop, start and restart the daemon in the usual fashion:

rc-service pdns start

rc-service pdns stop

rc-service pdns restart

Auto-start pdns at boot

To add the daemon to the default runlevel so it auto-starts at boot, do:

rc-update add pdns

Troubleshooting

Template:TODO

  • Ensure the daemon is running with

    rc-status