怎样安装PowerDNS

2019年12月21日 | 分类: 【技术】

【环境】

环境:CentOS 7

源码:https://github.com/poweradmin/poweradmin

手册:https://doc.powerdns.com/md/authoritative/installation/

参考:https://www.cnblogs.com/weavepub/p/11152919.html
参考:https://www.cnblogs.com/anpengapple/p/5205130.html
参考:https://blog.csdn.net/MemoryOY/article/details/89252282
参考:https://cloud.tencent.com/developer/article/1098794

参考:https://guozeyu.com/2016/08/self-host-dns/
参考:https://guozeyu.com/2018/03/dnssec/

【安装】

安装 epel 源:

yum install epel-release -y
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y

安装 pdns-server:

yum install pdns -y

输出:

...
Installed:
  pdns.x86_64 0:4.1.11-1.el7

Dependency Installed:
  libsodium.x86_64 0:1.0.18-1.el7
...

安装 pdns-backend-$backend:

Backend 可以自选:常用的有 BIND 和 Generic MySQL ,需要 GEODNS 可以用 GEOIP ,所有列表见此。如果想做网页版控制后台,使用 MySQL 的可能比较方便。如果只是通过文件形式控制,那么 BIND 和 GEOIP 都可以。GEOIP 版本可拓展性强,使用 YAML 文件,更灵活、优雅,本文就讲讲 GEOIP 版本。

yum install pdns-backend-geoip -y

输出:

...
Installed:
  pdns-backend-geoip.x86_64 0:4.1.11-1.el7

Dependency Installed:
  yaml-cpp.x86_64 1:0.5.1-2.el7
...

安装 dnsdist:

配置用户侧 IP 访问速率。

yum install dnsdist -y

输出:

...
Installed:
  dnsdist.x86_64 0:1.3.3-1.el7

Dependency Installed:
  luajit.x86_64 0:2.0.4-3.el7           protobuf.x86_64 0:2.5.0-8.el7
...

安装 geoipupdate 并下载 GeoIP2:

MaxMind GeoIP Lite 数据库, Binary 格式。

下载:https://dev.maxmind.com/geoip/legacy/geolite/

为了实现分区解析,需要 GeoIP 数据库。最新版的 PowerDNS GeoIP Backend(4.2.0)已经支持了 GeoIP2 的 mmdb 格式,同时也支持 dat 格式。而老版的只支持 dat 格式的数据库。由于 MaxMind 已经停止维护免费的 dat 格式数据库,因此强烈建议使用 4.2 版本及以上的 PowerDNS 并换用 mmdb 格式的 IP 数据库。

首先建立配置文件,创建 /etc/GeoIP.conf 为如下内容(包含了 IPv4 和 IPv6 的国家、城市、ASN 数据):

ProductIds GeoLite2-Country GeoLite2-City GeoLite2-ASN
DatabaseDirectory /usr/share/GeoIP

安装 geoipupdate:

参考:https://github.com/maxmind/geoipupdate

安装路径:/usr/bin/geoipupdate.
配置文件路径:/etc/GeoIP.conf

rpm -i path/to/geoipupdate_4.0.0_linux_amd64.rpm

下载/更新 GeoIP2:

geoipupdate -v

输出:

geoipupdate 3.1.1
Opened License file /etc/GeoIP.conf
Insert edition_id GeoLite2-Country
Insert edition_id GeoLite2-City
Read in license key /etc/GeoIP.conf
Number of edition IDs 2
url: https://updates.maxmind.com/app/update_getfilename?product_id=GeoLite2-Country
md5hex_digest: 00000000000000000000000000000000
url: https://updates.maxmind.com/geoip/databases/GeoLite2-Country/update?db_md5=00000000000000000000000000000000
Uncompress file /usr/share/GeoIP/GeoLite2-Country.mmdb.gz to /usr/share/GeoIP/GeoLite2-Country.mmdb.test
Rename /usr/share/GeoIP/GeoLite2-Country.mmdb.test to /usr/share/GeoIP/GeoLite2-Country.mmdb
url: https://updates.maxmind.com/app/update_getfilename?product_id=GeoLite2-City
md5hex_digest: 00000000000000000000000000000000
url: https://updates.maxmind.com/geoip/databases/GeoLite2-City/update?db_md5=00000000000000000000000000000000
Uncompress file /usr/share/GeoIP/GeoLite2-City.mmdb.gz to /usr/share/GeoIP/GeoLite2-City.mmdb.test
Rename /usr/share/GeoIP/GeoLite2-City.mmdb.test to /usr/share/GeoIP/GeoLite2-City.mmdb

