智能DNS
本文实现了 内网 DNS 解析到内网地址
-
安装bind9
dnf install bind9
-
修改配置
/etc/bind/named.conf// This is the primary configuration file for the BIND DNS server named. // // Please read /usr/share/doc/bind9/README.Debian for information on the // structure of BIND configuration files in Debian, *BEFORE* you customize // this configuration file. // // If you are just adding zones, please do that in /etc/bind/named.conf.local include "/etc/bind/named.conf.options"; include "/etc/bind/named.conf.local"; // include "/etc/bind/named.conf.default-zones";
/etc/bind/named.conf.localacl "internal-net" { 192.168.31.0/24; }; view "internal" { match-clients { "internal-net"; }; recursion yes; allow-recursion { "internal-net"; }; zone "devcxl.cn" { type master; file "/etc/bind/zones/db.devcxl.cn.internal"; }; include "/etc/bind/named.conf.default-zones"; }; view "external" { match-clients { any; }; recursion no; include "/etc/bind/named.conf.default-zones"; };
/etc/bind/zones/db.devcxl.cn.internal$TTL 86400 @ IN SOA ns.devcxl.cn. admin.devcxl.cn. ( 2024052001 ; Serial 3600 ; Refresh 1800 ; Retry 604800 ; Expire 86400 ) ; Minimum IN NS ns.devcxl.cn. ns IN A 192.168.31.177 admin IN A 192.168.31.127 console IN A 192.168.31.137 monitor IN A 192.168.31.147
-
自启动
systemctl enable --now bind9.service
-
路由器设置DNS为安装bind9的地址
参考资料
- https://cloud.tencent.com/developer/article/1411439
- https://developer.aliyun.com/article/472317
- https://help.aliyun.com/zh/dns/intelligent-dns-resolution#p-6bb-dpe-3pc
- https://www.cnblogs.com/xymhappy/p/15304154.html
- https://github.com/acmesh-official/acme.sh?tab=readme-ov-file
- https://github.com/acmesh-official/acme.sh/wiki/dnsapi#dns_ali
- https://www.cnblogs.com/heidsoft/p/7686148.html
- https://www.zytrax.com/books/dns/ch7/view.html
- https://www.modb.pro/db/128851
- https://e-mailky.github.io/2018-07-14-dnsmasq