PowerDNS: Difference between revisions
Jhjacobs81 (talk | contribs) No edit summary |
Jhjacobs81 (talk | contribs) No edit summary |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= General = | = 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 | 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. 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 | 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 | ||
Line 8: | Line 8: | ||
= Install = | = Install = | ||
{{Cmd|apk add pdns pdns-backend-sqlite3}} | {{Cmd|apk add pdns pdns-backend-sqlite3 pdns-docs}} | ||
{{Cmd|rc- | {{Cmd|rc-update add pdns}} | ||
= Configure = | = Configure = | ||
On Alpine, the default configuration file is: {{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> | <pre> | ||
launch=gsqlite3 | launch=gsqlite3 | ||
gsqlite3-database=/var/lib/powerdns/pdns.sqlite3 | gsqlite3-database=/var/lib/powerdns/pdns.sqlite3 | ||
</pre> | </pre> | ||
The pdns-doc ships with example's for different backends in {{path|/usr/share/doc/pdns/}}. For this example we use the sqlite schema. | The pdns-doc ships with example's for different backends in {{path|/usr/share/doc/pdns/}}. For this example we use the sqlite schema. | ||
Line 23: | Line 24: | ||
Next we need to import the database scheme: {{Cmd|sqlite3 /var/lib/powerdns/pdns.sqlite3 < /usr/share/doc/pdns/schema.sqlite3.sql}} | Next we need to import the database scheme: {{Cmd|sqlite3 /var/lib/powerdns/pdns.sqlite3 < /usr/share/doc/pdns/schema.sqlite3.sql}} | ||
Then we need to set the correct permissions: {{Cmd|chown -R pdns:pdns /var/lib/powerdns}} | Then we need to set the correct permissions: {{Cmd|chown -R pdns:pdns /var/lib/powerdns}} | ||
For a more detailed guide please see the documentation | For a more detailed guide please see the documentation [https://doc.powerdns.com/authoritative/guides/basic-database.html here] | ||
Now we can start the server and start adding records to it: {{Cmd|service pdns start}} | |||
Now we can start the server and start adding records to it: {{Cmd|rc-service pdns start}} | |||
= Use = | = Use = | ||
Adding records is done through the commandline. | Adding records is usually done through the commandline. There are several web based GUI's available, but this is outside the scope of this article. See the resources section for more information. | ||
We first have to setup a dns zone: | We first have to setup a dns zone: | ||
{{Cmd|pdnsutil create-zone example.com ns1.example.com}} We also add one NS record. | {{Cmd|pdnsutil create-zone example.com ns1.example.com}} We also add one NS record. | ||
Line 48: | Line 53: | ||
= Troubleshooting = | = Troubleshooting = | ||
<pre>TODO</pre> | |||
* Ensure the daemon is running with {{Cmd|rc-status}} | * Ensure the daemon is running with {{Cmd|rc-status}} | ||
= Resources = | = Resources = | ||
* The main website for PowerDNS: [https://www.powerdns.com PowerDNS] | * The main website for PowerDNS: [https://www.powerdns.com https://www.powerdns.com] | ||
* Packagelist: [https://pkgs.alpinelinux.org/packages?name=pdns*&branch=v3.17&repo=community&arch=&maintainer= | * PowerDNS Documentation: [https://doc.powerdns.com/ https://doc.powerdns.com/](Most of this article is from the main documentation site. only Alpine specific details where changed.) | ||
* Packagelist: [https://pkgs.alpinelinux.org/packages?name=pdns*&branch=v3.17&repo=community&arch=&maintainer= https://pkgs.alpinelinux.org/packages?name=pdns*&branch=v3.17&repo=community&arch=&maintainer=] | |||
Web GUI: | |||
* [https://github.com/PowerDNS-Admin/PowerDNS-Admin https://github.com/PowerDNS-Admin/PowerDNS-Admin] | |||
* [https://pdnsmanager.org/ https://pdnsmanager.org/] | |||
* [https://www.poweradmin.org/ https://www.poweradmin.org/] | |||
[[Category:Server]] | [[Category:Server]] |
Latest revision as of 09:57, 14 March 2023
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. 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-sqlite3 pdns-docs
rc-update add pdns
Configure
On Alpine, the default configuration file is: /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
The pdns-doc ships with example's for different backends in /usr/share/doc/pdns/. For this example we use the sqlite schema.
First we need to create the correct directory:
mkdir /var/lib/powerdns
Next we need to import the database scheme:
sqlite3 /var/lib/powerdns/pdns.sqlite3 < /usr/share/doc/pdns/schema.sqlite3.sql
Then we need to set the correct permissions:
chown -R pdns:pdns /var/lib/powerdns
For a more detailed guide please see the documentation here
Now we can start the server and start adding records to it:
rc-service pdns start
Use
Adding records is usually done through the commandline. There are several web based GUI's available, but this is outside the scope of this article. See the resources section for more information.
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
TODO
- Ensure the daemon is running with
rc-status
Resources
- The main website for PowerDNS: https://www.powerdns.com
- PowerDNS Documentation: https://doc.powerdns.com/(Most of this article is from the main documentation site. only Alpine specific details where changed.)
- Packagelist: https://pkgs.alpinelinux.org/packages?name=pdns*&branch=v3.17&repo=community&arch=&maintainer=
Web GUI: