Get the App
SLTechnology News&Howtos  ›  Servers  › 

CentOS 7.2Building DNS

Shulou Source: shulou.com Published: 2022-06-02 07:36:42 11月12日 Update

Download bind from ISC's official website www.isc.org

Note that there are three versions to choose from: early development version (Early Deployment), stable version (Current-Stable), stable version with extended features (Current-Stable, ESV). If there is no special need, stable version is recommended. The latest version is 9.10.6.

Download the source package: bind-9.10.6.tar.gz

Extract and enter the bind-9.10.6 directory

Compile and install. / configure-- enable-largefile-- enable-threads-- bindir=/bin-- sbindir=/sbin

Make & & make install

If there is no configuration file at the time of compilation and installation, you need to create it yourself.

The configuration file of vim / etc/named.conf bind is under / etc by default, and the file name is named.conf.

Options {

Directory "/ var/named"; # data file location

Pid-file "named.pid"

Recursive-clients 100000000; # how many user queries are run

Version "What do u wanna?"; # masked version

Allow-query {any;}; # run all user queries

Recursion yes; # uses recursive queries

# forward only

# forwarders {219.141.136.10;}

}

Key "rndc-key" {

Algorithm hmac-md5

Secret "RE4+Tk2AUXDjs2ns4Zox8w=="

}

Controls {

Inet 127.0.0.1 port 953

Allow {127.0.0.1;} keys {"rndc-key";}

}

Logging {

Channel query_log {

File "query.log" versions 3 size 20m

Severity info

Print-time yes

Print-category yes

}

Category queries {

Query_log

}

Category edns-disabled {null;}

Category lame-servers {null;}

}

Zone "." IN {

Type hint

File "named.ca"

}

Zone "localhost" IN {

Type master

File "localhost.zone"

Allow-update {none;}

}

Zone "0.0.127.in-addr.arpa" IN {

Type master

File "named.local"

Allow-update {none;}

}

# include "/ var/named/ws.conf"

The configuration in red is generated by the rndc-confgen command and then pasted into the configuration file.

But it takes a long time to generate directly, so you can use rndc-confgen-r / dev/urandom to speed up, or install rng-tools (yum install rng-tools) and start (systemctl start rngd.service) before executing rndc-confgen.

The result generated by rndc-confgen is divided into two parts, and the upper part needs to be written in / etc/rndc.conf (does not exist by default)

Create a new named directory under / var and enter

Generate 3 files: localhost.zone named.ca named.local

Named.ca is the address of the root domain name server

Forward parsing record of localhost.zone localhost

Reverse parsing record of named.local localhost

Named.ca is obtained through dig 8.8.8.8 > named.ca

PS: now it seems that you can only get one a.root-servers.net result. Before, you could get all 13 results.

Localhost.zone

$TTL 86400

$ORIGIN localhost.

@ 1D IN SOA @ root (

42; serial (d. Adams)

3H; refresh

15m; retry

1W; expiry

1D); minimum

1D IN NS @

1D IN A 127.0.0.1

Named.local

$TTL 86400

@ IN SOA localhost. Root.localhost. (

2012062001; Serial

28800; Refresh

14400; Retry

3600000; Expire

86400); Minimum

IN NS localhost.

1 IN PTR localhost.

After the configuration is complete, you can start DNS through the named command. If there are any errors, you can check what errors are reported through named- g, check whether there are syntax errors in named.conf through named-checkconf, and check whether there are syntax errors in the data files by named-checkzone.

Tags: File configuration error can pass data part query generate command version user directory result syntax check compile run special up and down president Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Redmi vpn Shulou Information NVidia