Introduction DNS is the Domain Name System, which can convert a domain name such as www.haoxiai.net to an IP address such as 211.152.50.35. Without DNS, you must use 211.2152.50.35 when browsing the 21php.com website. So hard to remember the numbers to visit. It is the DNS server that provides DNS services. The DNS server can be divided into three types, a cache server (Cache-only server), a primary server (Primary Name server), and a secondary server (Second Name Server).
The detailed principles, workflows, terminology, and concepts of DNS are limited by space, so I won't say it here. You can read a special article, such as DNS-HOWTO to understand.
2Configure the primary DNS server
First, we make the following assumptions: The A server is the primary domain name server of 21php.com, its IP address is 11.0.0.1, and the B server is the assistant of 21php.com. The domain name server, its IP address is 11.0.0.2;
Below we configure the server 11.0.0.1 as the primary DNS server of 21PHP.COM
The dns function under Linux is implemented by bind software. After the bind software is installed, several intrinsic files are generated, which are divided into two categories. One is the configuration file in the /etc directory, and the other is the dns record file in the /var/named directory. Together with other related documents, set up the dns server together. Below is a list and description of all the files related to the dns settings.
Located in the /etc directory are: hosts, host.conf, resolv.conf, named.boot, named.conf.
1, "hosts", file, defines the correspondence between the host name and ip address, which also has the ip address and host name of the computer that will run dns. Content:
127.0.0.1 localhost.localdomain localhost
2, “host.conf” file [Boban Note: originally mistakenly written as hosts.conf], "order hosts bind" statement, The order in which the host names are resolved is first searched in the hosts, and then found in the records of the dns server. “multi on" is to allow a host name to correspond to multiple ip addresses. Content:
order hosts, bind
multi on
nospoof on
3,“resolv.conf”file,“nameserver 10.0.0.211 ” specifies the address of the dns server. Note that this file is essential for normal non-dns server computers (non-windows systems; Windows systems are set up in "Network Properties"). If you have not set up this machine as a dns server, and you have to be able to resolve the domain name, you must specify the address of a dns server. You can write up to three addresses as a candidate dns server for the previous failure. “domain zrs.com” specifies the default domain. File Content:
domain 21php.com
nameserver 11.0.0.1
4,“named.boot” file is the configuration file used by the earlier version of the bind software, now The new version has given way to “named.conf”. Named.conf is the core file of the dns server configuration. Let's explain it for a while.
# named.conf - configuration for bind
#
# Generated automatically by bindconf, alchemist et al.
controls {
inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
include "/etc/rndc.key";options {
directory "/var/named/";
};
zone "." {
type hint;
file "named .ca";
};
zone "0.0.127.in-addr.arpa" {
type master;
file " 0.0.127.in-addr.arpa.zone";
};
zone "localhost" {
type master;
file " ;localhost.zone";
};
zone "21php.com" {
type master;
notify yes;
file "21php.com";
};
The above # is a comment symbol, and the other lines have the following meanings:
direto Ry /var/named
Specify named to read DNS data files from the /var/named directory. This directory can be specified and created by the user. All specified DNS data files are stored. In this directory;
zone "." {
type hint;
file "named.ca";
};< Br>
Specifies that named gets the top level of the Internet from the named.ca file.
zone "0.0.127.in-addr.arpa" {
type master;
file "0.0.127.in-addr.arpa.zone" ;
};
Specify named as the 127.0.0 network segment address translation master server, the named.local file contains the conversion data from the address to the domain name of 127.0.0.* (127.0) .0 network segment address is the internal loopback address of the LAN interface);
zone "localhost" {
type master;
file "localhost.zone";< Br>
};
Specify DNS file data containing localhost to be stored in /var/named/localhost.zone;
zone "21php.com" {
type master;
notify yes;
file "21php.com.zone";
};
The above statement indicates the domain 21php. The com DNS data is stored in 21php.com.zone in the /var/named/directory;
We can open /var/named/21php.com.zone with a text editor, the contents of which are as follows: Br>
$TTL 86400 @ IN SOA @ root.localhost (
2 ;serial
28800 ;refresh
7200 ;retry
604800 ;expire
86400 ;ttl
)
@ IN NS localhost
www IN A 11.0.0.233
www2 IN A 11.0.0.23
forum IN A 11.0.0.10
@ IN MX 5 mail.21php.com.
The first part of the file is the corresponding parameter settings, this part does not need to be changed, the latter part is the specific DNS data;
For example: < Br>
www IN A 11.0.0.233
Resolve www.21php.com to address 11.0.0.233;
www2 IN A 11.0.0.23
will be www2 .21php.com resolves to address 11.0.0.23;
club IN A 11.0.0.10
resolves club.21php.com to address 11.0.0.10;
3 configuration Secondary DNS Server
Configure Server 11.05.2 as 21php.com Secondary dns Server
A secondary DNS server that can transfer a complete set of domain information from the primary server. The zone file is transferred from the primary server and stored as a local disk file on the secondary server. There is a full copy of the domain information in the secondary server, so it is also possible to answer queries for this domain. The configuration of this part is as follows:
zone "21php.com" IN {
type slave;
file "21php.com.zone";
masters { 11.0.0.1; };
};
As you can see, the difference from the primary DNS server is: "type” changed to “slave”, then specified The address of the primary DNS server “masters { 11.0.0.1; };”. When the DNS service starts, it will automatically connect to 11.0.0.1, read the information of the 21php.com domain, and save it to the 21php.com.zone file of this machine.
4Test DNS Server
Change the corresponding file of DNS, restart the service with the “ndc restart” command, use the command in redhat 7.1 or later:
/Etc/rc.d/init.d/named restart
or
/etc/rc.d/init.d/named reload
Make the changes take effect.
To test DNS, you can find a client, set its DNS address to the newly created DNS server address, and then try to access the Internet, receive, download, and so on. You can also use the nslookup command: run nslookup, enter the host name to be queried to see if it returns the correct ip address, and use the dig command in redhat 7.1 or later.
For systems on the Internet, it is important to be clear about the situation: the network is not se
The reverse proxy can be divided into two types from the transmission: 1: synchronous mode (apache-
Today, I have brought the steps of adding static routes for Linux, I hope to help my friends! 1. Add
Devil-Linux is a special Linux distribution for firewalls and routers. The goal of Devil-Linux is to
Live555 can't get ip address solution under LINUX
Solve the system problem accurately Linux log management
Introduction to MTD/CFI driver under Linux system
Tip: Generate crypt encrypted passwords under Linux
CentOS configuration ssh system technology
Solaris performance optimization experience summary
AMH VPS control panel always fails to log in. The password is not registered.
Analysis of differences between Unix and Linux operating systems
Linux uses the ping command to return the solution of Operation not permitted
Nginx reverse proxy implementation of two ways of session retention
WinXP system optimization acceleration three secrets
How to use the JS script in the win7 Ultimate system to shut down
Uncover the mystery of the Windows system folder
Windows 10 installation fails and there is no prompt for other information. Causes and solutions
Teach you how to manually create a Windows 8 start menu?
DNF female judo brush map how to add points DNF female judo violent brush map plus snacks to share
How to use the maintenance wizard to perform regular maintenance on the system
Win8 system to modify the user's avatar prompts the user's avatar error reason and solution