1. PDNS 정의
PDNS란 오픈소스 DNS 소프트웨어로, 다양한 기능을 제공하는 네임서버입니다.
Poweradmin 도구를 이용하여 DB를 연동하여 웹에서 쉽게 관리할 수 있습니다.
PDNS 홈페이지 : https://www.powerdns.com/index.html
2. PDNS 설치
현재 나온버전으로는 4.1버전이 있으며 최신버전으로 설치하였습니다.
※ 환경 : CentOS 7.5 Apache 2.4 Mysql 5.7 PHP 5.6
– PDNS 다운로드
# yum install epel-release yum-plugin-priorities && curl -o /etc/yum.repos.d/powerdns-auth-
41.repo https://repo.powerdns.com/repo-files/centos-auth-41.repo
# yum install pdns pdns-backend-mysql
– PDNS DB 생성
mysql> create database pdns_db;
Query OK, 1 row affected (0.00 sec)
mysql> grant all on pdns_db.* to pdns_admin@localhost identified by ‘비밀번호’;
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
– 기본테이블과 index 생성
mysql> use pdns_db;
Database changed
mysql> CREATE TABLE records (
id BIGINT AUTO_INCREMENT,
domain_id INT DEFAULT NULL,
name VARCHAR(255) DEFAULT NULL,
type VARCHAR(10) DEFAULT NULL,
content VARCHAR(255) 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;
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;
mysql> CREATE TABLE supermasters (
ip VARCHAR(64) NOT NULL,
nameserver VARCHAR(255) NOT NULL,
account VARCHAR(40) NOT NULL,
PRIMARY KEY (ip, nameserver)
) Engine=InnoDB;
mysql> 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(255) NOT NULL,
PRIMARY KEY (id)
) Engine=InnoDB;
mysql> CREATE TABLE domainmetadata (
id INT AUTO_INCREMENT,
domain_id INT NOT NULL,
kind VARCHAR(32),
content TEXT,
PRIMARY KEY (id)
) Engine=InnoDB;
mysql> 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;
mysql> CREATE TABLE tsigkeys (
id INT AUTO_INCREMENT,
name VARCHAR(255),
algorithm VARCHAR(50),
secret VARCHAR(255),
PRIMARY KEY (id)
) Engine=InnoDB;
mysql> CREATE UNIQUE INDEX name_index ON domains(name);
mysql> CREATE INDEX nametype_index ON records(name,type);
mysql> CREATE INDEX domain_id ON records(domain_id);
mysql> CREATE INDEX recordorder ON records (domain_id, ordername);
mysql> CREATE INDEX comments_domain_id_idx ON comments (domain_id);
mysql> CREATE INDEX comments_name_type_idx ON comments (name, type);
mysql> CREATE INDEX comments_order_idx ON comments (domain_id, modified_at);
mysql> CREATE INDEX domainmetadata_idx ON domainmetadata (domain_id, kind);
mysql> CREATE INDEX domainidindex ON cryptokeys(domain_id);
mysql> CREATE UNIQUE INDEX namealgoindex ON tsigkeys(name, algorithm);
– PDNS 설정파일 수정
# vi /etc/pdns/pdns.conf
launch=gmysql
gmysql-host=127.0.0.1
gmysql-user=pdns_admin
gmysql-password=비밀번호
gmysql-dbname=pdns_db
– 방화벽 수정
# vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -p tcp -m state –state NEW -m tcp –dport 53 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m state –state NEW -m udp –dport 53 -j ACCEPT
# service iptables restart
– PDNS 시작
# systemctl enable pdns.service
# systemctl start pdns.service
# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:53 0.0.0.0:* LISTEN 32692/pdns_server
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 23483/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 981/master
tcp6 0 0 :::80 :::* LISTEN 6682/httpd
tcp6 0 0 :::53 :::* LISTEN 32692/pdns_server
tcp6 0 0 :::22 :::* LISTEN 23483/sshd
tcp6 0 0 ::1:25 :::* LISTEN 981/master
tcp6 0 0 :::3306 :::* LISTEN 18360/mysqld
3. PowerAdmin 설정
poweradmin이란 powerdns를 컨트롤할 수 있는 인터페이스입니다.
poweradmin 홈페이지 : https://www.poweradmin.org/
– 다운로드 및 설정
# wget https://jaist.dl.sourceforge.net/project/poweradmin/poweradmin-2.1.7.tgz
# tar xvfz poweradmin-2.1.7.tgz
# mv ./poweradmin-2.1.7/* /home/poweradmin
# cd /home/poweradmin/inc
# cp -arp config-me.inc.php config.inc.php
# vi /home/poweradmin/inc/config.inc.php
dbhost=′localhost′;dbhost=′localhost′;db_port = ‘3306’;
dbuser=′pdnsadmin′;dbuser=′pdnsadmin′;db_pass = ‘비밀번호’;
dbname=′pdnsdb′;dbname=′pdnsdb′;db_type = ‘mysql’;
URL로 들어간뒤에 설치를 진행합니다.
'LINUX > DNS' 카테고리의 다른 글
GSLB란 (0) | 2022.12.05 |
---|---|
PDNS 업그레이드 (0) | 2019.06.03 |
DNS 설치 및 설정 (0) | 2019.06.01 |
BIND 1차 2차 동기화 (0) | 2019.05.29 |