DNS Server
Install
yum install bind bind-chroot bind-libs bind-utils caching-nameserver
configuration
A、master dns
vim /var/named/chroot/etc/named.caching-nameserver.conf
vim /var/named/chroot/etc/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";
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";
// Those options should be used carefully because they disable port
// randomization
// query-source port 53;
// query-source-v6 port 53;
// randomization
// query-source port 53;
// query-source-v6 port 53;
allow-query { any; };
allow-query-cache { 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";
};
allow-query-cache { 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";
};
vim /var/named/chroot/etc/named.rfc1912.zones
zone "nono.com" IN {
type master;
file "nono.com.zone";
allow-update { none; };
};
type master;
file "nono.com.zone";
allow-update { none; };
};
zone "1.168.192.in-addr.arpa" IN {
type master;
file "192.168.1.local";
allow-update { none; };
};
type master;
file "192.168.1.local";
allow-update { none; };
};
vim /var/named/chroot/var/named/nono.com.zone
$TTL 86400
@ IN SOA centos1.nono.com. root.localhost. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS centos1.nono.com.
IN NS centos2.nono.com.
centos1 IN A 192.168.1.51
centos2 IN A 192.168.1.52
@ IN SOA centos1.nono.com. root.localhost. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS centos1.nono.com.
IN NS centos2.nono.com.
centos1 IN A 192.168.1.51
centos2 IN A 192.168.1.52
vim /var/named/chroot/var/named/192.168.1.local
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS centos1.nono.com.
IN NS centos2.nono.com.
51 IN PTR centos1.nono.com.
52 IN PTR centos2.nono.com.
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS centos1.nono.com.
IN NS centos2.nono.com.
51 IN PTR centos1.nono.com.
52 IN PTR centos2.nono.com.
chown -R named:named /var/named/chroot/etc/*
chown -R named:named /var/named/chroot/var/named/*
chown -R named:named /var/named/chroot/var/named/*
vim /etc/resolv.conf
nameserver 192.168.1.51
nameserver 192.168.1.52
nameserver 192.168.1.52
service named start
chkconfig --level named on
B、slave server
vim /var/named/chroot/etc/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";
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";
// Those options should be used carefully because they disable port
// randomization
// query-source port 53;
// query-source-v6 port 53;
// randomization
// query-source port 53;
// query-source-v6 port 53;
allow-query { any; };
allow-query-cache { 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";
};
allow-query-cache { 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";
};
vim /var/named/chroot/etc/named.rfc1912.zones
zone "nono.com" IN {
type slave;
masters { 192.168.1.51; };
file "slaves/nono.com.zone";
allow-update { none; };
};
type slave;
masters { 192.168.1.51; };
file "slaves/nono.com.zone";
allow-update { none; };
};
zone "1.168.192.in-addr.arpa" IN {
type slave;
masters { 192.168.1.51; };
file "slaves/192.168.1.local";
allow-update { none; };
};
type slave;
masters { 192.168.1.51; };
file "slaves/192.168.1.local";
allow-update { none; };
};
chown named:named -R /var/named/chroot/var/named
vim /etc/resolv.conf
nameserver 192.168.1.51
nameserver 192.168.1.52
nameserver 192.168.1.52
service named start
chkconfig --level named on
[root@centos1 var]# tail /var/log/messages | grep named
Dec 31 07:58:06 centos1 named[6749]: zone 1.168.192.in-addr.arpa/IN/localhost_resolver: loaded serial 1997022700
Dec 31 07:58:06 centos1 named[6749]: zone 255.in-addr.arpa/IN/localhost_resolver: loaded serial 42
Dec 31 07:58:06 centos1 named[6749]: zone 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN/localhost_resolver: loaded serial 1997022700
Dec 31 07:58:06 centos1 named[6749]: zone nono.com/IN/localhost_resolver: loaded serial 42
Dec 31 07:58:06 centos1 named[6749]: zone localdomain/IN/localhost_resolver: loaded serial 42
Dec 31 07:58:06 centos1 named[6749]: zone localhost/IN/localhost_resolver: loaded serial 42
Dec 31 07:58:06 centos1 named[6749]: running
Dec 31 07:58:06 centos1 named[6749]: zone 1.168.192.in-addr.arpa/IN/localhost_resolver: sending notifies (serial 1997022700)
Dec 31 07:58:06 centos1 named[6749]: zone nono.com/IN/localhost_resolver: sending notifies (serial 42)
Dec 31 07:58:06 centos1 named[6749]: client 192.168.1.51#9855: view localhost_resolver: received notify for zone '1.168.192.in-addr.arpa'
Dec 31 07:58:06 centos1 named[6749]: zone 1.168.192.in-addr.arpa/IN/localhost_resolver: loaded serial 1997022700
Dec 31 07:58:06 centos1 named[6749]: zone 255.in-addr.arpa/IN/localhost_resolver: loaded serial 42
Dec 31 07:58:06 centos1 named[6749]: zone 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN/localhost_resolver: loaded serial 1997022700
Dec 31 07:58:06 centos1 named[6749]: zone nono.com/IN/localhost_resolver: loaded serial 42
Dec 31 07:58:06 centos1 named[6749]: zone localdomain/IN/localhost_resolver: loaded serial 42
Dec 31 07:58:06 centos1 named[6749]: zone localhost/IN/localhost_resolver: loaded serial 42
Dec 31 07:58:06 centos1 named[6749]: running
Dec 31 07:58:06 centos1 named[6749]: zone 1.168.192.in-addr.arpa/IN/localhost_resolver: sending notifies (serial 1997022700)
Dec 31 07:58:06 centos1 named[6749]: zone nono.com/IN/localhost_resolver: sending notifies (serial 42)
Dec 31 07:58:06 centos1 named[6749]: client 192.168.1.51#9855: view localhost_resolver: received notify for zone '1.168.192.in-addr.arpa'
转载于:https://blog.51cto.com/number1/253509