An example of bind9 installation and configuration in linux

Source: Internet
Author: User

1. Install BIND
1. Download BIND http://www.isc.org can also go to this site to download bind9 dns software.
2. Compile and install

Copy codeCode: # tar zxvf bind-9.4.0.tar.gz
# Cd bind-9.4.0
#./Configure sysconfdir =/etc // more installation options./configure -- help
# Make
# Make install

2. Configure BIND
A. create the required file
1)./etc/named. conf
# Save vi/etc/named. conf or touch/etc/named. conf

2)./etc/rndc. conf
# Rndc-confgen>/etc/rndc. conf

B. Create a directory/var/named
# Mkdir/var/named

B. edit/etc/named. conf as follows:

Copy codeThe Code is as follows: options {
Directory "/var/named"; // indicates that the default database file is in/var/named.
// Pid-file "/var/run/named. pid"; // the path of the running PID file, which is used to start named by another user
};
Zone "." {// create the root domain

Type hint;
File "named. ca ";
};
Zone "localhost" {// create a localhost domain
Type master;
File "named. local ";
};
Zone "example.com" {// create example.com domain
Type master;
File "example.com. zone ";
};
Zone "0.0.127.in-addr. arpa" {// anti-resolution of localhost
Type master;
File "127.0.0.zone ";
};
Reverse resolution of zone "100.168.192.in-addr. arpa" {// example.com
Type master;
File "192.168.100.zone ";
};
// This file must be copied at the end of/etc/rndc. conf to use # 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 a data file name in/var/named, which is determined by the file parameter in named. conf.
Named. conf shows named. ca, named. local, example.com. zone, 127.0.0.zone, and 192.168.100.zone.
1. named. ca
# Dig-t NS.>/var/named. ca
2. Add named. local # vi/var/named. local to the following content:

Copy codeThe Code is as follows: $ TTL 1D
@ In soa localhost. root (
2007042801
1 H
15 M
1 W
1D)
In ns @
In a 127.0.0.1

3. example.com. zone

Copy codeThe Code is as follows: $ TTL 1D
@ In soa example.com. root (
2007042801
1 H
15 M
1 W
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.htm
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
1 H
15 M
1 W
1D
)
In ns localhost.
1 in ptr localhost.
4. 192.168.100.zone
$ TTL 1D
@ In soa @ root.example.com .(
2007042801
1 H
15 M
1 W
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.

Additional instructions
A. named server startup Problems
1. Start # named // start as root user
# Named-u named // start with a named user. This user must be available and the owner of named. pid is named.
2. How to restart after changing the configuration
# Rndc reload
3. test whether the configuration is successful. Check whether the configuration is successful by using host, dig, and nslookup.

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.