安装powerdns 并做IP反向解析
把ns.xx.com 域名A记录到本机安装powerdns的公网IP
系统debian11
apt update
apt install mariadb-server
apt install pdns-server pdns-backend-mysql
mysql -u root -p
CREATE DATABASE powerdns;
CREATE USER ‘pdns’@’localhost’ IDENTIFIED BY ‘your_password_here’;
GRANT ALL PRIVILEGES ON powerdns.* TO ‘pdns’@’localhost’;
FLUSH PRIVILEGES;
USE powerdns;
source /usr/share/doc/pdns-backend-mysql/schema.mysql.sql;
ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘NEW_PASSWORD’; //修改root密码
FLUSH PRIVILEGES;
exit;
nano /etc/powerdns/pdns.conf
如果不存在,请添加:
launch=gmysql
gmysql-host=localhost
gmysql-user=pdns
gmysql-password=your_password_here
gmysql-dbname=powerdns
启动服务
systemctl restart pdns
IP反向解析;
IP地址写法:去掉IP地址最后一位并反写,最后加上.in-addr.arpa
例如:10.3.2.0/24 要写成 2.3.10.in-addr.arpa
新增IP区域
pdnsutil create-zone 2.3.10.in-addr.arpa
给IP区域加记录
例如将 10.3.2.99 指向 xx.xx.com
pdnsutil add-record 2.3.10.in-addr.arpa 99 PTR xx.xx.com
验证命令
dig -x 10.3.2.99 @127.0.0.1