1、安装 named
2、配置如下文件:
/etc/named.conf
//
2 // named.conf
3 //
4 // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
5 // server as a caching only nameserver (as a localhost DNS resolver only).
6 //
7 // See /usr/share/doc/bind*/sample/ for example named configuration files.
8 //
9
10 options {
11 listen-on port 53 { any; };
12 //listen-on-v6 port 53 { ::1; };
13 directory "/var/named";
14 dump-file "/var/named/data/cache_dump.db";
15 statistics-file "/var/named/data/named_stats.txt";
16 memstatistics-file "/var/named/data/named_mem_stats.txt";
17 allow-query { any; };
18 recursion yes;
19
20 dnssec-enable yes;
21 dnssec-validation yes;
22 dnssec-lookaside auto;
24 /* Path to ISC DLV key */
25 bindkeys-file "/etc/named.iscdlv.key";
26
27 managed-keys-directory "/var/named/dynamic";
28 };
29
30 logging {
31 channel default_debug {
32 file "data/named.run";
33 severity dynamic;
34 };
35 };
36
37 zone "." IN {
38 type hint;
39 file "named.ca";
40 };
41
42 include "/etc/named.rfc1912.zones";
43 include "/etc/named.root.key";
44
/etc/namd.rfc1912/zones
// named.rfc1912.zones: 2 // 3 // Provided by Red Hat caching-nameserver package 4 // 5 // ISC BIND named zone configuration for zones recommended by 6 // RFC 1912 section 4.1 : localhost TLDs and address zones 7 // and http://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zo nes-02.txt 8 // (c)2007 R W Franks 9 // 10 // See /usr/share/doc/bind*/sample/ for example named configuration files. 11 // 12 13 zone "917.cs" IN { 14 type master; 15 file "123.cs.zone"; 16 }; 17 18 zone "1.168.192.in-addr.arpa" IN { 19 type master; 20 file "1.168.192.zone"; 21 }; 22 23 zone "1.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.ar pa" IN { 24 type master; 25 file "named.loopback"; 26 allow-update { none; }; 27 }; 28 29 zone "1.0.0.127.in-addr.arpa" IN { 30 type master; 31 file "named.loopback"; 32 allow-update { none; }; 33 }; 34 35 zone "0.in-addr.arpa" IN { 36 type master; 37 file "named.empty"; 38 allow-update { none; }; 39 }; 40
反向解析
/var/named/1.168.192.zone
1 $TTL 86400 2 @ IN SOA ns.123.cs. root.123.cs ( 3 12 ; serial 4 28800 ; refresh 5 14400 ; retry 6 3600000 ; expire 7 86400 ) ; minimum 8 @ IN NS ns.123.cs. 9 249 IN PTR mail.123.cs. 10 249 IN PTR ns.123.cs. 11 230 IN PTR img.123.cs
正向解析
/var/named/123.cs.zone
1 $TTL 86400 2 @ IN SOA ns.123.cs. root.123.cs ( 3 1 ; serial 4 1D ; refresh 5 1H ; retry 6 1W ; expire 7 3H ) ; minimum 8 @ IN NS ns.123.cs. 9 @ IN MX 5 mail.123.cs. 10 ns IN A 192.168.1.249 11 www IN A 192.168.1.230 12 mail IN A 192.168.1.249 13 img IN A 192.168.1.230 25 pop3 IN CNAME mail 26 smtp IN CNAME mail
启动:service named start
修改pc机 dns
vim /etc/resolv.conf