One example of linux installation configuration under bind9
- 2020-05-06 12:09:14
- OfStack
One, install BIND
1. Download BIND http: / / www isc. org can also go to this website to download bind9 dns software.
2. Compile and install
# tar zxvf bind-9.4.0.tar.gz
# cd bind-9.4.0
# ./configure sysconfdir=/etc // More installation options ./configure --help
# make
# make install
Second, configure BIND
A. File
is required to create
1)./etc/named.conf
# vi/etc/named conf launch can be saved or touch/etc/named conf
2)./etc/rndc.conf
# rndc-confgen
>
/etc/rndc.conf
B. Create directory /var/named
# mkdir /var/named
Es65en.edit /etc/ named.conf
options {
directory "/var/named"; // Represents the default database file in /var/named In the If not, create it manually
// pid-file "/var/run/named/named.pid"; // running PID The file path , Used to launch with other users named
};
zone "." { // create root The domain
type hint;
file "named.ca";
};
zone "localhost" { // create localhost The domain
type master;
file "named.local";
};
zone "example.com" { // create example.com The domain
type master;
file "example.com.zone";
};
zone "0.0.127.in-addr.arpa"{ //localhost Against the resolution
type master;
file "127.0.0.zone";
};
zone "100.168.192.in-addr.arpa" { //example.com Reverse resolution of
type master;
file "192.168.100.zone";
};
// This file is here /etc/rndc.conf Need to copy the tail of # tail +13 /etc/rndc.conf >>/etc/named.conf
# Use with the following in named.conf, adjusting the allow list as needed:
key "rndc-key" {
algorithm hmac-md5;
secret "HWM3L+e7LWDZJJ/dJEzQEw==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
# End of named.conf
D. Create the corresponding data file filename in /var/named by file parameter in named.conf
By named. conf knowable have named. ca, named. local, example. com. zone, 127.0.0. zone, 192.168.100. zone
1. named.ca
# dig -t NS .
>
/var/named/named.ca
# 2. named. local vi/var named/named local
to join the following content
$TTL 1D
@ IN SOA localhost. root (
2007042801
1H
15M
1W
1D )
IN NS @
IN A 127.0.0.1
3. example.com.zone
$TTL 1D
@ IN SOA example.com. root (
2007042801
1H
15M
1W
1D )
IN NS ns.example.com.
IN MX 10 mail.example.com.
IN A 192.168.100.125
www IN A 192.168.100.125
db IN A 192.168.100.124
ns IN A 192.168.100.126
mail IN A 192.168.100.251
shop IN A 192.168.100.125
*.shop IN A 192.168.100.124
news IN CNAME www
3. 127.0.0.zone
$TTl 1D
@ IN SOA @ root.localhost. (
2007042801
1H
15M
1W
1D
)
IN NS localhost.
1 IN PTR localhost.
4. 192.168.100.zone
$TTL 1D
@ IN SOA @ root.example.com. (
2007042801
1H
15M
1W
1D )
IN NS example.com.
125 IN PTR example.com.
125 IN PTR www.example.com.
124 IN PTR db.example.com.
126 IN PTR ns.example.com.
251 IN PTR mail.example.com.
Footnote
a. named server startup problem
1. Start #named // start
with root user Es144en-u named // start with named user, you must have this user and named.pid belongs to named
2. How to restart
after configuration changes # rndc reload
3. If the test configuration is successful, can be judged by host, dig and nslookup