Файл конфигурации named.conf:
Код: Выделить всё
// $FreeBSD: src/etc/namedb/named.conf,v 1.29.2.3.2.1 2010/06/14 02:09:06 kensmith Exp $
//
// Refer to the named.conf(5) and named(8) man pages, and the documentation
// in /usr/share/doc/bind9 for more details.
//
// If you are going to set up an authoritative server, make sure you
// understand the hairy details of how DNS works. Even with
// simple mistakes, you can break connectivity for affected parties,
// or cause huge amounts of useless Internet traffic.
// This networks can ask our dns.
acl "corpnets" {192.168.1.0/24; 127.0.0.1; };
options {
// All file and path names are relative to the chroot directory,
// if any, and should be fully qualified.
directory "/etc/namedb";
pid-file "/var/run/named/pid";
dump-file "/var/dump/named_dump.db";
statistics-file "/var/stats/named.stats";
// If named is being used only as a local resolver, this is a safe default.
// For named to be accessible to the network, comment this option, specify
// the proper IP address, or delete this option.
// BEGIN OPTIONS.
allow-query { "corpnets"; };
listen-on { 127.0.0.1; 192.168.1.1; };
recursion yes;
// These zones are already covered by the empty zones listed below.
// If you remove the related empty zones below, comment these lines out.
disable-empty-zone "255.255.255.255.IN-ADDR.ARPA";
disable-empty-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.0.IP6.ARPA";
disable-empty-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.ARPA";
// If you've got a DNS server around at your upstream provider, enter
// its IP address here, and enable the line below. This will make you
// benefit from its cache, thus reduce overall DNS traffic in the Internet.
/*
forwarders {
127.0.0.1;
};
*/
// If the 'forwarders' clause is not empty the default is to 'forward first'
// which will fall back to sending a query from your local server if the name
// servers in 'forwarders' do not have the answer. Alternatively you can
// force your name server to never initiate queries of its own by enabling the
// following line:
// forward only;
// If you wish to have forwarding configured automatically based on
// the entries in /etc/resolv.conf, uncomment the following line and
// set named_auto_forward=yes in /etc/rc.conf. You can also enable
// named_auto_forward_only (the effect of which is described above).
// include "/etc/namedb/auto_forward.conf";
/*
Modern versions of BIND use a random UDP port for each outgoing
query by default in order to dramatically reduce the possibility
of cache poisoning. All users are strongly encouraged to utilize
this feature, and to configure their firewalls to accommodate it.
AS A LAST RESORT in order to get around a restrictive firewall
policy you can try enabling the option below. Use of this option
will significantly reduce your ability to withstand cache poisoning
attacks, and should be avoided if at all possible.
Replace NNNNN in the example with a number between 49160 and 65530.
*/
// query-source address * port NNNNN;
};
// If you enable a local name server, don't forget to enter 127.0.0.1
// first in your /etc/resolv.conf so this server will be queried.
// Also, make sure to enable it in /etc/rc.conf.
zone "." { type hint; file "/etc/namedb/named.root"; };
// RFC 1912 (and BCP 32 for localhost)
zone "localhost" { type master; file "master/localhostf.db"; };
zone "0.0.127.in-addr.arpa" { type master; file "master/localhostr.db"; };
zone "xonix.lan" {
type master;
file "master/xonix.fwd.db";
};
zone "1.168.192.in-addr.arpa" {
type master;
file "master/xonix.rev.db";
};Файл зоны прямого запроса для домена xonix.lan xonix.fwd.db:
Код: Выделить всё
; $FreeBSD: src/etc/namedb/master/empty.db,v 1.1.12.1.4.1 2010/06/14 02:09:06 kensmith Exp $
$TTL 3h
xonix.lan. IN SOA testdns.xonix.lan. nobody.xonix.lan. (
42 1d 12h 1w 3h )
; Serial, Refresh, Retry, Expire, Neg. cache TTL
; DNS servers
IN NS testdns.xonix.lan.
; Macine Names
localhost IN A 127.0.0.1
testdns IN A 192.168.1.1
yaroha IN A 192.168.1.2
yaroha2 IN A 192.168.1.3Файл зоны обратного запроса для домена xonix.lan xonix.rev.db:
Код: Выделить всё
; $FreeBSD: src/etc/namedb/master/empty.db,v 1.1.12.1.4.1 2010/06/14 02:09:06 kensmith Exp $
$TTL 3h
1.168.192.in-addr.arpa. IN SOA testdns.xonix.lan. nobody.xonix.lan. (
42 1d 12h 1w 3h )
; Serial, Refresh, Retry, Expire, Neg. cache TTL
IN NS testdns.xonix.lan.
1 IN PTR testdns.xonix.lan.
2 IN PTR yaroha.xonix.lan.
3 IN PTR yaroha2.xonix.lan.Файл зоны для localhost localhostf.db:
Код: Выделить всё
; $FreeBSD: src/etc/namedb/master/localhost-forward.db,v 1.1.12.1.4.1 2010/06/14 02:09:06 kensmith Exp $
$TTL 3h
localhost. SOA localhost. nobody.localhost. 42 1d 12h 1w 3h
; Serial, Refresh, Retry, Expire, Neg. cache TTL
NS localhost.
A 127.0.0.1
AAAA ::1Файл обратной зоны для localhsot localhostr.db:
Код: Выделить всё
; $FreeBSD: src/etc/namedb/master/localhost-reverse.db,v 1.1.12.1.4.1 2010/06/14 02:09:06 kensmith Exp $
$TTL 3h
@ SOA localhost. nobody.localhost. 42 1d 12h 1w 3h
; Serial, Refresh, Retry, Expire, Neg. cache TTL
NS localhost.
1.0.0 PTR localhost.
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 PTR localhost.!!! Файлы зон для localhost'a я не изменял, взял те, которые появились после установки BIND'a.!!!!
Проблема №1:
В /var/log/messages при старте системы пишется:
Код: Выделить всё
Feb 5 03:33:14 testdns named[730]: starting BIND 9.6.2-P2 -t /var/named -u bind
Feb 5 03:33:14 testdns named[730]: built with '--prefix=/usr' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--enable-threads' '--disable-ipv6' '--enable-getifaddrs' '--disable-linux-caps' '--with-openssl=/usr' '--with-randomdev=/dev/random' '--without-idn' '--without-libxml2'
Feb 5 03:33:14 testdns named[730]: command channel listening on 127.0.0.1#953
Feb 5 03:33:14 testdns named[730]: command channel listening on ::1#953
[b][size=3]Feb 5 03:33:14 testdns named[730]: the working directory is not writable[/size][/b]
Feb 5 03:33:14 testdns named[730]: runningКак это исправить?
Проблема №2:
Хоть в сети пропинговка хостов по именам и по IP работает нормально, мне не нравиться ответ на команду dig:
Код: Выделить всё
; <<>> DiG 9.6.1-P3 <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 16547
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;. IN NS
;; Query time: 8 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Sat Feb 5 01:42:23 2011
;; MSG SIZE rcvd: 17Почему на любой мой запрос dig выдает SERVFAIL?
Пожалуйста, обьясните эти две проблемы более-менее простым текстом, так как я новенький в администрировании DNS сервера.
Заранее благодарен всем за помощь!