采用bind9,作为DNS服务。
Debian官方WIKI
apt-get install -y bind9 dnsutils
主要的配置文件在下边
options { directory "/var/cache/bind"; // IPV4的监听端口和地址,127.0.0.1, localhost只能用于本机使用。 listen-on port 53 { 10.1.1.10; }; // 允许那些机器方位DNS,any为所有机器都能访问。 allow-query { any; }; // 节省资源,关闭验证 // 不做互联网认证 dnssec-validation no; dnssec-enable no; recursion yes; // 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. // 转发的上级DNS的IP forwarders { 10.1.1.254; }; // 设置允许进行递归查询的ip地址列表,缺省值是允许所有地址进行查询,需要注意的是当设置了不允许递归查询后,如果仍然能够查询部分外部的域名,那是因为dns的缓存在起作用,将缓存清除以后就可以了。 //allow-recursion { internals; }; //======================================================================== // 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 //======================================================================== // ipv6监听 // listen-on-v6 { any; }; };