2016年6月9日 星期四

在 CentOS7/RHEL7 上安裝設定 Power DNS (二)

設定目標:
  • 架設 Power DNS 的 Master & Slave Server 備援機制!
  • 事先準備事項:
    • Power DNS 服務設定,請參考這一篇的設定!
Master 快速設定流程:
  1. 參考事先準備事項,完成 Power DNS Server 的架設!
  2. 修改設定檔內容:
    #cp /etc/pdns/pdns.conf /etc/pdns/pdns.conf.orig
    #vim /etc/pdns/pdns.conf
    allow-recursion=192.168.5.0/0
    allow-axfr-ips=192.168.5.11/32
    config-dir=/etc/pdns
    daemon=yes
    disable-axfr=no
    guardian=yes
    local-address=0.0.0.0
    local-port=53
    log-dns-details=on
    log-failed-updates=on
    loglevel=4
    master=yes
    slave=no
    setgid=pdns
    setuid=pdns
    socket-dir=/var/run
    version-string=powerdns
    include-dir=/etc/pdns/pdns.d
    
  3. 重新啟動 Power DNS Server:
    #systemctl restart pdns
    

Slave 快速設定流程:
  1. 參考事先準備事項,完成 Power DNS Server 的架設!(不用安裝 phpPowerAdmin)
  2. 修改設定檔內容:
    #cp /etc/pdns/pdns.conf /etc/pdns/pdns.conf.orig
    #vim /etc/pdns/pdns.conf
    allow-recursion=0.0.0.0/0
    config-dir=/etc/pdns
    daemon=yes
    disable-axfr=yes
    guardian=yes
    local-address=0.0.0.0
    local-port=53
    log-dns-details=on
    log-failed-updates=on
    loglevel=4
    master=no
    slave=yes
    slave-cycle-interval=60
    setgid=pdns
    setuid=pdns
    socket-dir=/var/run
    version-string=powerdns
    include-dir=/etc/pdns/pdns.d
    
  3. 在 MySQL 內,增加下列表格:(有發現錯誤時才做!)
    #mysql -u powerdns -p
    MariaDB [(none)]> use powerdns;
    MariaDB [powerdns]>CREATE TABLE `domainmetadata` (
                       `id` int(11) NOT NULL AUTO_INCREMENT,
                       `domain_id` int(11) NOT NULL,
                       `kind` varchar(16) DEFAULT NULL,
                       `content` text,
                       PRIMARY KEY (`id`)
                       ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
  4. 登入 MySQL ,增加 supermaster 設定值:
    #mysql -u powerdns -p
    MariaDB [(none)]> use powerdns;
    MariaDB [powerdns]> insert into supermasters values('192.168.5.1','dns1.example.tw','admin');
    MariaDB [powerdns]> exit;
    
  5. 重新啟動 Power DNS Server:
    #systemctl restart pdns
    

參考文獻:
  1. https://www.digitalocean.com/community/tutorials/how-to-configure-dns-replication-on-a-slave-powerdns-server-on-ubuntu-14-04
  2. https://www.benjaminfleckenstein.name/en/powerdns-master-slave-howto.html
  3. http://www.debiantutorials.com/installing-powerdns-as-supermaster-with-slaves/
  4. http://jpmens.net/2013/02/13/automatic-provisioning-of-slave-dns-servers/
  5. https://doc.powerdns.com/md/authoritative/modes-of-operation/