// If there is a firewall between you and nameservers you want // to talk to, you may need to fix the firewall to allow multiple // ports to talk. See http://www.kb.cert.org/vuls/id/800113
// If your ISP provided one or more IP addresses for stable // nameservers, you probably want to use them as forwarders. // Uncomment the following block, and insert the addresses replacing // the all-0's placeholder. # 设置递归查询 recursion yes; # 允许acl规则的主机递归查询 allow-recursion { trusted; }; # DNS转发器 forwarders { 202.96.134.133; 114.114.114.114; 223.5.5.5; 223.6.6.6; }; allow-transfer { none; }; //======================================================================== // If BIND logs error messages about the root key being expired, // you will need to update your keys. See https://www.isc.org/bind-keys //======================================================================== dnssec-validation auto; auth-nxdomain no; # conform to RFC1035 listen-on-v6 { any; }; };
dev@dns_server:/etc/bind$ cat named.conf.local // // Do any local configuration here //
// Consider adding the 1918 zones here, if they are not used in your // organization //include "/etc/bind/zones.rfc1918"; zone "test.com" { type master; file "/etc/bind/db.test.com"; }; zone "0.168.192.in-addr.arpa" { type master; file "/etc/bind/db.192.168.0"; };
说明:
named.conf.local: 用于配置正向和反向代理,此文件用于配置DNS Zone。
zone "test.com": 设定了DNS Zone的正向区域,指定DNS所用的域名为test.com
zone "0.168.192.in-addr.arpa" : 设定了DNS Zone的反向区域, 指定了IP地址的反写网段
dev@dns_server:/etc/bind$ cat db.test.com ; ; BIND data file forlocal loopback interface ; $TTL 604800 @ IN SOA test.com. root.test.com. ( 4 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS dns.test.com. test.com. IN A 192.168.1.10 dns.test.com. IN A 192.168.1.10 host.test.com. IN A 192.168.0.10
db.192.168.0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
dev@dns_server:/etc/bind$ cat db.192.168.0 ; ; BIND reverse data file forlocal loopback interface ; $TTL 604800 @ IN SOA test.com. root.test.com. ( 3 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS dns.test.com. 10 IN PTR test.com. 10 IN PTR dns.test.com. 100 IN PTR host.test.com.
dev@dns_server:/etc/bind$cat/etc/netplan/00-installer-config.yaml # This is the network config written by 'subiquity' network: ethernets: ens160: addresses: -192.168.1.10/23 gateway4:192.168.0.1 nameservers: addresses: -192.168.1.10# 修改此处,如有多个DNS,需将自建DNS放在第一位 search: [] version:2