The server was replaced by a previous arrayipfilter+ipnat+dhcp--freebsd5.4UnderIpfilter+ipnatPacket filtering, forwarding, andDhcpServer Schema Notes, but recently felt that the server will often drop the line, on the server to open aDnsCaching services, hoping to mitigate the current situation through caching.
First describes how to set up a high-speed DNS cache server on FreeBSD, citing the words in the FreeBSD 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.CurrentBINDByInternet Software Consortium http://www.isc.org/Maintenance.
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
3. 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.