First describes how to establish a high-speed DNS cache server on FreeBSD, citing the words in the Freebs D Chinese Manual:
A cached domain name server is a domain name server that does not provide authoritative resolution for any domain. It simply completes the query itself and remembers the queries for subsequent use. To set up such a server, simply configure a domain name server as usual, without configuring the domain.
The installation is as follows:
The software used is bind, after the installation of freebsd6.0 bind is automatically installed, version of BIND9, the path is generally/etc/namedb. freebsd5.2 and earlier users can download BIND9.3 from the ISC website. Currently, BIND is maintained by the Internet Software Consortium http://www.isc.org/.
1. Create local DNS reverse resolution domain file
proxy4bak# Cd/etc/namedb
proxy4bak# SH make-localhost
The Localhost.rev file is generated under the/etc/namedb/master directory.
2. Edit the DNS configuration file/etc/namedb/named.conf
The contents are as follows:
options {
directory "/etc/namedb";
pid-file "/var/run/named/pid";
dump-file "/var/dump/named_dump.db";
statistics-file "/var/stats/named.stats";
// forwarders {
// 221.228.255.1; 218.2.135.1;
// };
};
zone "." {
type hint;
file "named.root";
};
zone "0.0.127.IN-ADDR.ARPA" {
type master;
file "master/localhost.rev";
};
Here I did not use forwarders (forwarding), in the FreeBSD Chinese manual there is such a phrase:
To benefit from a superior cache, you can enable forwarders at this point. In general, a domain name server queries the Internet to find a specific domain name server, until an answer is received. Enabling this will allow it to first query the superior domain name servers (or other provided domain name servers) to obtain results from their caches. If a higher-level DNS server is heavily loaded, enabling it on a faster domain name server will help improve service quality.
3. Change/etc/resolv.conf
Change the resolv.conf content to:
NameServer 127.0.0.1
4. Make named start
Edit/etc/rc.conf and add the startup content as follows:
proxy4bak# cd/etc
proxy4bak# ee rc.conf
Join
Named_enable= "YES"
Restart the server after the addition completes, and use the top command to see if the named process is started. You can also query a URL through the nslookup, if you can, the description of the cache has been established, the following display:
proxy4bak# nslookup
> set type=any
> www.google.com
Server: 127.0.0.1
Address: 127.0.0.1#53
Non-authoritative answer:
www.google.com canonical name = www.l.google.com.
Authoritative answers can be found from:
google.com nameserver = ns4.google.com.
google.com nameserver = ns1.google.com.
google.com nameserver = ns2.google.com.
google.com nameserver = ns3.google.com.
A DNS cache software--djbdns was also found when searching for related reference materials, and a friend was already using it. For convenience, I used bind directly, because the FreeBSD was installed when it was put on. But in the performance of specific still do not know which will be better.
The first time you set up a DNS cache server, note that there are errors written. Hopefully this note will be useful for friends who want to build a high-speed DNS cache server on a local area network.