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.