PowerDNS Master/Slave installieren

Aus Carl-Christian Sautter - Wiki
Wechseln zu: Navigation, Suche

ACHTUNG! - Das Tutorial ist für aktuelle Power DNS Versionen 3 und 4 nicht mehr aktuell

Installiere von Power DNS

Zuerst muss PowerDNS mit MySQL/MariaDB Backend auf beiden Servern installiert werden.
Installation von MariaDB
Ändere das Binlog Format in der Datei /etc/mysql/my.cnf

binlog_format=row
# alternative: binlog_format=MIXED

Installiere PowerDNS mit MySQL Backend. Benutze dabei die geführte Einrichtung.

apt-get install -y pdns-server pdns-backend-mysql

Installiere PowerAdmin (nur MasterServer)

apt-get install -y apache2 gettext libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php-pear php5-imap  php5-ming php5-mysql php5-xmlrpc php5-mhash php5-mcrypt

Install the required PEAR modules:

pear install DB
pear install pear/MDB2#mysql

Enable Mcrypt:

php5enmod mcrypt

Change to your home directory:

cd ~

Download the compressed Poweradmin files:

wget http://sourceforge.net/projects/poweradmin/files/latest/download?source=directory

Extract the archive:

tar xvzf poweradmin-X.X.X.tgz

Move the poweradmin directory to the Apache web directory:

mv poweradmin-X.X.X /var/www/html/poweradmin

Create the configuration file:

touch /var/www/html/poweradmin/inc/config.inc.php

Give the Apache user ownership of the directory:

chown -R www-data:www-data /var/www/html/poweradmin/

Configure Poweradmin

To finish the installation of Poweradmin we will use the web-based configuration wizard.
Open your web browser and visit the URL below, substituting your own IP address or server hostname:

http://your_server_ip/poweradmin/install/

Select your preferred language
Select your preferred language and click the Go to step 2 button.
Read this information
There is some valuable information on the step 2 page, especially for multiple installations of Poweradmin. This information does not directly apply to this tutorial. When you are done reading the page, click the Go to step 3 button.
Enter the database connection information and create a new password as explained below
On the Installation step 3 page, we will need to enter the following information:

   Username: powerdns_user, or whatever username you created for MariaDB
   Password: powerdnsuserpassword, the database password you created earlier
   Database type: Select MySQL from the dropdown menu; remember that MariaDB acts like MySQL
   Hostname: 127.0.0.1 because we are connecting from localhost
   DB Port: 3306; leave the default
   Database: powerdns, or the database name you created earlier
   Poweradmin administrator password: Please set a unique password that you will use to log into the Poweradmin control panel later on; the username will be admin

Click the Go to step 4 button.
Enter the database and nameserver details as explained below
On the Installation step 4 page you have a choice between convenience and security. You can reuse the same database settings, or create a new less-privileged database user for Poweradmin. This example shows the same database user settings. You'll also choose your nameserver domains.

   Username: Use a new or existing database user; in this case we're using powerdns_user
   Password: Set a new password or use the existing database password of powerdnsuserpassword
   Hostmaster: Set the default hostmaster, such as hostmaster.example-dns.com
   Primary nameserver: Set the primary nameserver, such as ns1.example-dns.com
   Secondary nameserver: Set the secondary nameserver, such as ns2.example-dns.com

Click the Go to step 5 button.
If you created a new user, add the new database user with the command shown on the page, starting with GRANT
Verify that the database information is correct. If you chose to create a new user and password, then you should log into your MariaDB database and add the new user by copying and pasting the code block shown on the screen, starting with GRANT. Then click the Go to step 6 button.
The installer was able to write to the file "../inc/config.inc.php" . . .
You should see a message like The installer was able to write to the file "../inc/config.inc.php" . . .. If you have issues writing to the configuration file, that means you missed a step during the installation process.
If this step failed, go back to your server and create the file:

touch /var/www/html/poweradmin/inc/config.inc.php

Then restart the installation process again by refreshing the page.
Otherwise, click the Go to step 7 button to finish the installation.
Now we have finished the configuration . . .
You'll be given the username admin and your Poweradmin control panel password.
We are done with the configuration of Poweradmin.
To clean up, go back to your server and delete the installation directory. Poweradmin requires us to do this before we can log in:

rm -rf /var/www/html/poweradmin/install/

Poweradmin Configuration Changes
If you need to make changes to the Poweradmin settings after finishing the installation, edit this file:

nano /var/www/html/poweradmin/inc/config.inc.php

Here you can update the database connection settings and other configuration settings for Poweradmin.

Master Server Konfiguration

Master IP: 10.0.0.1
Slave IP: 10.0.0.2
Configfile /etc/powerdns/pdns.conf

# Add Slave IPs (Komma separated)
allow-axfr-ips=10.0.0.2
allow-recursion=127.0.0.1
config-dir=/etc/powerdns
daemon=yes
guardian=yes
lazy-recursion=yes
# Master IP
local-address=10.0.0.1
# Master IPv6
local-ipv6=1:2:3::2
local-port=53
log-dns-details=on
log-failed-updates=on
loglevel=4
master=yes
module-dir=/usr/lib/powerdns
setgid=pdns
setuid=pdns
slave=no
socket-dir=/var/run
version-string=powerdns
include=/etc/powerdns/pdns.d

Slave Server Konfiguration

#Master/Supermasters IPs
allow-axfr-ips=127.0.0.0/8,::1,10.0.0.1
allow-recursion=0.0.0.0/0
config-dir=/etc/powerdns
daemon=yes
#DNS Entry of this Nameserver (Slave)
default-soa-name=a.ns2.ns.de
disable-axfr=yes
guardian=yes
include-dir=/etc/powerdns/pdns.d
launch=
#You can bind to specified Interface
local-address=0.0.0.0
local-port=53
log-dns-details=on
loglevel=4
master=no
setgid=pdns
setuid=pdns
slave=yes
slave-cycle-interval=60
socket-dir=/var/run
version-string=powerdns

Supermaster in SQL Datenbank anlegen

Log in to MariaDB with the PowerDNS username and password you created in the previous tutorial. For example powerdns_user.

   mysql -u powerdns_user -p

Gebe das Passwort aus dem Powerdns SQL Config file ein. Benutze die SQL Datenbank aus dem Powerdns SQL Config file.

   USE powerdns;

Next we will crate a new row in the supermasters table. This row will specify the master server IP address, and the Fully Qualified Domain Name (FQDN) of the slave server we are currently configuring.

   insert into supermasters values ('10.0.0.1', 'ns2.ns.de', 'admin');

We can now exit the MariaDB shell.

   exit;

Restart the PowerDNS service for changes to take effect.

   sudo service pdns restart

Bekannte Fehlerquellen

  • Das Binlog Format des Mysql/MariaDB Servers muss RAW sein, ansonsten kann es zu Fehlern mit dem SQL Backend kommen.