Centos

PowerDNS 為所有請求返回 ServFail

  • January 24, 2016

我一直在努力讓 PowerDNS 在最新的 CentOS 7 x64 上執行。

除 Nginx 之外的所有內容都遵循本指南,因為我使用的是 Apache:https ://www.rosehosting.com/blog/install-powerdns-and-on-a-centos-7-vps/

防火牆被禁用。SELinux 設置為僅監控。

下面是我的數據庫,請注意 PowerDNS 的 Web 管理工作得很好。

dig但是,我在任何嘗試中都會遇到 servfail 。請參閱下面的數據庫輸出和 pdns conf。

請幫我找出問題所在!

請注意,我使用的是 BIND,它執行良好,但我想要一個數據庫驅動的 DNS 系統,所以我試圖讓 PDNS 正常工作。正如您從 netstat 輸出中看到的那樣,在這些測試期間 BIND 已停止。

版本:

# pdns_control version
3.4.7

數據庫資訊:

MariaDB [powerdns]> show tables;
+--------------------+
| Tables_in_powerdns |
+--------------------+
| domains            |
| migrations         |
| perm_items         |
| perm_templ         |
| perm_templ_items   |
| records            |
| records_zone_templ |
| supermasters       |
| users              |
| zone_templ         |
| zone_templ_records |
| zones              |
+--------------------+

MariaDB [powerdns]> select * from domains;
+----+----------------------+--------+------------+--------+-----------------+---------+
| id | name                 | master | last_check | type   | notified_serial | account |
+----+----------------------+--------+------------+--------+-----------------+---------+
|  2 | example.com          | NULL   |       NULL | MASTER |            NULL | NULL    |
+----+----------------------+--------+------------+--------+-----------------+---------+

MariaDB [powerdns]> select * from records;
+----+-----------+------------------+------+--------------------------------------------------------------------------+-------+------+-------------+
| id | domain_id | name             | type | content                                                                  | ttl   | prio | change_date |
+----+-----------+------------------+------+--------------------------------------------------------------------------+-------+------+-------------+
|  5 |         2 | example.com      | SOA  | ns1.example.com noreply@example.com 2016012205 28800 7200 604800 86400   | 86400 |    0 |  1453430301 |
|  6 |         2 | example.com      | A    |                                                                          | 86400 |    0 |  1453430985 |
|  7 |         2 | mail.example.com | A    | 123.123.123.123                                                          | 86400 |    0 |  1453430985 |
|  8 |         2 | ns1.example.com  | A    | 123.123.123.123                                                          | 86400 |    0 |  1453430985 |
+----+-----------+------------------+------+--------------------------------------------------------------------------+-------+------+-------------+

探勘任何記錄的 DIG 輸出:

# dig @127.0.0.1
; <<>> DiG 9.9.4-RedHat-9.9.4-29.el7_2.1 <<>> @127.0.0.1
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 3023
;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1680
;; QUESTION SECTION:
;.                              IN      NS
;; Query time: 1 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Jan 22 18:10:21 EST 2016
;; MSG SIZE  rcvd: 28

PDNS 配置:

# nano /etc/pdns/pdns.conf:
setuid=pdns
setgid=pdns
launch=gmysql
gmysql-host=localhost
gmysql-user=powerdns
gmysql-password=lolololol
gmysql-dbname=powerdns

NETSTAT 輸出:

# netstat -tap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 localhost:cslistener    0.0.0.0:*               LISTEN      950/php-fpm: master
tcp        0      0 0.0.0.0:mysql           0.0.0.0:*               LISTEN      1783/mysqld
tcp        0      0 0.0.0.0:ndmp            0.0.0.0:*               LISTEN      2561/perl
tcp        0      0 0.0.0.0:domain          0.0.0.0:*               LISTEN      12283/pdns_server
tcp        0      0 0.0.0.0:8822            0.0.0.0:*               LISTEN      1233/sshd
tcp        0      0 localhost:smtp          0.0.0.0:*               LISTEN      1826/master
tcp6       0      0 [::]:http               [::]:*                  LISTEN      900/httpd
tcp6       0      0 [::]:8821               [::]:*                  LISTEN      15532/vsftpd
tcp6       0      0 [::]:8822               [::]:*                  LISTEN      1233/sshd
tcp6       0      0 localhost:smtp          [::]:*                  LISTEN      1826/master

# netstat -uap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
udp        0      0 0.0.0.0:ndmp            0.0.0.0:*                           2561/perl
udp        0      0 0.0.0.0:domain          0.0.0.0:*                           12283/pdns_server
udp        0      0 0.0.0.0:bootpc          0.0.0.0:*                           1028/dhclient
udp        0      0 localhost:323           0.0.0.0:*                           621/chronyd
udp        0      0 0.0.0.0:13651           0.0.0.0:*                           1028/dhclient
udp6       0      0 localhost:323           [::]:*                              621/chronyd
udp6       0      0 [::]:50691              [::]:*                              1028/dhclient

我設置了一個系統日誌伺服器來查看日誌並發現:Jan 23 18:15:09 s01 pdns

$$ 27536 $$:後端錯誤:GSQLBackend查找查詢:執行mysql_query失敗,也許連接死了?Err=1:“欄位列表”中的未知列“已禁用” 這導致建議使用的數據庫模式可能不正確。我刪除了所有表並從下面的這兩個頁面導入了部分 MySQL 模式,然後重新啟動了 pdns 服務,它可以工作了! https://github.com/poweradmin/poweradmin/blob/master/sql/poweradmin-mysql-db-structure.sql https://doc.powerdns.com/md/authoritative/installation/

引用自:https://unix.stackexchange.com/questions/257126