파워dns 흔한 유지보수 메모

8720 단어

1. vcapple.com  dev.vpapple.com  qa.vpapple.com10.199 상기 DNS 데이터 수정을 역해석할 때 마스터만 수정할 수 있음(10.199.132.152)
2. 상기 도메인 이름 데이터가 수정되면 데이터는 자동으로 10.199.132.168(slave)과 10.199.129.21(slave)로 동기화됩니다.
3. 10.199.132.152(pdns,master) 10.199.132.168(pdns,slave)와 10.199.129.21(bind,slave)
4.10.199.132.152(pdns,master)10.199.132.168(pdns,slave)mysqlAB복제로 데이터 동기화
5. 도메인 이름 확인 데이터베이스에는 NS 레코드와 A 레코드, SOA 레코드가 필요합니다.
5.1 SOA가 고유 레코드
mysql> select domain_id, name, type, content from records where type='SOA';
+-----------+---------------------+------+----------------------------------------------------------------------------+
| domain_id | name                | type | content                                                                    |
+-----------+---------------------+------+----------------------------------------------------------------------------+
|         1 | vcapple.com         | SOA  | dns.vcapple.com dns.vcapple.com 201401104 28800 7200 604800 86400          |
|         2 | 199.10.in-addr.arpa | SOA  | dns.vcapple.com dns.vcapple.com 201401104 28800 7200 604800 86400          |
|         5 | qa.vpapple.com      | SOA  | dns.qa.vpapple.com dns.qa.vpapple.com 2014013002 28800 7200 604800 86400   |
|         6 | dev.vpapple.com     | SOA  | dns.dev.vpapple.com dns.dev.vpapple.com 2014013002 28800 7200 604800 86400 |
+-----------+---------------------+------+----------------------------------------------------------------------------+
4 rows in set (0.00 sec)

5.2 NS 레코드에는 모든 DNS 서버 레코드가 포함되어야 합니다.
mysql> select domain_id, name,type, content from records where type='NS' and name='vcapple.com';
+-----------+-------------+------+----------------------------------+
| domain_id | name        | type | content                          |
+-----------+-------------+------+----------------------------------+
|         1 | vcapple.com | NS   | dns.vcapple.com                  |
|         1 | vcapple.com | NS   | dns-slave.vcapple.com            |
|         1 | vcapple.com | NS   | hh-yun-puppet-129021.vcapple.com |
+-----------+-------------+------+----------------------------------+
3 rows in set (0.00 sec)

mysql> select domain_id, name, type, content from recordswhere type='NS' and name='199.10.in-addr.arpa';
+-----------+---------------------+------+----------------------------------+
| domain_id | name                | type | content                          |
+-----------+---------------------+------+----------------------------------+
|         2 | 199.10.in-addr.arpa | NS   | dns.vcapple.com                  |
|         2 | 199.10.in-addr.arpa | NS   | dns-slave.vcapple.com            |
|         2 | 199.10.in-addr.arpa | NS   | hh-yun-puppet-129021.vcapple.com |
+-----------+---------------------+------+----------------------------------+
3 rows in set (0.00 sec)

5.3 도메인 이름에 해당하는 DNS 서버 레코드를 입력해야 합니다.
mysql> select domain_id, name, type, content, ttl from records where type='A' and name='vcapple.com';
+-----------+-------------+------+----------------+------+
| domain_id | name        | type | content        | ttl  |
+-----------+-------------+------+----------------+------+
|         1 | vcapple.com | A    | 10.199.132.152 |  360 |
|         1 | vcapple.com | A    | 10.199.132.168 |  360 |
|         1 | vcapple.com | A    | 10.199.129.21  |  360 |
+-----------+-------------+------+----------------+------+
3 rows in set (0.00 sec)

5.4 위 호스트의 A 레코드가 있어야 하며 PTR 레코드가 권장됨
mysql> select id, domain_id, name, type, content, ttl from records where type='A' and name in ( 'dns.vcapple.com', 'dns-slave.vcapple.com', 'hh-yun-puppet-129021.vcapple.com');
+------+-----------+----------------------------------+------+----------------+------+
| id   | domain_id | name                             | type | content        | ttl  |
+------+-----------+----------------------------------+------+----------------+------+
| 5407 |         1 | dns-slave.vcapple.com            | A    | 10.199.132.168 | 3306 |
| 3965 |         1 | dns.vcapple.com                  | A    | 10.199.132.152 |  360 |
| 3672 |         1 | hh-yun-puppet-129021.vcapple.com | A    | 10.199.129.21  |  360 |
+------+-----------+----------------------------------+------+----------------+------+
3 rows in set (0.00 sec)

