Bind version: bind-9.9.5
Main: 192.169.1.100
From: 192.169.1.101
Tar zxvf bind-9.9.5.tar.gz
CD bind-9.9.5
./configure--prefix=/usr/local/named--enable-epoll--enable-threads--enable-ipv6--disable-openssl-version-check --enable-backtrace--enable-symtable
Make && make install
To start configuring BIND, the next step is to have RNDC manage bind
Create a rndc.conf file and use bind to generate it with your own program
Enter the/USR/LOCAL/NAMED/ETC and generate rndc.conf and named.conf
Cd/usr/local/named
/usr/local/named/sbin/rndc-confgen >/usr/local/named/etc/rndc.conf
The key information in the rndc.conf is exported to the named.conf
CD etc/
Tail-10 rndc.conf | head-9 | Sed-e s/#//g > named.conf
# #rndc. The key value for Conf and named.conf must be exactly the same and does not need to generate Rndc.key
VI Named.conf added at the back
Options {
Directory "/USR/LOCAL/NAMED/ETC";
Version "Guess";
Allow-transfer {192.169.1.101;};
Pid-file "/var/run/named.pid";
Recursion No;
Notify explicit;
also-notify {
192.169.1.101;
};
};
Zone "." {
Type hint;
File "named.ca";
};
Zone "0.0.127.in-addr. ARPA "{
Type master;
File "Localhost.rev";
};
RFC 3152
Zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6. ARPA "{
Type master;
File "Localhost-v6.rev";
};
RFC 1886--deprecated
Zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.int" {
Type master;
File "Localhost-v6.rev";
};
Zone "Wangzhe.me" {
Type master;
File "Wangzhe.me.zone";
};
Import information from the root server into the/usr/local/named/etc/named.ca file
Dig-t NS. >/usr/local/named/var/named/named.ca
Start bind to test if the installation is successful
/usr/local/named/sbin/named-gc/usr/local/named/etc/named.conf &
-GC parameter, you can display the startup log so that the error
If the last line of the run results shows running
Indicates that the installation and startup succeeded.
Test RNDC Command
[Root@ns1 etc]#/USR/LOCAL/NAMED/SBIN/RNDC Status
version:9.9.5 (Guess)
CPUs Found:8
Worker Threads:8
UDP listeners per Interface:8
Number of Zones:13
Debug level:0
Xfers running:0
Xfers deferred:0
SOA queries in progress:0
Query logging is off
Recursive clients:0/0/1000
TCP clients:0/100
The server is up and running
Add named to the startup entry and start with the operating system.
echo "/usr/local/named/sbin/named-c/usr/local/named/etc/named.conf&" >>/etc/rc.local
############ #从dns配置
Compile installation, generate rndc.conf, and named.conf and master library operations
VI Named.conf added at the back
Options {
Version "Guess";
Allow-transfer {none;};
Directory "/USR/LOCAL/NAMED/ETC";
Dump-file "/usr/local/named/var/cache_dump.db";
Statistics-file "/usr/local/named/var/named_stats.txt";
Memstatistics-file "/usr/local/named/var/named_mem_stats.txt";
allow-query {any;};
Recursion No;
Dnssec-enable No;
Dnssec-validation No;
};
Logging {
Channel Default_debug {
File "Named.run";
Severity dynamic;
};
};
Zone "." in {
Type hint;
File "named.ca";
};
Zone "Localhost.localdomain" in {
Type master;
File "Named.localhost";
allow-update {none;};
};
Zone "localhost" in {
Type master;
File "Named.localhost";
allow-update {none;};
};
Zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" in {
Type master;
File "Named.loopback";
allow-update {none;};
};
Zone "1.0.0.127.in-addr.arpa" in {
Type master;
File "Named.loopback";
allow-update {none;};
};
Zone "0.in-addr.arpa" in {
Type master;
File "Named.empty";
allow-update {none;};
};
Zone "Wangzhe.me" {
Type slave;
File "Slaves/wangzhe.me.zone";
Masters {192.168.1.100;};
};
Attention:
If you need to allow external queries on this DNS, you will need to add a named.conf inside options
allow-query {any;};
The specific style is
Options {
allow-query {any;};
Directory "/usr/local/named/var/named";
};
Start bind to test if the installation is successful
/usr/local/named/sbin/named-gc/usr/local/named/etc/named.conf &
-GC parameter, you can display the startup log so that the error
If the last line of the run results shows running
Indicates that the installation and startup succeeded. Success automatically synchronizes data
Test RNDC Command
[Root@ns1 etc]#/USR/LOCAL/NAMED/SBIN/RNDC Status
version:9.9.5 (Guess)
CPUs Found:8
Worker Threads:8
UDP listeners per Interface:8
Number of Zones:13
Debug level:0
Xfers running:0
Xfers deferred:0
SOA queries in progress:0
Query logging is off
Recursive clients:0/0/1000
TCP clients:0/100
The server is up and running
Add named to the startup entry and start with the operating system.
echo "/usr/local/named/sbin/named-c/usr/local/named/etc/named.conf&" >>/etc/rc.local
Idea:
The file type for the primary domain name server that was successfully obtained from the domain name server is inconsistent with the following:
File type for primary zone: Chinadaily.com.cn.zone:ASCII text
From the type of the zone file: Chinadaily.com.cn.zone:data
Bind9 default is so designed, the main zone with the text file, from the zone with the data file (bind official saying is RAW format), so from the zone file directly view are garbled,
If you want to check from the zone configuration file can be like this:
Sbin/named-compilezone-s relative-f raw-f text-o-abc.com Etc/cnc/abc.com.zone
The last line is OK to say that the zone file is fine.
-F is used to indicate the format of the zone from (altogether 2 kinds: text and raw, the garbled one is the raw format)
-F is used to indicate the format of the output after conversion
-O is used to indicate in which file the conversion is finished, followed by-the expression is finished directly in the standard output display
-S is used to specify the output style (2: Full---Convenient for scripting styles; relative---Convenient for manual processing or reading styles)
And the official website said that the reason for this design is because data is more efficient than text processing.