PowerDNS is a run on many Linux / DNS servers on Unix derivative version, it is possible to use different back-end configuration, including the type of BIND zone files, relational databases, or load balancing / failover algorithms. It can also be configured to a DNS recursive filter, as a separate process running on the server
End databases: 192.168.7.105
Web end: 192.168.7.103
105 end:
to create the database and create a user authorized to access
MariaDB [powerdns]> create database powerdns;
MariaDB [powerdns]> grant all on powerdns.* to user@'%' identified by '123';
Create a table
official document: https: //doc.powerdns.com/md/authoritative/backend-generic-mysql/
CREATE TABLE domains (
id INT AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
master VARCHAR(128) DEFAULT NULL,
last_check INT DEFAULT NULL,
type VARCHAR(6) NOT NULL,
notified_serial INT DEFAULT NULL,
account VARCHAR(40) DEFAULT NULL,
PRIMARY KEY (id)
) Engine=InnoDB;
CREATE UNIQUE INDEX name_index ON domains(name);
CREATE TABLE records (
id BIGINT AUTO_INCREMENT,
domain_id INT DEFAULT NULL,
name VARCHAR(255) DEFAULT NULL,
type VARCHAR(10) DEFAULT NULL,
content VARCHAR(64000) DEFAULT NULL,
ttl INT DEFAULT NULL,
prio INT DEFAULT NULL,
change_date INT DEFAULT NULL,
disabled TINYINT(1) DEFAULT 0,
ordername VARCHAR(255) BINARY DEFAULT NULL,
auth TINYINT(1) DEFAULT 1,
PRIMARY KEY (id)
) Engine=InnoDB;
CREATE INDEX nametype_index ON records(name,type);
CREATE INDEX domain_id ON records(domain_id);
CREATE INDEX recordorder ON records (domain_id, ordername);
CREATE TABLE supermasters (
ip VARCHAR(64) NOT NULL,
nameserver VARCHAR(255) NOT NULL,
account VARCHAR(40) NOT NULL,
PRIMARY KEY (ip, nameserver)
) Engine=InnoDB;
CREATE TABLE comments (
id INT AUTO_INCREMENT,
domain_id INT NOT NULL,
name VARCHAR(255) NOT NULL,
type VARCHAR(10) NOT NULL,
modified_at INT NOT NULL,
account VARCHAR(40) NOT NULL,
comment VARCHAR(64000) NOT NULL,
PRIMARY KEY (id)
) Engine=InnoDB;
CREATE INDEX comments_domain_id_idx ON comments (domain_id);
CREATE INDEX comments_name_type_idx ON comments (name, type);
CREATE INDEX comments_order_idx ON comments (domain_id, modified_at);
CREATE TABLE domainmetadata (
id INT AUTO_INCREMENT,
domain_id INT NOT NULL,
kind VARCHAR(32),
content TEXT,
PRIMARY KEY (id)
) Engine=InnoDB;
CREATE INDEX domainmetadata_idx ON domainmetadata (domain_id, kind);
CREATE TABLE cryptokeys (
id INT AUTO_INCREMENT,
domain_id INT NOT NULL,
flags INT NOT NULL,
active BOOL,
content TEXT,
PRIMARY KEY(id)
) Engine=InnoDB;
CREATE INDEX domainidindex ON cryptokeys(domain_id);
CREATE TABLE tsigkeys (
id INT AUTO_INCREMENT,
name VARCHAR(255),
algorithm VARCHAR(50),
secret VARCHAR(255),
PRIMARY KEY (id)
) Engine=InnoDB;
CREATE UNIQUE INDEX namealgoindex ON tsigkeys(name, algorithm);
End 103
disposed PowerDNS used as background data storage mariadb
# vim /etc/pdns/pdns.conf
launch=gmysql
gmysql-host=localhost
gmysql-port=3306
gmysql-dbname=powerdns
gmysql-user=powerdns
gmysql-password=powerdns123
Start Service
systemctl start pdns
systemctl enable pdns
1, the installation package associated httpd and php
yum -y install httpd php php-devel php-gd php-mcrypt php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mhash gettext
2, start the service
systemctl start httpd
systemctl enable httpd
3, download poweradmin program and unzip to the appropriate directory
# cd /usr/local/src/
# wget http://downloads.sourceforge.net/project/poweradmin/poweradmin-2.1.7.tgz
# tar -xvf poweradmin-2.1.7.tgz
# mv poweradmin-2.1.7/* /var/www/html/
4, start powerAdmin page views
5, provide details of a previously configured database, as well as Poweradmin set the administrator password
6, configuration management web
7, to create an authorized user
105 end
MariaDB [(none)]> GRANT SELECT, INSERT, UPDATE, DELETE
-> ON powerdns.*
-> TO 'poweradmin'@'192.168.7.%' #105变成变成%,否则无法连接数据库
-> IDENTIFIED BY 'poweradmin123';
Query OK, 0 rows affected (0.001 sec)
8, create a config.php file contents (Figure forget the shots, instead of using the pictures online, direct way to copy the following command file)
# vim /var/www/html/poweradmin/inc/config.inc.php
<?php
$db_host = '192.168.7.105';
$db_user = 'PowerAdmin';
$db_pass = '123';
$db_name = 'powerdns';
$db_type = 'mysql';
$db_layer = 'PDO';
$session_key = 'J[%f(e4re@5=$LRh{MrXDFbH@Pbi6oB!yiCysYozvczJ$O';
$iface_lang = 'en_EN';
$dns_hostmaster = 'master';
$dns_ns1 = '192.168.7.103';
$dns_ns2 = '';
?>
``
9、安装完毕后,删除install目录
rm -rf /var/www/html/install/
10, Log
http://192.168.7.103/poweradmin
11, add a new main area, just click "Add main area"
12, Add area "button to add the DNS zone.
You need to fill out a few things:
- Domain (Domain) - you want to add a domain area.
- Owner (Owner) - set the owner of a DNS zone.
- Template (Template) - DNS template - blank.
- DNSSEC - Domain Name System Security Extensions (optional - see if you need to).
13, edit existing DNS zone or add a new record
Add a new DNS entry here, you need to set the following information:
Name (Name) - the entry name. The first part simply add the domain / sub-domain, PowerAdmin will add the rest.
Type (Type) - select the record type.
Priority (Priority) - Record priority.
TTL - survival time, in seconds.
Test client:
Testing:
Install the software
yum install bind-utils
Modify the dns resolve dns192.168.7.103
Test:
DIG mysql.magedu.net
[root@controller1 network-scripts]# dig openstack-vip.magedu.net
; <<>> DiG 9.9.4-RedHat-9.9.4-74.el7_6.2 <<>> openstack-vip.magedu.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20527
;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; WARNING: recursion requested but not available
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1680
;; QUESTION SECTION:
;openstack-vip.magedu.net. IN A
;; AUTHORITY SECTION:
openstack-vip.magedu.net. 86400 IN SOA 192.168.7.103. master. 2019082900 28800 7200 604800 86400
;; Query time: 8 msec
;; SERVER: 192.168.7.103#53(192.168.7.103)