5.5 하위 도메인에 대한 재권한 필요
mysql> select id, domain_id, name, type, content, ttl from records where domain_id=1 and type='NS';
+------+-----------+-----------------+------+----------------------------------+------+
| id   | domain_id | name            | type | content                          | ttl  |
+------+-----------+-----------------+------+----------------------------------+------+
| 3962 |         1 | vcapple.com     | NS   | dns.vcapple.com                  | 360  |
| 5404 |         1 | vcapple.com     | NS   | dns-slave.vcapple.com            | 3306 |
| 5418 |         1 | vcapple.com     | NS   | hh-yun-puppet-129021.vcapple.com |  360 |
| 5441 |         1 | dev.vcapple.com | NS   | dns.dev.vcapple.com              |  360 |  <-  
+------+-----------+-----------------+------+----------------------------------+------+
4 rows in set (0.00 sec)

6. PDNS의 새 버전이 검증되어야만 알림bind가 dns 데이터 자동 업데이트를 지원합니다
[root@pdns-8tedp ~]# rpm -qa | grep pdns
pdns-static-3.4.1-1.x86_64

구성 요약 설명
[root@pdns-8tedp ~]# cat /etc/powerdns/pdns.conf | grep -v "#" | grep -v ^$

allow-axfr-ips=10.199.196.233,10.199.129.21
allow-recursion=10.199.196.233,10.199.129.21
also-notify=10.199.196.233,10.199.129.21    <--  ,  
daemon=yes
launch=gmysql
gmysql-host=127.0.0.1
gmysql-port=3306
gmysql-user=pdns
gmysql-dbname=pdns
gmysql-password=vipshop
guardian=yes
master=yes
recursor=10.199.129.21

참조 테스트 데이터베이스
mysql> select * from domains;
+----+-----------+--------+------------+--------+-----------------+---------+
| id | name      | master | last_check | type   | notified_serial | account |
+----+-----------+--------+------------+--------+-----------------+---------+
|  1 | terry.com | NULL   |       NULL | MASTER |               4 | NULL    |
+----+-----------+--------+------------+--------+-----------------+---------+
1 row in set (0.00 sec)


mysql> select * from records;
+----+-----------+-----------------+------+--------------------------------------------------------+------+------+-------------+----------+-----------+------+
| id | domain_id | name            | type | content                                                | ttl  | prio | change_date | disabled | ordername | auth |
+----+-----------+-----------------+------+--------------------------------------------------------+------+------+-------------+----------+-----------+------+
|  1 |         1 | terry.com       | NS   | dns.terry.com                                          | 3360 | NULL |        NULL |        0 | NULL      |    1 |
|  3 |         1 | dns.terry.com   | A    | 10.199.197.19                                          | 3360 | NULL |        NULL |        0 | NULL      |    1 |
|  4 |         1 | terry.com       | NS   | slave.terry.com                                        | 3360 | NULL |        NULL |        0 | NULL      |    1 |
|  5 |         1 | slave.terry.com | A    | 10.199.196.233                                         | 3360 | NULL |        NULL |        0 | NULL      |    1 |
|  6 |         1 | ttt.terry.com   | A    | 5.5.5.5                                                | 3360 | NULL |        NULL |        0 | NULL      |    1 |
|  7 |         1 | terry.com       | SOA  | dns.terry.com admin.terry.com 4 10800 3600 604800 3600 | 3360 |    0 |        NULL |        0 | NULL      |    1 |
+----+-----------+-----------------+------+--------------------------------------------------------+------+------+-------------+----------+-----------+------+
6 rows in set (0.00 sec)

매번 DNS 업데이트를 실행할 때마다 soa 업데이트를 실행해야 합니다
soa값은 위domains표에서 notifiedserial 열의 값(select notified serial from domains where name='terry.com';
SOA를 업데이트하는 방법은 다음과 같습니다. 다음 키워드를 새 SOA 로 바꾸십시오.NUM, 가장 일반적인 새로운 SOA는 이전 숫자 +1 작업입니다.
select notified_serial +1 from domains where name='terry.com'
update records set content='dns.terry.com admin.terry.com  SOA_NUM 10800 3600 604800 3600' where name='terry.com' and type='SOA';



좋은 웹페이지 즐겨찾기