Build a free cache DNS server on the Centos Server

Source: Internet
Author: User
Tags centos server nameserver to domain

Tutorial Background:The company's current network environment is accessible to all users above the internet, and the DNS used is obtained through the DHCP server, the DNS address entered on the DHCP server is a registered DNS server on the Internet. But ainuo did not set up a DNS server. With the increase of business, employees of minuo company frequently access the internet. Due to domain name resolution problems, network congestion is often caused, in addition, employees often complain that the Webpage Browsing times out during work periods (peak hours. Now, the company requires Linux to build a cache-type DNS server to cache the websites frequently visited by employees and their corresponding IP addresses to the local DNS server. When an employee visits a website again, you only need to resolve the domain name on the local cache DNS server to reduce network congestion. To install cache-based DNS, you do not need to register it on the public network. You only need to cache the domain name resolution records you have queried. When you first query a domain name, the cache server queries domain names from other DNS servers and saves the query results in the cache. The cache server greatly improves the query speed of common domain names, so it is especially suitable for use within the lan. Its main purpose is to increase the speed of domain name resolution and save the egress bandwidth for Internet access.Tutorial steps:I,Install the Domain Name Service (BINDThe BIND package is the most widely used DNS Server Installation Package in Linux. It can run on most UNIX servers, including Linux systems. By default, the BIND server software package is not installed in RHEL4, but only the software packages related to domain name resolution are installed named bind-libs and bind-utils, the bind-libs software provides library files necessary to implement the domain name resolution function, and bing-utils provides a testing tool program for the DNS server. The RHEL4 system provides the RPM-format BIND server package, located in the 4th-Chapter optical drive, with the installation file named bind-9.2.4-2.i386.rpm. Because no default installation is performed, the administrator needs to use the rpm command for manual installation. The Service Program (SCRIPT) Name of the BIND server is named, which is not automatically started by default after the BIND server is installed, you need to use the chkconfig command to manually set the startup status at runtime Level 3 and 5. The main configuration file of the BIND server is named. conf, Which is saved in the "/etc" directory. This file is generated when the bind package is installed, not included in the package. The domain name region file on the BIND server must be saved in the working directory "/var/named/". After the bind package is installed, the directory contains two empty subdirectories, the administrator needs to save the region file of the DNS server in this directory. The database stores all the files in the primary region in the directory data, and all the regional files copied from the primary DNS are saved in slaves, which is read-only by default.II,Install caching-nameserverThe software package RHEL4 system providesCaching-nameserver software package, which is saved on the first installation disc, is not installed by default. You need to use the rpm command for manual installation. After the installation is complete,Caching-nameserver changes the content of the configuration file named. conf of the BIND server. The content in the original file is saved in the file "/etc/named. conf. rpmorig.

III,Analyze the configuration fileNamed. conf1, Named. confThe global setting directory in is used to set the working directory of the BIND server, that is, the directory saved by the domain name region file. The default value is "/var/named ". Dump-file is used to set the storage location and file name of the domain name cache file.2Root region settings and root region file root region are the beginning of all domain names on the internet, use periods (.) indicates that the cache server can only access the DNS root server to provide normal domain name resolution services. The configuration information is as follows: if type is set to hint, the type of the region is the root region. File is used to set the region file. The root region file name is name. ca. The file is saved in the BIND working directory, that is, the "/var/named" directory. The name. ca file contains the address resolution information of all DNS root servers used by the Internet worldwide. It is uniformly published by Internet management institutions, so you do not need to change the content. All configured region files are saved in "/var/named/" name. after the ca file is removed from the comment line, the content and form are as follows: the IP addresses and corresponding domain names of the 13 root DNS servers in China are displayed.3, LocalhosThe Localhost region is resolved between the host name localhost and the loopback address 127.0.0.1, which indicates the local host and can be used for Nic testing on the local host. The parameter description is as follows: typemaster indicates that the type of the region is the master server. File: Set the region name of the localhost domain to localhost. zonelocalhost. zone. The region file is localhost. zone. You can see that A record corresponds to 127.0.0.1.4, LocalhosIn the DNS region, the forward resolution of each region must have a corresponding reverse resolution region. The reverse resolution region is used to convert the IP address to the corresponding domain name.The content is as follows: the reverse resolution region of Localhost is 0.0.127.in-addr. arpa with the suffix ". in-addr.arpa "area are reverse resolution area, the name 0.0.127 is the IP address 127.0.0 inverted, such reverse resolution area name is named. the conventions in the conf configuration file. The type of the 0.0.127.in-addr. arpa region is master, that is, the master server. The name of the region file is named. local. The region file has the following content: In the named. local Region file, use the following record to set the host domain name corresponding to IP address 127.0.0.1 to localhost.IV,Start and test the cache Domain Name ServerThe caching-nameserver package can be started without any other configuration. As long as the DNS server can access the Internet, it will be able to use the thirteen root servers, domain name query by iteration.Start namedServer. Test the cache Domain Name Server, and test the forward resolution of localhost and reverse resolution of 127.0.0.1. If you can access the Internet, you can also test the forward and reverse resolution of a domain name on the network.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.