Database Connection Method
[root@gd02-qa-plxt2-nodomain /]# mysql -u vipdns -pvipdns -h 10.0.3.99mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || pdns |+--------------------+2 rows in set (0.00 sec)
Note:
-U specified user name (vipdns)
-P password (vipdns)
-H specifies the host (10.0.3.99)
Default port 3306
Table Information
mysql> show tables;+--------------------+| Tables_in_pdns |+--------------------+| cryptokeys || domainmetadata || domains || perm_items || perm_templ || perm_templ_items || records || supermasters || tsigkeys || users || zone_templ || zone_templ_records || zones |+--------------------+13 rows in set (0.00 sec)
Important: domain table records table
Domain table structure
mysql> desc domains;+-----------------+--------------+------+-----+---------+----------------+| Field | Type | Null | Key | Default | Extra |+-----------------+--------------+------+-----+---------+----------------+| id | int(11) | NO | PRI | NULL | auto_increment || name | varchar(255) | NO | UNI | NULL | || master | varchar(128) | YES | | NULL | || last_check | int(11) | YES | | NULL | || type | varchar(6) | NO | | NULL | || notified_serial | int(11) | YES | | NULL | || account | varchar(40) | YES | | NULL | |+-----------------+--------------+------+-----+---------+----------------+7 rows in set (0.01 sec)
Data in the current domains table
mysql> select * from domains;+----+---------------------+--------+------------+--------+-----------------+---------+| id | name | master | last_check | type | notified_serial | account |+----+---------------------+--------+------------+--------+-----------------+---------+| 1 | vclound.com | NULL | NULL | MASTER | NULL | NULL || 2 | 3.0.10.in-addr.arpa | NULL | NULL | MASTER | NULL | NULL |+----+---------------------+--------+------------+--------+-----------------+---------+2 rows in set (0.00 sec)
Note:
Id-primary key name-domain name (two already added). First, check vclound.com master-unknown last_check-unknown type-whether the MASTER Domain Server is used (generally only one DNS is used as the master) notified_serial-Modify version information account-Unknown
Add a 163.com domain name and call an SQL example
insert into pdns.domains (name, type) values ( '163.com', 'MASTER');
Update, delete, (omitted)
Records table structure
+-------------+--------------+------+-----+---------+----------------+| Field | Type | Null | Key | Default | Extra |+-------------+--------------+------+-----+---------+----------------+| id | int(11) | NO | PRI | NULL | auto_increment || domain_id | int(11) | YES | MUL | NULL | || name | varchar(255) | YES | MUL | NULL | || type | varchar(10) | YES | | NULL | || content | mediumtext | YES | | NULL | || ttl | int(11) | YES | | NULL | || prio | int(11) | YES | | NULL | || change_date | int(11) | YES | | NULL | || ordername | varchar(255) | YES | | NULL | || auth | tinyint(1) | YES | | NULL | |+-------------+--------------+------+-----+---------+----------------+10 rows in set (0.00 sec)
Note: records. domain_id is the foreign key of domains.
Table description
Id-primary key domain_id-domains table (id) foreign key name-domain name (vclound.com), forward resolution (ddns.vcloudn.com), reverse resolution Host name (105.3.0.10.in-addr. arpa) type-Description of the name field, such as (SOA [dns domain name) A [forward resolution] PTR [reverse resolution], MX [email server], the CNAME [host alias] field must be capitalized. The DNS resolution corresponding to the content-definition name [This is complicated when the type is SOA, however, you can refer to the current variable value as a fixed value] In ttl-cache, it can be used as a fixed value prio-priority level, ignoring change_date-timestamp ordername-ignoring auth-Unknown
Forward parsing data in the current form
mysql> select id, name, type, content, ttl, change_date from records where domain_id=1;+----+---------------------+------+----------------------------------------------------------------------+-------+-------------+| id | name | type | content | ttl | change_date |+----+---------------------+------+----------------------------------------------------------------------+-------+-------------+| 1 | vclound.com | SOA | ddns.vclound.com ddns.vclound.com 2014013003 28800 7200 604800 86400 | 86400 | 1391015078 || 4 | pdnsweb.vclound.com | A | 10.0.3.103 | 86400 | 1391015359 || 5 | pdns.vclound.com | A | 10.0.3.99 | 86400 | 1391015379 || 6 | pdnsdb.vclound.com | A | 10.0.3.99 | 86400 | 1391015391 |+----+---------------------+------+----------------------------------------------------------------------+-------+-------------+
Reverse parsing data
mysql> select id, name, type, content, ttl, change_date from records where domain_id=2;+----+-------------------------+------+----------------------------------------------------------------------+-------+-------------+| id | name | type | content | ttl | change_date |+----+-------------------------+------+----------------------------------------------------------------------+-------+-------------+| 2 | 3.0.10.in-addr.arpa | SOA | ddns.vclound.com ddns.vclound.com 2014013002 28800 7200 604800 86400 | 86400 | 1391015099 || 3 | 99.3.0.10.in-addr.arpa | PTR | pdnsdb.vclound.com | 86400 | 1391015270 || 7 | 103.3.0.10.in-addr.arpa | PTR | pdnsweb.vcloud.com | 86400 | 1391018671 |+----+-------------------------+------+----------------------------------------------------------------------+-------+-------------+3 rows in set (0.00 sec)
Simulate the forward resolution method for adding 163.com
This is a Domain Name Record
insert into records (name, type, content, ttl, change_date) values ('163.com, 'SOA', 'dns.163.com dns.163.com 2014013002 28800 7200 604800 86400', '86400');
This is the host name record.
insert into records (name, type, content, ttl, change_date) values ('dns.163.com, 'A', '192.168.0.1', '86400');insert into records (name, type, content, ttl, change_date) values ('www.163.com, 'A', '192.168.0.2', '86400');
In this way, you can add two host records.
Similarly, remember that the domain name is 0.168.192.in-addr. arpa.
Verify dns method
/Etc/resolv. conf
Nameserver 10.0.3.99 <-must point to him
[root@gd02-qa-plxt2-nodomain /]# nslookup vclound.comServer: 10.0.3.99Address: 10.0.3.99#53*** Can't find vclound.com: No answer[root@gd02-qa-plxt2-nodomain /]# nslookup pdnsweb.vclound.comServer: 10.0.3.99Address: 10.0.3.99#53Name: pdnsweb.vclound.comAddress: 10.0.3.103[root@gd02-qa-plxt2-nodomain /]# nslookup pdnsdb.vclound.comServer: 10.0.3.99Address: 10.0.3.99#53Name: pdnsdb.vclound.comAddress: 10.0.3.99
For more information, see the preceding example. Note: domain names cannot be resolved directly.
Refer to reverse resolution examples
[root@gd02-qa-plxt2-nodomain /]# nslookup 10.0.3.99Server: 10.0.3.99Address: 10.0.3.99#5399.3.0.10.in-addr.arpa name = pdnsdb.vclound.com.[root@gd02-qa-plxt2-nodomain /]# nslookup 10.0.3.103Server: 10.0.3.99Address: 10.0.3.99#53103.3.0.10.in-addr.arpa name = pdnsweb.vcloud.com.