bind

 

[root@master ~]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=master.kpxiaotian.com
GATEWAY=192.168.1.1
[root@master ~]# yum -y install bind bind-devel bind-caching caching-nameserver
[root@master etc]# cd /var/named/chroot/etc/
[root@master etc]# cp -p named.caching-nameserver.conf named.conf
[root@master etc]# vim named.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";
                   forwarders { 192.168.1.10; };
 
        allow-query     { any; };
        allow-query-cache { any; };
};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
view any_resolver {
        match-clients      { any; };
        match-destinations { any; };
        recursion yes;
        include "/etc/named.rfc1912.zones";
};
[root@master etc]# vim named.rfc1912.zones
 
zone "kpxiaotian.com" IN {
        type master;
        file "kp.zheng";
        allow-update { none; };
};
 
zone "kangping.cc" IN {
        type master;
        file "k.zheng";
        allow-update { none; };
};
 
zone "1.168.192.in-addr.arpa" IN {
        type master;
        file "kp.fan";
        allow-update { none; };
};
 
[root@master named]# cd ../var/named/
[root@master named]# cp -p named.zero kp.zheng
[root@master named]# cp -p named.zero kp.fan
[root@master named]# vim kp.zheng
$TTL     86400
@                IN SOA localhost.      root.localhost. (
                                        42              ; serial (d. adams)
                                        3H             ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
        IN      NS      master.kpxiaotian.com.
master IN      A       192.168.1.10
dns     IN      A       192.168.1.10
www     IN      A       192.168.1.10
"kp.zheng" 11L, 499C                                                                                               11,1        
[root@master named]# vim kp.fan
$TTL     86400
@                IN SOA localhost.      root.localhost. (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
        IN      NS      master.kpxiaotian.com.
10      IN      PTR     master.kpxiaotian.com.
10      IN      PTR     dns.kpxiaotian.com.
10      IN      PTR     www.kpxiaotian.com.
[root@master named]# cat /etc/resolv.conf
generated by /sbin/dhclient-script
search kpxiaotian.com
nameserver 192.168.1.10
[root@master named]# service named restart
Stopping named: [ OK ]
Starting named: [ OK ]
[root@master named]# chkconfig named on
[root@master named]# host www.kpxiaotian.com
www.kpxiaotian.com has address 192.168.1.10
www.kpxiaotian.com mail is handled by 5 mail.kpxioatian.com.
[root@master named]# host www.kangping.cc
www.kangping.cc has address 192.168.1.10

 

[root@master httpd-2.2.15]# iptables -I INPUT -p udp --dport 53 -j ACCEPT
[root@master httpd-2.2.15]# iptables -I INPUT -p icmp -j ACCEPT
[root@master httpd-2.2.15]# service iptables save

你可能感兴趣的:(linux,linux,bind,bind,dns,dns,named)