Bind simple self-use DNS server, binddns

Source: Internet
Author: User

Bind simple self-use DNS server, binddns

Purpose: To customize a domain name www.test.com, which can be resolved to a specified machine.

 

Install(Version: 9.7.3 ):

Yum install bind

 

Configuration:

Initialization Configuration:

# Generate the rndc. conf file

Cd/etc
Rndc-confgen> rndc. conf
# Generate the named. conf file
Tail-10 rndc. conf | head-9 | sed s/# \ // g> named. conf

# After that, the content of named. conf looks like this:

Key "rndc-key "{

Algorithm hmac-md5;
Secret "Bvqc7XRIJlz3s6p0JQ4Gwg = ";
};

Controls {
Inet 127.0.0.1 port 953
Allow {127.0.0.1;} keys {"rndc-key ";};
};

 

Append the following content to/etc/named. conf.

Options {
Directory "/var/named ";
Forwarders {192.168.1.1 ;}; # The domain name cannot be resolved.
Allow-query {any ;};
# Allow-transfer {none ;};
};

# Process localhost

 

Zone "localhost "{
Type master;
File "named. localhost ";
};

# Reverse parsing of localhost

Zone "0.0.127.in-addr. arpa "{
Type master;
File "named. loopback ";
};

# Our own domain name

Zone "test.com" IN {
Type master;
File "test. zone ";
Allow-update {none ;};
};

 

Add a configuration file test. zone under/var/named. The content is as follows:

$ Ttl 1D
@ In soa test.com. root.test.com .(
1053891162
3 H
15 M
1 W
1D)
In ns ns1
Ns1 in a 192.168.0.1
Www in a 192.168.0.3

 

After the configuration is complete, start the service: service named start

Test:

Host www.test.com

 

Expand and configureBindMaster/Slave, simple

Copy/etc/named. conf of the primary DNS to the slave dns server and configure the corresponding domain name.

Zone "test.com" IN {

Type master;

File "test. zone ";

Allow-update {none ;};

};

Change to (red part)

Zone "test.com" IN {

TypeSlave;

File "test. zone ";

Allow-update {none ;};

Masters {MasterDnsAddress;};

};

After the primary dns is updated, the secondary dns is automatically updated after it is restarted, and the test. zone file does not need to be synchronized.

 

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.