The following content is reproduced from http://hi.baidu.com/wang01ning/blog/item/aa9292ff0795b03a5d600840.html
Centos5.6 BIND server for installing DNS
The following content is about the installation, configuration, and testing of DNS in centos. The RedHat 5 series are similar.
[Root @ testserver named] # uname-
Linux testserver 2.6.18-164. EL5 #1 SMP Thu Sep 3 03:28:30 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
[Root @ testserver centos] # rpm-Qa | grep bind
Bind-chroot-9.3.6-4.P1.el5
Bind-utils-9.3.6-4.P1.el5
Bind-libs-9.3.6-4.P1.el5
Ypbind-1.19-12.el5
Bind-9.3.6-4.P1.el5
Kdebindings-3.5.4-6.el5
[Root @ testserver centos] # rpm-IVH bind-libbind-devel-9.3.6-4.P1.el5.x86_64.rpm
Preparing... ######################################## ### [100%]
1: bind-libbind-devel ################################### ####### [1, 100%]
[Root @ testserver centos] # rpm-IVH bind-devel-9.3.6-4.P1.el5.x86_64.rpm
Preparing... ######################################## ### [100%]
1: bind-devel ##################################### ###### [100%]
[Root @ testserver centos] # rpm-Qa | grep bind
Bind-chroot-9.3.6-4.P1.el5
Bind-utils-9.3.6-4.P1.el5
Bind-libs-9.3.6-4.P1.el5
Ypbind-1.19-12.el5
Bind-9.3.6-4.P1.el5
Bind-libbind-devel-9.3.6-4.P1.el5
Kdebindings-3.5.4-6.el5
Bind-libbind-devel-9.3.6-4.P1.el5
Bind-devel-9.3.6-4.P1.el5
[Root @ testserver centos] #
[Root @ testserver centos] # rpm-IVH caching-nameserver-9.3.6-4.P1.el5.x86_64.rpm
Preparing... ######################################## ### [100%]
1: caching-nameserver ##################################### ###### [100%]
This is a bit confusing. How can I install it? The common configuration files are all under/etc/. Of course, you can also run rpm-ax | grep I bind to check out/etc/named .*
[Root @ testserver named] # ls-La/etc/named .*
Lrwxrwxrwx 1 root named 52 Dec 17 16:50/etc/named. caching-nameserver.conf->/var/named/chroot/etc/named. caching-nameserver.conf
Lrwxrwxrwx 1 root named 42 Dec 17 16:50/etc/named. rfc1912.zones->/var/named/chroot/etc/named. rfc1912.zones
Have you seen it? It turns out to be an l file. There are two methods. You can directly go to the original directory to edit the original file or operate on the linked file. The effect is the same!
[Root @ testserver centos] # cd/var/named/chroot/etc/
[Root @ testserver etc] # ls
Localtime named. caching-nameserver.conf named. rfc1912.zones rndc. Key
[Root @ testserver etc] # cd/var/named/chroot/var/named/
[Root @ testserver named] # ls-LD
Drwxr-x --- 4 root named 4096 Dec 17.
[Root @ testserver named] # ls
Data localhost. Zone named. Ca named. Local slaves
Localdomain. Zone named. Broadcast named. ip6.local named. Zero
[Root @ testserver named] # cd http://www.cnblogs.com/etc/
# Pwd
/Var/named/chroot/etc
# CD ../var/named/
# Pwd
/Var/named/chroot/var/named
[Root @ testserver etc] # cp-B named. rfc1912.zones named. rfc1912.zones. Bak
[Root @ testserver etc] # ls
Localtime named. caching-nameserver.conf named. rfc1912.zones named. rfc1912.zones. Bak rndc. Key
Any;
[Root @ testserver etc] # Vim named. caching-nameserver.conf
Options {
Listen-on port 53 {Any ;};
Listen-on-v6 port 53 {: 1 ;};
Directory "/var/named ";
Dump-file "/var/named/data/cache_dump.db ";
Statistics-file "/var/named/data/named_stats.txt ";
Memstatistics-file "/var/named/data/named_mem_stats.txt ";
Query-source port 53;
Query-source-v6 port 53;
Allow-query {Any ;};
};
Logging {
Channel default_debug {
File "Data/named. Run ";
Severity dynamic;
};
};
View localhost_resolver {
Match-clients {Any ;};
Match-destinations {Any ;};
Recursion yes;
Include "/etc/named. rfc1912.zones ";
};
[Root @ testserver named] # cd http://www.cnblogs.com/etc/
---------------------------------------------------------------------------
[Root @ testserver etc] # cp named. rfc1912.zones named. rfc1912.zones. Bak
// Define a forward domain area.com and a forward resolution file name area.com. Zone
// Define the reverse domain and the reverse resolution file name 10.25.61.zone
[Root @ testserver etc] # vi named. rfc1912.zones
// Test
Zone "area.com" in {
Type master;
File "area.com. Zone ";
Allow-update {none ;};
};
Zone "61.25.10.in-ADDR. Arpa" in {
Type master;
File "10.25.61.zone ";
Allow-update {none ;};
};
---------------------------------------------------------------------------
# Configure a forward/reverse parsing File
---------------------------------------------------------------------------
# Cp-P localdomain. Zone area.com. Zone
# Vim area.com. Zone
$ TTL 86400
@ In SOA www.area.com. root.area.com .(
42; Serial (D. Adams)
3 h; refresh
15 m; retry
1 W; expiry
1D); Minimum
In NS www.area.com.
WWW in a 10.25.61.32
In AAAA: 1
---------------------------------------------------------------------------
# Cp-P named. Local 10.25.61.zone
# Vim 10.25.61.zone
$ TTL 86400
@ In SOA www.area.com. root.area.com .(
1997022700; Serial
28800; refresh
14400; retry
3600000; expire
86400); Minimum
In NS www.area.com.
32 In PTR www.area.com.
---------------------------------------------------------------------------
32 refers to the last number of IP addresses: 10.25.61.32.
Add your own machine for domain name resolution
# Vi/etc/hosts
127.0.0.1 localhost. localdomain localhost
#: 1 localhost6.localdomain6 localhost6
10.25.61.32 www.area.com WWW
# Vi/etc/resolv. conf
Nameserver 10.25.61.32
Search area.com
Configure SELinux
[Root @ testserver etc] # setup
A dialog box is displayed. We need to configure the firewall as follows:
Select "firewall configuration" --- press the "tab" key to switch to the "run tool"-press ENTER-"Security Level" option. You need to press the "tab" key before "enabled"-"sellinux" select "disabled"-click the "tab" key-select "customize"-a new dialog box is displayed-Enter "53: TCP 53: UDP-OK-return to the previous dialog box-OK-the dialog box is automatically closed. Configuration complete.
Start named
# Service named start
#/Etc/init. d/named start
Test
------- Host ----------
[Root @ testserver named] # host 10.25.61.32
32.61.25.10.in-ADDR. Arpa Domain Name Pointer www.area.com.
[Root @ testserver named] # host www.area.com
Www.area.com has address 10.25.61.32
Www.area.com has IPv6 address: 1
[Root @ testserver named] #
--------- NSLookup --------------------------
[Root @ testserver named] # NSLookup
> Www.area.com
Server: 10.25.61.32
Address: 10.25.61.32 #53
Name: www.area.com
Address: 10.25.61.32
> 10.25.61.32
Server: 10.25.61.32
Address: 10.25.61.32 #53
32.61.25.10.in-ADDR. Arpa name = www.area.com.
> Exit
Remember to restart after modifying the configuration
# Service named restart
#/Etc/init. d/named restart
Ftp://rs.internic.net/domain/ download the latest name. Root Database