配置 Crontab 定期执行上面指令更新数据库文件(并重载 PowerDNS 服务),以更新 GeoIP 数据库。

配置 PowerDNS:

配置文件路径:

/etc/pdns/pdns.conf

首先删除 PowerDNS 原本的 demo 配置,然后建立文件夹以存储 DNSSEC 的密钥文件:

rm /etc/pdns/*
mkdir /etc/pdns/keys

创建 /etc/pdns/geoip.conf 为如下内容:

launch=geoip
geoip-database-files=/usr/share/GeoIP/GeoLite2-Country.mmdb /usr/share/GeoIP/GeoLite2-City.mmdb /usr/share/GeoIP/GeoLite2-ASN.mmdb
geoip-zones-file=/etc/pdns/zones.yaml
geoip-dnssec-keydir=/etc/pdns/keys

在 geoip-database 选项中,你可以按照需要设置自己所需要的一个或多个 GeoIP 数据库。

【部署(2)】

安装 dns主机_PowerDNS 与 管理接口_PowerAdmin

参考:http://www.howtoforge.com/installing-powerdns-with-mysql-backend-and-poweradmin-on-centos-5.2

【对标】

Bind

Bind是一款开放源码的DNS服务器软件,Bind由美国加州大学Berkeley分校开发和维护的,全名为Berkeley Internet Name Domain它是目前世界上使用最为广泛的DNS服务器软件,支持各种unix平台和windows平台。

官网:https://www.isc.org/downloads/BIND/
下载:ftp://ftp.isc.org/isc/bind9/

wddns

wddns是一套基于bind+mysql构建开发,web在线管理的智能DNS系统,安装方便,快速,让你可在最短时间内架构一套DNS/智能DNS系统.目前支持电信/网通/教肓网/移动/铁通/广电/按省份解析(31个省份)/搜索引擎蜘蛛等多线路,具有强大的监控功能,服务器健康检测,即宕机检测和切换,DNS服务器健康监控,宕机切换,防攻击检测,可选自动屏蔽攻击者IP,易扩展DNS服务器,数据自动同步等

参考:http://www.7edown.com/soft/down/soft_34110.html
参考:https://blog.csdn.net/h270768095/article/details/9317269
参考:http://www.laozuo.org/1993.html

【参考】

参考:http://www.laozuo.org/3924.html
参考:https://wenku.baidu.com/view/8cb117303968011ca3009187.html
参考:https://wenku.baidu.com/view/7fd5d83c67ec102de2bd8996.html
参考:http://www.ttlsa.com/tools/install-powerdns-on-linux/
参考:https://blog.csdn.net/u011608531/article/details/50756363
参考:http://static.oschina.net/p/powerdns/news
参考:https://www.v2ex.com/t/98618
参考:http://www.hostloc.com/thread-43077-1-94
参考:http://wenku.baidu.com/view/278f8ef6ba0d4a7302763a67
参考:http://www.mcqyy.com/wenku/jiaocheng/jzjc/wzyy/88990
参考:https://www.howtoing.com/installing-powerdns-with-mysql-backend-and-poweradmin-on-ubuntu-8.10/

参考:https://blog.csdn.net/jiangsd198/article/details/60780187

参考:https://linux.cn/article-5623-1.html
参考:https://linux.cn/article-5623-2.html
参考:https://linux.cn/article-5623-3.html

参考:https://itw01.com/VHT4EPO.html
参考:https://itw01.com/V9AIEHT.html